text:
Q: Does std::vector have to resize if the elements it contains grow in size? I apologize if this is too basic a question to ask here; I've been reading a bit about std::vector and I understand that it has to resize when the size reaches capacity. This can be an expensive operation if the objects it contains are large since it has to copy every one of them.
My question is: how does std::vector handle the actual size of the objects it contains growing? Suppose I initialize some
std::vector<Obj> vec(100);

And each Obj is initialized to something very small. But what if I then do something like
vec[14].ENGORGIO()

So that it now takes much more memory. Since the elements of std::vector are stored in contiguous memory, does this mean that it has to resize (expensively!)
To avoid this kind of thing, should I instead be storing pointers in a vector rather than the objects themselves? Like so
std::vector< std::unique_ptr<Obj> > vec;

Thank you

A: The size of a data type in C++ is set at compile time and cannot change. The data type may contain references to other objects, and these other objects can vary in size, but the size of the reference, and thus the data type, is unchanging.
Consider a vector of vectors. The inner vector may contain 0 elements or billions and billions and it will always be the same size. The outer vector only knows that it contains 0 or more vectors and knows nothing about what is contained inside the inner vectors.
You do not have to worry about this.

A: Each type has a size, and all objects of that type have the same size. The size of an object never changes throughout the program. Therefore the scenario that you describe does not exist.
The way vector "resizes" without changing the size of the vector object is achieved through indirection. The elements are not part of the memory of the object. Instead, the vector points to a buffer in dynamic memory. Resizing is done by creating a bigger dynamic buffer, and copying the elements from the old one before destroying the old buffer.


text:
Q: How to make horizonatl aligned with css at the same line two block of the vutify I am working on project with vutify I have created two blocks a div into a v-row I want  cols into a row to display aligned at the same line without space on the bottom.
I am sharing my code:

.sub-heading {
    font-size: 1.25rem;
    line-height: 1.625rem;
    color: #F1191D;
    margin-bottom: 13px;
    text-transform: uppercase;
    font-weight: 600;
}
h2{
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    font-style: normal;
    font-size: 3rem;
    line-height: 3.85rem;
}
.short-text{
    font-size: 1.125rem;
    line-height: 1.125rem;
    font-style: normal;
    font-weight: normal;
    color: #201E1C;
}
.vertical{
    width: 2px !important;
     height: 106px !important;
     border-color: #201E1C !important;
     margin-top: 58px;

}
<template>
 <v-container fluid >
     <v-row justify="center">
         <v-col cols="12" md="6">
             <v-row class="justify-center align-center  test">
                 <v-col cols="12" md="5"  sm="6" class="mb-6">

Test

Test1

 Post recenti

                  </v-col>

                 <v-divider vertical class="vertical    hidden-sm-and-down  justify-center align-center">  </v-divider>

                    <v-col cols="12" md="7" sm="6" >

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Felis, pharetra donec id velit tincidunt sed hac fringilla. In est ac fermentum cras. Neque viverra ultricies in at ipsum iaculis pretium, viverra felis. Pretium porttitor leo vulputate imperdiet aliquet etiam eget sit.

                 </v-col >
             </v-row>
        </v-col>
        </v-row>
    </v-container>
</template>

This is  what I have created until now.
[![enter image description here][1]][1]
But we want first col and second col to aligned at the same line into a row.
Any idea
[1]: https://i.stack.imgur.com/5sQOW.png

redpajama_set_name: RedPajamaStackExchange


text:
Q: Good inductor parameter for GHz frequency matching chosing I want to buy inductor and capacitor for matching circuit of antenna in about 1.6GHZ.
I searched the net for some inductor for example 3.7nH and i collided with lots of parameter!!
I know concept of parameters like  SRF & Q .But for example it told something like 25 @ 200MHZ, and witch SRF is better for me and why? I think about 2GHz is ok, isn't that? And i found no Q in 1.6GHZ.How can i chose these and other parameter?
Please explain them.

A:
witch SRF is better for me and why?

You need the SRF to be higher than your operating frequency, if you want your inductor to behave like an inductor and not a capacitor.

But for example it told something like 25 @ 200MHZ

Many rf parts will have available SPICE models or s-parameter measured characteristics. If you use a simulator that emphasizes rf design (like ADS), you can plug the s-parameter measurement file into a simulation block, and simulate the behavior.

And i found no Q in 1.6GHZ.How can i chose these and other parameter?

The Q factor lets you estimate the resistive loss in an inductor. If you also have a DCR value, it's mostly redundant information (although there could be skin effect increasing the loss at high frequencies). Again if you want to be sure, use the rough parameters (DCR, SRF, Q) to do an initial part selection, but then simulate your design using the more detailed models or typical measurements.

A: Do you understand what SRF is? If you understand that, then you can calculate the parasitic capacitance of the inductor. Before you jump into selecting inductors, make sure you know what that is.
As far as Q, you should select fairly (25 to 30 minimim) high Q inductors, measures at a high frequency.
I've had good luck with Coilcraft HQ inductors in high frequency applications, but they have terminations on the bottom of the part, so you really need a hot air soldering iron to swap them out, which you'll be doing if you're trying to do an impedance match. It's been a while since I comparison shopped inductors, so YMMV


text:
Q: What does "powerful" mean, when discussing programming languages? In the context of programming language discussion/comparison, what does the term "power" mean?
Does it have a well defined meaning? Even a poorly defined meaning?
Say if someone says "language X is more powerful than language Y" or asks the same as a question, what do they mean - or what information are they trying to find out?

A: The only meaningful way to describe "power" in a programming language is "can do what I require with the least amount of resources" where "resources" is defined as "whatever costs I'd rather not pay" and could, thus, be development time, CPU time, memory space, money, etc.
So basically the definition of "power" is purely subjective and rendered meaningless in any objective discussion.

A: Powerful means "high in power". "Power" is something that increases your ability to do things. "Things" vary in shape, size and other things. Loosely speaking therefore, "powerful" when applied to a programming language means that it helps you to do perform your tasks quickly and efficiently.
This makes "powerful" somewhat well defined but not constant across domains. A language powerful in one domain might be crippling in another eg. C is very powerful if you want to do systems level programming since it gives you direct access to the machine and hardware and structures that let you code much faster than you would in assembly. C compilers also produce tight code that runs fast. However, once you move to web applications, C can become very "unpowerful" and crippling since it's so much effort to get something up and running and you have to worry about a lot of extraneous details like memory etc.
Sometimes, languages are "powerful" in multiple domains. This gives them a general "powerful" tag (or badge since were are on SO here). PG's claim is that with LISP, this is the case. That might be true or might not be.
At the end of the day, "powerful" is a loaded word so you should evaluate who is saying it, why he's saying it and what it means to to your work.

A: There are really only two meanings people are worried about:
"Powerful" in the sense of "takes less resources (time, money, programmers, LOC, etc.) to achieve the same/better result", and "powerful" in the sense of "is capable of doing a wide range of tasks".
Some languages are extrememly resource-effective for a small range of tasks. Others are not so resource-effective but can be applied to a wide range of tasks (e.g. C, which is often used in OS development, creation of compilers and runtime libraries, and work with microcontrollers).
Which of these two meanings someone has in mind when they use the term "powerful" depends on the context (and even then is not always clear). Indeed often it is a bit of both.

A: Typically there are two distinct meanings:

*

*Expressive, meaning the code tends to be very short and understandable

*Low level, meaning you have very fine-grained control over the hardware.

For the most languages, these two definitions are at opposite ends of the spectrum:  Python is very expressive but not very low level; C is very low level but not very expressive.  Depending on which definition you pick, either language is powerful or not powerful.

A: It does not have a well-defined meaning.  In these types of discussions, "language X is more powerful than language Y" usually means little more than "I like language X more than language Y."  On the other end of the spectrum, you'll also usually have someone chime in about how any Turing-complete language can accomplish the same tasks as any other Turing-complete language, so that neither is strictly more powerful than the other.
I think a good meaning for it is expressivity.  When a language is highly expressive, it means less code is required to express concepts.  To me, this doesn't just mean that you have to write less code to accomplish the same tasks, but also that the code is easily readable by humans.  Of course, generally (to a point), having fewer lines of code to read makes the task of reading and understanding easier for humans.
Having a "powerful" standard library comes into play here along the same lines.  If a language comes equipped with thorough, complete libraries, then idiomatic code in that language will be able to benefit from the existing library code and not have to repeat or reinvent common functionality in application code.  The end result is, again, having to write and read less code to accomplish the same tasks.
I keep saying "generally" and "to a point", because once a language gets too terse, it gets more difficult for humans to decipher.  I suppose at this extreme, a language may still be considered "more powerful" (or even "too powerful").  So I guess I'm saying my personal interpretation of "powerful" includes some aspects of "useful" and "readable" in it as well.

A: nothing absolutely nothing.
To high level programmers it might mean alot of available datatypes built in.  Or maybe abstractions to easily create or follow Design Patterns.
Paul Graham is a very high level guy here is what he has to say:
http://www.paulgraham.com/avg.html
Java guys might tell you something about portability, the power to reach every platform.
C/UNIX programmers may tell you that its speed and efficiency, complete control over every inch of memory.
VHDL/Verilog programmers will tell you its complete control over every clock and gate so as to not waste any electricity or time.
But in my opinion a "powerful language" supports all of the features for you to complete your task.  Documentation may be important, or perhaps it is portability, or the ability to do graphics.  It could be anything,  writing a gui from Assembly is just stupid, so is trying to design an embedded processor in flash.
Choosing a language that suits your needs perfectly will always feel like power.

A: C is powerful, because it is low level and gives you access to hardware. Python is powerful because you can prototype quickly. Lisp is powerful because its REPL gives you fantastic debugging opportunities. SQL is powerful because you say what you want and the DMBS will figure out the best way to do it for you. Haskell is powerful because each function can be tested in isolation. C++ is powerful because it has ten times the number of syntactic constructs that any one person ever needs or uses. APL is powerful since it can squeeze a ten-screen program into ten characters. Hell, COBOL is powerful because... why else would all the banks be using it? :)

A: I view the term as marketing fluff, no one well-defined meaning.
If you consider, say, Assembler, C, and C++. On occasions one drops from C++ "down" to C for particualr needs, and in turn from C down to assembler. So that make assembler the most powerful because it's the only language that can do everything. Or, to argue the other way, a single line of C++ code can replace several of C (hiding polymorphic dispatch via function pointers for example) and a single line of C replaces many of assembler. So C++ is more powerful because one line does "more".
I think the term had some currency when products such as early databases and spreadsheets had in-built languages, some quite restricted. So vendors would tout their language as being "powerful" because it was less restricted.

A: It can have several meanings.  In the very basic sense there's power as far as what is computable.  In that sense the most powerful languages are Turing Complete which includes pretty much every general purpose programming language (as opposed to most markup languages and domain specific languages which are often not Turing complete).
In a more pragmatic sense it often refers to how concisely (and readably) you can do certain things.  Basically how easy is it to do certain tasks in one language compared to another.
What language is more powerful (besides being somewhat subjective) depends heavily on what you're trying to do.  If your requirements are to get something running on a small device with 64k of memory you're likely not going to be using Java.  Most likely the right language would be C or C++ (or if you're really hard core assembly).  If you need a very simple CRUD app done in 1 day, maybe something like Ruby On Rails would be the way to go (I know Rails is a framework and Ruby is the language, but these days what libraries and frameworks are available factor greatly into picking a language)

A: I think that, perhaps coincidentally, the physics definition of power is relevant here: "The rate at which work is performed."
Of course, a toaster does not perform very quickly the work of putting out fires.  Similarly, the power of a programming language is not universal, but specific to the domain or task to which it is being applied.  C is a powerful language for writing device drivers or implementations of higher-level languages; Python is a powerful language for writing general-purpose applications; XPath is a powerful language for writing queries on structured data sets.
So given a problem domain, the power of a language can be said to be the rate at which a competent programmer is able to use it to solve problems in that domain.

A: "Powerful" has no real technical meaning, but lots of people have made proposals.
A couple of the more interesting ones:

*

*Paul Graham wants to call a language "more powerful" if you can write the same programs in fewer lines of code (or some other sane, sensible measure of program size).

*Matthias Felleisen has written a very serious theoretical study called On the Expressive Power of Programming Language.
As someone who knows and uses many programming languages, I believe that there are real differences between languages, and that "power" can be a convenient shorthand to describe ways in which one language might be better than another.  Nevertheless, whenever I hear a discussion or claim that one language is more powerful than another, I tend to keep one hand firmly on my wallet.

A: A precise answer can be tried to reach, by not assuming that the elements that define "powerful" (in the context of languages) come from so many dimensions.
See how many could be, and a lot will be missing:

*

*runtime speed

*code size

*expressiveness

*supported paradigms

*development / debugging time

*domain specialization

*standard libs

*codebase

*toolchain ecosystem

*portability

*community

*support / documentation

*popularity

*(add more here)

These and more parameters draw together X picture of how "programming in some language" would be like at X level. That will be only the definition, though, the only real knowledge comes with the actual practice of using the language, but i digress.
The question comes down to which parameter will represent the intrinsic quality of a language. If you refer to a language in itself, its ultimate, intrinsic purpose is "express things", and thus the most representative parameter is rightfully expressiveness, and is also one that resonates frequently when someone talks about how powerful a language is.
At the moment you try to widen the question/answer to cover more than the expressiveness of the language "as a language, as a tongue", you are more talking about different kinds of "environment", social environment, development environment, commercial environment, etc.
Depending of the complexity of the environment to be defined you'll have to mix more parameters that come from multiple, vast, overlapping and sometimes contradictory dimensions, and eventually the point of getting the definition will be lost or the question will have to be narrowed.
This approximation still won't answer "what is an expressive language", but, again, a common understanding are the definitions that Vineet well points out in its answer, and Forest remarks in the comments. I agree, for me "expression" is "conveying meaning".

A: I remember many instructors in college calling whatever language they were teaching "powerful".
Leads me to think:
Powerful = a  relative term comparing the latest way to code something vs. the original or previous way.

A: I think that power would normally refer to how quickly it can process data, for example I found that in python as soon as a list exceeds a length of approx. 2000 it becomes unbearably slow whereas in C++ a list can easily contain 20,000 entries without doing so.

A: I find it useless to use the word "powerful" in regards to discussing anything software related. Every time my professor in college would introduce a new concept such as polymorphism he would say "so this is a really powerful feature". After a while I got annoyed. If everything is powerful then nothing is. It's all the same. You can write code to do anything. Does is really matter how much code is required to do it? You can say it's short or efficient but powerful is just useless. Nuclear energy is powerful. Code is words.


text:
Q: Understanding C++ code I have been following a tutorials to make a linked list, and i'm trying to understand the code to the fullest. I just have some questions considering the code you guys might help me answer (i hope). This function is to insert a element.
node *temp = new node;
temp->nameOfFood = nameOfFood;
temp->eatCalories = eatCalories;
temp->next = NULL;
head = temp;
last = temp;

I understand this code (kinda), but i don't understand the last part - why does both head and last equals temp;? Then both the head, and last will be the same element/value?
And then the next part. Checking if the list is empty, elsewise inserting a element.
if(isEmpty(head)) //Cheacking if list is empty
    insertNode(head, last, nameOfFood, eatCalories);
else
{
    node *temp = new node;
    temp->nameOfFood = nameOfFood;
    temp->eatCalories = eatCalories;
    temp->next = NULL;
    last->next = temp;
    last = temp;

I understand that you create the new node, and forward from there, but then last->next = temp; and last = temp; i'm not sure i understand why?

A: Lets say you have a list of three nodes, it will look something like

+--------+     +--------+     +--------+
| node 1 | --> | node 2 | --> | node 3 |
+--------+     +--------+     +--------+

The "arrows" is the next pointer.
Now with this list, head should point at "node 1" while last should point at "node 3".
What the two lines you are wondering about does, is make the last nodes next pointer point to the new node, and then make last point to the new node, thereby adding the new node last in the list.
So with the list above, and adding one node, then it will lokk like

+--------+     +--------+     +--------+     +--------+
| node 1 | --> | node 2 | --> | node 3 | --> | node 4 |
+--------+     +--------+     +--------+     +--------+

And last has been updated to now point at "node 4".

A: Why does both head and last equals temp;? Then both the head, and last will be the same element/value?
Because in this list you only have one element, so this element is the first and the last at the same time.
but then last->next = temp; and last = temp; i'm not sure i understand why?
last->next = temp is actually linking the last element of the list to the one that you just created, which is going to be the next in your list. And, since this is the new last element, you must update the value of last by doing last = temp.


text:
Q: How to remove lines containing any one of an array of strings from a file? I have a file like :
<string name="app_name">多系统启动免费版</string>
<string name="newitem">新建</string>
<string name="edit">编辑</string>
<string name="edits">编辑\u0020</string>
<string name="details">详情</string>
<string name="resize">改变大小</string>
<string name="seticon">设置图标</string>
<string name="delete">"删除 \u0020"</string>
<string name="reset">恢复出厂设置</string>
<string name="setdefault">设为默认</string>
<string name="description">多系统启动免费版</string>
<string name="nodata">没有发现虚拟系统镜像!!!</string>

and I want to remove lines containing reset newitem details from this. How do I make a script to remove these automatically?

A: maybe
grep -vf <(printf "%s\n" reset newitem details) filename

A: Easiest is grep -v -e reset -e newitem -e details, as has been said. But for kicks, here's sed:
sed '/reset/d;/newitem/d;/details/d'
sed '/reset\|newitem\|details/d'

And awk:
awk '!/reset|newitem|details/'
awk '!/reset/ && !/newitem/ && !/details/'
awk '/reset/ || /newitem/ || /details/ { next } 1'

A: If you want to remove lines where "reset", "newitem" or "details" appear anywhere in the strings, you can easily chain some grep -v statements together:
prompt:~/> cat file.txt | grep -v reset | grep -v newitem | grep -v details
<string name="app_name">多系统启动免费版</string>
<string name="edit">编辑</string>
<string name="edits">编辑\u0020</string>
<string name="resize">改变大小</string>
<string name="seticon">设置图标</string>
<string name="delete">"删除 \u0020"</string>
<string name="setdefault">设为默认</string>
<string name="description">多系统启动免费版</string>
<string name="nodata">没有发现虚拟系统镜像!!!</string>

The -v searches for the inverse of what grep would normally return. For a simple case like this, I think this approach would be easier than sed or awk.


text:
Q: How to create nice tables using PROC REPORT and ODS RTF output I want to create a 'nice looking table' using the SAS ODS RTF output and the PROC REPORT procedure. After spending the whole day on Google I've managed to produce the following:
The dataset
DATA survey;
   INPUT id var1 var2 var3 var4 var5 var6 ;
   DATALINES;
 1  1  35 17  7 2 2
17  1  50 14  5 5 3
33  1  45  6  7 2 7
49  1  24 14  7 5 7
65  2  52  9  4 7 7
81  2  44 11  7 7 7
2   2  34 17  6 5 3
18  2  40 14  7 5 2
34  2  47  6  6 5 6
50  2  35 17  5 7 5
;
RUN;

DATA survey;
    SET survey;
    LABEL var1 ='Variable 1';
    LABEL var2 ='Fancy variable 2';
    LABEL var3 ='Another variable no 3';
RUN;

LIBNAME mylib 'C:\my_libs';
RUN;

PROC FORMAT LIBRARY = mylib.survey;
    VALUE groups 1 = 'Group A'
                2 = 'Group B'
    ;

OPTIONS FMTSEARCH = (mylib.survey);

DATA survey;
    SET survey;
    FORMAT var1 groups.;
RUN;

** The code for creating the rtf-file **
ods listing close;
ods escapechar = '^';
ods noproctitle;

options nodate number;
footnote;

ODS RTF FILE = 'C:\my_workdir\output.rtf'
author = 'NN'
title = 'Table 1 name'
bodytitle
startpage = no
style = journal;
options papersize = A4
orientation = landscape;

title1 /*bold*/ /*italic*/ font = 'Times New Roman'  height = 12pt justify = center underlin = 0 color = black bcolor = white 'Table 1 name';
footnote1 /*bold*/ /*italic*/ font = 'Times New Roman'  height = 9pt justify = center underlin = 0 color = black bcolor = white 'Note: Created on January 2012';

PROC REPORT DATA = survey nowindows headline headskip MISSING
    style(header) = {/*font_weight = bold*/ font_face = 'Times New Roman' font_size = 12pt just = left}
    style(column) = {font_face = 'Times New Roman' font_size = 12pt just = left /*asis = on*/};
    COLUMN var1 var1=var1_n var1=var1_pctn;
    DEFINE var1 / GROUP ORDER=FREQ DESCENDING 'Variable';
    DEFINE var1_n / ANALYSIS N 'Data/(N=)';
    DEFINE var1_pctn / ANALYSIS PCTN format = percent8. '';
RUN;

ODS RTF CLOSE;

This generates an RTF table in Word something like the following (a little simplified):

However, I want to add a variable lable 'Variable 1, n (%)' above the groups in the variable name column as a separate row (NOT in the header row). I also want to add additional variables and statistics in an aggregated table.
In the end, I want something that looks like this:

I have tried "everything" - is there anyone who knows how to do this?

A: I know this has been open for awhile, but I too was struggling with this for awhile, and this is what I figured out. So...
In short, SAS has trouble outputting nicely formatted tables that contain more than one type of table "format" in them. For instance, a table where the columns change midway through (like you commonly find in the "Table 1" of a research study describing the study population).
In this case, you're trying to use PROC REPORT, but I don't think it's going to work here. What you want to do is stack two different reports on top of each other, really. You're changing the column value midway through and SAS doesn't natively support that.
Some alternative approaches are:

*

*Perform all your calculations and carefully output them to a data set in SAS, in the positions you want. Then, use PROC PRINT to print them. This is what I can only describe as a tremendous effort.

*Create a new TAGSET that allows you to output multiple files, but removes the spacing between each one and aligns them to the same width, effectively creating a single table. This is also quite time consuming; I attempted it using HTML with a custom CSS file and tagset, and it wasn't terribly easy.

*Use a different procedure (in this case, PROC TABULATE) and then manually delete the spacing between each table and fiddle with the width to get a final table. This isn't fully automated, but it's probably the quickest option.
PROC TABULATE is cool because you can use multiple table statements in a single example. Below, I put some code in that shows what I'm talking about.
DATA survey;
   INPUT id grp var1 var2 var3 var4 var5;
   DATALINES;
     1  1  35 17  7 2 2
    17  1  50 14  5 5 3
    33  1  45  6  7 2 7
    49  1  24 14  7 5 7
    65  2  52  9  4 7 7
    81  2  44 11  7 7 7
    2   2  34 17  6 5 3
    18  2  40 14  7 5 2
    34  2  47  6  6 5 6
    50  2  35 17  5 7 5
;
RUN;

I found your example code to be a little confusing; var1 looked like a grouping variable, and var2 looked like the first actual analysis variable, so I slightly changed the code. Next, I quickly created the same format you were using before.
PROC FORMAT;
    VALUE groupft 1 = 'Group A' 2 = 'Group B';
RUN;

DATA survey;
    SET survey;
    LABEL var1 ='Variable 1';
    LABEL var2 ='Fancy variable 2';
    LABEL var3 ='Another variable no 3';
    FORMAT var1 groupft.;
RUN;

Now, the meat of the PROC TABULATE statement.
PROC TABULATE DATA=survey;
    CLASS grp;
    VAR var1--var5;
    TABLE MEDIAN QRANGE,var1;
    TABLE grp,var2*(N PCTN);
RUN;

TABULATE basically works with commas and asterisks to separate things. The default for something like grp*var1 is an output where the column is the first variable and then there are subcolumns for each subgroup. To add rows, you use a column; to specify which statistics you want, you add a keyword.
This above code gets you something close to what you had in your first example (not ODS formatted, but I figure you can add that back in); it's just in two different tables.
I found the following papers useful when I was tackling this problem:
http://www.lexjansen.com/pharmasug/2005/applicationsdevelopment/ad16.pdf
http://www2.sas.com/proceedings/sugi31/089-31.pdf

A: 1 ODS has some interesting formatting features (like aligning the numbers so a decimal point goes at the same column) but their usefulness is limited for more complex cases. The most flexible solution is to create a formatted string yourself and bypass PROC REPORT's formatting facility completely, like:
data out;
    length str $25;
    set statistics;
    varnum = 1;
    group = 1;
    str = put( median, 3. );
    output;
    group = 2;
    str = put( q1, 3. ) || " - " || put( q3, 3. );
    output;
run;

You can set varnum and group as ORDER variables in PROC REPORT and add headings like "Variable 1" or "Fancy variable 2" via COMPUTE BEFORE; LINE
2 To further keep PROC REPORT from messing up the layout in ODS RTF output, consider re-enabling ASIS style option:
define str / "..." style( column ) = { asis= on };


text:
Q: How I can download files with Git How I can download from my repository at Git?
I can upload and commit my sources, but, I don't know download from my repository.How I can this?

A: Are you just looking for the ability to get latest from the remote repo?  If so it's just:
git pull origin master

where origin is the remote and master is the branch name.

A: git clone git://git.kernel.org/pub/scm/.../linux-2.6

Just use git clone.


text:
Q: Getting result from stored procedure How to get 2 results, using mysqli and stored procedures?
db_class.php
       /*  some class code  */

        function  GetList1()
        {
            return $this->dbconn->query("CALL list1()");
        }

        function  GetList2()
        {
            return  $this->dbconn->query("CALL list2()");
        }

      /*  some class code  */

ui.php
  $res1 =  $db->GetList1();

  while ($row = $res1->fetch_array(3))
  {
     echo $row[0];   // already working
  }

  // $res1->free_result();     -- not helped

  $res2 =  $db->GetList2();
  while ($row = $res2->fetch_array(3))
  {
     echo $row[0];  // getting error " Fatal error: Call to a member function fetch_array() on a non-object in "
  }


text:
Q: .NET Runtime 2.0 Error I keep on getting .NET Runtime 2.0 Errors (reported in the Event Log) on my test machines, I tend to get these when swapping assemblies out for those with more debugging / diagnostic information (or fixes). An example message:
Faulting application MyApp.exe, version 1.0.0.66, stamp 4a3851fa, faulting module kernel32.dll, version 5.2.3790.4480, stamp 49c51f0a, debug? 0, fault address 0x0000bef7.

My guess is that even though I'm careful not to alter the interface, swapping assemblies in this way is probaly something I shouldnt be doing (should I be doing this?)
All the same, the instalation / Build process for this app is hefty, and its a massive pain to rebuild and reinstall everything when debugging problems (in fact its just not fesable). Is there any way to get any more useful information out of these sorts of errors?

A: This is due to the application encountering an unhandled exception.
Although it may be more work in the short run, you could rework your application to include tracing information and to use the tools provided in the System.Diagnostics namespace.
For example, System.Diagnostics.Trace allows you to specify via configuration (no change in build) different listener classes that could be used for runtime tracing.  You could use this to implement functionality that would at least help you narrow down what might be causing your issues, and only enable the tracing output on your test machines.
Also, make sure you have a clean, top level exception handler.  That may help you at least discover some of your stack trace information when your application faults.

A: Old post but I just had this problem and was able to track down the offending code by remote debugging as described here:
http://www.codeproject.com/Articles/146838/Remote-debugging-with-Visual-Studio-2010#_rating
similar question here:
.NET Winforms app dies on startup
In my case I had a hanlder for a treeview AfterSelect which was was changing the selection of the tree and causing another AfterSelect to be called, etc - the resulting error: stackoverflow. This doesn't seem to happen on other machines so might be something to do with the framework.

A: I had the same issue with a console application; I solved it by launching it from the command line, where I could see the cause of the error (in my case, access rights on a DLL) :
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'FHVI_Common, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. Access is denied. File name: 'FHVI_Common, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=null' ---> System.UnauthorizedAccessException:
    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    at xyzCL_Process.Main()


text:
Q: Julia installs python 2.7 while python 3.6 is already installed I have installed python 3.6 via Anaconda3 and then julia 0.6.2. When I install PyPlot package for julia, it installs python 2.7 and mkl, numpy... How can I tell julia to use the current installed python 3.6 since I don't want to install different versions of python. Thank you.

A: Run:
ENV["PYTHON"] = "... path of the python program you want ..."
Pkg.build("PyCall")

Reference: https://github.com/JuliaPy/PyCall.jl#specifying-the-python-version


text:
Q: JSON Exception - No value for wanted parameter I am developing an app on the android platform that gets youtube video search results as a JSON format and puts the title, channel name, and thumbnail url into a listview. I should also add that I am using the jsoup library for android. Pretty much I am connecting to a URL that contains a JSON response and am trying to use values from that response and apply them to a listview.
Here is the method.
public void initSearch(String searchQuery) {
    String url = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&order=rating&q=" + searchQuery + "&key=MY_GOOGLE_API_KEY";

    try {
        Document doc = Jsoup.connect(url).ignoreContentType(true).timeout(10 * 1000).get();
        String getJson = doc.text();

        try{
            JSONObject jsonObject = (JSONObject) new JSONTokener(getJson).nextValue();

            String videoId = jsonObject.getString("videoId");
            String thumbnail = "http://img.youtube.com/vi/" + videoId + "/mqdefault.jpg";
            String title = (String)jsonObject.get("title");
            String channelTitle = (String)jsonObject.get("channelTitle");

            VideoDetails videoDetails = new VideoDetails(thumbnail, title,channelTitle,"6,900" );
            searchedList.add(videoDetails);
        } catch (JSONException e){
            e.printStackTrace();
        }
    } catch (IOException e){
        e.printStackTrace();
    }
}

Here is what the webpage I am connecting to looks like.
I have already checked if it is valid JSON format, and yes it is.
Now the problem is, nothing is actually added to my list view. When this method is called I receive an error that looks like this.
W/System.err: org.json.JSONException: No value for videoId

Anyone know whats going on? Thanks in advance.

A: The videoId is a sub-element in the JSON, so you need to traverse the JSON to get it.
Bad way (note the hard coded index):
String videoID = (String) ((JSONObject) ((JSONObject) jsonObject.getJSONArray("items").get(0)).get("id")).get("videoId");
System.out.println(videoID);

Preferred way:
Iterator<?> keys = jsonObject.keys();

/* Iterate over all the elements and sub-elements and assign as
 * needed. Based on the type you can concert each item to a JSONObject or
 * JSONArray, etc.
 */
while (keys.hasNext()) {
    String key = (String) keys.next();

    System.out.println(key + "\t" + jsonObject.get(key) + "\t" + jsonObject.get(key).getClass());
}


text:
Q: Odd behavior with a PHP POST So I'm seeing an odd behavior and I asked over on serverfault but it looks to be a code issue. The thing is this code works fine when I test locally with MAMP, once I put it on HostGator I get this oddness.
So the process is

*

*Upload file;

*Check the state of things;

*Unzip the file;

*Read in a data file;

*Copy and thumbnail images;

*dump data into database.

I know 1 to 5 happen as I can see the thumbnails. The oddness is I get an error from step 2 saying the file didn't upload. So it looks like the whole process is started over with "blank" POST data.
So, step 1 is this bit of code. It's called when my form is posted:
function action_upload() {
    $ownerName = $this->request->post('ownerName', '');
    $ownerEmail = $this->request->post('ownerEmail', '');
    $ownerPhone = $this->request->post('ownerPhone', '');
    $username = $this->request->post('username', '');
    $password = $this->request->post('password', '');
    $treeName = $this->request->post('treeName', '');

    $error = $this->util->process_datafile($ownerName, $ownerEmail, $ownerPhone, $username, $password, false, $treeName);

    if ($error != "") {
        echo json_encode(array(
            'error' => $error,
        ));
    } else {
        echo json_encode(array(
            'gotoURL' => "/" . $treeName,
        ));
    }
    exit;
}

The action reads in some form fields and calls a function process_datafile that, well, processes the uploaded file. Below is that function, the error I'm recieving is from the 9th line, "No tree name provided". But I know it at some point gets past that error.
public function process_datafile($ownerName, $ownerEmail, $ownerPhone, $username, $password, $update, $treeName) {

    // Make sure we have a tree name
    if ($treeName != "") {
        $this->scriptPath = dirname(__FILE__);
        $this->treePath = dirname(dirname($this->scriptPath)) . "/assets/trees/" . $treeName . "/";
        $this->tempFilePath = dirname(dirname($this->scriptPath)) . "/assets/temp/" . $this->guid() . "/";
    } else {
        return "No tree name provided";
    }

    // Check to make sure the tree is in the expect condition
    $treeExists = false;
    if (file_exists($this->treePath)) {
        $treeExists = true;
    }
    if ($treeExists && !$update) {
        return "Tree name already exists " . $this->treePath;
    } else if (!$treeExists && $update) {
        return "Tree does not exists";
    }

    // Make sure there are no upload errors
    if ($_FILES['treeFile']['error'] == '1' || $_FILES['treeFile']['error'] == '2') {
        return "File size to large, try to upload your tree without media.";
    } else if ($_FILES['treeFile']['error'] != '0') {
        return "File upload error: " . $_FILES['treeFile']['error'];
    }

    // Move the uploaded file
    if (!file_exists($this->tempFilePath)) {
        mkdir($this->tempFilePath, 0700, true);
    }
    $name = $_FILES["treeFile"]["name"];
    $tempfile = $this->tempFilePath . $name;
    copy($_FILES['treeFile']['tmp_name'], $tempfile);

    // Make sure it is something we can deal with
    $finfo = finfo_open(FILEINFO_MIME);
    $fileparts = explode(";", finfo_file($finfo, $tempfile));
    $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
    $filetype = $fileparts[0];
    $valid = "text/plain,image/png";
    if (($filetype != "text/plain" && $filetype != "application/zip") || ($ext != "ged" && $ext != "zip")) {
        return "Only gedcom (.ged) or archive (.zip) files may be uploaded.";
    }

    $gedfile = $tempfile;
    $archive_tmp = "";
    if ($filetype == "application/zip" && $ext == "zip") {
        $archive_tmp = $this->tempFilePath . "archive/";
        if (!file_exists($archive_tmp)) {
            mkdir($archive_tmp, 0700, true);
        }

        // Extract the archive
        $zip = new \ZipArchive;
        $res = $zip->open($tempfile);
        if ($res === TRUE) {
            $zip->extractTo($archive_tmp);
            $zip->close();
        } else {
            $this->delTree($archive_tmp);
            return "Error processing archive";
        }

        // Find the gedcom
        $found = false;
        $it = new \RecursiveDirectoryIterator($archive_tmp);
        foreach(new \RecursiveIteratorIterator($it) as $file)
        {
            $file_ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            if (strtolower($file_ext) == "ged") {
                $gedfile = $file;
                $found = true;
            }
        }

        if (!$found) {
            $this->delTree($archive_tmp);
            return "Could not find gedcom (.ged) file in archive.";
        }
    }

    // Make the tree folder if needed
    if (!file_exists($this->treePath)) {
        mkdir($this->treePath, 0700, true);
    }
        $this->mediaPath = $this->treePath . "media/";
    $this->delTree($this->mediaPath);
    if (!file_exists($this->mediaPath)) {
        mkdir($this->mediaPath, 0700, true);
    }
    if (file_exists($this->treePath . "tree.ged")) {
        unlink($this->treePath . "tree.ged");
    }
    copy($gedfile, $this->treePath . "tree.ged");

    // Deal with the database
    if (!$this->create_database($ownerName, $ownerEmail, $ownerPhone, $username, $password, $update)) {
        return "Could not open database";
    }

    // Process the gedcom
    $this->process_gedcom($this->mediaPath, $archive_tmp);

    // Remove the temp folder
    $this->delTree($this->tempFilePath);

    return "";
}

I know at some point it gets into the process_gedcom as that where the thumbnailing takes place... I also know it never gets to foreach ($ged->people as $person) as there are no entries in the database.
private function process_gedcom($mediaPath, $archivePath) {
    // Insert statements
    $personInsert = "INSERT INTO people   (id, gender, first, last, middle, title, suffix) VALUES (:id, :gender, :first, :last, :middle, :title, :suffix)";
    $nameInsert   = "INSERT INTO names    (personID, `type`, first, last) VALUES (:id, :type, :first, :last)";
    $familyInsert = "INSERT INTO families (id, personAID, personBID) VALUES (:id, :personAID, :personBID)";
    $childInsert  = "INSERT INTO children (familyID, `type`, personID) VALUES (:familyID, :type, :personID)";
    $eventInsert  = "INSERT INTO events   (personID, familyID, `type`, date, place, description) VALUES (:personID, :familyID, :type, :date, :place, :description)";
    $factInsert   = "INSERT INTO facts    (personID, name, value) VALUES (:personID, :name, :value)";
    $mediaInsert  = "INSERT INTO media    (id, file, `type`, title) VALUES (:id, :file, :type, :title)";
    $peopleMediaInsert = "INSERT INTO people_media (mediaID, personID) VALUES (:mediaID, :personID)";
    $familyMediaInsert = "INSERT INTO family_media (mediaID, familyID) VALUES (:mediaID, :familyID)";

    // Load in the gedcom file
    $ged = new \App\Gedcom();
    $ged->import($this->treePath . "tree.ged", array($this, 'log'));

    // Add objects to the database
    foreach ($ged->objects as $obj) {
        $file = $this->findFile($obj->getFilename(), $archivePath);
        if ($file !== false) {
            $finfo = finfo_open(FILEINFO_MIME);
            $fileparts = explode(";", finfo_file($finfo, $file));
            $filetype = $fileparts[0];
            $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            $hash = md5_file($file);
            copy($file, $mediaPath . $hash . "." . $ext);
            $this->makeThumb($mediaPath . $hash . "." . $ext, 200, 200, "thumb");
            $this->makeThumb($mediaPath . $hash . "." . $ext, 1024, 768, "resized");
            $this->database($mediaInsert, array(':id'    => $obj->getId(),
                                                ':file'  => $hash . "." . $ext,
                                                ':type'  => $filetype,
                                                ':title' => $obj->getTitle()));
        }
    }

    // Add people to the databsse
    foreach ($ged->people as $person) {
        $this->database($personInsert, array(':id'     => $person->getId(),
                                             ':gender' => $person->getGender(),
                                             ':first'  => $person->getFirstName(),
                                             ':last'   => $person->getLastName(),
                                             ':middle' => $person->getMiddleName(),
                                             ':title'  => $person->getTitleName(),
                                             ':suffix' => $person->getSuffixName()));

More data inserts...
What would cause things to restart as it looks like its calling process_datafile twice, once with valid inputs, the second time everything is '' blanks?


text:
Q: Managing Free and a Trial / Paid in the same code base in Windows Phone 7 I've got a free ad supported game on the market place. I'd like to add a paid version which will have the same ads in trial mode.
Will the IsTrial method return false in the free version? Is there any other way to distinguish between the two versions?

A: Free versions will have IsTrial=false - they are essentially purchased for $0

A: Take a look at this : http://invokeit.wordpress.com/2011/09/20/free-trial-and-paid-apps/


text:
Q: find out what page the iframe is on I have a 'toolbar' on the top of my website, and the content of the page is an iframe.
How can I find out with javascript what the current URL of the iframe is?

A: This may not be possible if the iframe is in a different domain, or otherwise violates the same origin policy. For example, if the page is at example.com/foo and the iframe is at example.org/bar, you cannot get the location.
If you are not violating the same origin policy, you can use something like this:
window.frames["iframeID"].location.href

A: How about window.frames[0].location.href ?
Or if you know the id of the iframe, then document.getElementById("iframe1").src should work.

A: Check the "src" attribute.
for example window.frames["your_iframe"].src

A: function getUrl()
{
    var pageFrame = $find("frame_id_goes_here", document);
    if(pageFrame) {
        return pageFrame.location;
    }
}

A: Assuming the iframe is the first on the page:
document.getElementsByTagName('IFRAME')[0].contentDocument.location.href

Of course you could always just grab it by ID:
document.getElementById('myIframe').contentDocument.location.href

The contentDocument is the key.
Best of luck!


text:
Q: Mantine form, prevent closing mantine modal after submitting I am writing Form for updating information. Inside submit function I am sending new information to redux-toolkit state. Form is closing after submitting. However, I want to form must be stay open if state return a error message
onSubmit={form.onSubmit(values => {
                            values = {
                                ...values,
                                included_modules: values.included_modules.map((item: any) => {
                                    return { type: item };
                                }),
                            };
                            dispatch(updatePackage({ id: value?.id, values: values }));
                            if (myPackage.showError === true) {
                                setServerError(myPackage.message);
                            } else {
                                setShowModal(false);
                            }
                        })}

A: You can pass following props to mantine modal to prevent it from closing:
  /** Should modal be closed when outside click was registered? */
  closeOnClickOutside: false;
  /** Should modal be closed when escape is pressed? */
  closeOnEscape: false;
  /** Hides close button if set to false, modal still can be closed with escape key and by clicking outside */
  withCloseButton: false;
  /** Should modal be closed when confirm button is pressed */
  closeOnConfirm: false,
  /** Should modal be closed when cancel button is pressed */
  closeOnCancel: false,


text:
Q: Creating universal distribution group in exchange through Java I need to create universal distribution groups in exchange server 2010 programmatically through Java. I tried to look but most API's are mail box specific and create groups within the mailbox. Or I have to use Power shell cmdlets. I am wondering if there is any possible solutions for Java or do i have to use .NET?

A: As far as I know, all Exchange administration is done through PowerShell now. Even when programming in .NET, you need to run PowerShell cmdlets to do anything with Exchange. I had to do that when I wrote a service in C# to create mailboxes for new users (we're running 2010 as well).
So if you want to do this, you'll need to run PowerShell with Java.
This might help (I have no experience with it; I just found it in a Google search): https://github.com/profesorfalken/jPowerShell
To really make things a pain, to get the Exchange PowerShell module installed, you have to install the Exchange management tools, which is part of the Exchange installation (you only select the management tools in the setup). You'll have to do that on any machine your app will run on.


text:
Q: Determine whether a given JavaScript action has been initiated by user Is it possible to determine whether a given JavaScript action has been initiated by user? For instance I want to know whether a link was clicked by user or via jQuery fire event method?

A: event.which will be undefined if the event is triggered with code.
jsFiddle.


text:
Q: Add ImageView in RelativeLayout with coordinates How to add ImageView in RelativeLayout with some coordinates, which is bigger than RelativeLayout Size?
Trouble is, when I add ImageView with padding left bigger then layout width, and use in that layout scrollTo(-100,0) (for example), I can't see nothing, my ImageView disappeared, or be smaller(when padding left a little less than layout width).
How can I turn off ImageView auto-scaling or something?


text:
Q: How to retrieve "Runs Completed" count of more than one Logic App I have a bunch of Azure Logic Apps in my architecture and want to figure the cumulative sum of total runs completed in all the Logic Apps in my architecture. So far, I could only configure a single Logic App to the chart but I am wondering if there is a way to get a cumulative count in a single shot.
Any suggestions are much appreciated. Thanks.

A: For this requirement, we can use Azure Log Analytics workspace.

*

*We need to create a Log Analytics workspace first. Please refer to this tutorial to create it.

*Then enable "Log Analytics" when you create the logic app and choose the Log Analytics workspace which we created above.

*After that, we can see the running log(include the cumulative sum of total runs completed) in the Log Analytics workspace. We can see them by go to the Log Analytics workspace and click "Workspace summary".

If you have already created many logic apps and do not want to create them again, you can follow the steps below:

*

*Also create the "Log Analytics workspace" as the first solution above.

*Then install Logic Apps Management solution in it.

*After that, go to your logic app and set the logs to send to Log Analytics.
By the way, the logs in Log Analytics workspace will be a little bit of a delay, so please wait a moment for the logs.(In my test, I wait for more than 25 mins).


text:
Q: How to add some items or some pixmaps to the qgraphicscene? I'm trying to make a puzzle game. My thought came from the 8-puzzle problem, so now I try to use the pyqt5. My opinion is that I choose a picture from my computer and then I try to use it. But when I try to upset the picture ,it comes some trouble.So I come here and look for help
since it comes to trouble so I simplify the code that just make the picture change into pieces. And now I just try them list on the qgraphicscene firstly, but I don't known why all of them stacked in the upper left corner, I just want them list in order which looks like the original picture, what should I do?
import sys
from vision import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow, QFileDialog
from PyQt5 import QtWidgets, QtGui, QtCore
from PIL import Image

class MyWindow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MyWindow, self).__init__()
        self.setupUi(self)

        self.item = []
        self.if_opened = 0
        self.dim = 3

        self.upset.clicked.connect(self.make_upset)

    def make_upset(self):

        if self.image is None:
            return

        self.scene.clear()
        self.showView.setScene(self.scene)

        pixmap = QtGui.QPixmap(self.image)
        x_side = self.image_file.size[0] / self.dim
        y_side = self.image_file.size[1] / self.dim

        count = 0
        self.item.clear()
        for j in range(self.dim):
            for i in range(self.dim):
                m = pixmap.copy(i * x_side, j * y_side, x_side, y_side)
                self.item.append(QtWidgets.QGraphicsPixmapItem(m))
                self.scene.addItem(self.item[count])
                count = count + 1

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    myShow = MyWindow()
    myShow.show()
    sys.exit(app.exec_())

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1077, 741)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.upset = QtWidgets.QPushButton(self.centralwidget)
        self.upset.setGeometry(QtCore.QRect(800, 210, 171, 51))
        self.upset.setObjectName("upset")

        self.showView = QtWidgets.QGraphicsView(self.centralwidget)
        self.showView.setGeometry(QtCore.QRect(55, 38, 643, 623))
        self.showView.setObjectName("showView")

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.upset.setText(_translate("MainWindow", "upset"))


text:
Q: Tracking down stack overflow in meteor/node fiber I'm seeing this crash now and am not familiar enough with the node fiber infrastructure to know where to begin interpreting the error or instrumenting the code...
Meteor server running on: http://localhost:3000/
W202407-10:06:05.740(-8)? (STDERR) /Users/dauser/.meteor/tools/0b2f28e18b/lib/node_modules/fibers/future.js:173
W202407-10:06:07.363(-8)? (STDERR)                      throw(ex);
W202407-10:06:07.363(-8)? (STDERR)                            ^
W202407-10:06:07.363(-8)? (STDERR) RangeError: Maximum call stack size exceeded
=> Exited with code: 8
=> Meteor server restarted

As I understand it, something is recurring a little too enthusiastically, the server stack blows up, and it crashes. Unfortunately, I have no real idea where this offending function is--I looked at the my Deps.autorun call (just one at the moment) and it does not seem to be the trouble. None of my code is implemented with explicit recursion, and I don't have any reason to suspect large objects are being passed around. Obviously, I'm not really sure, of course.
I'm really just looking for advice on how to instrument the code to show me where things are getting out of hand. Since Meteor's doing a whole lot behind the scenes, it would be really useful if anyone could give me a few pointers as to where to look.
Just coming back to this, and am still pretty lost as to where to be looking. this suggested updating to node 0.11.x would give me more info, but doing that doesn't seem to have added any more detail when it crashes.
The crash happens after any page interaction--that is, the server starts up and is functioning ok, but if I reload in the browser or interact with the page itself, BOOM!
By popular demand, here is the server code:
isAuthorized = () ->
    console.log "checking authorization"
    this.userId == Assets.getText('authorizedUsers')

Meteor.methods(
    isAuthorized : isAuthorized
    filePickerKey : () ->
        # TODO: properly abstract this, rather than copy/paste...
        if this.userId == Assets.getText('authorizedUsers')
            Assets.getText('fpKey')
        else
            Meteor.Error 403, 'Error 403: Forbidden')

uncommenting line 172 of future.js did not provide more details:
I2041-15:52:07.363(-8)? Resolve cb threw Maximum call stack size exceeded

And, here's the trouble I run into while trying to use node-inspector. I have been playing with this for the past half hour, so I'm likely just making some fundamental error, but:
I installed node-inspector via npm (npm install -g node-inspector).
then, I try
$ node-inspector &
[1] 3408
$ Node Inspector v0.6.2
  info  - socket.io started
Visit http://127.0.0.1:8080/debug?port=5858 to start debugging.

$ meteor &
[2] 3413
$ [[[[[ ~/Projects/indefinite-ways ]]]]]

=> Meteor server running on: http://localhost:3000/

$ kill -s USR1 3413
Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858

so far, so good. At this point, the client side is not open in my browser (i.e. no tab pointing at localhost:3000). I open up a Chrome tab pointing to localhost:5858, and see the source for meteor.js I set a breakpoint on line 6 of meteor.js
var Fiber = require('fibers');

and then open the meteor client tab (localhost:3000) and the aforementioned stack overflow pops up again. The debugger does not halt on line 6, or in any other way indicate that it has noticed. Same is true if I set a breakpoint at line 3.

A: Try node-inspector, it allows to inspect the callstack. This is a video presentation of how to use it, visually it looks like the chrome debugger (it's the same base source).

A: The slightly more helpful answer comes from the unofficial Meteor FAQ:
$ node-inspector &
$ NODE_OPTIONS='--debug-brk' mrt run &

This starts the node-inspector process in the background, and then starts meteor's node container listening with the right debugging flags set. Opening the Chrome tab to http://127.0.0.1:8080/debug?port=5858 let me step through.
Also, not strictly the answer to the question, but the offending line in the code above seems to be calling Meteor.Error in the server code. I'll still gladly accept an answer to this that would have identified that. I'm guessing that Meteor.Error is not at all EJSONable, and in attempting to parse it, the stack explodes.

A: Line 173 of future.js forwards an exception onward to the next listener.  It appears in your case the next listener is the instance itself, resulting in a stack crashing loop.
Edit your future.js file (path referenced in OP) and uncomment the console.log line just above it... then you should see a more detailed explanation of what is going on.  If the console.log output isn't helpful to resolve, post here for further diagnostics.
My guess is it's related to a missing package, per this thread.


text: Q: date start of submodule with commit number in github and installable git server Whenever I used a git submodule the commit number was not shown. Now it is shown. From when and which version did github/ git server start using a commit number in the submodules.


text:
Q: Convert hex string to pdf I have a string like 0x255044462D312E330D0A312030206F626A0D0 and I've tried to convert it to a PDF.
Code:
var inputStr="my hex string";
pdfFile = Encoding.Unicode.GetBytes(inputStr).ToArray();
return new FileContentResult(pdfFile, "application/pdf");

It's not working ( "Failed to load PDF document" is the message I get ). What am I doing wrong? I've also tried to change response:
Response.ClearHeaders();
Response.Clear();
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Length", pdfFile.Length.ToString());
Response.AddHeader("Content-Disposition", "inline; filename=sample.pdf");
Response.BinaryWrite(pdfFile);
Response.Flush();
Response.End();

Update
I don't know how the string was initially encoded
Update 2
So I'm receiving "-2" because of someone who thought this questions is a duplicate ( he deteled his answer by the way ) ? Thank you

A: Assuming your hex string is actually a valid pdf file you need to convert it into a byte array like this:
var inputStr = "0x255044462D312E330D0A312030206F626A0D0";
var hex = inputStr.Substring(2);

int NumberChars = hex.Length / 2;
byte[] pdfFile = new byte[NumberChars];
using (var sr = new StringReader(hex))
{
    for (int i = 0; i < NumberChars; i++)
        pdfFile[i] = Convert.ToByte(new string(new char[2]{(char)sr.Read(), (char)sr.Read()}), 16);
}

A: You will need to use some kind of API to create a PDF document. PDF files are complicated file formats and what you have created is basically just a text file.
I'm assuming the error "Failed to load PDF document" is from whatever software is trying to open the PDF file. It is getting the mime header that you have specified saying it is a pdf file but when it looks it doesn't find a pdf file, just a text file.
As an example of this try changing the mime type from "application/pdf" to "text/plain" and you should find it will give you a text file with your input text in it.
Although closed as off topic Creating pdf files at runtime in c# has discussions on APIs that can be used to create PDFs.


text:
Q: AWS SNS with SQS permissions Looking at this blog post it seems that I need to open my SNS queue to the world to integrate it with SNS. Is this still the case?
I'm trying to implement automatic bounce handling for SES emails and Amazon recommend using a SNS/SQS pattern but if I understand this correctly it would mean that anyone can effectively remove people from our email list? I can't believe this is the case.

A: So I found some documentation which indicates that you can specify a source ARN in the queue permissions:

Add a condition that allows the action for the topic. Click Add
  Conditions (optional), select ArnEquals for Condition, select
  aws:SourceArn for Key, and paste in the topic ARN for Value. Click Add
  Condition. The new condition should appear at the bottom of the box
  (you may have to scroll down to see this).


text:
Q: How to disable a specific warning of IBM xl C++ compiler via compiler commandline? I get compiler message/information
1500-030: (I) INFORMATION: ... Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.

and it cannot be turned off by
#pragma report(disable, "1500-030")

as suggested by question How to disable a specific IBM XL C++ compiler warning?

A: What OS is xlc running on?
Try
-qsuppress=1500-030

Or
-w


text:
Q: Get filename from Content-Disposition header I'm currently checking for this header and if it's available, I'll try to get the filename from it. Question is, what is the best method to retrieve it? I understand that Content-Disposition header may appear with different parameters. Examples below:
Content-Disposition = "inline; filename=sample-file-123.pdf"
Content-Disposition = "attachment; filename="123.zip""

I'm only interested to get the filename.

A: There is a dedicated API for this: URLResponse.suggestedFilename
So if you are getting your header from a URLResponse you just call
let filename: String = response.suggestedFilename ?? "default"

and you're done. Note that despite what the documentation says, the return value is optional so you have to provide a default or force unwrap if you dare (I wouldn't).
From the documentation:

The method first checks if the server has specified a filename using the
content disposition header. If no valid filename is specified using that mechanism,
this method checks the last path component of the URL. If no valid filename can be
obtained using the last path component, this method uses the URL's host as the filename.
If the URL's host can't be converted to a valid filename, the filename "unknown" is used.
In mose cases, this method appends the proper file extension based on the MIME type.
This method always returns a valid filename.

A: I would do something along the lines of this:
- (NSString *)getFilenameFrom:(NSString *)string {
    NSRange startRange = [string rangeOfString:@"filename="];

    if (startRange.location != NSNotFound && startRange.length != NSNotFound) {
        int filenameStart = startRange.location + startRange.length;
        NSRange endRange = [string rangeOfString:@" " options:NSLiteralSearch range:NSMakeRange(filenameStart, [string length] - filenameStart)];
        int filenameLength = 0;

        if (endRange.location != NSNotFound && endRange.length != NSNotFound) {
            filenameLength = endRange.location - filenameStart;
        } else {
            filenameLength = [string length] - filenameStart;
        }

        return [string substringWithRange:NSMakeRange(filenameStart, filenameLength)];
    }
    return nil; //or return @"", whatever you like
}

You will have to check it as i made this in the browser (dont have access to xcode atm).

A: + (NSString *)filenameFromContentDispositionHeader:(NSString *)contentDispositionHeader {
  NSString *pattern = @"filename=\"(.*)\"";
  NSRegularExpression *regex =
      [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:nil];
  NSTextCheckingResult *result =
      [regex firstMatchInString:contentDispositionHeader
                        options:0
                          range:NSMakeRange(0, contentDispositionHeader.length)];
  NSRange resultRange = [result rangeAtIndex:0];

  if (resultRange.location == NSNotFound) {
    return nil;
  } else {
    return [contentDispositionHeader substringWithRange:
        NSMakeRange(resultRange.location + 10, resultRange.length - 11)];
  }
}

Note that you'll need to modify the pattern if you can't be sure the filename is surrounded in double-quotes.


text:
Q: Docker Compose: run a command at build time but not at run time I am trying to build a service based on postgresql using docker-compose.
The service is very simple:
version: "3.8"
services:
  db:
    image: postgres:latest
    volumes:
      - db-data:/var/lib/postgresql/data
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s

volumes:
  db-data:

The problem I am facing is due to the postgresl image that does not start due to the absence of root password.
When I build the container using docker run, I can pass arguments to the default command using the flag '-e' and set the root password.
I would like to do the same but directly in the compose file in order to have the root password set the first time the service is created but not executed in the subsequent run which will not need to build the image again.
I was hoping to find an option under the "build" tag of the compose file but to no avail.
The aim is to have the deployment process as smooth as possible without having to connect to the container afterwards to set the root password.

A: the official postgres image has several environment variables you can use to configure the service, including the one you're looking for.
Check its documentation at https://hub.docker.com/_/postgres


text:
Q: Multiple adjectives but following reference is singular
Everyone was mostly Muslim or atheist, like my family.

What is the rule here, is the family Muslim or atheist?  I know it's poorly written, I didn't write it and I can't ask the author.  My gut response is atheist.  Is there a rule for this?

A: I do agree with the comments that this sentence is a little unclear, but I think this is where a comma makes all the difference.
The comma appears after "Muslim or atheist", which to me describes "everyone" as being either Muslim or atheist. The comma separating "atheist" and "like my family" indicates that people being either Muslim or atheist is a description that also applies to my family. Everyone is Muslim or atheist. My family is also either Muslim or atheist. This is a very subtle distinction.
Had the sentence been phrased:
Everyone was mostly Muslim, or atheist like my family.
                          ^

with the comma appearing after "Muslim", then I would interpret that sentence to mean everyone (except my family) is Muslim or atheist. My family is mostly atheist.
The meaning of the sentence can change based on the position of the comma that separates terms in a series (see also Oxford comma or Harvard comma).
Since the difference in phrasing is subtle, but the difference in meaning is potentially big, this sentence probably should be rewritten to clarify the meaning. It is difficult to make a judgement with this single sentence. Consider looking at the sentences before and after this one for a point of reference. If the sentences before and after this one talk about the person's family being Muslim or atheist, then you could make that assumption about this sentence. Similarly, if nearby sentences talk about the author's family being atheist, then you could make the assumption that this sentence implies the author's family is predominantly atheist.


text:
Q: How to check if objectB used instance of objectA from objectA using private variables Code Explanation
I have two classes, mesh and geometry, that are used to maintain attributes of a 3D array to fill a space. First a mesh is defined and builds a 3D array. Then geometric shapes can be created within the same bounds of the mesh object, but not in the original mesh object. This is done by passing the mesh in to the shape so that it uses the bounds of the mesh.
The shape has functions that are not shown below to fill in cells as needed. For example, you could add a sphere centered at a point with a specified radius and the shape will work out which cells to fill in. Then say I really wanted a hemisphere, I could clear out everything below the center of the sphere and I would have an array that when translated to 3D space would draw a (pixelated) hemisphere.
There are properties that allow the mesh and geometry to work out a physical spatial location which have been removed in the code below since they are not relevant.
Once a shape has reached its final form, I want to be able to merge it back into the original mesh. So, if I wanted to create a silo, I would create a hemisphere object as described above, then a cylinder, and then add both back into the original mesh.
Problem Statement
I want to make sure that the geometry object used the mesh that it is being added to.
$mesh1 = new mesh(2,2,2);
$mesh2 = new mesh(2,2,2);

$geo = new geometry($mesh1);
$geo->fill(0,0,0,1);
$geo->fill(1,1,1,1);

$mesh1->add($geo); //should be fine;
$mesh2->add($geo); //should do nothing since $geo used $mesh1 and not $mesh2

I know I can use the === operator on the objects to make sure they are the same,
if ($this === $geo->mesh)

but it doesn't work of the $geo->mesh is private. I would prefer to keep the mesh private if possible. Making $geo->mesh public solves the issue, but does not protect $geo->mesh as well as I would like.
I considered maybe naming the mesh and making it a public geometry variable, but it's not as clean as I would like.
public $name; //in mesh object
public $mesh_name; //in geometry object
$this->mesh_name = $mesh->name; //in geometry constructor

if ($this->name == $geo->mesh_name)
...

Is there a way to check that the mesh the geometry used is the same mesh without breaking encapsulation or requiring inheritance?
Code for the classes
class mesh
{
    private $domain;

    public $i;
    public $j;
    public $k;

    public function __construct($i, $j, $k)
    {
        $this->i = $i;
        $this->j = $j;
        $this->k = $k;
        $this->build();
    }

    public function build()
    {
        $karr = array_fill(0, $this->k, 0);
        $jarr = array_fill(0, $this->j, $karr);
        $this->domain = array_fill(0, $this->i, $jarr);
    }

    public function add(geometry $geo)
    {
        // if ($this === $geo->mesh)
        {

            for ($i = 0; $i < $this->i; $i++){
                for ($j = 0; $j < $this->j; $j++){
                    for ($k = 0; $k < $this->k; $k++){

                        if ($geo->domain[$i][$j][$k] > 0)
                            $this->domain[$i][$j][$k] = $geo->domain[$i][$j][$k];

    }   }   }   }   }

}

class geometry
{
    private $mesh; //would rather keep private

    public $domain;

    public function __construct(mesh $mesh)
    {
        $this->mesh = $mesh;
        $this->build();
    }

    public function build()
    {
        $karr = array_fill(0, $this->mesh->k, 0);
        $jarr = array_fill(0, $this->mesh->j, $karr);
        $this->domain = array_fill(0, $this->mesh->i, $jarr);
    }

    public function fill($i, $j, $k, $value)
    {
        $this->domain[$i][$j][$k] = $value;
    }
}

A: Use Getters and Setters. The below code will let the $mesh_name property be read, but not written by external code.
class MyObject {
    protected $mesh_name = 'foo';
    protected $accessible = ['mesh_name'];
    protected $writable = [];

    public function __get($name) {
        if( in_array($name, $this->accessible) ) [
            return $this->name;
        } else {
            // return null, throw exception, do nothing
        }
    }

    public function __set($name, $value) {
        if( in_array($name, $this->writable) ) {
            if( $this->validationMethod($value) ) {
                $this->$name = $value;
            } else {
                throw new Exception("Property $name failed validation: $value");
            }
        } else {
            throw new Exception("Property $name is not marked as writable.");
        }
    }
}

eg:
$foo = new MyObject();
echo $foo->mesh_name; // foo
$foo->mesh_name = 'bar'; // Exception("Property mesh_name is not marked as writable.");


text:
Q: Pandas df.itertuples renaming dataframe columns when printing I know that normally pandas' itertuples() will return the values of each including the column names as follows:
ab=pd.DataFrame(np.random.random([3,3]),columns=['hi','low','med'])
for i in ab.itertuples():
    print(i)

and the output is as follows:
Pandas(Index=0, hi=0.05421443, low=0.2456833, med=0.491185)
Pandas(Index=1, hi=0.28670429, low=0.5828551, med=0.279305)
Pandas(Index=2, hi=0.53869406, low=0.3427290, med=0.750075)

However, I have no idea why it doesn't shows the columns as I expected for my another set of code as below:
            us qqq equity  us spy equity
date
2017-06-19            0.0            1.0
2017-06-20            0.0           -1.0
2017-06-21            0.0            0.0
2017-06-22            0.0            0.0
2017-06-23            1.0            0.0
2017-06-26            0.0            0.0
2017-06-27           -1.0            0.0
2017-06-28            1.0            0.0
2017-06-29           -1.0            0.0
2017-06-30            0.0            0.0

the above is a Pandas Dataframe with Timestamp as index, float64 as the values in the list, and a list of string ['us qqq equity','us spy equity'] as the columns.
When I do this:
for row in data.itertuples():
    print (row)

It shows the columns as _1 and _2 as follows:
Pandas(Index=Timestamp('2017-06-19 00:00:00'), _1=0.0, _2=1.0)
Pandas(Index=Timestamp('2017-06-20 00:00:00'), _1=0.0, _2=-1.0)
Pandas(Index=Timestamp('2017-06-21 00:00:00'), _1=0.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-22 00:00:00'), _1=0.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-23 00:00:00'), _1=1.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-26 00:00:00'), _1=0.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-27 00:00:00'), _1=-1.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-28 00:00:00'), _1=1.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-29 00:00:00'), _1=-1.0, _2=0.0)
Pandas(Index=Timestamp('2017-06-30 00:00:00'), _1=0.0, _2=0.0)

Does anyone has any clue about what have I done wrong? Does it have to do with some variable referencing issue when creating the original dataframe? (Also, as a side question, I learnt from the community that the type of data generated from itertuples() should be tuples, but it seems (as shown above), the return type is  as I verified from the type statement?)
Thank you for all your patience as I am still trying to master the application of DataFrame.

A: Interesting observation: out of DataFrame.iterrows(), DataFrame.iteritems(), DataFrame.itertuples() only the last one renames the columns, containing spaces:
In [140]: df = df.head(3)

In [141]: list(df.iterrows())
Out[141]:
[(Timestamp('2017-06-19 00:00:00'), us qqq equity    0.0
  us spy equity    1.0
  Name: 2017-06-19 00:00:00, dtype: float64),
 (Timestamp('2017-06-20 00:00:00'), us qqq equity    0.0
  us spy equity   -1.0
  Name: 2017-06-20 00:00:00, dtype: float64),
 (Timestamp('2017-06-21 00:00:00'), us qqq equity    0.0
  us spy equity    0.0
  Name: 2017-06-21 00:00:00, dtype: float64)]

In [142]: list(df.iteritems())
Out[142]:
[('us qqq equity', date
  2017-06-19    0.0
  2017-06-20    0.0
  2017-06-21    0.0
  Name: us qqq equity, dtype: float64), ('us spy equity', date
  2017-06-19    1.0
  2017-06-20   -1.0
  2017-06-21    0.0
  Name: us spy equity, dtype: float64)]

In [143]: list(df.itertuples())
Out[143]:
[Pandas(Index=Timestamp('2017-06-19 00:00:00'), _1=0.0, _2=1.0),
 Pandas(Index=Timestamp('2017-06-20 00:00:00'), _1=0.0, _2=-1.0),
 Pandas(Index=Timestamp('2017-06-21 00:00:00'), _1=0.0, _2=0.0)]

A: This seems to be an issue with handling column names having spaces in them. If you replace the column names with different ones without spaces, it will work:
df.columns = ['us_qqq_equity', 'us_spy_equity']
# df.columns = df.columns.str.replace(r'\s+', '_')  # Courtesy @MaxU
for r in df.head().itertuples():
    print(r)

# Pandas(Index='2017-06-19', us_qqq_equity=0.0, us_spy_equity=1.0)
# Pandas(Index='2017-06-20', us_qqq_equity=0.0, us_spy_equity=-1.0)
# ...

Column names with spaces cannot effectively be represented in named tuples, so they are renamed automatically when printing.


text:
Q: How can I create a series of minimal app windows that only consist of a titlebar? This question is for people with programming experience in creating apps, even simple apps. I'm having trouble figuring out where to start, because (as usual) I'm trying to do something non-standard.
I have a multi-Desktop Workspace workflow that I'm working on streamlining, and from all my research, there are no products that seem to easily support what I'm trying to do: have a text name associated with each Desktop Workspace in Mission Control Spaces.
The best solution I have found is to have some app, it could be any app that supports multiple windows, in which I create a window on each Desktop and each app window has a title that is the name of that Desktop. Then bringing that window to the front, selected by its title, automatically changes the Desktop Workspace to the desired Space.
Some apps, like TextEdit, Terminal, and Notes, work a little better than apps like Stickies because TextEdit, Terminal, and Notes will all, upon a reboot, reopen their windows in the original Desktop, where Stickies will reopen all windows in Desktop 1.
Also, I have other uses for Terminal, TextEdit, and Notes. I would prefer a low-overhead app that I can dedicate for this purpose.
So I'm looking to create a minimalist app, one that consists only of a title bar, with no body. That title will name the Desktop that it's in. I'm getting lost in the doc of various systems for creating apps because they are all about what the app will do, and I don't care for it to do anything. If it has to do something, displaying the text of its title would be enough.
Better would be if the underlying framework supporting this minimalist app were able to automatically provide the reboot robustness such that all open windows would reopen in their original Desktop. But I don't see that addressed in tutorials on "Hello World" or in the feature lists or in the indexes to the reference doc for any simple app-making systems. It's simply ignored as a relevant issue. Desktop Workspaces seem to be a Cinderella in MacOS, a beautiful, forgotten stepchild left behind to do the drudge work. So I'm resigned to having to experiment to find out if it works, if I can get the simple titlebar app working on some framework or another.
AppleScript appears to not be able to create a window of its own, even if a script can be saved as an app for other intents and purposes. It seems to only open windows for other apps.
I don't want to get into Objective-C or Swift, if I can help it, because they are for building complex apps and there appears to be way too much set up and configuration required to get any kind of app started in either of those systems.
How about Node.js? I've never used it, but descriptions sound like it could be in the right direction. Could it make a simple app window that consists of only a titlebar. And do that multiple times so that they could be moved to different Desktop Workspaces?
Are there other simple app frameworks that I should be looking at?
Thanks for ideas.


text:
Q: Any way of getting current playback time for iPhone video play in pre 3.2 API? Is there an API that works for pre OS 3.2 for getting the current time of a video being played back? There's this one
http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPMediaPlayback_protocol/Reference/Reference.html
But it's 3.2 or later....
Is there any way to do this with the MPMoviePlayerController API?

A: Sorry, but no, there isn't a way to do it pre 3.2


text:
Q: How to make horizontal scrolling in UIWebView in iOS? I am loading a pptx file in UIWebView,it is  getting loaded and it is scrolled vertically,but  it should be scrolled horizontally.Here is my code.
readWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0, [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)];
     NSString *path=[[NSBundle mainBundle] pathForResource:@"MyPPT" ofType:@"pptx"];
      readWebView.scrollView.delegate=self;
        NSURL *url=[NSURL fileURLWithPath:path];
        NSURLRequest *request=[NSURLRequest requestWithURL:url];
        readWebView.scalesPageToFit=YES;
        readWebView.scrollView.showsVerticalScrollIndicator=false;
        readWebView.scrollView.showsHorizontalScrollIndicator=true;
        readWebView.scrollView.scrollEnabled=YES;
        readWebView.autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        readWebView.scrollView.pagingEnabled=YES;
     [readWebView loadRequest:request];
    [self.view addSubview:readWebView];

A: set like
readWebView.scrollView.delegate = self;
[readWebView.scrollView setShowsVerticalScrollIndicator:NO];

-(void)scrollViewDidScroll:(UIScrollView *)scrollVie
{
if (scrollVie.contentOffset.y > 0  ||  scrollVie.contentOffset.y < 0 )
    scrollVie.contentOffset = CGPointMake(scrollVie.contentOffset.x, 0);
}

A: Enable Horizontal scrolling and disable Vertical scrolling:
myWebView.scrollView.delegate = self;
[myWebView.scrollView setShowsVerticalScrollIndicator:NO];

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y > 0  ||  scrollView.contentOffset.y < 0 )
        scrollView.contentOffset = CGPointMake(scrollView.contentOffset.x, 0);
}

the 2nd line there will hide the vertical scroll indicator. Checking if "scrollView.contentOffset.y < zero" will disable the bouncing when you attempt to scroll downwards. You can also do: scrollView.bounces=NO to do the same thing!! By just looking at Rama Rao's answer i can tell that his code will reset the scrollView to (0.0) the moment you try to scroll vertically, thereby moving you away from your horizontal position, which is not good.
Enable vertical scrolling and disable Horizontal scrolling:
myWebView.scrollView.delegate = self;
[myWebview.scrollView setShowsHorizontalScrollIndicator:NO];

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.x > 0)
        scrollView.contentOffset = CGPointMake(0, scrollView.contentOffset.y);
}


text:
Q: Invalid number error - [Error Code: 1722, SQL State: 42000] ORA-01722: invalid number The 1st query from the below 2 queries is giving me [Error Code: 1722, SQL State: 42000] ORA-01722: invalid number error.
But when I limit the no of records as in the 2nd query then it is running fine.
Other than limiting the rows in the 2nd query, both the queries are identical.
SELECT b.first_name,
       b.last_name,
       b.device_derived,
       b.ios_version_group,
       b.add_date,
       FIRST_VALUE (b.add_date)
         OVER (PARTITION BY b.first_name, b.last_name, b.ios_version_group)
         AS first_date,
       LAST_VALUE (b.add_date)
         OVER (PARTITION BY b.first_name, b.last_name, b.ios_version_group)
         AS last_date
FROM   (SELECT a.first_name,
               a.last_name,
               a.os_version,
               a.device_type,
               a.device,
               a.add_date,
               a.device_derived,
               CASE
                 WHEN (    (   UPPER (a.device_derived) = 'IPHONE'
                            OR UPPER (a.device_derived) = 'IPAD')
                       AND TO_NUMBER (SUBSTR (a.os_version, 1, 1)) > 4)
                 THEN
                   'iOS ' || SUBSTR (a.os_version, 1, 1)
                 ELSE
                   'Others'
               END
                 AS ios_version_group
        FROM   (SELECT first_name,
                       last_name,
                       os_version,
                       device_type,
                       device,
                       add_date,
                       CASE
                         WHEN UPPER (device_type) = 'ANDROID'
                         THEN
                           'Android'
                         WHEN    UPPER (device_type) = 'BB'
                              OR UPPER (device_type) = 'BLACKBERRY'
                         THEN
                           'Blackberry'
                         WHEN     UPPER (device_type) = 'IOS'
                              AND (   SUBSTR (UPPER (device), 1, 6) = 'IPHONE'
                                   OR SUBSTR (UPPER (device), 1, 4) = 'IPOD')
                         THEN
                           'iPhone'
                         WHEN     UPPER (device_type) = 'IOS'
                              AND (SUBSTR (UPPER (device), 1, 4) = 'IPAD')
                         THEN
                           'iPad'
                       END
                         AS device_derived
                FROM   vw_mobile_devices_all) a) b;

SELECT b.first_name,
       b.last_name,
       b.device_derived,
       b.ios_version_group,
       b.add_date,
       FIRST_VALUE (b.add_date)
         OVER (PARTITION BY b.first_name, b.last_name, b.ios_version_group)
         AS first_date,
       LAST_VALUE (b.add_date)
         OVER (PARTITION BY b.first_name, b.last_name, b.ios_version_group)
         AS last_date
FROM   (SELECT a.first_name,
               a.last_name,
               a.os_version,
               a.device_type,
               a.device,
               a.add_date,
               a.device_derived,
               CASE
                 WHEN (    (   UPPER (a.device_derived) = 'IPHONE'
                            OR UPPER (a.device_derived) = 'IPAD')
                       AND TO_NUMBER (SUBSTR (a.os_version, 1, 1)) > 4)
                 THEN
                   'iOS ' || SUBSTR (a.os_version, 1, 1)
                 ELSE
                   'Others'
               END
                 AS ios_version_group
        FROM   (SELECT first_name,
                       last_name,
                       os_version,
                       device_type,
                       device,
                       add_date,
                       CASE
                         WHEN UPPER (device_type) = 'ANDROID'
                         THEN
                           'Android'
                         WHEN    UPPER (device_type) = 'BB'
                              OR UPPER (device_type) = 'BLACKBERRY'
                         THEN
                           'Blackberry'
                         WHEN     UPPER (device_type) = 'IOS'
                              AND (   SUBSTR (UPPER (device), 1, 6) = 'IPHONE'
                                   OR SUBSTR (UPPER (device), 1, 4) = 'IPOD')
                         THEN
                           'iPhone'
                         WHEN     UPPER (device_type) = 'IOS'
                              AND (SUBSTR (UPPER (device), 1, 4) = 'IPAD')
                         THEN
                           'iPad'
                       END
                         AS device_derived
                FROM   vw_mobile_devices_all) a) b
WHERE  ROWNUM <= 100;

Can somebody tell me why I am getting this error. Is there an efficient way to write this query?

A: You have TO_NUMBER (SUBSTR (a.os_version, 1, 1) in your queries, so presumably you're hitting data that doesn't have a number at the start of the os_version, when you request more than 100 rows.
You need to check your data.

A: This error happens when you try to convert a non-numeric value with TO_NUMBER.
In the second query the first 100 rows seem not to result into a.os_version to a non-numeric value.
Try a simple select vw_mobile_devices_all to find the non-numeric os_version. Figure out how you can work around the problem. Maybe you can query the os_version differently.


text:
Q: Any way to guarantee all tasks will be attempted with Task Parallel library? This is actually a question of my own in response to my answer to Circular dependency with cross-cutting concern
Is there a variant of Parallel.ForEach that at least guarantees that every possible Task will at least be attempted regardless if any particular task throws an exception?
I realize I can wrap each task in it's own try/catch/finally, etc, (either directly or indirectly) and maybe use some synchronized container save the exceptions, or something, but that seems like a lot of work--with many possible solutions to evaluate--work I would think might be better for the Task Parallel library to handle.
My trials of throwing exceptions within tasks seem to suggest that Parallel.ForEach might abort in the middle and cancel any remaining tasks).  The situation seems similar for {some enumerable}.AsParallel().ForAll({the task});.  I think the strategy of aborting remaining tasks -- or aborting before creating the remaining tasks, as it might be--is a perfectly acceptable behavior in some circumstances.  However, sometimes, tasks are going to die, and it is best that we attempt running as many tasks as we can and keep track of which ones survived and which ones died.
I so see How to handle all unhandled exceptions when using Task Parallel Library? but its not clear to me if that answer my question.
http://blogs.msdn.com/b/pfxteam/archive/2009/05/31/9674669.aspx <= might also be related.
This is not any high priority question for me, I just thought I'd throw it out there just in case others might want to contribute an answer.
Edit: just in case there really is a bug in the code that demonstrates the behavior, here it is (also related to the other question).  I've been running it in LinqPad, and sometimes I see all the WriteLine results, and sometimes I don't.  Please, no critiques of the code quality, I just want to see if I understand what is happening.  I suspect there might be something with that [ThreadStatic] modified variable.
static void Main() //Main(string[] args)
{
    string[] messages = "this is a test.  but it's going to be an issue!".Split(' ');

    try{
        messages.AsParallel().ForAll(Log);
    } catch(AggregateException){
        throw;
    }

    Console.ReadLine();
}
[ThreadStatic]
static bool _disable = false;
public static void Log(string message)
{
    if (_disable)
    {
        return;
    }
    try {
        _disable = true;
        Console.WriteLine(GetPrefix() + message);
        throw new Exception("bar");
    } finally {
        _disable = false;
    }
}

public static string GetPrefix()
{
    Log("Getting prefix!");
    return "Prefix: ";
}

A: First, I think it's confusing when you talk about tasks. What you have are iterations of a loop that will be executed in parallel using Tasks, but that doesn't mean each iterations is a task.
Second, if you're really doing this just for logging, you're not likely to get any performance gain, I don't think logging is parallelizable.
Now, what you could do is to manually create a separate Task for each iteration of the loop and then wait for them to complete using Task.WaitAll(). This way, all iterations will be executed and if some of them fail, WaitAll() is going to throw an AggregateException containing them all.
var tasks = messages.Select(m => Task.Factory.StartNew(() => Log(m)));
Task.WaitAll(tasks.ToArray());

This is likely going to be less efficient that Parallel.ForEach() or PLINQ, but that may be okay for you. If not, then you have to use the try-catch approach you suggested.


text:
Q: Windows Server - Using default rdp license of 2 while having many RDP sessions disconnected makes the RD services busy Hi
I want to test an application running in the background (of every logged in user) while users are logged in to the server using remote desktop but remote desktop session is disconnected.
My windows server 2016 is having the default 2 license for simultaneously connected users, which is all I need since I don't use more than 2 simultaneously connected users.
After ~15 login and disconnect, I start to experience a slowness while remote desktop of the next user.
Finally, it gets to a point where it takes very long time to connect and in some cases I get a message:
"The task you are trying to do can't be completed because remote desktop services is currently busy. please try again in a few minutes. Other users should still be able to log on."
Eventually, I manage to get my 150 users logged in to the server, but this behaviour is driving me crazy every time I need to test it again.
Is this behaviour something that Microsoft deliberately designed so I will have to use their license for multi users?
Again, I don't need simultaneously connected users...
Thanks,
Kobi

A: To solve above problem one can restart term service for btw machine remotely. Trigger below commands to do the same:
(1.) tasklist /s \\servername /svc /fi "imagename eq svchost.exe" (locate PID for TermService)
(2.) taskkill /s \\servername /pid xxxx (may need /f to force, UAC might give problems as well)
(3.) sc \\servername start TermService

A: You may try the following steps:

*

*Login as Administrator

*Open services.msc

*Look for Remote Desktop Services

*Right-click then click on Restart


text:
Q: Vuejs : Accessing Specific URL Segment I have a route/URL :

Ex. http://localhost:8080/qr-codes

I want to access to the first segment
qr-codes
How do I do that ?
I used to be able to do sth like this in Laravel

Request::segment(1);

A: Using URL.pathname and String#split:

const str = 'http://localhost:8080/qr-codes';

const firstSegment = (new URL(str)).pathname.split('/')[1];

console.log(firstSegment);

Vue demo:

new Vue({
  el: "#app",
  computed: {
    path: function() {
      const firstSegment = (new URL(window.location.href)).pathname.split('/')[1];
      return `${firstSegment}/create`;
    }
  }
});

{{path}}

A: const getUrlPathSegments = () => (
  (new URL(window.location.href)).pathname.split('/').filter(Boolean)
)

for example, when you call the function on current stackoverflow page, you get:
getUrlPathSegments() === ['questions', '70427242', 'vuejs-accessing-specific-url-segment']

getUrlPathSegments()[0] === 'questions'


text:
Q: Efficiently processing DataFrame rows with a Python function? In many places in our Pandas-using code, we have some Python function process(row). That function is used over DataFrame.iterrows(), taking each row, and doing some processing, and returning a value, which we ultimate collect into a new Series.
I realize this usage pattern circumvents most of the performance benefits of the numpy / Pandas stack.

*

*What would be the best way to make this usage pattern as efficient
as possible?

*Can we possibly do it without rewriting most of our code?

Another aspect of this question: can all such functions be converted to a numpy-efficient representation?  I've much to learn about the numpy / scipy / Pandas stack, but it seems that for truly arbitrary logic, you may sometimes need to just use a slow pure Python architecture like the one above. Is that the case?

A: You should apply your function along the axis=1. Function will receive a row as an argument, and anything it returns will be collected into a new series object
df.apply(you_function, axis=1)

Example:
>>> df = pd.DataFrame({'a': np.arange(3),
                       'b': np.random.rand(3)})
>>> df
   a         b
0  0  0.880075
1  1  0.143038
2  2  0.795188
>>> def func(row):
        return row['a'] + row['b']
>>> df.apply(func, axis=1)
0    0.880075
1    1.143038
2    2.795188
dtype: float64

As for the second part of the question: row wise operations, even optimised ones, using pandas apply, are not the fastest solution there is. They are certainly a lot faster than a python for loop, but not the fastest. You can test that by timing operations and you'll see the difference.
Some operation could be converted to column oriented ones (one in my example could be easily converted to just df['a'] + df['b']), but others cannot. Especially if you have a lot of branching, special cases or other logic that should be perform on your row. In that case, if the apply is too slow for you, I would suggest "Cython-izing" your code. Cython plays really nicely with the NumPy C api and will give you the maximal speed you can achieve.
Or you can try numba. :)


text:
Q: Use target_link_libraries to libraries not start with lib* I am trying to link my program(hello) with a special library(/path/abc.so) that not starts with 'lib'.
Here is my CMakeLists.txt
add_executables(hello hello.c)

target_link_libraries(hello /path/abc.so)

It works fine, but is there any other way to avoid this full path(/path/abc.so) things?
I don't want to make symlink of abc.so or modify abc.so itself.

A: Probably your best option is not to link directly the library, but use imported targets:
You can have your library target as
add_library(ABC SHARED IMPORTED)
set_target_properties(ABC PROPERTIES
            IMPORTED_LOCATION path/to/library/abc.so
            INTERFACE_INCLUDE_DIRECTORIES path/to/include
            )

Then you can link it as a target:
target_link_libraries(hello ABC)

The next step would be to have a library find module, or config module, so you don't define full path in your CMakeLists.txt, but search for the library, or just include a .cmake file with all of the paths.
Have a look HERE and HERE