text:
Q: ConTeXt: Customize bibliography list field rendering I'm trying to recreate a bibliography rendering style for a document (called "NTC1486").

The structure goes basically like this:
SECOND NAME, First Names. Title of the article. City. Editorial, Year.

The bibliography client provided consist just on a bunch of URL links. I've set up a .bib file that goes like this, no year provided on any entry:
@manual{iso27000,
    title  = "Normatividad y certificaciones aplicadas a SGSI",
    author = "Agustín López Neira and Javier Ruiz Spohr",
    url    = "http://www.iso27000.es/download/doc_iso27000_all.pdf",
    year   = "consultado el 29 de septiembre de 2017"
}

But the documentation for MkIV Bibliography seems confusing to me. I've tried messing with
\usebtxdataset[bibliografia][bibliografia.bib]

\usebtxdefinitions[apa]
\definebtxrendering[bibliografia][apa][specification=apa,sorttype=authoryear,numbering=no,dataset=bibliografia,group=examples]
\setupbtxlist[apa][alternative=paragraph,width=fit,distance=0mm,margin=0mm]
\setupbtx[apa:list:author][separator:names:3={\btxspace y \btxspace},separator:names:4={\btxspace y \btxspace\btxcomma},authorconversion={normal},textstyle={\WORDS},textstyle={\WORDS}]
\setupbtx[apa:list:title][textstyle={\normal}]

\starttext
\placelistofpublications[bibliografia][method=dataset]
\stoptext

But it renders all on lower case. If I set \setupbtxlist[apa][textstyle={\WORDS}], it will set all but the article title on uppercase.
It's something I'm doing wrong? Or it's a bug or something?

A: Currently the APA format for bibliographies lacks the capability to format the author using
\setupbtx
  [apa:list:author]
  [command=\WORD]

Therefore you have to patch up the command btx:apa:author-or-editor yourself.  I have also submitted a patch to the maintainers, so maybe it is even fixed in the next beta.
% macros: mkvi

\startbuffer[bibliografia]
@manual{iso27000,
  title  = "Normatividad y certificaciones aplicadas a SGSI",
  author = "López Neira, Agustín and Ruiz Spohr, Javier",
  url    = "http://www.iso27000.es/download/doc_iso27000_all.pdf",
  year   = "consultado el 29 de septiembre de 2017"
}

@inbook{Bunge1970,
  title   = "La ciencia. Su método y su filosfía",
  author  = "Bunge, Mario",
  address = "Buenos Aires: Ariel",
  year    = "1970",
  pages   = "120"
}
\stopbuffer

\mainlanguage[es]

\setuppagenumbering[location=footer]

\setuplayout
  [backspace=4cm,
   leftmargin=0pt,
   width=middle,
   rightmargin=0pt,
   cutspace=2cm,
   %
   topspace=3cm,
   header=0pt,
   headerdistance=0pt,
   height=middle,
   footerdistance=\dimexpr1cm-\lineheight\relax,
   footer=\lineheight,
   bottomspace=2cm]

\setuphead
  [title]
  [style=\WORD,
   align=middle,
   after={\blank[2*line]}]

\usebtxdefinitions[apa]

\usebtxdataset[bibliografia][bibliografia.buffer]

\definebtxrendering
  [bibliografia][apa]
  [dataset=bibliografia,
   group=examples]

\setupbtxlist
  [apa]
  [alternative=paragraph,
   width=fit,
   distance=0mm,
   margin=0mm,
   after={\blank[2*line]}]

\setupbtx
  [apa:list]
  [separator:names:2={\btxcomma},
   separator:names:3={\btxcomma\btxlabeltext{and}\space},
   separator:names:4={\btxspace\btxlabeltext{and}\space},
   authorconversion=normal]

\setupbtx
  [apa:list:author]
  [command=\WORD]

\setupbtx
  [apa:list:title]
  [style=normal]

\unprotect
% patch btx:apa:author-or-editor, copied from publ-imp-apa.mkvi
\starttexdefinition unexpanded btx:apa:author-or-editor #author
    \btxdoifelse {#author} {
        \btxstartstyleandcolor[apa:\s!list:#author]
            \btxusecommand [apa:\s!list:#author]{
                \btxflush{#author}
            }
        \btxstopstyleandcolor
        % use \processaction [] [] here?
        \doifelse {\btxfoundname{#author}} {editor} {
            \btxleftparenthesis
            \btxsingularorplural {editor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } {\doif {\btxfoundname{#author}} {ineditor} {
            \btxleftparenthesis
            \btxsingularorplural {ineditor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } }
        \doif {\currentbtxcategory} {film} {
            \btxleftparenthesis
            \doifelse {\btxfoundname{#author}} {director} {
                \btxsingularorplural {director} {
                    \btxlabeltext{apa:Director}
                } {
                    \btxlabeltext{apa:Directors}
                }
            } {
                \doif {\btxfoundname{#author}} {author} {
                    \btxsingularorplural {author} {
                        \btxlabeltext{apa:Writer}
                    } {
                        \btxlabeltext{apa:Writers}
                    }
                }
                \doif {\btxfoundname{#author}} {producer} {
                    \btxsingularorplural {producer} {
                        \btxlabeltext{apa:Producer}
                    } {
                        \btxlabeltext{apa:Producers}
                    }
                }
                \btxdoif {director} {
                    \btxrightparenthesis
                    \removeunwantedspaces
                    \btxparameter{\c!separator:names:3}
                    \btxflush{director}
                    \btxleftparenthesis
                    \btxsingularorplural {director} {
                        \btxlabeltext{apa:Director}
                    } {
                        \btxlabeltext{apa:Directors}
                    }
                }
            }
            \btxrightparenthesis
        }
        \btxdoif {withauthor} {
            \btxleftparenthesis
            \btxlabeltext{with}
            \btxspace
            \btxflush{withauthor}
            \btxrightparenthesis
        }
    } {
        \texdefinition{btx:apa:title}
    }
\stoptexdefinition
\protect

\starttext

\starttitle[title=Bibliografía]
  \placelistofpublications[bibliografia][method=dataset]
\stoptitle

\stoptext

A: You had it right with separator:names. Only a few problems that were ironed out for consistency's sake. You got it wrong with the setupbtxlist though. And so did I, because I couldn't get it done 'quite' right.
Don't vote, I'll just leave it here as a reminder.
See if Aditya can help you out, or perhaps someone over at the mailing list could.
Here is the code:
 \definebtxdataset[template]
 \usebtxdataset[template]
 [bibliografia.bib]

 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template,
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]

 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth,
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]

 \starttext

 \startbodymatter
 a citation: \cite[num][template::iso27000::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter

 \stoptext

this is another example. It was copied from http://ftp.math.utah.edu/pub/tex/bib/tugboat.html.
 \definebtxdataset[template]
 \usebtxdataset[template]
 [tugbib.bib]

 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template,
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]

 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth,
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]

 \starttext

 \startbodymatter
 a citation: \cite[num][template::Gregorio:TB26-3-273::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter

 \stoptext


text:
Q: Web Component: Dom Exception: This name has already been used tl:dr; I don't know how to fix the error below on the site here:
You will need credentials:
un: stackoverflowuserj23jf4@mailinator.com
pass: testingStackOverflow123

Details: I am trying to conditionally include a web component in a page like so:
<script>
  document.addEventListener("DOMContentLoaded", function(event) {
  if (document.querySelector('simple-fred')) {
    var script = document.createElement('script');
    script.src = 'https://embedint.crossroads.net/fred/js/simplefred.min.js';
    document.head.appendChild(script)
  }
});
</script>

Including the script conditionally instead of statically broke the code. The script  above used to be loaded like this:
<script src="https://embedint.crossroads.net/fred/js/simplefred.min.js"></script>, which worked
I then include the element on the page:
<simple-fred data-form-name="buildingblocksformarriage" data-redirect-url="/care/weddings/building-blocks-for-marriage/signup/confirmation"> </simple-fred>

This works fine locally and on plunker.
To run it on plnkr, you do need to disable CORS blocking for Chrome, the command is:
TASKKILL /F /IM chrome.exe
start chrome.exe --args --disable-web-security --user-data-dir
pause

This is all good and well, but when I run this code in concert with other code, it fails. I get the following error (same error, browsers report it differently):
Chrome:

Uncaught DOMException: Failed to execute 'define' on
  'CustomElementRegistry': this name has already been used with this
  registry
      at Function.value (https://embedint.crossroads.net/fred/js/simplefred.min.js:5:383105)

Mozilla:

Error: A custom element with name 'slim-repeat' has already been
  defined.

This error seems to be caused by two third-parties trying to create the same custom component as far as I can tell judging by this question I have a bounty on
I am at a loss at this point. The int environment that throws the error is here:
https://int.crossroads.net/care/weddings/building-blocks-for-marriage/signup
You may need a login, I made one so it's faster (can be shared):
stackoverflowuserj23jf4@mailinator.com
testingStackOverflow123

The code is open source and is found here (I don't think looking at it will help, just for completeness): https://github.com/crdschurch/crds-fred/blob/development/CrdsFred/Views/Form/Index.cshtml
How do I fix this?
Or at least, what are possible causes? I will throw at least a 100 point bounty on this to reward the accepted answer.

A: it looks like there's a node module named slim-js, and it creates an element called slim-repeat on lines 1057 and/or 1146 of Slim.js (see screenshot). Maybe you just need to pick a different name?

A: I am the author of this library and would like to assist. I will deploy a hot fix for this Issue. Eventually not running the whole script if another instance of Slim is already initialized.

redpajama_set_name: RedPajamaStackExchange


text:
Q: mathtools brackets larger than \Bigg I'd like to use the syntax of the mathtools package to generate brackets larger than \Bigg.
One can create larger brackets than \Bigg of specified size using
About big parenthesis larger than Bigg
However, that solution doesn't work with the \DeclarePairedDelimiter construct of mathtools.
See the MWE below.  I suspect that what's needed is \Vastl, \Vastr, and \Vastm commands.
\documentclass{article}

\usepackage{mathtools}
\makeatletter
\newcommand{\vast}{\bBigg@{4}}
\newcommand{\Vast}{\bBigg@{5}}
\makeatother

\DeclarePairedDelimiter{\parens}()

\begin{document}

\[
 \parens[\Bigg]{\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}}
\]

\[
 \Vast({\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}} \Vast)\qquad
 \parens[\Vast]{\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}}  % does not work
\]
\end{document}

A: Yes, your suspicion  is right. Simply define:
\newcommand{\vastl}{\mathopen\vast}
\newcommand{\vastm}{\mathrel\vast}
\newcommand{\vastr}{\mathclose\vast}
\newcommand{\Vastl}{\mathopen\Vast}
\newcommand{\Vastm}{\mathrel\Vast}
\newcommand{\Vastr}{\mathclose\Vast}

and you can use \vast and \Vast with \DeclarePairedDelimiter.
MWE:
\documentclass{article}

\usepackage{mathtools}
\makeatletter
\newcommand{\vast}{\bBigg@{4}}
\newcommand{\Vast}{\bBigg@{5}}
\newcommand{\vastl}{\mathopen\vast}
\newcommand{\vastm}{\mathrel\vast}
\newcommand{\vastr}{\mathclose\vast}
\newcommand{\Vastl}{\mathopen\Vast}
\newcommand{\Vastm}{\mathrel\Vast}
\newcommand{\Vastr}{\mathclose\Vast}
\makeatother

\DeclarePairedDelimiter{\parens}()

\begin{document}

\[
 \parens[\Bigg]{\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}}
\]

\[
 \Vast({\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}} \Vast)\qquad
 \parens[\Vast]{\dfrac{\dfrac{y}{x}}{\dfrac{a}{b}}}  % works now
\]
\end{document}

Output:


text:
Q: How to apply function to each 2d matrix in an array I have a function that takes an X*X matrix as input, and returns a vector of length X.
I would like to apply that function to an X*X*Y array, and get back an X*Y matrix/array of the results from the function.
I can apply the function to one matrix with
funcName(arrayName[,,1])

but I can't figure out how to apply the function to each of the matrices. I'm sure it's simple - using apply or sapply or lapply, but I can't figure it out.

A: Just before posting my question, I tried one more thing.
The reference material for apply tells you that the MARGIN argument should be set to 1 for rows, and 2 for columns. I tried both of those without success, but then thought to try setting the MARGIN argument to 3 - that did the trick, and gave me the exact output I wanted.
To be exact, I did:
apply(arrayName, MARGIN=3, FUN=funcName)


text:
Q: Microsoft Word Document Controls not accepting carriage returns So, I have a Microsoft Word 2007 Document with several Plain Text Format (I have tried Rich Text Format as well) controls which accept input via XML.
For carriage returns, I had the string being passed through XML containing "\r\n" when I wanted a carriage return, but the word document ignored that and just kept wrapping things on the same line. I also tried replacing the \r\n with System.Environment.NewLine in my C# mapper, but that just put in \r\n anyway, which still didn't work.
Note also that on the control itself I have set it to "Allow Carriage Returns (Multiple Paragrpahs)" in the control properties.
This is the XML for the listMapper
<Field id="32"  name="32" fieldType="SimpleText">
    <DataSelector path="/Data/DB/DebtProduct">
        <InputField fieldType=""
                    path="/Data/DB/Client/strClientFirm"
                    link="" type=""/>
        <InputField fieldType=""
                    path="strClientRefDebt"
                    link="" type=""/>
    </DataSelector>
    <DataMapper formatString="{0} Account Number: {1}"
                name="SimpleListMapper" type="">
        <MapperData></MapperData>
    </DataMapper>
</Field>

Note that this is the listMapper C# where I actually map the list (notice where I try and append the system.environment.newline)
namespace DocEngine.Core.DataMappers
{
    public class CSimpleListMapper:CBaseDataMapper
    {
        public override void Fill(DocEngine.Core.Interfaces.Document.IControl control, CDataSelector dataSelector)
        {
            if (control != null && dataSelector != null)
            {
                ISimpleTextControl textControl = (ISimpleTextControl)control;
                IContent content = textControl.CreateContent();
                CInputFieldCollection fileds = dataSelector.Read(Context);
                StringBuilder builder = new StringBuilder();

                if (fileds != null)
                {
                    foreach (List<string> lst in fileds)
                    {
                        if (CanMap(lst) == false) continue;
                        if (builder.Length > 0 && lst[0].Length > 0)
                            builder.Append(Environment.NewLine);
                        if (string.IsNullOrEmpty(FormatString))
                            builder.Append(lst[0]);
                        else
                            builder.Append(string.Format(FormatString, lst.ToArray()));
                    }

                    content.Value = builder.ToString();

                    textControl.Content = content;
                    applyRules(control, null);
                }
            }
        }
    }
}

Does anybody have any clue at all how I can get MS Word 2007 (docx) to quit ignoring my newline characters??

A: Use a function like this:
private static Run InsertFormatRun(Run run, string[] formatText)
{
    foreach (string text in formatText)
    {
        run.AppendChild(new Text(text));
        RunProperties runProps = run.AppendChild(new RunProperties());
        Break linebreak = new Break();
        runProps.AppendChild(linebreak);
    }
    return run;
}

A: None of the above answers were any help for me.
However I figured out that the InsertAfter method  swaps the \n in the original XML string for \v and when this is passed into the content control it then renders correctly.
contentControl.MultiLine = true
contentControl.Range.InsertAfter(your string)

A: I think it works
WordprocessingDocument _docx = WordprocessingDocument.Create("c:\\Test.docx", WordprocessingDocumentType.Document);
MainDocumentPart _part = _docx.MainDocumentPart;
string _str = "abc\ndef\ngeh";
string _strArr[] = _str.Split('\n');

foreach (string _line in _strArr)
{
    Body _body = new Body();
    _body.Append(NewText(_text));
    _part.Append(_body);
}
_part.Document.Save();
_docx.Close();

.
static Paragraph NewText(string _text)
{
    Paragraph _head = new Paragraph();
    Run _run = new Run();
    Text _line = new Text(_text);
    _run.Append(_line);
    _head.Append(_run);
    return _head;
}

A: I got the same problem but it was in a table cell.
I had one string with carriage return (multiple line) into a Text object that was append to a paragraph that was append to a table cell.
=> The carriage return was ignored by word.
Well the solution was simple :
Create one paragraph by line and add all of these paragraph's to the table cell.


text:
Q: Trying to scroll the web page using anchor tags but it's not helping I am trying to put scrolling effect on my web page

$(document).ready(function(){
  $("a").on('click', function(event) {
    if (this.hash !== "") {
      event.preventDefault();
      var hash = this.hash;
      $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 800, function(){
        window.location.hash = hash;
      });
    }
  });
});
/*General Styles*/

* {
 margin: 0;
 padding: 0;
 box-sizing: border-box;
}

html {
 font: normal 16px sans-serif;
 color: #555;
}

ul,
nav {
 list-style: none;
}

a {
 text-decoration: none;
 opacity: 0.75;
 color: #fff;
}

a:hover {
 opacity: 1;
}

a.btn {
 border-radius: 4px;
 text-transform: uppercase;
 font-weight: bold;
 text-align: center;
 background-color: #3f51b5;
 opacity: 1;
}

a.btno {
 border-radius: 4px;
 text-transform: uppercase;
 text-align: center;
 background-color: #3f51b5;
 opacity: 1;
}

section {
 display: flex;
 flex-direction: column;
 align-items: center;
 padding: 100px 80px;
}

section:not(.hero):nth-child(even) {
 background-color: #f5f5f5;
}

.grid {
 width: 100%;
 display: flex;
 flex-wrap: wrap;
 justify-content: center;
}

hr {
 width: 250px;
 height: 3px;
 background-color: #3f51b5;
 border: 0;
 margin-bottom: 50px;
}

section h3.title {
 text-transform: capitalize;
 font: bold 32px "Open Sans", sans-serif;
 margin-bottom: 30px;
 text-align: center;
}

section p {
 max-width: 775px;
 line-height: 2;
 padding: 0 20px;
 margin-bottom: 30px;
 text-align: center;
}

@media (max-width: 800px) {
 section {
  padding: 50px 20px;
 }
}

/*Header Styles*/

header {
 position: absolute;
 width: 100%;
 display: flex;
 justify-content: space-between;
 align-items: center;
 padding: 35px 100px 0;
 animation: 1s fadein 0.5s forwards;
 opacity: 0;
 color: #fff;
}

@keyframes fadein {
 100% {
  opacity: 1;
 }
}

header h2 {
 font-family: "Quicksand", sans-serif;
}

header nav {
 display: flex;
 margin-right: -15px;
}

header nav li {
 margin: 0 15px;
}

@media (max-width: 800px) {
 header {
  padding: 20px 50px;
  flex-direction: column;
 }

 header h2 {
  margin-bottom: 15px;
 }
}

/*Hero Styles*/

.hero {
 position: relative;
 justify-content: center;
 text-align: center;
 min-height: 100vh;
 color: #fff;
}

.hero .background-image {
 position: absolute;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 background-size: cover;
 z-index: -1;
 background-color: #80a3db;
}

.hero h1 {
 font: bold 60px "Open Sans", sans-serif;
 margin-bottom: 15px;
}

.hero h3 {
 font: normal 28px "Open Sans", sans-serif;
 margin-bottom: 40px;
}

.hero a.btn {
 padding: 20px 46px;
}

.hero-content-area {
 opacity: 0;
 margin-top: 100px;
 animation: 1s slidefade 1s forwards;
}

@keyframes slidefade {
 100% {
  opacity: 1;
  margin: 0;
 }
}

@media (max-width: 800px) {
 .hero {
  min-height: 600px;
 }

 .hero h1 {
  font-size: 48px;
 }

 .hero h3 {
  font-size: 24px;
 }

 .hero a.btn {
  padding: 15px 40px;
 }
}

/*Destinations Section*/

.destinations .grid li {
 height: 350px;
 padding: 20px;
 background-clip: content-box;
 background-size: cover;
 background-position: center;
}

.destinations .grid li.small {
 flex-basis: 30%;
}

.destinations .grid li.large {
 flex-basis: 70%;
}

@media (max-width: 1100px) {
 .destinations .grid li.small,
 .destinations .grid li.large {
  flex-basis: 50%;
 }
}

@media (max-width: 800px) {
 .destinations .grid li.small,
 .destinations .grid li.large {
  flex-basis: 100%;
 }
}

/*Packages Section*/

.packages .grid li {
 padding: 50px;
 flex-basis: 50%;
 text-align: center;
}

.packages .grid li i {
 color: #8c9eff;
}

.packages .grid li h4 {
 font-size: 30px;
 margin: 25px 0;
}

@media (max-width: 800px) {
 .packages .grid li {
  flex-basis: 100%;
  padding: 20px;
 }
}

/*Testimonials Section*/

.testimonials .quote {
 font-size: 22px;
 font-weight: 300;
 line-height: 1.5;
 margin: 40px 0 25px;
}

@media (max-width: 800px) {
 .testimonials .quote {
  font-size: 18px;
  margin: 15px 0;
 }

 .testimonials .author {
  font-size: 14px;
 }
}

/*Contact Section*/

.contact form {
 display: flex;
 align-items: center;
 justify-content: center;
 flex-wrap: wrap;
 width: 60%;
}

.contact form .btn {
 padding: 18px 42px;
}

.contact form input {
 padding: 15px;
 margin-right: 30px;
 font-size: 18px;
 color: #555;
 flex: 1;
}

@media (max-width: 1000px) {
 .contact form input {
  flex-basis: 100%;
  margin: 0 0 20px 0;
 }
}

/*Footer Section*/

footer {
 display: flex;
 align-items: center;
 justify-content: space-around;
 background-color: #607d8b;
 color: #fff;
 padding: 20px 0;
}

footer ul {
 display: flex;
}

footer ul li {
 margin-left: 16px;
}

footer p {
 text-transform: uppercase;
 font-size: 14px;
 opacity: 0.6;
 align-self: center;
}

@media (max-width: 1100px) {
 footer {
  flex-direction: column;
 }

 footer p {
  text-align: center;
  margin-bottom: 20px;
 }

 footer ul li {
  margin: 0 8px;
 }
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Mountain Travel</title>
  <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="assets/css/styles.css">

Mountain Travel

Tours

About

Contact

Mountain Travel

Unmissable Adventure Tours Around The World

      Contact Us Now

Some of our destinations:

Tired of the ocean? Are the plains too plain? Come along with us on one of our mountain adventures. Here are some pictures from people who have had elevated experiences with us.

Tour Packages

We offer a variety of mountaineering packages. Whether you've climbed Everest or don't even know what a mountain is, we've got the perfect vacation for you.

Guided Trips

Looking for the complete experience? Take a tour with one of our experts. They'll show you secrets that you're likely to miss otherwise.

Photo Trips

Want to experience nature's beauty without all of that annoying exercise? Take a photo tour on one of our mountain buses.

Biking Trips

If bicycles are more your speed, consider taking a tour through one of our mountain bike paths. We'll provide the bikes, and lunch too!

Racing Trips

Got a competitive spirit? Sign up for one of our mountain marathons! Try to reach the summit before anyone else.

Testimonials from our adventurers:

Wow! This tour made me realize how much I love mountains. After going on one of these tours, I can safely say that they are my favorite geographic feature, and my favorite word that starts with M.

- Joe Gatto

I never understood why people cared so much about mountains. But then I went on one of these tours. Now I can't understand people who don't care about mountains!

- Brain Quinn

If you want to understand the universe, head to the mountains. I mean, seriously. It's like, woah. You know? It's like that.

- Sal Volcano

Learn more

Want to know about our upcoming mountain-related events, or come to one of our mixers? Just sign up for our mailing list. No spam from us, we promise! Except for the spam we give you to keep up your energy while you're hiking through the mountains. We have tons of that.

    <form>
      <input type="email" placeholder="Email">
      Subscribe now
    </form>

Images courtesy of unsplashyy.

Why are you even reading this?! There's never anything interesting in the footer!

I have tried alot but when I click on tours, about or contact it's not showing scrolling.All i want is to show some scrolling using anchor tag not the button but I am unable to do this. Without CSS it;s working great but with css it's not.Thanks in advance.

A: You can you answer from dknaack using jQuery.offset() and jQuery.animate().
Sample:
function scrollToAnchor(aid){
    var aTag = $("a[name='"+ aid +"']");
    $('html,body').animate({scrollTop: aTag.offset().top},'slow');
}

scrollToAnchor('id3');

A: Your Tour link is linked to Some of our destinations and About linked to Tour Packages.
You can change that, it is not such a big deal. I would like to add smooth scrolling for effective look. Here is jsfiddleLink, you can copy that code. Hope it helps
<!DOCTYPE html>

Mountain Travel

Tours

About

Contact

Some of our destinations:

Tired of the ocean? Are the plains too plain? Come along with us on one of our mountain adventures. Here are some pictures from people who have had elevated experiences with us.

Tour Packages

We offer a variety of mountaineering packages. Whether you've climbed Everest or don't even know what a mountain is, we've got the perfect vacation for you.

Guided Trips

Looking for the complete experience? Take a tour with one of our experts. They'll show you secrets that you're likely to miss otherwise.

Photo Trips

Want to experience nature's beauty without all of that annoying exercise? Take a photo tour on one of our mountain buses.

Biking Trips

If bicycles are more your speed, consider taking a tour through one of our mountain bike paths. We'll provide the bikes, and lunch too!

Racing Trips

Got a competitive spirit? Sign up for one of our mountain marathons! Try to reach the summit before anyone else.

Testimonials from our adventurers:

Wow! This tour made me realize how much I love mountains. After going on one of these tours, I can safely say that they are my favorite geographic feature, and my favorite word that starts with M.

- Joe Gatto

I never understood why people cared so much about mountains. But then I went on one of these tours. Now I can't understand people who don't care about mountains!

- Brain Quinn

If you want to understand the universe, head to the mountains. I mean, seriously. It's like, woah. You know? It's like that.

- Sal Volcano


text:
Q: How to trace the write system call in the Linux kernel? I am trying to do this:
I am sending packet through iperf-an open source tool from one machine to another and I want to trace the write system or send call.
Please help me to do that,if someone can guide through Ftrace framework to trace system call that would be great otherwise by any other tracing tool.

A: The hard part is to know exactly what to trace so you can see only the results that you want, but the tracing itself is very easy:

*

*First, your kernel must be configured with CONFIG_FTRACE=y

*Determine what event you want to trace
cat /sys/kernel/debug/tracing/available_events

*Write the event that you have chosen into set_event
echo sys_enter_write > /sys/kernel/debug/tracing/set_event

*Determine what kind of trace you want to trace
cat  /sys/kernel/debug/tracing/available_tracers

*Write the kind of trace that you want in current_tracer file
echo function_graph > /sys/kernel/debug/tracing/current_tracer

*Enable tracing:
echo 1 > /sys/kernel/debug/tracing/tracing_on

*Now you can run the "iperf -c... " as you wish, and disable tracing when it is done.
echo 0 > /sys/kernel/debug/tracing/tracing_on
To see the results:
vi /sys/kernel/debug/tracing/trace

A: strace
If you are going to just trace one process, why not just use strace? It can even connect to running processes: How does strace connect to an already running process?
For ftrace, use echo none > /sys/kernel/debug/tracing/current_tracer to trace just the system calls
As of Linux 4.15 at least, if you use function_graph instead, then it shows a ton of functions in addition to the system call.
You could work around that with filtering, but it is simpler to just use nop: How to trace just system call events with ftrace without showing any other functions in the Linux kernel?
Run with sudo:
#!/bin/sh
set -eux

d=debug/tracing

mkdir -p debug
if ! mountpoint -q debug; then
  mount -t debugfs nodev debug
fi

# Stop tracing.
echo 0 > "${d}/tracing_on"

# Clear previous traces.
echo > "${d}/trace"

# Find the tracer name.
cat "${d}/available_tracers"

# Disable tracing functions, show only system call events.
echo nop > "${d}/current_tracer"

# Find the event name with.
grep write "${d}/available_events"

# Enable tracing write.
# Both statements below seem to do the exact same thing,
# just with different interfaces.
# https://www.kernel.org/doc/html/v4.18/trace/events.html
echo sys_enter_write > "${d}/set_event"
# echo 1 > "${d}/events/syscalls/sys_enter_write/enable"

# Start tracing.
echo 1 > "${d}/tracing_on"

# Generate two write calls by two different processes.
rm -rf /tmp/a /tmp/b
printf a > /tmp/a
printf b > /tmp/b

# View the trace.
cat "${d}/trace"

# Stop tracing.
echo 0 > "${d}/tracing_on"

umount debug

and a sample output:
# tracer: nop
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
            a.sh-18135 [004] .... 11152.454767: sys_write(fd: 2, buf: 5558769acc00, count: 2)
            a.sh-18135 [004] .... 11152.454777: sys_write(fd: 2, buf: 555877f6a968, count: 2)
            a.sh-18135 [004] .... 11152.454785: sys_write(fd: 2, buf: 555877f6a968, count: 4)
            a.sh-18135 [004] .... 11152.454793: sys_write(fd: 2, buf: 555877f6a968, count: 7)
            a.sh-18135 [004] .... 11152.454801: sys_write(fd: 2, buf: 555877f6a968, count: 7)
            a.sh-18135 [004] .... 11152.454807: sys_write(fd: 2, buf: 7ffc5f3f2be7, count: 1)
 gnome-terminal--3419  [005] .... 11152.454833: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
 gnome-terminal--3419  [005] .... 11152.454862: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
 gnome-terminal--3419  [005] .... 11152.454887: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
 gnome-terminal--3419  [005] .... 11152.454894: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
           gmain-3193  [002] .... 11152.456141: sys_write(fd: 4, buf: 7fbfe5a93c40, count: 8)
           gmain-3193  [002] .... 11152.456168: sys_write(fd: 4, buf: 7fbfe5a92bd0, count: 8)
           gmain-3193  [002] .... 11152.456172: sys_write(fd: 4, buf: 7fbfe5a93c40, count: 8)
            a.sh-18135 [004] .... 11152.456534: sys_write(fd: 2, buf: 5558769acbd8, count: 2)
            a.sh-18135 [004] .... 11152.456547: sys_write(fd: 2, buf: 555877f6a968, count: 6)
            a.sh-18135 [004] .... 11152.456555: sys_write(fd: 2, buf: 555877f6a968, count: 2)
            a.sh-18135 [004] .... 11152.456561: sys_write(fd: 2, buf: 7ffc5f3f2be7, count: 1)
            a.sh-18135 [004] .... 11152.456578: sys_write(fd: 1, buf: 555877f6af00, count: 1)
 gnome-terminal--3419  [005] .... 11152.456651: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
 gnome-terminal--3419  [005] .... 11152.456660: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
            a.sh-18135 [004] .... 11152.456674: sys_write(fd: 2, buf: 5558769acbd8, count: 2)
            a.sh-18135 [004] .... 11152.456683: sys_write(fd: 2, buf: 555877f6a968, count: 6)
            a.sh-18135 [004] .... 11152.456690: sys_write(fd: 2, buf: 555877f6a968, count: 2)
            a.sh-18135 [004] .... 11152.456694: sys_write(fd: 2, buf: 7ffc5f3f2be7, count: 1)
            a.sh-18135 [004] .... 11152.456703: sys_write(fd: 1, buf: 555877f6af00, count: 1)
            a.sh-18135 [004] .... 11152.456738: sys_write(fd: 2, buf: 5558769acb88, count: 2)
            a.sh-18135 [004] .... 11152.456745: sys_write(fd: 2, buf: 555877f6a968, count: 3)
            a.sh-18135 [004] .... 11152.456750: sys_write(fd: 2, buf: 555877f6a968, count: 14)
            a.sh-18135 [004] .... 11152.456756: sys_write(fd: 2, buf: 7ffc5f3f2be7, count: 1)
 gnome-terminal--3419  [005] .... 11152.456816: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)
 gnome-terminal--3419  [005] .... 11152.456845: sys_write(fd: 4, buf: 7ffe4f3a61c0, count: 8)

As you can see, write is a very common system call, so it is difficult to isolate our two write calls. Things would be easier to see with a less common call, e.g. mkdir: How do I trace a system call in Linux?
Tested on Ubuntu 18.04, Linux kernel 4.15.

A: To get call graph of write syscall, you can:
sudo trace-cmd record -p function_graph -g vfs_write your-prog

your-prog can be simple write program like:
#include <stdio.h>
#include <sys/file.h>
int main()
{
        int fd = open("a.txt", O_WRONLY | O_CREAT);
        write(fd, "abcdefg", 6);
        close(fd);
}

Then trace-cmd report | grep -v trace-cmd | less

A: Apart from ftrace, you can also use perf like:
sudo perf record --call-graph fp ./fio --filename=aa --size=4G --direct=0 --rw=write --bs=1M  --iodepth=512 --numjobs=1 --name=job_name

Then:
sudo perf report --call-graph

and expand vfs_write:
  Children      Self  Command  Shared Object       Symbol
+   80.17%     0.00%  fio      [kernel.kallsyms]   [k] entry_SYSCALL_64_after_hwframe                                                                                ◆
+   80.15%     0.02%  fio      [kernel.kallsyms]   [k] do_syscall_64                                                                                ▒
+   78.57%     0.07%  fio      libpthread-2.31.so  [.] __libc_pwrite64                                                                                ▒
-   78.49%     0.04%  fio      [kernel.kallsyms]   [k] vfs_write                                                                                ▒
   - 78.46% vfs_write                                                                                ▒
      - 78.40% new_sync_write                                                                                ▒
         - 78.37% ext4_file_write_iter                                                                                ▒
            - 78.33% ext4_buffered_write_iter                                                                                ▒
               - 77.73% generic_perform_write                                                                                ▒
                  - 50.15% ext4_da_write_begin                                                                                ▒
                     - 38.72% grab_cache_page_write_begin                                                                                ▒
                        - 38.61% pagecache_get_page                                                                                ▒
                           - 23.52% __page_cache_alloc                                                                                ▒
                              - 23.16% alloc_pages                                                                                ▒
                                 - 22.63% __alloc_pages                                                                                ▒
                                    - 22.00% get_page_from_freelist                                                                                ▒
                                       - 18.16% prep_new_page                                                                                ▒
                                            17.84% clear_page_rep                                                                                ▒
                                         1.80% rmqueue                                                                                ▒
                                         1.28% node_dirty_ok                                                                                ▒
                           - 12.84% add_to_page_cache_lru                                                                                ▒
                              - 9.77% __add_to_page_cache_locked                                                                                ▒
                                 - 1.89% __mem_cgroup_charge                                                                                ▒
                                      1.01% charge_memcg                                                                                ▒
                                      0.77% get_mem_cgroup_from_mm                                                                                ▒
                                 - 1.09% xa_get_order                                                                                ▒
                                    - 0.89% xas_load                                                                                ▒
                                         0.53% xas_descend                                                                                ▒
                              - 2.69% lru_cache_add                                                                                ▒
                                 - 2.37% __pagevec_lru_add                                                                                ▒
                                      2.01% __lock_text_start                                                                                ▒
                           - 1.21% xas_load                                                                                ▒
                                0.66% xas_descend                                                                                ▒
                     - 10.38% ext4_block_write_begin                                                                                ▒
                        - 7.01% create_empty_buffers                                                                                ▒
                           - 5.98% alloc_page_buffers                                                                                ▒
                              - 5.59% alloc_buffer_head                                                                                ▒
                                 - 4.24% kmem_cache_alloc                                                                                ▒
                                    - 1.03% ___slab_alloc                                                                                ▒
                                       - new_slab                                                                                ▒
                                          - 0.87% allocate_slab                                                                                ▒
                                             - 0.57% alloc_pages                                                                                ▒
                                                - 0.55% __alloc_pages                                                                                ▒
                                                     get_page_from_freelist                                                                                ▒
                                      0.84% get_obj_cgroup_from_current                                                                                ▒
                                   0.53% memset                                                                                ▒
                        - 2.42% ext4_da_get_block_prep                                                                                ▒
                           - 1.26% ext4_da_map_blocks.constprop.0                                                                                ▒
                                0.53% ext4_es_lookup_extent                                                                                ▒
                  - 16.27% copy_page_from_iter_atomic                                                                                ▒
                       copy_user_generic_string                                                                                ▒
                  - 8.74% ext4_da_write_end                                                                                ▒
                     - 8.23% generic_write_end                                                                                ▒
                        - 7.83% block_write_end                                                                                ▒
                           - __block_commit_write.isra.0                                                                                ▒
                              - 6.89% mark_buffer_dirty                                                                                ▒
                                 - 5.66% __set_page_dirty                                                                                ▒
                                      5.54% __lock_text_start                                                                                ▒
                    1.35% __get_user_nocheck_1                                                                                ▒
+   78.48%     0.00%  fio      [kernel.kallsyms]   [k] __x64_sys_pwrite64                                                                                ▒
+   78.48%     0.00%  fio      [kernel.kallsyms]   [k] ksys_pwrite64                                                                                ▒
+   78.40%     0.02%  fio      [kernel.kallsyms]   [k] new_sync_write                                                                                ▒
+   78.37%     0.02%  fio      [kernel.kallsyms]   [k] ext4_file_write_iter                                                                                ▒
+   78.33%     0.00%  fio      [kernel.kallsyms]   [k] ext4_buffered_write_iter                                                                                ▒
+   77.73%     0.27%  fio      [kernel.kallsyms]   [k] generic_perform_write                                                                                ▒
+   50.28%     0.45%  fio      [kernel.kallsyms]   [k] ext4_da_write_begin                                                                                ▒
+   38.76%     0.07%  fio      [kernel.kallsyms]   [k] grab_cache_page_write_begin                                                                                ▒
+   38.74%     0.91%  fio      [kernel.kallsyms]   [k] pagecache_get_page                                                                                ▒
+   25.19%     0.66%  fio      [kernel.kallsyms]   [k] __alloc_pages                                                                                ▒
+   24.44%     0.64%  fio      [kernel.kallsyms]   [k] get_page_from_freelist


text:
Q: How to map UID/GID to username/groupname in linux In a C program on Linux, I get UID and GID of a file, but I want to print the username and group name. So how to map UID/GID to username/group name?

A: Use the getpwuid function to get the username associated with a uid:
struct passwd *getpwuid(uid_t uid);

The name is returned in passwd.pw_name
For groups, use getgrgid:
struct group *getgrgid(gid_t gid);

The name is returned in group.gr_name


text:
Q: Why did I set the y attribute value in d3 and it did not actually take effect; code show as below:
d3.select('#points').append('use')
    .attr('id', 'yd')
    .attr('type', 'point')
    .attr('x', 70)
    .attr('y', 480)
    .attr('class', 'origin')
    .attr('xlink:href','#point')
    .call(d3.drag()
        .on('start', dragstarteds)
        .on('drag', draggeds)
        .on('end', dragendeds));
console.log(d3.select('#yd'));
console.log(d3.select('#yd').attr('y'));

The two results obtained by console are as follows:
1.The set x attribute takes effect but the y attribute does not take effect
2.But the value obtained through d3.select('#yd').attr('y') is exactly the value of the y attribute I set (80)
The y property value shown on the page is 490 instead of the 480 I set
I didn't modify this y attribute value elsewhere. Can someone help me to see what the problem is?


text:
Q: hello.js library for Twitter, Google+ produces logout error I have problem with logout with twitter and Google+ with hello.js library with auth authentication. I have written logout code it is not working for twitter and Google+ but working with Facebook perfectly.
Code here:
hello("google").logout({force:true},function(){
    alert("Signed out");
});

A: Logout from the thirdparty is only available with Facebook and Windows http://adodson.com/hello.js/#hellologout


text:
Q: Scope of extern variable outside directory I am trying to use a variable whose value is set to 1 after a a option is passed to a code.
MyValueis =1 in a code say /abc/xyz/abc.c
Means a c code check that a particular option is passed to it.If it is true, it set the value of variable to 1.Now if the value of variable is set to 1, i need to enable a different code in a different directory but within same sofwarw code.
So i declared the variable as extern
extern int MyValueis;

is this extern variable is accessible in a different directory inside same software code?
I had read certain articles regarding scope of extern variable but they don't proved to be useful in my question.

A: Source code directory doesn't matter in C. What matters is source code file and executables (programs).
If the object code file abc.o is linked with your other code, then the variable will be available in the other code no matter which directory the source code happen to be in.


text:
Q: thread pooling for http requests I have a few questions regarding architecture & performance for concurrency.
Setup:
There is a JavaFX GUI where users can start various Tasks, which are themselves threaded tasks (new Thread(new CustomTask<?>).start();). These tasks do a loop for ~700k HTTP-requests and insert the processed return values if there are around 10k items in the prepared insert statement for the database. Their progress is displayed in the GUI (ObservableList items).

Problem:
These tasks take a long time and the bottleneck seems to be the delay while waiting for the HTTP-response.
(DB inserts are done with auto-commit turned off in bulks of 10k prepared insert statements)
Target:
Improve overall performance by having the requests in separate tasks/threads.

Q1:
Is it even reasonable to use threads here? How can I improve the performance in a other way?
Q2:
If threading is reasonable, how do I realize it?
I was thinking about having a global thread pool or ExecutorService where the request tasks are queued. When the response is available, it will be written to a synchronized list. If there are 10k+ objects in the list, execute a batch insert.
Q3:
How do I determine a good thread-pool size? How to distinguish threads?
Thread.activeCount() returns 7 (current Thread Group)
ManagementFactory.getThreadMXBean().getThreadCount() returns 13 (threads overall?)
Runtime.getRuntime().availableProcessors() returns 8
I´ve read a few comments on multithreading and they all said that having more threads than cores does not necessarily improve performance (no "real" concurrency, timeslicing). I don´t know but if I had to guess I´d say the number 13 includes some GUI threads. I can´t seem to wrap my head around how to get a useful number for the ThreadPoolSize.

I appreciate any hint on how to improve my application.

A: Of course you can use ExecutorService.

I´ve read a few comments on multithreading and they all said that having more threads than cores does not necessarily improve performance (no "real" concurrency, timeslicing)

This is true for processes that don't sleep or wait/block, such as calculating prime numbers or processing images. In your case, HTTP client blocks until response returns, and until it happens thread remains idle. For HTTP request executor pool of size 50-100-200 is okay.
Pattern could be the following:
ExecutorService es = Executors.newFixedThreadPool(50);

// ...
// creating request and response future associated with it
Future<Response> responseFuture = es.submit(new Callable<Response>() {
    @Override
    public Response call() throws Exception {
        // request data by HTTP
        return response;
    }
});
customTask.push(responseFuture);

In a customTask object let's create a single thread service executor which will operate on list of Responses:
// create single pool executor in order to accept responses
// one by one and at the order they're requested
ExecutorService customTaskService = Executors.newSingleThreadExecutor();
List<Response> results = new ArrayList<>();

// push() method
public void push(final Future<Response> responseFuture) {

     customTaskService.execute(new Runnable() {

         public void run() {
             try {
                 // response.get() will block inside this service thread
                 // though not affecting GUI thread
                 results.add(response.get(TIMEOUT, TimeUnit.SECONDS));
             } catch (RuntimeException e) {
                 // processing of a request failed
             }
             if (results.size() > MAX_SIZE) {
                 // make inserts to DB
                 results.clear();
             }
         }
     });
}

A:
Q1

First it is unclear what you need to respond back to the client with. Do you have to talk to the database to send back a response?
If you don't it is the Pub/Sub pattern (ie its fire and forget) then message queues or any pub/sub systems are ideal and scale far better than using a plain ExecutorService. Some examples are AMQP, JMS, Redis Pub/Sub and many many more.
You can do pub/sub with a reply to the client but this generally requires nonblocking client connections like WebSockets, Comet and is fairly complicated to setup.

Q2 and Q3

If your problem is you DO need to reply to the client then it follows the Request/Reply pattern which is a harder problem to scale.
Some libraries that do this well are on the JVM are Hystrix which follows the command and bulkhead pattern which gives configurable and fault tolerant Request/Reply along with request collapsing which I believe solves your: "If there are 10k+ objects in the list, execute a batch insert."
Figuring out the proper pool size is actually fairly complicated for blocking operations. For nonblocking (ie cpu bound or in memory processing) its simply the available processors but this is not the case for you since your connecting to a database and probably using a blocking IO servlet container.
To figure out the proper pool size for blocking operations you will have use metrics and monitoring which Hystrix provides out of the box. You also should be aware of your downstream dependencies. For example if your database can only handle 200 concurrent connections you do not want a thread pool that talks to the database bigger than 200.


text:
Q: How to make the performance of query faster by using the things other than Union in C#? I have an object called Product which have the attribute called ProductItem and tags.
public class Shop{
    public string Id {get; set;}
    public Product Products {get; set;}
}

public class Product{
    public string Name {get; set;}
    public string Id {get; set;}
    public Tag Tags {get; set;}
    public ProductItem ProductItems {get; set;}
    public Shop ShopInformation {get; set;}
}

public class Tag{
    public string Id {get; set;}
    public string name {get; set;}
}

public class ProductItem{
    public string Id {get; set;}
    public Tag Tags {get; set;}
}

I would like to get all the tags in both Products and Tags from the datacontext
and I use this query
var result = from shop in dataContext.Shop
             select new Response
             {
                 Id = shop.Id,
                 Tags = (from product in dataContext.Product
                 where product.ShopInformation.Id == shop.Id
                 from productTag in
                 product.Tags.Union(product.ProductItems.SelectMany(s => s.Tags))
                 select productTag.Name).Distinct(),
             };

However, the performance is pretty slow, and thus I would like to know if there is a way to collect all tags faster.


text:
Q: How can I open a JPG image on my computer using selenium with python I want to import an organizational logo using Selenium with Python.
I have to click on a link that will open up your file explorer and then I want to be able to find the image using Selenium.
This is what I have so far assuming that I have already made it to the website successfully.
input = driver.find_element(
    By.ID,
    "linkConfigurelogo").click()
input.driver.find_element(
    By.ID, "OrganizationLogo").send_keys(
    "C://filepath//Documents//image.jpg")

A: More details about your specific project might be necessary to fully answer this question, but this might be a good start.
Firstly, send_keys will send the actual keystrokes of whatever you pass to the element. This code is the equivalent of me clicking on the image element and then typing into my keyboard "C://filepath//Documents..." Unless the website is built to respond to these keystrokes, it doesn't do anything.
To download an image to your computer, you generally need to isolate the src attribute for the image in question. This can be done in selenium:
img = driver.find_element(By.ID, "linkConfigurelogo").click()
src = img.get_attribute('src')

Once you have the source, there exist a few ways to download the image:
import urllib
urllib.urlretrieve(src, "captcha.png")

See this post, this article, and this tutorial


text:
Q: Calling non-generic method from generic method in C# This is similar to this question Call overloaded generic method from generic method but it's not the same: in that case, the method returned void, while I need to return the generic type T, so the proposed solution does not work.
I'm implementing a tuple-like class which has generic parameters and accessors for these parameters:
public class MyClass<T1, T2>
{
    private readonly T1 _item1;
    private readonly T2 _item2;

    public MyClass(T1 item1, T2 item2)
    {
        _item1 = item1;
        _item2 = item2;
    }

    public T1 GetItem(T1 _) => _item1;

    public T2 GetItem(T2 _) => _item2;

    private T GetItem<T>(T x)
    {
        throw new ArgumentException();
        // return x;
    }

    public T Get<T>()
    {
        return GetItem(default(T));
    }
}

I would like to use this class like this:
var obj = new MyClass<int, string>(1, "hello");
var a = obj.Get<int>();
var b = obj.Get<string>();

But if I try this, the Generic T GetItem<T>(T x) is always called (the exception is thrown), and not the non-generic implementations.
If I try to access the GetItem method directly, it works as intended:
var obj = new MyClass<int, string>(1, "hello");
var q = obj.GetItem(default(int));
var w = obj.GetItem(default(string));

q and w contain 1 and hello as expected.
Is there a way for me to use this class as I want (using obj.Get<T>)? I want to avoid Item1 Item2 Item3 getters.

A:
But if I try this, the Generic T GetItem<T>(T x) is always called (the exception is thrown), and not the non-generic implementations.

That's because overload resolution happens at compile-time, and at compile-time, the concrete type of T is unknown.

Is there a way for me to use this class as I want (using obj.Get<T>)?

Using plain old dynamic type checking, sure:
public class MyClass<T1, T2>
{
    private readonly T1 _item1;
    private readonly T2 _item2;

    public MyClass(T1 item1, T2 item2)
    {
        _item1 = item1;
        _item2 = item2;
    }

    public T Get<T>()
    {
        if (typeof(T) == typeof(T1))
        {
            return (T)(object)_item1;
        }

        if (typeof(T) == typeof(T2))
        {
            return (T)(object)_item2;
        }

        throw new InvalidOperationException();
    }
}

The advantage of this solution is that the behavior of the edge cases (T1 == T2, or T matches neither T1 nor T2) is properly defined and easy to see.

Alternatively, you can use the dynamic "hack" used in the question you linked to, you just need to cast the result to T: return (T)GetItem((dynamic)default(T));, here's a working fiddle.
But this is just plain ugly, please don't do that. Compare the fiddle with the version above and try to judge honestly which one is easier to read, easier to understand, and, thus, easier to maintain.

A: Tests
var instance = new MyClass<string, int>("hello", 1);
Console.WriteLine(instance.GetItem("hi"));
Console.WriteLine(instance.GetItem(2));
// returns "hello"
Console.WriteLine(instance.Get<string>());
// returns "1"
Console.WriteLine(instance.Get<int>());
// throws with details
Console.WriteLine(instance.Get<object>());

Implementation
public T Get<T>()
{
    var parentType = typeof(MyClass<T1, T2>);
    var method = parentType.GetMethod(nameof(GetItem), new[] { typeof(T) });
    if (method == null)
        throw new NotImplementedException(
            $"No implementation for {nameof(GetItem)} with parameter type {typeof(T).FullName}");

    var result = (T)method.Invoke(this, new object[] { default(T) });
    return result;
}

This version uses reflection. If you need more performance you should go for compiled expressions, but that is harder to maintain

A: What if you had the same data-type for the two items?
var obj = new MyClass<int, int>(1, 2);

what should GetItem return here? Obviously there's no valid answer to this.
Anyway providing a parameter only to distinguish which method to call is pretty odd. Actually your GetItem<T>-method shouldn't be generic at all. Just use two different methods:
T1 GetItem1() => _item1;
T2 GetItem2() => _item2;

or use auto-properties to get rid of the backing-fields:
public class MyClass<T1, T2>
{
    public T1 Item1 { get; }
    public T2 Item2 { get; }

    public MyClass(T1 item1, T2 item2)
    {
        Item1 = item1;
        Item2 = item2;
    }


text:
Q: File uploader to SE from within Lightning Component We've been looking for a way to inject large files (>5MB) in anyway from within a Lightning component. The Heap limits of APEX means we are limited to from passing the files to Apex then onward as need.
We've finally found that creating a HTML5 only form allow for the posting of a file to Amazon s3, once in s3 we can move it to were we actually need it.
Is there any reason to not continue to do this? We understand that this limits browser comparability that no more then Lightning already does. The below is a cut down sample of how we implement the uploader. There is no JavaScript involved in the actual upload.
<form aura:id="form" id="form" name="form" action="https://example.s3.amazonaws.com/" method="POST" enctype="multipart/form-data" novalidate=""
      onsubmit="" onchange="" >

    <fieldset>
        <input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000000" />
        <input type="hidden" name="key" value="{!v.key+v.filename}" />
        <input type="hidden" id="x-amz-meta-tag" name="x-amz-meta-tag" value="1234567890adb"/>
 <input type="file" name="file" id="file" />

            <button type="submit" onclick="">Upload Files</button>
    </fieldset>

</form>

We'd like to know if this is how large file uploading should be handled or is the just a "bug" in locker services that wasn't closed as it doesn't involve JavaScript. Any input on how this can be done cleaner would be helpful.
PS. We have tested this with Large files (~250MB) without problem.

A: We had a similar requirement to upload large files to Salesforce and then upload them to external system via batch apex.
We tried couple of options:

*

*Like you mentioned, we tried to send data back to Salesforce, but we realized that even with Chunking, we won't be able to exceed 4.3MB limit due to payload size and the apex heap size etc.

*We tried to invoke Salesforce REST Service directly from Client side to invoke Files API (Ie, the content Object), but we got stuck with Session ID issue. We were advised not to generate session id from controller side and use it in lightning as they are served from different locations.
You mentioned you are connecting to Amazon S3, so in that case are you using any JS Library to authenticate and connect to S3?
http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-examples.html
If the above is the case, then JS file needs to be 100% locker service compatible (Ie, all the ES5 compatible).
I believe the best person to answer this question would be @Doug Chasman.


text:
Q: How do I convert string characters into a list?
Possible Duplicate:
How to create a list with the characters of a string?

Example:
'abc'

becomes
['a', 'b', 'c']

Is it a combination of split and slicing?

A: >>> x = 'abc'
>>> list(x)
['a', 'b', 'c']

Not sure what you are trying to do, but you can access individual characters from a string itself:
>>> x = 'abc'
>>> x[1]
'b'

A: If you need to iterate over the string you do not even need to convert it to a list:
>>> n = 'abc'
>>> for i in n:
...     print i
...
a
b
c

or
>>> n[1]
'b'

A: yourstring = 'abc'
[char for char in yourstring]


text:
Q: Do a person get-out of / be out of / leave / exit balance? What is the idiomatic word to go with 'balance' in the following context?
For example:
If a person had one disease and then got another one, we might say "He had one disease, and as a result he got out of /  was out of / left / exited balance and got another one". (or maybe other choices I've not mentioned).


text:
Q: PostMessage not working for WM_PASTE , mfc I have an application which has a button on Click of button am trying to paste the text already available to Notepad. My application gathers the text first and puts it on the clipboard(this is working perfectly fine), I am facing problem with the Paste part. Here is the code, Please let me know where am i going wrong.
CWnd *pCwnd = FindWindow(NULL, _T("Untitled - Notepad"));
    HWND handle = pCwnd->GetSafeHwnd();
    pCwnd->PostMessageA(WM_PASTE,0,0);

I am using Notepad to test it so the name is ("Untitled -  Notepad").
Please help me. Thanks in advance.

A: I don't use MFC, but you can probably translate to what you need.  The issue is you need to send the message to the edit control, not the main window.
#include <Windows.h>
#include <string>
#include <cstdlib>

int main()
{
    const std::string data("This is some text from the clipboard.");
    HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, data.size() + 1);
    std::memcpy(GlobalLock(hMem), data.c_str(), data.size() + 1);
    GlobalUnlock(hMem);
    OpenClipboard(NULL);
    EmptyClipboard();
    SetClipboardData(CF_TEXT, hMem);
    CloseClipboard();

    HWND mainWindow = FindWindow(NULL, "Untitled - Notepad");
    HWND editWindow = FindWindowEx(mainWindow, NULL, "edit", NULL);
    PostMessage(editWindow, WM_PASTE, 0, 0);
    return 0;
}


text:
Q: bootstrap no respeta los estilos de la tabla en el media print Buena tarde tengo el inconveniente de que bootstrap no me respeta los estilos de esta pequeña tabla al momento de imprimir ya aplique algunas soluciones como la de entrar directo al archivo bootstrap , o de colocar puros !important en la hoja de estilo el detalle , con el archivo bootstrap es que no puedo alterar el archivo ya que se trabaja en conjunto y hay otros compañeros que si usan el !important entonces no lo puedo descartar , haber si de casualidad ustedes sabe alguna solución diferente.
Les dejo el codigo y ahi vienen los colores que deberia imprimir lo cual no los muestras , como nota tambien ya revise graficos de fondo de google.
GRACIAS!

            Frecuencia

            1*

            más de 8,811,266 a 17,363,387

            3

            más de 6,313,789 a 8,811,266

            5

            más de 4,061,497 a 6,313,789

            11

            más de 2,172,839 a 4,061,497

            12

            de 747,801 a 2,172,839

            *Unidades geográficas con valores que se alejan del resto. Ver más

A: Ya probaste incluyendo los estilos en un css con el atributo media?
<link rel="stylesheet" type="text/css" media="print" href="print.css">

Los estilos irían dentro del media print:
@media print {
   * { color: black; background: white; }
   table { font-size: 80%; }
}


text:
Q: ASP updateprogress close button I have a problem with my updateprogress. Its working, but I want a close button to close it. Its not problem yet, but I want to display this button after display of updateprogress in 30 sec. I tried do it with jquery, but it didnt work.
Can you help me?
Here is a sample. My problem is, that I dont know, what kind of event show the updateprogress.
$('.UpdateProgress').on('display', function () {
    $('.btnClose').hide(0).delay(30000).show(0);
});

I tried display, show, focus event, but I dont know how to do this.

A: Set your button to hidden to start:
<style>
    input.btnClose
    {
        display: none;
    }
</style>

<input type="submit" class="btnClose">

Now use setTimeout to show() it after 30000ms (30 seconds):
<script type="text/javascript">
    $(document).ready(function(){
        $('.UpdateProgress').on('display', function () {
            setTimeout("showDelay();", 30000);
        });
    });

    function showDelay() {
        $('.btnClose').show();
    }
</script>


text:
Q: Distinct() does not work properly with time stamps in SQL If I run following query I will have duplicates for 2021-03-28 04:00:00 . How can I avoid these duplicates?
SELECT distinct(ts) as date  FROM ( --(ts, '%Y-%m-%d %H:00:00') TO_CHAR(ts,'YYYY-MM-DD HH24:00:00')
                SELECT '2020-10-21'::TIMESTAMP AT TIME ZONE 'UTC'  AS tm
                UNION
                SELECT '2021-03-29'::TIMESTAMP AT TIME ZONE 'UTC'  AS tm
                ) AS t TIMESERIES ts AS '1 Hour' OVER (ORDER BY tm)

A: I don't get any duplicates, otherwise this query would return some rows:
SELECT ts,count(*) as occ FROM (
  SELECT ts FROM (
   SELECT '2020-10-21'::TIMESTAMP AT TIME ZONE 'UTC'  AS tm
   UNION
   SELECT '2021-03-29'::TIMESTAMP AT TIME ZONE 'UTC'  AS tm
  ) AS t
  TIMESERIES ts AS '1 Hour' OVER (ORDER BY tm)
) b
GROUP BY 1 HAVING COUNT(*) > 1;
-- out  ts | occ
-- out ----+-----
-- out (0 rows)

What is different in your query?


text:
Q: UBUNTU 12.04 Upgrade - No Programs in Dash
Possible Duplicate:
Dash search gives no result

I upgraded to Ubuntu 12.04 after being prompted.  Every did as it should have... so I think.  The install took a very long time so I did not pay too much attention to the install.  Anyways, i just logged in to my computer today (Ubuntu 12.04 now installed) and I have NO programs to choose from.  The Dash Home has NOTHING in it.  I open the software center to find that it is no longer working properly either... meaning, the window opens, but nothing works... nothing is displayed and the search renders nothing at all.  The only programs that run are the default programs in the icon bar.
I have never seen such a problem with Ubuntu before, or Linux for that matter.  I need to get this fixed ASAP!


text:
Q: How to install Theano on Ubuntu 14.04 x64, and configure it so that it uses the GPU? I tried to follow the instructions on Easy Installation of an Optimized Theano on Current Ubuntu but it doesn't work: whenever I run a Theano script using GPU, it gives me the error message:

CUDA is installed, but device gpu is not available (error: Unable to get the number of gpus available: no CUDA-capable device is detected)

More specifically, following the instructions in the linked webpage, I executed the following steps:
# Install Theano
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano

# Install Nvidia drivers and CUDA
sudo apt-get install nvidia-current
sudo apt-get install nvidia-cuda-toolkit

Then I rebooted and tried running:
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python gpu_test.py # gpu_test.py comes from http://deeplearning.net/software/theano/tutorial/using_gpu.html

But I get:
f@f-Aurora-R4:~$ THEANO_FLAGS='mode=FAST_RUN,device=gpu,floatX=float32,cuda.root=/usr/lib/nvidia-cuda-toolkit' python gpu_test.py WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: Unable to get the number of gpus available: no CUDA-capable device is detected) [Elemwise{exp,no_inplace}(<TensorType(float32, vector)>)] Looping 1000 times took 2.199992 seconds Result is [ 1.23178029 1.61879337 1.52278066 ..., 2.20771813 2.29967761 1.62323284] Used the cpu

A: (I tested the following on Ubuntu 14.04.4 LTS x64 and Kubuntu 14.04.4 LTS x64, I guess it should work on most Ubuntu variants)
Installing Theano and configuring the GPU (CUDA)
The instructions on the official website are outdated. Instead you can use the following instructions (assume a freshly installed Kubuntu 14.04 LTS x64):
# Install Theano
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano

# Install Nvidia drivers, CUDA and CUDA toolkit, following some instructions from http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb # Got the link at https://developer.nvidia.com/cuda-downloads
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda

sudo reboot

At that point, running nvidia-smi should work, but running nvcc won't work.
# Execute in console, or (add in ~/.bash_profile then run "source ~/.bash_profile"):
export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH

At that point, both nvidia-smi and nvcc should work.
To test whether Theano is able to use the GPU:
Copy-paste the following in gpu_test.py:
# Start gpu_test.py
# From http://deeplearning.net/software/theano/tutorial/using_gpu.html#using-gpu
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in xrange(iters):
    r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')
else:
    print('Used the gpu')
# End gpu_test.py

and run it:
THEANO_FLAGS='mode=FAST_RUN,device=gpu,floatX=float32' python gpu_test.py

which should return:
f@f-Aurora-R4:~$ THEANO_FLAGS='mode=FAST_RUN,device=gpu,floatX=float32' python gpu_test.py
Using gpu device 0: GeForce GTX 690
[GpuElemwise{exp,no_inplace}(<CudaNdarrayType(float32, vector)>), HostFromGpu(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 0.658292 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the gpu

To know your CUDA version:
nvcc -V

Example:
username@server:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

Adding cuDNN
To add cuDNN (instructions from http://deeplearning.net/software/theano/library/sandbox/cuda/dnn.html):

*

*Download cuDNN from https://developer.nvidia.com/rdp/cudnn-download (need registration, which is free)

*tar -xvf cudnn-7.0-linux-x64-v3.0-prod.tgz

*Do one of the following

Option 1: Copy the *.h files to CUDA_ROOT/include and the *.so* files to CUDA_ROOT/lib64 (by default, CUDA_ROOT is /usr/local/cuda on Linux).
sudo cp cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/

Option 2:
export LD_LIBRARY_PATH=/home/user/path_to_CUDNN_folder/lib64:$LD_LIBRARY_PATH
export CPATH=/home/user/path_to_CUDNN_folder/include:$CPATH
export LIBRARY_PATH=/home/user/path_to_CUDNN_folder/lib64:$LD_LIBRARY_PATH

By default, Theano will detect if it can use cuDNN. If so, it will use it. If not, Theano optimizations will not introduce cuDNN ops. So Theano will still work if the user did not introduce them manually.
To get an error if Theano can not use cuDNN, use this Theano flag: optimizer_including=cudnn.
Example:
THEANO_FLAGS='mode=FAST_RUN,device=gpu,floatX=float32,optimizer_including=cudnn' python gpu_test.py

To know your cuDNN version:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

Adding CNMeM
The CNMeM library is a "Simple library to help the Deep Learning frameworks manage CUDA memory.".
# Build CNMeM without the unit tests
git clone https://github.com/NVIDIA/cnmem.git cnmem
cd cnmem
mkdir build
cd build
sudo apt-get install -y cmake
cmake ..
make

# Copy files to proper location
sudo cp ../include/cnmem.h /usr/local/cuda/include
sudo cp *.so /usr/local/cuda/lib64/
cd ../..

To use with Theano, you need to add the lib.cnmem flag. Example:
THEANO_FLAGS='mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=0.8,optimizer_including=cudnn' python gpu_test.py

The first output of the script should be:
Using gpu device 0: GeForce GTX TITAN X (CNMeM is enabled with initial size: 80.0% of memory, cuDNN 5005)

lib.cnmem=0.8 means that it can use up to 80% of the GPU.
CNMeM has been reported to give some interesting speed improvements, and is supported by Theano, Torch, and Caffee.
Theano - source 1:

The speed up depend of many factor, like the shapes and the model itself. The speed up go from 0 to 2x faster.

Theano - source 2:

If you don't change the Theano flag allow_gc, you can expect 20% speed up on the GPU. In some case (small models), we saw a 50% speed up.

Running Theano on multiple CPU cores
As a side note, you can run Theano on multiple CPU cores with the OMP_NUM_THREADS=[number_of_cpu_cores] flag. Example:
OMP_NUM_THREADS=4 python gpu_test.py

The script theano/misc/check_blas.py outputs information regarding which BLAS is used:
cd [theano_git_directory]
OMP_NUM_THREADS=4 python theano/misc/check_blas.py

To run Theano's test suite:
nosetests theano

or
sudo pip install nose-parameterized
import theano
theano.test()

Common issues:

*

*Importing theano: AttributeError: 'module' object has no attribute 'find_graphviz'


text:
Q: NullPointerException while writing to an excel file using Apache POI I was trying to make an application that would hold data of what their customer is buying. Code for the method that is creating trouble for me is here:
private void MyData(long Invoice, String Name, int num, String[] products, int[] quantity, double tax, double cost) throws FileNotFoundException, IOException
{
    FileInputStream inputStream = new FileInputStream(new File("SalesDetails.xlsx"));
    XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
    XSSFSheet worksheet = workbook.getSheetAt(0);
    Invoice =Invoice+3;
    for(int i=2; i<=27; i++)
    {
        XSSFCell cell=null;
        cell = worksheet.getRow((int)Invoice).getCell(i);
        switch (i) { //some cases. }
    }

In this method, I am using Apache POI to write to an excel file.
The line where I put cell = worksheet.getRow((int)Invoice).getCell(i);  is creating an exception which I am not getting why. Please help me find solution to this.
I know there is already a similar question, but the solution to it is not helping me remove the exception.


text:
Q: Can't load "props" data In my project, I download data from the following page (with the help of Axios):

http://seo-gmbh.eu/json/api_sunds.php?action=init_data_for_index

The data is used in my main page.
After that, I try to pass these data through "props" to my center content components.
My Vue debugger shows me that it has been done right:

But in into my center content component, I can't get this data to show it into my HTML code.
I could get part of the data like this: dbIndex.data
But if I try to get this props data deeper like this: dbIndex.data.init_data_for_index
The following error is displayed:

Cannot read property 'init_data_for_index' of undefined.

My question is:
How should I get this data correctly in my case?
import LiServiceApp from '~/components/CenterContentIndexApp/LiServiceApp';
  export default {
    props: ['dbIndex'],
    components: {
      LiServiceApp,
    }
  }
}

<template>

          {{  dbIndex.data.init_data_for_index  }}

</template>

A: Try this code:

  {{ init_data_for_index }}

...

computed() {

  init_data_for_index() {
    return this.dbIndex && this.dbIndex.data && this.dbIndex.data.init_data_for_index
      ? this.dbIndex.data.init_data_for_index
      : [];
  },

},

So initially init_data_for_index is an empty array until it populated from API.


text:
Q: Makefile cannot able to target dependecies #
# Makefile
#

# compiler to use
CXX = clang++

# flags to pass compiler
CXXFLAGS = -ggdb3 -O0 -std=c++11 -Wall -Werror -pedantic-errors

# flags for the C PreProcessor
CPPFLAGS =  -MMD

# The maintainer's variant of CXXFLAGS
AM_CXXFLAGS =

# The command used to actually compile a C++ source file.
# The file name is appended to form the complete command line.
CXXCOMPILE =

# The command used to actually link a C++ program
CXXLINK =

# space-separated list of header files
HDRS =

# space-separated list of libraries, if any,
# each of which should be prefixed with -l
LIBS =  -lm -lpthread

# default target
# require that an argument be provided at the command line
# for the target name
TARGET = $(target)

> problem with this line
> It is just targeting the single .cpp
> But when I want make project folder
#
# Makefile
#

# compiler to use
CXX = clang++

# flags to pass compiler
CXXFLAGS = -ggdb3 -O0 -std=c++11 -Wall -Werror -pedantic-errors

# flags for the C PreProcessor
CPPFLAGS =  -MMD

# The maintainer's variant of CXXFLAGS
AM_CXXFLAGS =

# The command used to actually compile a C++ source file.
# The file name is appended to form the complete command line.
CXXCOMPILE =

# The command used to actually link a C++ program
CXXLINK =

# space-separated list of header files
HDRS =

# space-separated list of libraries, if any,
# each of which should be prefixed with -l
LIBS =  -lm -lpthread

# default target
# require that an argument be provided at the command line
# for the target name
TARGET = $(target)

I cannot able to target header file and corresponding .cpp dependencies
      all: $(TARGET)
      $(TARGET): $(TARGET).cpp ; $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXCOMPILE) $(CXXLINK) $(HDRS)  -o $(TARGET) $(TARGET).cpp $(LIBS)

# housekeeping
clean:
    rm -f core


text:
Q: Windows 7 hangs after going into sleep a second time I've searched everywhere around Google and can't figure out why this is happening so I decide to ask here to see if anyone has a problem like this.
Like it says in the title, whenever I sleep ONCE I'm able to wake the system, but going back to sleep again AFTER waking up for the first time results in it hanging on no input and no output, with the fan spinning as fast as possible and alot of heat being spewed out by the fan as well.
I've tried various things like setting all USB Hub Root's to not get switched off for power saving, disabling USB selective suspend, disabling PCI-e link state power management, and even unplugging ALL USB devices and it wont wake up after the second attempt. And I've even waited up to a full hour of the CPU fan spinning loudly and it's still stuck trying to wake up.
The only USB devices I use are a Microsoft USB Comfort Curve Keyboard 2000 (IntelliType Pro)
and a generic HID compliant mouse from Creative model number OMC90S "CREATIVE MOUSE OPTICAL LITE".
My other devices like external drives and controllers are unplugged when I'm not using them as having too many USB devices plugged in at a time causes a deadlock on almost all of the ports I have.
Here's my system specifications (Most of these are from CPU-Z):
Brand: Gateway DX4300-19
Mainboard: Gateway RS780
Chipset: AMD 780G Rev 00
Southbridge: AMD SB700 Rev 00
LPCIO: ITE IT8718
BIOS: American Megatrends Inc. ver P01-A4 09/15/2009
CPU: AMD Phenom II X4 810 at 2.60 GHz
RAM: 8.0 GB DDR2 Dual Channel Ganged Mode at 400 MHz
GPU: ATI Radeon HD3200 Graphics Intergrated - RS780
OS: Windows 7 Home Premium x64 OEM (Acer Group)
HDD: WDC WD10EADS-22M2B0 1.0 TB (Western Digital Green Caviar)
My BIOS has absolutely no control over how I setup the sleep mode to be either S1 or S3. So I can't check these settings or even change them.
Hybrid sleep is also disabled, I can successfully go into hibernation and wake from hibernation but this is painfully slow due to a harddrive problem I'm having with this "Green Drive". (Hibernation takes over ~3 minutes to complete)
Any help would be appreciated, thanks.


text:
Q: How to make Tensorflow-lite available for the entire system in Ubuntu My tflite directory is as follows:
/home/me/tensorflow_src/tensorflow/lite/

However, I fail to import it in my C++ project:
#include "tensorflow/lite/interpreter.h" // getting a not found error

How can I add resolve this error? My assumption is that I'd need to add the tflite to my bash to make it available for all of my projects. How can I add tflite to the bash file?
This is my CMAKE file:
cmake_minimum_required(VERSION 3.22)
project(mediafile_device_crossverification)

set(CMAKE_CXX_STANDARD 17)

set(OpenCV FOUND 1)
find_package(OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(mediafile_device_crossverification main.cpp src/VideoProcessing.cpp src/VideoProcessing.h)

A: There are various options:
First option: Install/copy the tensorflow header files to e.g. /urs/local/include that folder is usually in the system include path by default.
Second option: GCC has some environment variables that can be used to modify the system include path. C_INCLUDE_PATH and CPLUS_INCLUDE_PATH, your can add them to .bashrc to set them when you login. See: https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html
Third option is to add /home/me/tensorflow_src to the include path in the CMakefile.
When searching the include path #include <tensorflow/lite/interpreter.h> should be used.

A: You can't really make it available for the entire system with the way TFLite's CMake is currently configured.
There's a section in TFLite's documentation which shows you how to build a project depending on it.
A bit further up there's also a note why the library cannot be built stand-alone for time time being:

Note: This generates a static library libtensorflow-lite.a in the current directory but the library isn't self-contained since all the transitive dependencies are not included. To use the library properly, you need to create a CMake project. Please refer the "Create a CMake project which uses TensorFlow Lite" section.


text:
Q: axios delete route not supported laravel vuejs I have a very strange issue with deleteing records. In my vuejs I call axios.delete to delete my record, which in turn calls my laravel route.
The record is getting deleted fine but an error message is displaying "message": "The DELETE method is not supported for this route. Supported methods: GET, HEAD.",
axios.delete('/member/event/' + this.data.module.slug);

My laravel route is as follows
Route::resource('event', 'EventController');

I am using laravel 6 to

A: It's high chance that delete url you try to send and route url are not the same, please check network and route:list, if not then you probably define your spa route at top, I mean the route except every params

A: The issue was nothing to do with the routes it was that I was not returning a json response after the delete which was causing the issue

A: Try this way-
routes routes/api.php
Route::apiResource('event','EventController');

In Controller Method
public function destroy(Event $event)
    {
        $event->delete();
        return new EventResource($event);
    }

In Your Components
axios.delete('/api/event/'+this.data.module.slug)
     .then(response => {
           console.log(response)
           this.$snotify.success("Data Successfully Delete",'Success')

          })
     .catch(err => {
           console.log(err)
          })


text:
Q: Does F# require .NET runtime and libraries to run? Does F# like C# requires .NET framework to run? According to Wikipedia as stated below, F# is mostly used as a CLI language which means that it is used mostly with .NET. But it also states that the F# foundation provides a compiler for F# separately.

F# is most often used as a cross-platform CLI language, but can also be used to generate JavaScript and GPU code.
F# is developed by the F# Software Foundation,[6] Microsoft and open contributors. An open source, cross-platform compiler for F# is available from the F# Software Foundation. F# is also a fully supported language in Visual Studio and Xamarin Studio. Other tools supporting F# development include Mono, MonoDevelop, SharpDevelop and WebSharper.

Does it mean that F# can be used like unmanaged code similar to C++ and C. I am a total newbie to the .NET platform.

A:
Does it mean that F# can be used like unmanaged code similar to C++ and C?

Theoretically, yes. Practically, no.
Languages often don't specify how they're compiled. There's nothing precluding you from taking the syntax and semantics of Java or C# and have them compile down directly to x86 assembly and avoid the need for the JVM or .NET runtime.
That said, such a compiler doesn't exist (as far as I know) - so if you want that functionality you'll need to spend a few years to decades building it yourself. And I would question any reason for thinking you'd want that in the first place.


text:
Q: Module not found with npm package in React app I have a React app that takes some data from an API. The data is transit data and is serialized with protocol buffers, so I'm using the gtfs-realtime-bindings.js package to deserialize it. That also uses ProtoBuf.js and ByteBuffer.js under the hood. However, when I run my dev server, I'm getting this error in the browser:
./node_modules/protobufjs/ProtoBuf.js
Module not found: `/Users/Ben/React/subway-
checker/node_modules/ByteBuffer/ByteBuffer.js` does not match the
corresponding path on disk `bytebuffer`.

I'm not really sure how to start debugging this. It could be a Webpack issue? I'm using create-react-app if that helps diagnose.
For context, here's the rest of the code in the file that's causing the error:
import GtfsRealtimeBindings from 'gtfs-realtime-bindings';
    import request from 'request';
function getFeedData (sub) {
    var feedId;
    switch (sub) {
        case '1' || '2' || '3' || '4' || '5' || '6' || 'S':
                feedId = 1;
                break;
            case 'A' || 'C' || 'E':
                feedId = 26;
                break;
            case 'N' || 'Q' || 'R' || 'W':
                feedId = 16;
                break;
            case 'B' || 'D' || 'F' || 'M':
                feedId = 21;
                break;
            case 'L':
                feedId = 2;
                break;
            case 'G':
                feedId = 31;
                break;
    }
    var requestSettings = {
      method: 'GET',
      uri: 'http://datamine.mta.info/mta_esi.php?key=YOUR_KEY_HERE&feed_id=2',
      encoding: null
    };
    request(requestSettings, function (error, response, body) {
      if (!error && response.statusCode == 200) {
          var feed = GtfsRealtimeBindings.FeedMessage.decode(body);
          return { feed: feed };
        }
    });
}

function reverseStop (sub, stop) {
    var stopIdN
    var stopIdS
    var stopData = require('./stops');
    var invalidEntries = 0;
    function filterByName (item) {
        if (item.stop_name == stop && item.stop_id.charAt(0) == sub) {
            return true;
        }
        invalidEntries++;
        return false;
    }
    var stopObjs = stopData.filter(filterByName);
    for (var i = 0; i < stopObjs.length; i++) {
        if (stopObjs[i].stop_id.charAt(stopObjs[i].stop_id.length - 1) == 'N') {
            stopIdN = stopObjs[i].stop_id;
        } else if (stopObjs[i].stop_id.charAt(stopObjs[i].stop_id.length - 1) == 'S') {
            stopIdS = stopObjs[i].stop_id;
        }
    }
    return {
        stopIdN: stopIdN,
        stopIdS: stopIdS
    };
}

var isDelayN = (function (sub, stop) {
    var arrivals = [];
    var delays = [];
    reverseStop(sub, stop);
    getFeedData(sub);
    (function () {
            var invalidEntries = 0;
            var feedObjs = getFeedData.feed.filter(function (feedObj) {
                if (feedObj.entity.trip_update.stop_time_update.stop_id == reverseStop.stopIdN) {
                    return feedObj.entity.trip_update.stop_time_update;
                }
            });
            for (var i = 0; i < feedObjs.length; i++) {
                arrivals.push(feedObjs.arrival.time.low);
                delays.push(feedObjs.arrival.delay);
            }
        })();
    var nextArrival = Math.min(...arrivals);
    var delayIndex = arrivals.findIndexOf(nextArrival);
    var delay = delays.delayIndex;
    if (delay === null || Math.ceil(delay / 60) <= 5) {
        var noDelay = Math.ceil((nextArrival - getFeedData.feed.header.timestamp.low) / 60);
        return { noDelay: noDelay };
    } else {
        var yesDelay = Math.ceil(delay / 60);
        return { yesDelay: yesDelay };
    }
})();

var isDelayS = (function (sub, stop) {
    var arrivals = [];
    var delays = [];
    reverseStop(stop);
    getFeedData(sub)
        .then(function (feed) {
            var invalidEntries = 0;
            var feedObjs = feed.filter(function (feedObj) {
                if (feedObj.entity.trip_update.stop_time_update.stop_id == reverseStop.stopIdS) {
                    return feedObj.entity.trip_update.stop_time_update;
                }
            });
            for (var i = 0; i < feedObjs; i++) {
                arrivals.push(feedObjs.arrival.time.low);
                delays.push(feedObjs.arrival.delay);
            }
        });
    var nextArrival = Math.min(...arrivals);
    var delayInex = arrivals.findIndexOf(nextArrival);
    var delay = delays.delayIndex;
    if (delay === null || Math.ceil(delay / 60) <= 5) {
        var noDelay = Math.ceil((nextArrival - getFeedData.feed.header.timestamp.low) / 60);
        return { noDelay: noDelay };
    } else {
        var yesDelay = Math.ceil(delay / 60);
        return { yesDelay: yesDelay };
    }
})();

export { isDelayN, isDelayS };

I realize that code may need a lot of context. In lieu of posting all of my components and having an unreasonably long post, here's the full Github repo as it stands right now: https://github.com/benuchadnezzar/subway-checker
Any help is appreciated! Including if you see something else egregiously wrong with the code in this file.


text:
Q: onActivityResult is not called in android I am making a mobile app, Here I want to take a number from contact. When i click on contact imageview then mobile contact is open then i select a number.After then mob_no edittext is blank that means onActivityResult is not called, I am also print the value of resultcode, requestcode and data, but it is not executed. Please solve my problem how to call onActivityResult(...)
public class Recharge_activity extends Activity{

private static final int PICK_CONTACT = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {

mob_no = (EditText) findViewById(R.id.mobilenum);
        mob_no.requestFocus();
        contact = (ImageView) findViewById(R.id.mobile_contact);

mob_no.addTextChangedListener(textWatcher);

            contact.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {
                    // TODO Auto-generated method stub
                    try{

                        Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts"));
                        pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only contacts w/ phone numbers

                        startActivityForResult(pickContactIntent, 1);

                    } catch(Exception e){
                        Toast.makeText(Recharge_activity.this, "Number is not format", Toast.LENGTH_SHORT).show();
                    }

                }
            });
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);

        switch (requestCode) {
        case (PICK_CONTACT):
            if (resultCode == Activity.RESULT_OK) {
                Uri contactData = data.getData();

                    String[] projection = {Phone.NUMBER};

                    @SuppressWarnings("deprecation")
                    Cursor cursor = managedQuery(contactData, projection, null, null, null);
                    cursor.moveToFirst();

                    // Retrieve the phone number from the NUMBER column
                    int column = cursor.getColumnIndex(Phone.NUMBER);
                    String number = cursor.getString(column);

                    String newNum = number.replaceAll("-", "").trim();

                    newNum=newNum.replace("+91", "");

                    mob_no.setText(newNum);
                    }
        }
    }
    private TextWatcher textWatcher = new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            //after text changed

            if (count==0)
            {
                counter=counter-1;
            }else if(count==1)
            {
                counter = count + counter;
            }

            if(counter!=0)
            {
                if(counter==6 && count==1)
                {
                    spinner.setEnabled(true);
                cont_no=mob_no.getText().toString();
                setfillspinner();

                }

                if(counter<5)
                {
                    provider_name.clear();
                    spinner.setEnabled(false);
                    provider_name.add("Select Operator");
                    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(Recharge_activity.this

                            ,android.R.layout.simple_spinner_item, provider_name);
                    System.out.println("value call double time");

                                 // Set the Adapter
                    arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    //amt.setFocusable(true);
                    spinner.setAdapter(arrayAdapter);
                    spinner.setSelection(0);

                }

            }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    };
}

A: try with this.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub

        if (resultCode == Activity.RESULT_OK && requestCode == 1) {
       //put your code here
    }
    super.onActivityResult(requestCode, resultCode, data);
}

Edit answer
  Intent pickContactIntent = new Intent(MainActivity.this, Uri.parse("content://contacts"));
                    pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only contacts w/ phone numbers

                    startActivityForResult(pickContactIntent, 1);

A: Are you set permission  in AndroidManifest
<uses-permission android:name="android.permission.READ_CONTACTS"/>


text:
Q: break label statement inwhile loops java Hi guys the following program output is not understanding can any body explain
I am break with label statement .here i am using 3 while loops with label break statements.
public static void main(String[] args) {

        int i=10,j=10,k=10;

        //Loop:
        while(i!=0)
        {
            System.out.println("i : "+i);

            iLoop:
            while(j!=0)
            {
                System.out.println(" j : "+j);
                j--;
                //iLoop:
                while(k!=0)
                {
                    System.out.println("  k : "+k);
                    k--;
                    i--;
                    break iLoop;
                    //break jLoop;
                    //break Loop;
                }
            }

        }
    }

and output is this
 i : 10
     j : 10
      k : 10
    i : 9
     j : 9
      k : 9
    i : 8
     j : 8
      k : 8

A: From documentation -
An unlabeled break statement terminates the innermost switch, for, while,
or do-while statement, but a labeled break terminates an 'outer statement'.

That means outer while loop will be broken.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html
But using labels in NOT recommended.

A: Because you have labeled the loop based on j, when you call the labeled break statement, it breaks out of that loop and goes to the next iteration of the i loop. So, the output makes sense for what you have. If we didn't use the label, and had a normal break statement, you wouldn't see the i output every iteration like that. As others have stated, try not to use labels, since, as you've experienced first-hand, they are confusing, hard to read (easy to miss), and can be easily replaced with more straight-forward techniques.