text:
Q: Обработка формы Есть форма
<form action="test.php" method="post">
    name<input type="text" name="nemus">

    family<input type="text" name="famel">

    <input type="submit">
</form>

И есть файл test.php со скриптом, который ее должен обрабатывать
<? echo"Поздравляем $nemus $famel вы выиграли авто!";?>

Но в сообщении test.php при обработке появляется только текст, сами переменные не обрабатываются.
A: Быть может, потому что не привязаны переменные $nemus и $famel к аналогичным элементам из массива $_POST? С выключенным register_globals ))
$name = (isset($_POST['name']))?htmlspecialchars($_POST['name']):"";


text:
Q: Touch tracking for multitouch I am creating a game using GLKit (not using Cocos2d) and I basically need two "buttons" - each button 250 points wide and placed on opposite sides in landscape mode. MultipleTouch is YES as I need to track more than one touch.
In touchesbegan I determine if the touch.x <= 250 (Button 1) or >= view.bounds.size.width - 250 (Button 2). Based on this I set a BOOL to YES to determine state.
In touchesended I want to know when the user is no longer "pressing" Button 1 or Button 2. The thing is - I cannot just test where the touch happened in the view any longer as the user could have moved the finger so it is no longer over the "Button" that was initially pressed. That means if the user started the touch by pressing Button 1 but moved the finger outside the Button boundaries and then lifted the finger - the state is still YES.
Is there a good way to reliably track where the touch first started in TouchesEnded? Any pointer to source code would be highly appreciated.
Edit:
Here is the code I have created:
Please note that I know this code is wrong as it only tracks one touch. However, what I want to achieve is when the user presses the left button and moves the finder out of that button .. I need to know that the touch in touchesEnded is equivalent of the touch that started in the button earlier on so that I know that button is no longer "pressed".
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];

    // Determine where the touch happened
    CGPoint p = [touch locationInView:self.view];

    // If the user pressed the left gutter then break
    if ( p.x <= 250 )
        isBreaking = YES;

    // If the user pressed the right gutter then accelerate
    if ( p.x >= (self.view.bounds.size.width - 250) )
        isAccelerating = YES;
}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];

    // Determine where the touch happened
    CGPoint p = [touch locationInView:self.view];

    // If the user pressed the left gutter then stop break
    if ( p.x <= 250 )
        isBreaking = NO;

    // If the user pressed the right gutter then stop accelerate
    if ( p.x >= (self.view.bounds.size.width - 250) )
        isAccelerating = NO;
}

A: I think I found the solution, though I have not yet tested it: http://www.blumtnwerx.com/blog/2009/06/taming-touch-multi-touch-on-the-iphone/
What I really needed to know is in the docs:

A UITouch object is persistent throughout a multi-touch sequence. You should never retain an UITouch object when handling an event. If you
  need to keep information about a touch from one phase to another, you
  should copy that information from the UITouch object.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Expanding Java Regex to match word containing certain string So I've got this regex:
String tagsRegex = "^(" + String.join("|", tags) + ")$";

Which will match everything being exactly the string tags. For instance, if tags is john, it will match JUST john but not johnny or thejohnman.
What I want is to match *tag*, in other words I want to match every word which contains the string stored in the variable tag.
Any  hint?

A: Try using your regex as:
String tagsRegex = "\\w*(" + String.join("|", tags) + ")\\w*";

This is assuming your array tags doesn't have any elements with special regex symbols such as [()*+] etc.
With above if array tags is: {"foo", "bar", "baz"} then built regex will be:
\w*(foo|bar|baz)\w*


text:
Q: Curly braces in verilog I was looking through a program and found the following code:
{a2, a1} <= {a1, b};

I am not sure whether the program that I'm going through is written in Verilog or SystemVerilog. I know the curly braces are used for concatenation operation in Verilog, but then I don't quite follow what kind of concatenation is being done here. Also since I'm not sure whether the given snippet is in Verilog or SystemVerilog, I'm left confused with the code. Also does curly braces denote another operation in SystemVerilog…?
Thanks in advance

A: This is just concatenation treating the Left and right hand side as one variable each. SystemVerilog 2009 replace Verilog, so is backwards compatible with most (all?) syntax.
For example
wire [0:0] l1;
wire [2:0] l2;
reg  [1:0] r1;
reg  [1:0] r2;

assign {l1,l2} = {r1,r2} ;

Is the same as
assign l1[0] = r1[1];
assign l2[2] = r1[0];
assign l2[1] = r2[1];
assign l2[0] = r2[0];


text:
Q: How to convert char into an array in Informix database? I have a stored procedure like this:
CREATE PROCEDURE Proc_Test(testvalue set(char(1000) not null))  RETURNING int;
        DEFINE z char(7000);
        LET z = ' ';

FOREACH
select * into z from table(testvalue)
END FOREACH;
return 1;
end procedure;

Due to the change in the requirement I would like to change this stored procedure as:
CREATE PROCEDURE Proc_Test(testvalue char(7000) not null) RETURNING int;
            DEFINE z char(7000);
            LET z = ' ';
    CAST(cvg AS set(char(1000)));
    FOREACH
    select * into z from table(testvalue)
    END FOREACH;
    return 1;
    end procedure;

I am having some unknown syntax error.
I know the error is here:
CAST(cvg AS set(char(1000)));

Do you know better way to cast a variable to another type to convert it at runtime?

A: Puzzlement
What exactly is your procedure supposed to do?  As far as I can see, it is a contorted test for 'is the string in testvalue NULL'?  Maybe...Actually the code unconditionally returns 1, so it is not clear that it even does the null test, but the procedure likely executes quicker on a null string than on a string with a value.
Diagnosis
The syntax error arises because 'cvg' is not a defined variable in the procedure.  Also, the CAST would have to be on the RHS of an assignment or something similar.  And I'm not clear that you can break up a CHAR(7000) into seven CHAR(1000) fields in a set with a cast.
Fix?
However, I can't advise you what to do since I don't understand the old or new requirements.


text:
Q: iADs what do i do now and can i get some advice on the app store? Hi everyone i was wondering about iAD's. I created a application with them in it but i was wondering what now, do i have to create the ads or does apple populate them for me ? and this will be my first app in the app store any advice. I'm kind of nervous i remember steve saying at the last keynote " This isn't amateur hour" i mean i worked hard on the application ( as hard as a 13 year old using Xcode can work) but i'm not a artist at the images. will they reject my app for images? I'm sorry for all the questions but any advice would defiantly help. thanks :)

A: Apple will populate your app with ads. You just need to call the iAd framework correctly and enable iAds when you load the app into the iTunes Connect (there is a button and some extra forms to fill out)


text:
Q: sound in canvas or webgl alright i'm a little stuck on this one. i did some research and didnt find any kind of "sound equalizer" in a canvas/webgl. so my intention is to load the sound to the scene and get the information of the file and effect the objects in the scene.
i'm searching for some kind of "sound effector" like in "cinema4d".
is there any existing attempt in the browser? (webgl/canvas)?
here is an example what it should do:
sound effector
the graphics are not the problem.
is it possible to let the objetcs being effected by a sound or a song you can load into the scene?

A: I had a play with the Audo Data API in Firefox last year so it's doable.
There are blog posts out there and you should also have a look at this project: dynamicaudio.js (which has a Flash fallback)


text:
Q: publish ios app without any registered device I have completed an ios app that I want to get published. I do not have any apple devices other than my mac. I used the simulator to test my app. I tried to make a provisioning profile   in the member center and link it up to my app but Xcode keeps telling me that it cannot find any compatible provisioning profiles since I do not have any ios devices registered in the member center. I believe that I cannot register my mac as an ios device. I tried doing that in the member center using my mac's UDID but it did not recognize the UDID.
I want to know if there is any way I can still have the app published without buying any other ios device?

A:
I used the simulator to test my app.

Then you did not test your app. The simulator is useful but it is nowhere near an adequate substitute for device testing. What if users report that the app crashes on their devices, but you can't reproduce the crash in the simulator? This is not a hypothetical scenario, it's actually quite common.

I want to know if there is any way I can still have the app published without buying any other ios device?

Possibly, but it would be extremely unwise to publish the app without testing it on a device. If you can't get a device, try to borrow one.

A: I see only workaround here - Get device from your friend or family and register it for first install. You just need its UDID to register.


text:
Q: Indexing PDF in SP2013: iFilter parser error, No filter installed for extension 'pdf' When I attempt to index PDF files I get an error from the Crawl log in Central Admin:
"Processing this item failed because of a IFilter parser error.  (…) No filter installed for extension 'pdf'"
To my understanding, the possibility of using custom PDF iFilter came back to Sharepoint after the July 2014 CU (source). At one point PDF's were indexing just fine. This is what I have done:

*

*Set the UseIFilter property to true through
Set-SPEnterpriseSearchFileFormatState in PowerShell

*Installed FoxIT PDF iFilter

*Ran full crawl and saw that PDF files were being indexed+searchable by content

*The trial of FoxIT seems to have run out and it is decided not to purchase this software, since indexing PDF's is possible through a standard SP2013 installation (am I mistaken?)

*I can't say for sure when these errors started appearin (before or after trial expiration), but I find it natural to think that this happened after the trial ran out

*Uninstalled FoxIT PDF iFilter, hoping the file handler through SP2013 would know how to index PDF's

I think I read somewhere that Adobe Reader was bundled with an iFilter, so I have also installed this on both the search server and frontend server. This did't seem to have much impact other than removing another error that was seemingly related to this: "Processing this item failed because of a IFilter parser error.  (…) Value does not fall within the expected range".
Have I broken the indexing by installing/uninstalling or by changing UseIFilter property? Do I need to re-register the iFilter for this document type? If so, how do I do that?

A: I would get rid of all the Adobe products and change the UseIFilter property back to false. Then run a full crawl to determine if the native PDF file handler is working correctly.

A: I am sure you index will be fine after installing or uninstalling but you have to have run the full crawl after this activity.
I think you should remove the custom ifilter as it is trial version and expired. We had metalogix trail product in our farm which give us tough time after expired trial.
I would uninstall the 3rd party ifilter and then configure search to use the default one.
after that "Your change is effective after you restart the SharePoint 2013 Search Host Controller process of each server that hosts a content processing component in the Search service application."
Now run full crawl.
https://technet.microsoft.com/en-us/library/jj730455.aspx

A: TLDR; install the July 2016 CU for SharePoint 2013.
Full answer:
We were in the same boat but with a custom IFilter for a file type is widely used by the industry my company is in.  The ifilter worked fine with SP2007 and SP2010 but with SP2013 we found that SharePoint was never loading the filter for the file type.  It turns out that Microsoft changed how they detect a files type, instead of trusting the extension they look inside at the content. I suppose they had too many instances of files being handled improperly due to the wrong extension. The problem was that if your file type was a ASCII text file, their auto-detection would always trigger first and never trigger the loading mechanism for custom file types.  The July 2014 CU was supposed to fix it by giving us the new parameters listed in the question, but it didn't work for us.
I was able to demonstrate using Process Explorer that the registry entry for the file type was never being read which meant that SharePoint was not honoring the 'useIfilter' parameter even when it was properly configured.  I know this because we opened a support ticket with Microsoft and walked them through the installation, registry, test cases, etc. and even sent them a copy of the ifilter along with a test file and the product group admitted it was a bug.  Microsoft has posted a fix for this in the July 2016 CU. Admittedly we aren't done with our testing but I can see that the custom ifilter is now being loaded so I have hope that this is fixed.


text:
Q: QGIS Plugin reload is incomplete I am developing a QGIS Plugin in PyCharm. I use the QGIS Plugin "Plugin reloader" to reload the plugin when I want to test the plugin. But changes in the code are not applied on running the plugin most of the time.
I have to reload the plugin a second time or oftener to update the plugin (I am waiting till the reload-info-dialog disappears, before testing the plugin). The likelihood to reload the code, in the plugin-base-path is higher than in a containing directory.
After restarting qgis, the plugin works as expected. But I cannot restart QGIS for every test!
Edit:
I use QGIS 3.8 on Windows 10 (Plugin reloader 0.7.8)
The "plugin-base-path" is the plugin-directory where my_plugin.py is. Here i have subdirectories to handle the plugin-files.


text:
Q: async signalr hub - returning root task not pushing events I am using .net 4.0. I have an async signalR Hub which returns a Task.
The root Task also has a ContinueWith associated to it.

*

*When I return the 1st/root task, my Clients.Caller pushes do not appear in the browser.

*When I return the ContinueWith task my Clients.Caller pushes do appear in the browser.

So this does push updates out to the browser....
public class MyHub : Hub
  ......

public Task DoSomething()
{

    return myService
      .DoSomeIO()
        .ContinueWith(t => {
           Clients.Caller.helloWorld("hello world");
            //do other stuff
         });
 }

this does not..
public class MyHub : Hub
  ......

public Task DoSomething()
{
   var rootTask = myService.DoSomeIO();
   rootTask.ContinueWith(t => {
                               Clients.Caller.helloWorld("hello world");
                               //do other stuff
                       });
    return rootTask;
}

Why is this?
The reason I am asking is because I can unit test the second scenario, but cannot for the first. Using the second scenario I can start the task, then wait for it to completed and control will jump into the continuewith then I can make my assertions regarding the subsequent service calls.
I cant start the second task as I get a

Start may not be called on a continuation task

A: Using Tasks that can be Start()ed should be very rare. Most of the time, you don't need this functionality and as you discovered, it doesn't work with continuations and other kinds of Tasks (e.g. async Tasks from C# 5.0).
Because of that I think you should switch to using already started Tasks everywhere. This means:

*

*Changing DoSomeIO() so that it returns an already started Task.

*Changing your mock to return a started or even finished Task, e.g. by using TaskCompletionSource.

*Removing the call to Start() from your unit tests.

When you do all that, you should be able to use the working version in your unit tests without any problems.


text:
Q: how to set multiple pattern for one method in spring mvc controller In my controller:
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
    return "page/post/list";
}

I want url with pattern '/' or '/list' or '/index' are all handled by this method,is there any way to config it?

A: @RequestMapping(value = {"/", "/list", "/index"}, method = RequestMethod.GET)
public String index() {
    return "page/post/list";
}


text:
Q: AirPort Utility (5.6) stuck on "Configuring your existing wireless network to allow it to be joined" I just bought a new AirPort Extreme and set it up as my main wireless network. I also have a 1st gen. Time Capsule and a 1st gen. AirPort Extreme in addition that I want to connect like this:
Main AE --> TC 1st gen --> AE 1st gen
The first two I have managed to set up flawlessly, and that works great. Now I'm trying to connect the last AE to the TC, but when I set it up in AirPort Utility 5.6, it displays the text "Configuring your existing wireless network to allow it to be joined", and doesn't do anything.

I have no idea why it won't work, but if I try to set it up via Lion-AirPort Utility, it just chooses the main AE, and won't let me choose to connect to the TC.
Is this a known bug, or is there a way to fix it?
Thanks.

I tried to use Lions AirPort Utility again, and found a way to choose which base station to extend, but it only shows the main AE again.

A: AirPort Utility 5.6 isn't really supported anymore, so I found the only true solution to be to use Airport Utility 6.1.
To solve this question, I had to reset every single AirPort Express, Extreme and Time Capsule, but it works a lot better now.


text:
Q: Exception has been thrown by the target of an invocation when using Tesseract ocr I'm coding a program that extract text from image using Tesseract .. The program should bring all images from a directory and put them one by one in a picture box and then extract the text from them. I have downloaded an English trained data from this link and put it inside Debug folder https://github.com/tesseract-ocr/tessdata/blob/master/eng.traineddata
The exception is:
Here's my code: Exception has been thrown by the target of an invocation.
and the inner exception indicated in catch was : Failed to find library "liblept172.dll" for platform x86.
private void button1_Click(object sender, EventArgs e)
{
    Image image;
    string[] images = Directory.GetFiles("E:\\Omar Project\\New", "*.png");
    for (int i = 0; i < images.Length;i++)
    {
        image = Image.FromFile(images[i]);
        pictureBox1.Image = image;
        //ocr = new TesseractEngine(@"tessdata", "eng", EngineMode.Default);
        using (var engine = new TesseractEngine("E:\\Omar Project\\Extracting Text From Image Using Microsoft Office\\Extracting Text From Image Using Microsoft Office\\bin\\Debug\\eng.traineddata", "eng", EngineMode.Default))
        {
          using(var img=Pix.LoadFromFile(images[i]))
          {
              using(var page=engine.Process(img))
              {
                  richTextBox1.Text += page.GetText();
              }
          }
        }
    }

}

A: Create a folder "x64" or "x86" in your project directory (where your .csproj file is located) and copy liblept1760.so and libtesseract400.so into it. Now you should be able to see your both files in visual studio. You will have to set "copy to output directory" (is the property called like this in english?) for both files to "always"
Make sure you have the following packages installed inside your container
apt-get install -y libgif7 libjpeg62 libopenjp2-7 libpng16-16 libtiff5 libwebp6

Otherwise the dlopen command for liblept will fail and you will get your mentioned errormessage.
If you don't have the liblept package installed inside your container and only copied the .so file into the x64 directory, the open command for libtesseract will fail.
To fix this, you have to create a sym link to your liblept shared object.
Just run inside your container / Dockerfile
ln -s /app/x64/liblept1760.so /usr/lib/x86_64-linux-gnu/liblept.so.5

Make sure to use the correct source path. For default asp.net core docker images and my described way /app/x64/liblept1760.so should be working.

A: Wiki Tesseract
Common reasons for failure are:
The Visual Studio 2015 x86 & x64 Runtime is not installed, as detailed on the main readme page these can be found here.
The x86 and x64 versions leptonica (liblept172.dll) and tesseract (libtesseract304.dll) were not copied to their respective folders in the bin directory.
DotNet may be reporting the wrong architecture, for instance a known issue is that for an Application compiled using the prefer 32-bit flag will report it's running on x64 when running on windows 64-bit OS (see issue #55). A common workaround is to either change the cpu architecture to x86.
Your running this on an unsupported architecture (e.g. ARM).
Further diagnosis
Tesseract will write the detected architectures and paths searched to the System.Diagnostics source named "Tesseract" which will be helpful for figuring out what is going on. An example configuration is provided at the end of the page.
If the correct version of the library is being found but fails to load, the log will tell you if this is the case, then the next step is to enable logging of binding errors and check the fusion log. Note that it's been my experience that Windows may log these errors to the Windows Event Log so it might be worth checking that first. Further details can be found here:
https://blogs.msdn.microsoft.com/suzcook/2003/05/29/debugging-assembly-loading-failures/
http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net
If you cannot resolve the issue please file a new issue including the library version, operating system your executing the code on, the target architecture for the entry program, and a copy of the full standard and trace outputs. Note you'll need to enable System.Diagnostics output for the Tesseract source as previously mentioned.


text:
Q: A couple of questions about closed subgroups of a topological group. I am reviewing my previous exams, and I completely missed the following two-part question. It deals with closed subgroups of topological groups under certain situations. I am having trouble working it out. I'm not sure where to begin.

A. Let $f: \mathbb{R} \rightarrow G$ be an injective homomorphism of topological groups. Is is true that $f(\mathbb{R})$ must be a  closed subgroup of $G$?
B. Suppose that a topological group $G$ has a subgroup $H$ which is isomorphic (as a topological group) to $\mathbb{R}$. Does is follow that $H$ is closed in $G$?

Many thanks, and I really appreciate any help!

A: $\newcommand{\cl}{\operatorname{cl}}\newcommand{\int}{\operatorname{int}}$An affirmative answer to (B) follows immediately from the theorem that a locally compact subgroup of a Hausdorff topological group is closed, since $\Bbb R$ is locally compact.

Proof: Let $G$ be a Hausdorff topological group, and let $H$ be a locally compact subgroup of $G$. Let $W$ be a nbhd of $1_G$ in $G$ such that $W\cap H$ is compact, and let $U=\int_GW$. Suppose that $g\in\cl_GH$; then $gU^{-1}$ is an open nbhd of $g$, so we may choose $h\in gU^{-1}\cap H$. Clearly $g\in hU$. Let $$\mathscr{N}=\{N\subseteq G:1\in\int_GN\text{ and }gN\subseteq hU\}\;,$$ and for $N\in\mathscr{N}$ let $H_N=gN\cap H$; $gN$ is a nbhd of $g$, so $H_N\ne\varnothing$ and $g\in\cl_G H_N$. Moreover, $$H_N\subseteq hU\cap H\subseteq hW\cap H=hW\cap hH=h(W\cap H)\;,$$ so $$g\in\bigcap_{N\in\mathscr{N}}\cl_GH_N\subseteq\cl_Gh(W\cap H)\;.$$ $W\cap H$ is compact, so $h(W\cap H)$ is compact and therefore closed in $G$, so in fact we have $g\in h(W\cap H)$. But then in particular $g\in hH=H$, and $H$ is therefore closed. $\dashv$

Added: Martin has provided a negative answer to (A) in the comments below; I take the liberty of repeating it here to make the answer self-contained. Let $\alpha$ be any irrational number, and define $f:\Bbb R\to\Bbb R^2:x\mapsto\alpha x$. Let $q:\Bbb R^2\to\Bbb R^2/\Bbb Z^2$ be the quotient map, and let $h=q\circ f$. Then $h$ is in injective homomorphism of $\Bbb R$ into the torus $\Bbb R^2/\Bbb Z^2$. The fact that $h$ is injective follows from the irrationality of $\alpha$. The irrationality of $\alpha$ also implies that $h[\Bbb R]$ is dense in $\Bbb R^2/\Bbb Z^2$. In fact, pick any $x\in(0,1)$ such that $\alpha x$ is also irrational; this proof that $\{nx:n\in\Bbb Z\}$ is dense in $\Bbb R/\Bbb Z$ can easily be adapted to show that $\{h(nx):n\in\Bbb Z\}$ is dense in $\Bbb R^2/\Bbb Z^2$.


text:
Q: Custom 404 page when using IIS 7 Url Rewrite Module I'm nearly done doing a major rewrite and redesign/restructuring of an existing website that gets a lot of traffic. I've been using the IIS 7 Url Rewrite Module to enable extension-less and SEO-friendly urls, as well as to redirect requests for old pages to appropriate pages in the new site structure. It's been going well, but I'm looking into how to set up a custom 404 page and am stymied. So far, I've set up the following code in the  node of the web.config:
<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" subStatusCode="-1" />
  <error statusCode="404" prefixLanguageFilePath="" path="/404.htm" responseMode="ExecuteURL" />
</httpErrors>

The thing is, it WORKS, but not quite! If I go to an non-existent URL, I do get served my custom 404 page, but the request get a 200 OK status code in response instead of the desired 404. I've fiddled with various attributes of the httpErrors node but no luck. Does anyone know how to show the custom 404 page AND return an actual 404 status code?
Thanks!

A: To get our custom 404 handler working, we had to do the following:
    <customErrors defaultRedirect="ErrorPage.aspx" mode="On">
        <error statusCode="500" redirect="ErrorPage.aspx" />
        <error statusCode="404" redirect="/404.aspx" />
        <error statusCode="403" redirect="ErrorPage.aspx" />
    </customErrors>

AND
    <httpErrors errorMode="Custom">
        <remove statusCode="404" subStatusCode="-1" />
        <error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
    </httpErrors>

I actually think I ran into the same problem, where I specified only the one type of error. This might not work for extensionless -- but hopefully it sets you on the right track.

A: This worked for me, in the code behind of the 404.aspx:
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Response.StatusCode = 404;
        this.Response.StatusDescription = "Not Found";
        this.Response.TrySkipIisCustomErrors = true;
    }


text:
Q: Cox hazard Model: HR of 1 variable greater than 1 in simple regression becomes smaller than 1 in a multiple regression I'm performing a simple and multiple Cox regression. I have 1 dependent variable
$y$ and 10 independent variables:
$$X = x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_{10}$$
A particularity of the model is that
$${x_8}_i + {x_9}_i = {x_{10}}_i$$
(i.e. that the vector $x_{10}$ is the addition of $x_8$ and $x_9$)
When running the simple Cox regression model

*

*$x_1$, $x_2$, $x_3$, $x_4$, $x_5$, $x_6$, $x_7$ are not survival predictors (i.e. their HR are cross 1 and are of the type HR: 1.1, 95% CI: [0.8-1.2}, p > 0.05)

*whereas $x_8$, $x_9$, $x_{10}$ are predictor of poorer (i.e. their HR are above 1 and are of the type HR: 1.2, 95% CI: [1.1-2.0}, p < 0.05)

When running the multiple Cox regression model

*

*$x_1$, $x_2$, $x_3$, $x_4$, $x_5$, $x_6$, $x_7$ are still not survival predictors

*$x_8$, $x_9$, $x_{10}$ are still predictor of poorer (i.e. their HR are above 1 and are of the type HR: 1.2, 95% CI: [1.1-2.0}, p < 0.05)

*whereas $x_{10}$ are predictor of better (i.e. their HR are under 1 and are of the type HR: 0.8, 95% CI: [0.6-0.9}, p < 0.05)

Here are my questions:

*

*Is it ok to use a variable such $x_{10}$ which is a linear combination of other 2 explanatory variables (in this case $x_8$ and $x_9$)

*How come $x_{10}$ which is statistically significant predictor of poorer survival in the simple model becomes a significant predictor of better survival in the multiple model (instead of simply becoming a non significant predictor of poorer survival). Does it have to do with the fact that it is a linear combination of $x_8$ and $x_9$


text:
Q: writing multiple returns to a file in python I need to write the returns of each function in to a text file. I have used the code below. However, when I have multiple functions, this process of using file1.write() consumes a lot of time and lines. Is there any smarter method to write the outputs?
def function1():
    #some operation
    return "Status 1" + "\n\n"

def function2():
    #some operation
    return "Status 2" + "\n\n"

def function3():
    #some operation
    return "Status 1" + "\n\n"

if __name__ == '__main__':

    file1 = open("test.txt","w")

    output1 = function1()
    file1.write(output1)

    output2 = function2()
    file1.write(output2)

    output3 = function3()
    file1.write(output3)

    file1.close()

I have modified the code since many are confused with my question.

A: This code can be made shorter (and possibly clearer) by replacing everything below if by:
with open("text.txt","w") as file1:
    for func in (addition, subtraction, multiplication):
        file1.write(func(5,6))

but this won't improve execution time.

A: It looks like you're trying not to repeat yourself so much.  You can take advantage of the fact that functions are "first class objects" in order to iterate over them.  Also, you can take advantage of the features of the functools module to reuse the basic structure of nearly identical functions.  The following code will produce identical output to your example with far less repetition of code:
import functools

def base_func(func_id):
    return 'status of {}\n\n'.format(func_id)

functions = [functools.partial(base_func, i+1) for i in range(3)]

if __name__ == '__main__':
    with open('test.txt','w') as file1:
        for func in functions:
            file1.write(func())

However, it will almost certainly not run execute any faster, but given your example I'd hardly thing computing performance should  be of great concern.

A: The fastest text writer I've come across is Pandas, which I usually use with NumPy.  So it would look something like this:
import pandas as pd
import numpy as np
a=np.zeros(len(results)) #if you know the result size
#now store all your results in a
a[0]=add(5,6)
a[1]=sub(5,6)
a[2]=multiply(5,6)
#continue
b=pd.DataFrame(a)
b.to_csv('test.csv', header=False, index=False, sep=',')

Hope you get the idea - sep can be any delimiter.  If you need a multidimensional array you can do that too.


text:
Q: Facilitate Single Sign On Between Asp.Net Forms Authentication and Asp.Net Core 1.0 with Framework We have a multiple applications under one domain, and every application is built in asp.net mvc. Currently single sign on is facilitated using forms authentication, shared machine key. All applications are on same server for now.
For one our new application we considering asp.net core with framework option. We have an Accounts application which handles authentication(login/logout) for existing application. And we have build STS, using Identity Server3 into the same application.
www.mydomain/Accounts
www.mydomain/app1
www.mydomain/app2
www.mydomain/asp.netcoreApp1

The new test asp.net core application(client) using openIdConnect communicates with STS, Identity Server3 and is working fine.
Challenge: Have to facilitate single sign on between existing applications, which uses Forms Authentication,  and new Asp.Net Core.
Operational/Environment Facts:

*

*All applications are on same machine.

*Access to machine key.

*On navigation from app1 to asp.net core cookies are available in Request header.

Problem Scenarios:

*

*If user successfully logins to app1 and navigates to asp.net core the user has to logon again for authorized access. No issue with anonymous access.

*Similar to #1 vice versa case.

*If user logout in any one of the application then user should be log out from all the applications.

Since test application built using Asp.net core with framework option, will  FormsAuthentication be compatible? direct me to documentation or code snippet?
Please share your ideas.


text:
Q: How to observe garbage collection of a WeakMap in Javascript? It is my understanding of WeakMap that "References to objects in the collection are held weakly. If there is no other reference to an object stored in the WeakMap, they can be garbage collected."
Why do the following key/value pairs still appear in the WeakMap after the references have been removed? Shouldn't the WeakMap be empty?
let dog1 = {name: 'Snickers'};
let dog2 = {name: 'Sunny'};

var strong = new Map();
var weak = new WeakMap();

strong.set(dog1, 'Snickers is the best!');
strong.set(dog2, 'Sunny is the 2nd best!');
weak.set(dog1, 'Snickers is the best!');
weak.set(dog2, 'Sunny is the 2nd best!');

dog1 = null;
dog2 = null;

console.log(strong);
console.log(weak);

/*
Output
Map(2) {{…} => "Snickers is the best!", {…} => "Sunny is the 2nd best!"}
WeakMap {{…} => "Snickers is the best!", {…} => "Sunny is the 2nd best!"}
*/

setTimeout(function(){
console.log("1200ms later... waiting for garbarge collection");
console.log(strong);
console.log(weak);
}, 1200);

/*
Output
Map(2) {{…} => "Snickers is the best!", {…} => "Sunny is the 2nd best!"}
WeakMap {{…} => "Snickers is the best!", {…} => "Sunny is the 2nd best!"}
*/

A: After fixing the bugs pointed out by @Amadan @Bergi @Geeganage, the following code gives the desired output in Safari and Chrome, with garbage collection running after one of the several newly added timeouts. Resulting in the final WeakMap not holding onto any references.
let dog1 = {name: 'Snickers'};
let dog2 = {name: 'Sunny'};

var strong = new Map();
var weak = new WeakMap();

strong.set(dog2, 'Sunny is the 2nd best!');
weak.set(dog1, 'Snickers is the best!');

dog1 = null;
dog2 = null;

console.log(strong);
console.log(weak);

/*
Output
[Log] Map {{name: "Sunny"} => "Sunny is the 2nd best!"} (1)
[Log] WeakMap {{name: "Snickers"} => "Snickers is the best!"} (1)
*/

setTimeout(function(){
console.log("1200ms later... waiting for garbarge collection");
console.log(strong);
console.log(weak);
}, 1200);

setTimeout(function(){
console.log("3200ms later... waiting for garbarge collection");
console.log(strong);
console.log(weak);
}, 3200);

setTimeout(function(){
console.log("6200ms later... waiting for garbarge collection");
console.log(strong);
console.log(weak);
}, 6200);

setTimeout(function(){
console.log("12200ms later... waiting for garbarge collection");
console.log(strong);
console.log(weak);
}, 12200);

/*
Output (eventually)
[Log] Map {{name: "Sunny"} => "Sunny is the 2nd best!"} (1)
[Log] WeakMap {} (0)
*/

Since garbage collection is not guaranteed to run, if you paste the code into the console while scrolling a JS heavy website, GC may actually run after the first timeout.

A: Your code is totally fine, the problem is that it is not guaranteed to show you your desired results, garbage collection happens when ever JS engine decides that it is time to do so ... we can not define the time it does it. That's exactly why WeakMap does not support iteration and methods keys(), values(), entries(), because we don't know if those keys and values are there or not ... in other words we don't know if garbage collection has happened at that moment or not.
If we have a loose reference, and it has not been garbage collected yet, these methods give us wrong results, and that's why they are disabled for WeakMap

A: In here you firstly created two seperate javascript objects called(reference
   variable names) dog1 and dog2:
    let dog1 = {name: 'Snickers'};
    let dog2 = {name: 'Sunny'};

And then you've created two different Map objects called strong and weak.
    var strong = new Map();
    var weak = new WeakMap();

In here you only set the value of the reference variable as the key for both
  Maps. And that map object is a seperate object and it doesn't have any
  connection with those reference variables "dog1" and "dog2" anymore after those
  values are put as the keys of that map objects.
   strong.set(dog1, 'Snickers is the best!'); // Here after value of dog1 doesn't affect map "strong"
   strong.set(dog2, 'Sunny is the 2nd best!'); // Here after value of dog2 doesn't affect map "strong"
   weak.set(dog1, 'Snickers is the best!'); // Here after value of dog1 doesn't affect map "weak"
   weak.set(dog2, 'Sunny is the 2nd best!'); // Here after value of dog2 doesn't affect map "weak"

So, after put the values of these variables in to the maps, even you assign null
  value to those reference variables it doesn't affect the map. Because they are
  seperate objects and don't depend on each other anymore.
   dog1 = null;
   dog2 = null;

So, even you check it after 1200ms also the result is same. Because making
   changes(by assigning null) to those reference variables doesn't affect the map.
   setTimeout(function(){
     console.log("1200ms later... waiting for garbarge collection");
     console.log(strong);
     console.log(weak);
   }, 1200);

And also you still have a reference variables strong and weak,so they are not
  still elegible for garbage collection.
Hope that following link will help you to learn garbage collection in
  JavaScript:
https://dzone.com/articles/memory-management-and-garbage-collection-in-javasc


text:
Q: Will a github token leak when running github actions I'm running Github actions workflow in a private repo, and it pushes changes in a public repo. I'm providing my GitHub token in the private repo for the workflow github actions. Will my token leak in my public repo .git?
Can somebody clarify this? I'm don't have knowledge of security things :(

A: The Automatic token authentication page uses a GITHUB_TOKEN secret, which should, as its name suggests, remains... a secret.

At the start of each workflow run, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow.
You can use the GITHUB_TOKEN to authenticate in a workflow run.
The GITHUB_TOKEN secret is a GitHub App installation access token.
You can use the installation access token to authenticate on behalf of the GitHub App installed on your repository.
The token's permissions are limited to the repository that contains your workflow.

So you should not need to use your own GitHub token, only the one generated by GitHub Action.


text:
Q: Howto: SaaS / PHP Application / Tenants / Security Being completely new in the webhostingcorner I have a few questions on how to implement/setup a webserver for a SaaS application. I'm about to rent my own server for a new product (CMS) I'm launching in two months. Developing the system wasn't that much of wild ride to me, but a correct way to implement it, is.
So lets say this is my situation:

*

*I want to host 10 websites for 8
clients.

*There are 6 single sites, and two clients have two websites they can
manage with my software.

*The CMS must be placed on the server too, all clients are
connecting to 1 system

*The database must be placed

*Depending on the contract a client makes, the client gets some storage.
How to measure the used storage over
the DB, FileSystem and email

*Clients may not, in any case be able to somehow get outside their
directory, but from the CMS directory
the CMS must be able to create files
and dirs in a clients directory (for
templates, imagegalleries, widgets,
etc, etc).

I was thinking about something like a dirstructure like this:
./CMS/          [all CMS files]
./Websites/*/   [all websites]
My hostingprovider will install updates to the os (CentOS, latest) and the admin panel (Direct Admin).
Is there anybody with experience on this topic? Or do you have some thoughts about it? please join the conversation since I'm completely new to this.

A: Have you considered a virtualization strategy?
That way you can easily manage the amount of disk space available for a client. You can make sure clients can't access each others stuff. And you can be prepared to scale out to a more clients by making sure that the virtual machines are automatically installed by a template or from a golden image. If you need more hardware, just add another host and start deploying virtual machines or move already running virtual machines to the new host. Also properly setup virtual infrastructure will enable you to very quickly move virtual machines into a public cloud like Amazon EC2 or RackSpace. If a client of yours gets slashdotted it can be a life safer to just throw that clients virtual servers into the cloud and not have your other clients get bogged down.

A: I don't get that shiny new term now widely used on the Internet "SaaS", but... let's join the discution :)
Is your software ready ?
For disk space quotas there are a few possibilities:

*

*standard quotas (managed at the filesystem level, let's say on extfs as it is the most common)

*partitioning / volume management: LVM is very handy to create slices of disk space for the costumers

If I understand you well enought, everybody would get the same software but may be able to add its extra files/themes.
I don't know if it would be a great solution for you but it is possible to mount a reference template (let's say a LVM slice) in read-only mode and mount in write mode a customer disk space on a "theme" or "custom" folder.
This way, all changes you make to the reference template is "deployed" for all your customers.
Tell more about your wishes and needs so that we can add more advices

A: To get it more like a conversation I'll post a new answer.
SaaS is indeed a new term since a year or two, and rising in popularity. In fact it's just a servicebased contract with your clients. They rent your software to keep up with their competence ;)
My software is almost ready. The interesting parts are all done, the displaymodules (template renderer) needs optimalization, but it's ready for testing.
Can i combine the used quotas in the database with the used diskspace and used emailspace?
The mounting will not be an option since all clients are paying for a unique template. A thing which is a mustrequirement.

A: Without knowing all the details of your actual CMS application it is somewhat hard to advice specifically. But assuming the CMS software has some system in place to differentiate between the clients and what they can access your DirectAdmin system will solve the rest more or less; it is able to chroot the users (keep them in their own directory), measure bandwidth, diskspace usage and enforce quota's. It also installs MySQL I think.
It should pretty much do what you want but with a catch: only if you install your CMS on every client's domain. Which is something you do not want.
So I would look into linking (man ln) your CMS software to each home dir, making it available. Test this - and be VERY AWARE that if I can write to your CMS software I can hack all other clients that use this CMS. So look into setting correct permissions (man chmod / man chown).
You should be able to solve the issues by adding clients to certain groups and giving the webserver user access to some (storage) directories while the clients themselves can not write there.

A: Personally I'd forget about the about symlinking, disk space is indeed cheap and upgrading the installation of your CMS to a broken state (it will happen) pisses of all your clients at once.
Create one installation per client, I do hope that it's an application feature to manage multiple distinct sites with the CMS and not the OS, it's just the wrong place and I recommend everyone to run not walk away from a product that claims to be able to manage multiple sites but in reality just needs multiple installations.
The Pros:

*

*upgrades that break will not piss of all clients at once

*you can expose new features to a small fraction of clients (yes 1 out of 10 is still viable for this, maybe it's someone you can talk to better than the others and suggest them they take a test drive)

*if one client breaks the installation because of security bugs no other client will be affected (unless the escalation goes to a deeper level that b0rks the system)


text:
Q: How to go about accessing MasterPage body from another page I've got a log-in page with a drop down list, which you can pick a background color for the website. But I'm having trouble linking the masterpage's body with the selected value on the drop down list.

Here's the opening tag of my MasterPage body, and here's the dropdownlist I've got.

                <asp:Label runat="server" ID="lblColor" ClientIDMode="Static" AssociatedControlID="ddlColor" class="input-group-addon"></asp:Label>
                <asp:DropDownList runat="server" ID="ddlColor" ClientIDMode="Static" aria-describedby="lbColor" data-taggle="dropdown" data-style="DropDownListHint-datastyle" class="btn dropdown-toggle DropDownListHint-datastyle">
                <asp:ListItem Text="Бял" Value="White" Selected="True" />
                <asp:ListItem Text="Зелен" Value="Green" />
                </asp:DropDownList>

A: use Master.FindControl Method
var body = Master.FindControl("bodyMasterPage");


text:
Q: Why is z-index not working for this webpage? Open up http://irule.at/quovadis, and it will show you a regular theme. The problem is that the div photos is not showing up. It's most likely hiding behind body/html because of the z-index, but I want them to show behind the divs in the middle. How do I fix this?

A: It looks like you're using a negative z-index for photos. Instead of that, use a positive or 0 index, and give the other elements a higher index. Also remember that in order for z-index to work the elements should have position: relative. I got photos to show up by having it z-index 1, having header z-index 2 and position relative.

A: You've had an answer, but thought I'd chip in a little to clear things up.
Z-indexing requires an element to be positioned, not necessarily relative or absolute as you've already figured out, but fixed is also an option.


text:
Q: textarea styling not submitted I've created a textarea editor without using any plugins, only with select fields for font-family, font-size and font-color.
It is working fine, but the thing is, what happen to all the effects I changed?
If I click submit it should save in database like:
Chethan K
 but this is not happening. Can anyone help me?
My code is :

<form id="myform" method="Post" action="<?php echo site_url('Maincntrl/texta'); ?>">
  <select id="clr">
    <option>-Color-</option>
    <option value="black">black</option>
    <option value="green">green</option>
    <option value="yellow">yellow</option>
    <option value="red">red</option>
    <option value="gray">gray</option>
    <option value="blue">blue</option>
  </select>
  <select id="fs">
    <option>-Font-</option>
    <option value="arial">Arial</option>
    <option value="verdana">Verdana</option>
    <option value="impact">Impact</option>
    <option value="'ms comic sans'">MS Comic Sans</option>
  </select>
  <select id="size">
    <option>-Size-</option>
    <option value="5">5</option>
    <option value="10">10</option>
    <option value="15">15</option>
    <option value="20">20</option>
  </select>

  <textarea name="texta" rows=5 cols="34" class="changeMe"></textarea>

    <button type="submit" class="btn btn-info">Save</button>

</form>

A: The problem here is that you're using .css() in your functions…
.css() adds styling on the element, but it doesn't add anything inside.
Here is a snippet where I added a consoling when you click on the Save button:

$("#fs").change(function() {
  $('.changeMe').css("font-family", $(this).val());
});
$("#size").change(function() {
  $('.changeMe').css("font-size", $(this).val() + "px");
});
$("#clr").change(function() {
  $('.changeMe').css("color", $(this).val());
});

// TAKIT: Added this for testing purpose
$("#myform").submit(function(event) {
  event.preventDefault();
  console.log("Value of textarea:\n  '" + $("textarea[name=texta]").val() + "'");
});

<form id="myform" method="Post" action="#">
  <select id="clr">
    <option>-Color-</option>
    <option value="black">black</option>
    <option value="green">green</option>
    <option value="yellow">yellow</option>
    <option value="red">red</option>
    <option value="gray">gray</option>
    <option value="blue">blue</option>
  </select>
  <select id="fs">
    <option>-Font-</option>
    <option value="arial">Arial</option>
    <option value="verdana">Verdana</option>
    <option value="impact">Impact</option>
    <option value="'ms comic sans'">MS Comic Sans</option>
  </select>
  <select id="size">
    <option>-Size-</option>
    <option value="5">5</option>
    <option value="10">10</option>
    <option value="15">15</option>
    <option value="20">20</option>
  </select>

  <textarea name="texta" rows=5 cols="34" class="changeMe"></textarea>

    <button type="submit" class="btn btn-info">Save</button>

</form>

⋅
⋅
⋅
Now, I think I understand why you used

.
But the problem here is that you have two times the same name="texta".
I made the following modifications:

*

*As you can only post values of form elements, I changed your p to an input. You could use type=hidden on it, but I used disabled so that we can see its value.

*Added a class="selector" and a "prop" attribute on your selects to simplify your code.

*Added value="" for the default options.

Here is the final snippet:

$(".selector").change(function() {
  // Apply each select on the textarea
  $(".selector").each(function(i, elm) {
    $('.changeMe').css($(elm).attr('prop'), $(elm).val());
  });
  // Copy style of the textarea in our input using a span element
  $("[name=textstyle]").val($('.changeMe').attr('style'));
});

// TAKIT: Added this for testing purpose
$("#myform").submit(function(event) {
  event.preventDefault();
  console.log("Submitted:");
  console.log("  textstyle: '" + $("[name=textstyle]").val() + "'");
  console.log("  texta: '" + $("[name=texta]").val() + "'");
});
textarea {
  resize: none;
}

<form id="myform" method="Post" action="#">
  <select class="selector" prop="color">
    <option value="">-Color-</option>
    <option value="black">black</option>
    <option value="green">green</option>
    <option value="yellow">yellow</option>
    <option value="red">red</option>
    <option value="gray">gray</option>
    <option value="blue">blue</option>
  </select>
  <select class="selector" prop="font-family">
    <option value="">-Font-</option>
    <option value="arial">Arial</option>
    <option value="verdana">Verdana</option>
    <option value="impact">Impact</option>
    <option value="'ms comic sans'">MS Comic Sans</option>
  </select>
  <select class="selector" prop="font-size">
    <option value="">-Size-</option>
    <option value="5px">5</option>
    <option value="10px">10</option>
    <option value="15px">15</option>
    <option value="20px">20</option>
  </select>

  <textarea name="texta" rows=5 cols="34" class="changeMe"></textarea>

<input name="textstyle" disabled />

  <button type="submit" class="btn btn-info">Save</button>

</form>

Then, server-side, you get both names and do your stuff.
Hope it helps.


text:
Q: Converting Form-data to HTTPClient post request I have this request from POSTMAN
    POST /v1/files HTTP/1.1

    Postman-Token: ab620166-b3ce-c21f-0e29-97cd43111daa
    Content-Type: multipart/form-data; boundary=----    WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
 Content-Disposition: form-data; name="image1"; filename=""
 Content-Type:

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image2"; filename=""
Content-Type:

------WebKitFormBoundary7MA4YWxkTrZu0gW--

I have tried converting it to HTTPClient post as
    httpPost.addHeader("Content-Type", "multipart/form-data");

    HttpEntity entity = MultipartEntityBuilder
                .create()
                .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
                .addBinaryBody("image1",new(File("/image1.jpg"))
                .addBinaryBody("image2",new(File("/image2.jpg"))
                .build();

I have also tried using bodyPart instead of addBinarybody...
I still get a bad request from the server, Anything I am missing?


text:
Q: Android: how to force left justified items to wrap rather than right justified items? this is the layout i have:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:minHeight="?android:attr/listPreferredItemHeight">
    <LinearLayout
        android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content">
        <TextView
            android:id="@+id/customer_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18sp"
            android:paddingLeft="4dip"/>
        <TextView
            android:id="@+id/ticket_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="14sp"
            android:paddingLeft="6dip"/>
    </LinearLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:gravity="right">
        <TextView
            android:id="@+id/total"
            android:gravity="right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18sp"
            android:paddingRight="6dip"/>
        <TextView
            android:id="@+id/date"
            android:gravity="right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="14sp"
            android:paddingRight="6dip"/>
    </LinearLayout>
</LinearLayout>

which produces list items that look like this:

and as you can see, it's a bit ugly.  i'd like for the top blue box to wrap if the top right box is red, and have the bottom row completely independent of the justification up top, such that the date does not wrap at all, regardless of what the top row looks like.  what's the best way to accomplish this?

A: Use a TableLayout and make it have shrinkColumns="0" and specifify the client name/ticket# to be in column 0. You can also set strechColums for ones you want to expand to fit, so probably column 1 to expand the column for dates.
Other option is to not put them in vertical linear layouts and instead make horizontal ones for each row.

A: implementation:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:shrinkColumns="0"
        android:stretchColumns="1"
        android:minHeight="?android:attr/listPreferredItemHeight">
    <TableRow>
        <TextView
            android:id="@+id/customer_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_span="2"
            android:textSize="18sp"
            android:paddingLeft="4dip"/>
        <TextView
            android:id="@+id/total"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:gravity="right"
            android:layout_gravity="right"
            android:textSize="18sp"
            android:paddingRight="6dip"/>
    </TableRow>
    <TableRow>
        <TextView
            android:id="@+id/ticket_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:textSize="14sp"
            android:paddingLeft="6dip"/>
        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_span="2"
            android:layout_gravity="right"
            android:gravity="right"
            android:textSize="14sp"
            android:paddingRight="6dip"/>
    </TableRow>
</TableLayout>


text:
Q: MessageBodyWritter error in jersey REST call I'm bulding a REST application using Jersey but I'm getting quite frustrated because I can't understand why am I always getting this error:
SEVERE: MessageBodyWriter not found for media type=application/json, type=class domain.transfer.ListOntologies, genericType=class domain.transfer.ListOntologies.

This is what I'm trying to do:
My resource implementation:
@GET @Path("/getOntologies")
@Produces(MediaType.APPLICATION_JSON)
public ListOntologies getAllOntologies() {

    // Just a list of OWL Ontologies
    List<OWLOntology> ontologies = repository.getOntologies();
    TransferOntologyOperation transferAllOntologiesOp = new TransferOntologyOperation(ontologies);

    // Transforms OWLOntologies to OntologyTransfer, which have the @XmlRootElement annotation
    ArrayList<OntologyTransfer> ontologiesToTransfer = transferAllOntologiesOp.fullyTransformOntologies();

    ListOntologies list = new ListOntologies();

    // The list object contains a list of OntologyTransfer objects
    list.setOntologies(ontologiesToTransfer);
    return list;
}

The OntologyList class:
@XmlRootElement
public class ListOntologies {

    private List<OntologyTransfer> ontologies;

    public ListOntologies() {

    }

    public List<OntologyTransfer> getOntologies() {
        return ontologies;
    }

    public void setOntologies(List<OntologyTransfer> ontologies) {
        this.ontologies = ontologies;
    }
}

The OntologyTransfer class:
@XmlRootElement
public class OntologyTransfer {

    private String namespace;

    private List<String> classes;

    private List<String> instances;

    private List<String> objectProperties;

    private List<String> dataProperties;

    public OntologyTransfer() {

    }

    public OntologyTransfer(String namespace, ArrayList<String> classes, ArrayList<String> instances,
            ArrayList<String> objectProperties, ArrayList<String> dataProperties) {
        this.namespace = namespace;
        this.classes = classes;
        this.instances = instances;
        this.objectProperties = objectProperties;
        this.dataProperties = dataProperties;
    }

    // getters and setters for all class attributes
}

Every time I test the method getAllOntologies I get the error I presented above.
I've tested also the code:
@GET @Path("/getOntologies")
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<OntologyTransfer> getAllOntologies() {
    List<OWLOntology> ontologies = repository.getOntologies();
    TransferOntologyOperation transferAllOntologiesOp = new TransferOntologyOperation(ontologies);
    ArrayList<OntologyTransfer> ontologiesToTransfer = transferAllOntologiesOp.fullyTransformOntologies();
    return ontologiesToTransfer;
}

But I get the error:
SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.ArrayList<domain.transfer.OntologyTransfer>`

I know that my pom.xml has all the current jars because I can, for example, change the ListOntologies class to:
@XmlRootElement
public class ListOntologies {

    private List<String> ontologies;

    public ListOntologies() {

    }

    public List<String> getOntologies() {
        return ontologies;
    }

    public void setOntologies(List<String> ontologies) {
        this.ontologies = ontologies;
    }
}

And change the getAllOntologies method to:
@GET @Path("/getOntologies")
@Produces(MediaType.APPLICATION_JSON)
public ListOntologies getAllOntologies() {
    ListOntologies list = new ListOntologies();
    ArrayList<String> stringsTest = new ArrayList<String>();
    stringsTest.add("Testing");
    list.setOntologies(stringsTest);
    return list;
}

And this code works. What exactly am I doing wrong here? Why can't I return either an object which has a list of OntologyTransfer or simply return an ArrayList of OntologyTransfer directly in the getAllOntologies method?


text:
Q: visual studio 2017 does not allow to compile multiple projects I'm trying to rebuild some projects in Solution Explorer window.
I'm choosing some projects by shift button -> RMB -> Rebuild Selection but nothing done.
The output in Output window:
======== Rebuild All: 0 successed, 0 failed, 0 skipped =================
When I try to rebuild this projects one by one (Select project -> RMB -> rebuild), its work.
Any solution?
Thanks!

A: I reinstalled vs2017 and it worked well...


text:
Q: Как посчитать количество заданных словосочетаний? Нужно, что бы код считал определённые словосочетания, например "you know".
Пример ввода:
I called him, you know, 5 times this morning and like, he never answered.

Пример вывода: 1
Пробую так:
import numpy as np

n = "I called him, you know, 5 times this morning and like, he never answered."
text = str.split(n)
y = np.array(text)
x = np.count_nonzero(y == "you" and "know")
print(x)

A: почему бы не сделать так:
text = "I called him, you know, 5 times this morning and like, he never answered."

res = len(text.split("you know")) - 1

дешево и очень сердито :)

A: import re

text = """I called him, you know, 5 times this morning and like, he never answered.
You know him, right?
What about 'you knowledge' or 'babayou know' - are you guys going to count them as well? ;)
"""

entries = re.findall(r"\byou know\b", text.lower())

res = len(entries) if entries else 0

print(res)

результат
2


text:
Q: st_aggrid nested grids don't display changed data after DF is altered Using ...
streamlit==1.9.0
streamlit-aggrid==0.2.3.post2
Python 3
I'm attempting to use nested AgGrid Grids as described here
The end goal is to show a list of instruments and, (only) when checked, the subgrid below the instrument updates with data about the instrument.
The problem is; the updated Grid (updated after selecting a checkbox, which alters the underlying DataFrame) does not actually show the new DF data (it still shows the old data.)
DETAILS:

*

*When I first load the page, it creates a DataFrame st.session_state["instruments_and_injections_df"] correctly using build_initial_instruments_df()

*The Grid appears correctly, with the nested data, and checkboxes next to each line in both the outer grid, and the nested grid.

*Selecting a checkbox does trigger _get_injection(instrument_name) and _update_instruments_and_injections_df(...)

*These functions have been validated as working (it does query the database and update the DF with the new data.) If I dump the updated DF st.session_state["instruments_and_injections_df"] we can see the JSON data has been correctly added to the instrumentData column on the correct row.

*After selecting a checkbox, however, the data in the main grid does not change (still shows the "instrumentData": {"sample_name":"test"}, not the new data)

*Selecting a second checkbox, also queries the database, and updates the Df - but then the grid is completely goofy.

*I have tried changing the update_mode in AgGrid() call to "MANUAL", "VALUE_CHANGED", "SELECTION_CHANGED", and "MODEL_CHANGED". The behavior does not change.
  def build_initial_instruments_df():
      """ This works to build initial grid. Grid behaves correctly at this point"""
      st.session_state["raw_json"] = json.dumps([
                                                  { "instrument_name":"Inst1", "instrumentData": {"sample_name":"test"},
                                                  { "instrument_name":"Inst2", "instrumentData": {"sample_name":"test"}
                                                  ])
      st.session_state["instruments_and_injections_df"] = pd.read_json(st.session_state["raw_json"])
      st.session_state["instruments_and_injections_df"]["instrumentData"] = st.session_state["instruments_and_injections_df"]["instrumentData"].apply(lambda x: pd.json_normalize(x))

  def _update_instruments_and_injections_df(selected = [], always_update = False):
  """ This works to query database, and update the field "instrumentData" with JSON.
      Verified by dumping updated st.session_state["instruments_and_injections_df"] to screen which shows the updated JSON cell"""
      _instruments = st.session_state["instruments_and_injections_df"]["instrument_name"].to_list()
      for _instrument in _instruments:
          if _instrument in selected:
              _injection_json = _get_injection(_instrument)
              _instrument_index = st.session_state["instruments_and_injections_df"].index[st.session_state["instruments_and_injections_df"]['instrument_name']==_instrument].tolist()[0]
              st.session_state["instruments_and_injections_df"].at[_instrument_index, "instrumentData"] = _injection_json

  def _get_injection(instrument_name):
      """ This works to obtain the data from the DB and convert it to JSON"""
      with st.spinner("Displaying results..."):
          _sql = "SELECT  sample_name, sample_orderno, sample_amount FROM injections WHERE instrument_name = '{}';".format(instrument_name)

          injection_df = pd.read_sql(_sql, st.session_state["conn"])
          injection_df_json = injection_df.to_json(orient = "records")
          injection_df_json = json.loads(injection_df_json)
          return injection_df_json

  #===============================================================================
  # MAIN
  #===============================================================================
      try:
          st.session_state["instruments_and_injections_df"] # Will error if has never been loaded
      except (KeyError, NameError):
          build_initial_instruments_df()

      gridOptions = {
          # enable Master / Detail
          "masterDetail": True,
          "rowSelection": "multiple",
          "pagination": st.session_state["enable_pagination"],
          "paginationAutoPageSize": st.session_state["paginationAutoSize"],
          "groupSelectsChildren":st.session_state["groupSelectsChildren"],
          "groupSelectsFiltered":st.session_state["groupSelectsFiltered"],

          # the first Column is configured to use agGroupCellRenderer
          "columnDefs": [
              {
                  "field": "instrument_name",
                  "cellRenderer": "agGroupCellRenderer",
                  "checkboxSelection": True,
              },
          ],
          "defaultColDef": {
              # "flex": 1,
          },
          # provide Detail Cell Renderer Params
          "detailCellRendererParams": {
              # provide the Grid Options to use on the Detail Grid
              "detailGridOptions": {
                  "rowSelection": "multiple",
                  "suppressRowClickSelection": True,
                  "enableRangeSelection": True,
                  "pagination": st.session_state["enable_pagination"],
                  "paginationAutoPageSize": st.session_state["paginationAutoSize"],
                  "groupSelectsChildren":st.session_state["groupSelectsChildren"],
                  "groupSelectsFiltered":st.session_state["groupSelectsFiltered"],
                  "columnDefs": [
                              {"field": "sample_name", "checkboxSelection": True},
                  ],
                  "defaultColDef": {
                      "sortable": True,
                      # "flex": 1, # This sets the columns to fit to the window (bad)
                  },
              },
              "getDetailRowData": JsCode(
                  """function (params) {
                      console.log(params);
                      params.successCallback(JSON.parse(params.data.instrumentData));
          }"""
             ).js_code,
          },
      }

      st.session_state["instruments_grid_response"] = AgGrid(
          st.session_state["instruments_and_injections_df"],
          gridOptions=gridOptions,
          height=st.session_state["grid_height"],
          allow_unsafe_jscode=True,
          enable_enterprise_modules=True,
          # update_mode=GridUpdateMode.SELECTION_CHANGED,
          data_return_mode=st.session_state["return_mode_value"],
          update_mode=st.session_state["update_mode_value"],
      )

  #===============================================================================
  # Discover any data selected from grid
  #===============================================================================
      if st.session_state["instruments_grid_response"]['selected_rows'] != []:
          _selected_instruments = pd.DataFrame(st.session_state["instruments_grid_response"]['selected_rows'])["instrument_name"].to_list()
          _update_instruments_and_injections_df(selected = _selected_instruments)
      else:
          st.write("No instruments selected")


text:
Q: What is apt and aptitude in Ubuntu? I've been blindly copy pasting code that contains these keywords to install programs and having migrated from Windows, I don't quite understand what they mean. Can anyone explain them and their significance with their similarities/differences?
Also, I would like to know how do you know the answer to this question? I mean, since I am learning to use Ubuntu now from barely any prior experience, how should I have know this answer? Where should I have looked for it, apart from Googling, which I tried only to find answers not satisfying/clear enough.

A: Apt and aptitude are command-line software tools to manage application packages. Essentially they install and remove software. If you're new to ubuntu you shouldn't really need to use them at all, because the ubuntu software center is the graphical application to take care of such things.

A: As Garry says, they're applications that install and remove software from Ubuntu's software repositories, amongst other tasks. If you've no idea what that means, let's step back one further:

*

*Software (like Firefox, GIMP, xchat, etc) is compiled and then packaged into *.deb files.

*These debs are essentially installers. They contain all the files that get copied into the system as well as scripts that allow it to depend on (or conflict with) other known packages.

*If you install Firefox from a package, apt and dpkg (the applications that processes the dependencies) will make sure you have its dependencies installed first and if you haven't, it'll grab those packages too.

*Packages are stored in online repositories as big lists.

*Apt is the tool (or set of tools) that downloads all these lists from various sources, combines them and allows you to select certain packages for installation.

*The benefit to all this is you can install a lot of software without having to hunt for it. More than that, the software in the official Ubuntu repositories is maintained so that if security fixes are released, they're applied and a new package is created. When apt next checks for updates, it sees the new version and you're prompted to download it.

I won't say apt-get/aptitude are useless because they're not, they're both very powerful utilities and like a lot of CLI-vs-GUI comparisons, if you know how to use them, they're a good deal faster than the Software Center.
But punching in random commands without knowing what to expect is a recipe for disaster. It only takes one bad/clumsey person to suggest a destructive command and you'll nuke your system. If you don't know what something's going to do either:

*

*Ask.

*Run man <command> (eg man apt-get) to see the manual page for a specific application.

The command line in Linux systems is a good few hundred thousand times more powerful than it's Windows counterpart. You have to treat it with respect or it will bite your legs off.


text:
Q: Save a sliced point cloud- Matlab I have sliced a point cloud(30%) from original cloud(.ply image) using Matlab R2015b Image Processing Toolbox. When i save that sliced cloud as a new point cloud.
sliced and background of original both are saved. How can i just store sliced part as a new point cloud (.ply)
stepSize = 1;
indices = 1:stepSize:(cloudImage.Count)/2;
pt = select(cloudImage, indices);
pcwrite(cloudSliced,'half','PLYFormat','binary');

A: From your code it appears that the sliced point cloud is stored in pt.
So it should be
pcwrite(pt,'half','PLYFormat','binary');


text:
Q: Java 8 LocalDateTime and ZonedDateTime conversion Given a zone name and the outputDtf, is this the best way to use Java 8 LocalDateTime and ZonedDateTime? I would like to simplify where possible.
String zoneName = "America/Los_Angeles";
DateTimeFormatter outputDtf = DateTimeFormatter
        .ofPattern("yyyy-MM-dd'T'HH:mm:ssZ")
        .withZone(ZoneId.of(zoneName));

// timestamp in UTC. convert to zone America/Los_Angeles
DateTimeFormatter timestampDtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
String timestamp = "20180722060602";
LocalDateTime ldt = LocalDateTime.parse(timestamp, timestampDtf);
Instant tsInstant = ldt.atZone(ZoneId.of("UTC")).toInstant();
System.out.println(outputDtf.format(tsInstant));
// 2018-07-21T23:06:02-0700

// date in zone America/Los_Angeles. add start of day and zone
DateTimeFormatter dateDtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String date = "2018-07-18";
ZonedDateTime zdt = LocalDate.parse(date, dateDtf).atStartOfDay().atZone(ZoneId.of(zoneName));
System.out.println(outputDtf.format(zdt));
// 2018-07-18T00:00:00-0700

A: Other than dropping the toInstant() in the first example, there is nothing to simplify.
You have to parse the input string, you have to specify the time zone, and for a date-only you have to say it's at midnight.
Those are the steps you're doing, and it cannot be simplified, though you can make the DateTimeFormatter do the work.
String zoneName = "America/Los_Angeles";
DateTimeFormatter outputDtf = DateTimeFormatter
        .ofPattern("yyyy-MM-dd'T'HH:mm:ssZ")
        .withZone(ZoneId.of(zoneName));

// timestamp in UTC. convert to zone America/Los_Angeles
DateTimeFormatter timestampDtf = DateTimeFormatter
        .ofPattern("yyyyMMddHHmmss")
        .withZone(ZoneOffset.UTC);
String timestamp = "20180722060602";
ZonedDateTime zdt1 = ZonedDateTime.parse(timestamp, timestampDtf);
System.out.println(outputDtf.format(zdt1)); // 2018-07-21T23:06:02-0700

// date in zone America/Los_Angeles. add start of day and zone
DateTimeFormatter dateDtf = new DateTimeFormatterBuilder()
        .appendPattern("yyyy-MM-dd")
        .parseDefaulting(ChronoField.HOUR_OF_DAY, 0)
        .toFormatter()
        .withZone(ZoneId.of(zoneName));
String date = "2018-07-18";
ZonedDateTime zdt2 = ZonedDateTime.parse(date, dateDtf);
System.out.println(outputDtf.format(zdt2)); // 2018-07-18T00:00:00-0700

As you can see, if the DateTimeFormatter is set up once and re-used, the code using it is simpler, but overall the code is not simpler.

A: Your code is generally fine, there's not much you can do better.
In the first snippet I would use OffsetDateTime rather than Instant:
    OffsetDateTime tsOffsetDateTime = ldt.atOffset(ZoneOffset.UTC);
    System.out.println(outputDtf.format(tsOffsetDateTime));

You don't need the formatter in the second snippet since your string, 2018-07-18, is in the default format for LocalDate (AKA ISO 8601):
    ZonedDateTime zdt = LocalDate.parse(date).atStartOfDay().atZone(zone);

Link: Wikipedia article: ISO 8601


text:
Q: WordPress JSON API displaying a post with images in Android I'm writing an Android app for a WordPress website. I've figured get how to 'get' posts and display them in a listView and make them clickable.
The problem is once the post is clicked on, I want to display each post as it is on the original website, i.e. with the images in the same positions as they are on the website (intersparsed with the text). I know how to get the text and images separately but how can I format them in the correct way? (I don't know how many images there will be in a post)

A: you can open a WebView and in the wordpress you can create a new template to show just the post without the menus.


text:
Q: How to send a key anonymously on a server through tor from command line? There are only few servers that are supporting key uploading from a tor node as given in the sks servers list.
How would you suggest to send a key anonymously through tor from command line?
I guess the following should make it
 service tor start
 proxychains gpg --send-keys --keyserver keyserver1.gnupg.pub <GPGKEY ID>

where keyserver1.gnupg.pub is a server supporting tor.


text:
Q: Color Transform in OpenCV or SimpleCV I've looked at the documentation but I couldn't find if there was a method for transforming the colors for an entire image using some formula. Would this be somehow related to the color curve functions because I'm not too sure what effects those have- I've tried them but do not understand what effect each parameter has.
For example: If I want to take an image and tranform the colors using the following formula
(2R - 0.5G - B)/4
I read through the functions and some seem like they may apply but the meaning of the parameters are unclear to me. Is there a method for SimpleCV and/or OpenCV to do this?
EDIT:
By transform, I mean take the RGB values of the image and apply that formula to them so those are the new RGB values. OR instead of a formula, to use a matrix like:
[Y]     [0.299  0.587   0.114  ][R]
[I]  =  [0.596  -0.274  -0.322 ][G]
[Q]     [0.212  -0.523  0.311  ][B]

A: To do this in SimpleCV you just do:
from SimpleCV import *
img = Image('simplecv')
(r,g,b) = img.splitChannels(False) #we pass false to break into color channels, not greyscale
updated = ((r * 2) - (g * 0.5) - b)/4
updated.show()

A: It dpeends on what interface you're using.
If you're using python it's fairly simple as images are represented as numpy arrays.
So to get an image that was (2R - 0.5G - B)/4 you could do:
imgF = img.astype('float') # convert from INT to FLOAT
# note that OpenCV loads it as Blue,Green,Red. not RGB.
imgTransformed = (2.*imgF[:,:,2] - .5*imgF[:,:,1] - imgF[:,:,0])/4

For matrix transforms, have a look at OpenCV's transform function.
As per documentation, it performs:
dest(I) = mtx * src(I)

for each index I.
So for the matrix example in your question, you'd do
cv2.transform( img, [ [ 0.114, 0.587, 0.299],
                      [-0.322, 0.274, 0.596],
                      [ 0.311,-0.523, 0.212] ] )

Note - I swapped your columns 1 and 3 because in OpenCV the images are read in with channel order B,G,R instead of R,G,B.


text:
Q: NetworkManager refuses to manage my WLAN interface
I'm using Ubuntu 12.10 with Gnome 3.6 on a brand-new Samsung NP900X4C.
The installer detected the wireless adapter, took in the SSID and WPA passphrase, wrote these into /etc/network/interfaces and connected perfectly.
Once installation was finished I wanted to switch to using NetworkManager to manage the wireless adapter, since this is much more convenient than fiddling with /etc/network/interfaces every time I find a new hotspot.
Therefore I edited /etc/NetworkManager/NetworkManager.conf to set:
[ifupdown]
managed=true

When I rebooted NetworkManager, the problems started:
 - The NetworkManager tray applet changed from saying device not managed to device not ready
 - I lost all internet connectivity as wlan0 would not associate to the Access Point
 - if I set managed=false in NetworkManager.conf and restarted both NetworkManager and networking services from the command-line, the Gnome desktop "semi-crashed" and lost all its Window Decorations, the panel, the launcher and basically became unusable.
However if I restart the computer completely after setting managed=false, wlan0 once again works perfectly.

A: I ended up fixing this myself, see the exact steps below.
Note that there may be an easier solution but these steps definitely worked.

*

*Make sure network-manager is the latest version (I have 0.9.6.0-0ubuntu7 ).
You can check this with: sudo dpkg -l | grep network-manager

*Right-click on Network Manager tray icon -> Edit Connections -> Wireless -> Add
Manually add the parameters for connecting to your WLAN.

*Edit /etc/NetworkManager/NetworkManager.conf to set...
[ifupdown]
managed=true
DO NOT restart network-manager service.

*Edit /etc/network/interfaces to deactivate the auto-start of your Wireless interface (probably called wlan0).
For example:
From this: auto wlan0
.... to this: #auto wlan0

*Run /etc/init.d/network-manager force-reload

A: Uninstall wicd if you intalled it along with network-manager
If both are installed at a time, then there will be a conflict and only one will be able to use the device at a time.


text: Q: Is the scalar extension of an ideal an ideal Let $\mathfrak{m}$ be an ideal in the polynomial ring $R[x_1, ..., x_n]$. If $R[t_1, ..., t_m]$ is another polynomial ring, is then the scalar extension $R[t_1, ..., t_m]\otimes_R\mathfrak{m}$ an ideal in the tensor product $R[t_1, ..., t_m]\otimes_RR[x_1, ..., x_n]=R[t_1, ..., t_m, x_1, ..., x_n]$, seen as a ring?


text:
Q: Run two actions in component I would like to dispatch below actions, after clicked button, but one by one (like a mergeMap) or run second action after first's success.
Important thing - in component, not effect class etc.
case BtnType.BTN_TEST: {
                this.store$.dispatch(action1({
                 // some data
                }));

                this.store$.dispatch(
                    action12({
                         // some data
                    }));
                break;
            }
    ```

A: Simply subscribe to  your Ngrx store using a selector which would be affected by your first action, once a new value arrived, dispatch the next.
 case BtnType.BTN_TEST: {
      this.store$.dispatch(action1({
        // some data
      }));

      this.store.pipe(select(getHeroes))
        .subscribe(x => {

            this.store$.dispatch(action12({
              // some data
            }));

        })

      break;
    }

Optionally you can inject Actions to your constructor and wait for the first action to get dispatched using ofType operator function just as you would in an Effect.
 constructor(
   private actions$: Actions,
   private store: Store<AppState>,
 ) { }

...
case BtnType.BTN_TEST: {

    this.store$.dispatch(action1({});

    this.actions$
      .pipe(
        ofType(ActionTypes.Action1),
        first()
      )
      .subscribe(x => {

        this.store$.dispatch(action12({
          // some data
        }));

      })

    break;
  }

Note: both options are not considered best practice, as event dispating should never be done asynchronously.


text:
Q: VS 2010 debugging - from where is the method called? In C#, VS 2010, is there a keyboard shortcut to see from where did the breakpoint was hit when you debug?
For example, if I have a breakpoint in a method called myMethod(), and it was hit, how to see from what line was it called?

A: You can look at the "Call Stack". In VS go to Debug > Windows > Call Stack.
In debug mode the call stack will show which methods have been called in order to reach your break point.

A: If you open up the Call Stack window you can see the chain of method calls leading to the current line.
If you've got one of the fancier versions of Visual Studio, you might also take a look at Debugger Canvas.

A: Isn't the call stack window enought ?

A: You can look at the call stack which will show you where the method call came from, it can be opened by going to the Debug => Windows menu option when your app is running or by pressing Ctrl+D,C.

A: Are you looking for the entire call stack?
In this case you may try this when your breakpoint is hit:
- On the Debug menu, select Windows and then click Call Stack.

A: In simple cases the "Call stack" Window will show this.
If the compiler used tail call optimization or method inlining, it can give an unexpected result. But that shouldn't happen while debugging, because that (by default) disables those optimizations.
yield-iterators and async methods show from where they were resumed, and not where they were originally called.


text:
Q: add key to an object from another object I have those two arrays and I'm trying to introduce a new key in the array of objects from the second array with no success
 this.dockerApplicationList = [
            {
                lastUpdate: new Date(),
                registryId: 'registryIdOne',
                applicationId: 'appIdOne',
                appName: 'dockerOne',
            },
            {
                lastUpdate: new Date(),
                registryId: 'registryIdTwo',
                applicationId: 'appIdTwo',
                appName: 'dockerTwo',
            },
            {
                lastUpdate: new Date(),
                registryId: 'registryIdThree',
                applicationId: 'appIdThree',
                appName: 'dockerThree',
            },
            {
                lastUpdate: new Date(),
                registryId: 'registryIdFour',
                applicationId: 'appIdFour',
                appName: 'dockerFour',
            },
            {
                lastUpdate: new Date(),
                registryId: 'registryIdFive',
                applicationId: 'appIdFive',
                appName: 'dockerFive',
            },
        ];

  this.spaceList = [
            { name: 'space one', space: '0' },
            { name: 'space two', space: '1' },
            { name: 'space three', space: '2' },
            { name: 'space four', space: '3' },
            { name: 'space five', space: '4' },
        ];

I need to  introduce the name of spaceList in as a new key in dockerApplicationList
This is what I'm trying this but it's not working:
for (let i=0; i<this.dockerApplicationList.length; i++) {
    for(let x=0; x<this.spaceList.length; x++) {
        this.dockerAppplicationList[i]['space'] = this.spaceList[x].name;
    }
}

Why is this not working?

A: Let's try using map with spread syntax:

let dockerApplicationList = [
    {
        lastUpdate: new Date(),
        registryId: 'registryIdOne',
        applicationId: 'appIdOne',
        appName: 'dockerOne',
    },
    {
        lastUpdate: new Date(),
        registryId: 'registryIdTwo',
        applicationId: 'appIdTwo',
        appName: 'dockerTwo',
    }
];

let spaceList = [
    {name: 'space one', space: '0'},
    {name: 'space two', space: '1'},
];

dockerApplicationList = dockerApplicationList.map((e, index) => (
    {...e, ...{'name': spaceList[index].name}}
));
console.log(dockerApplicationList);

Or just key assignment:

let dockerApplicationList = [
    {
        lastUpdate: new Date(),
        registryId: 'registryIdOne',
        applicationId: 'appIdOne',
        appName: 'dockerOne',
    },
    {
        lastUpdate: new Date(),
        registryId: 'registryIdTwo',
        applicationId: 'appIdTwo',
        appName: 'dockerTwo',
    }
];

let spaceList = [
    {name: 'space one', space: '0'},
    {name: 'space two', space: '1'},
];

dockerApplicationList = dockerApplicationList.map((e, index) => {
    e['name'] = spaceList[index].name;
    return e;
});
console.log(dockerApplicationList);


text:
Q: SQL Server 2008: Joining results of STORED PROCEDURE (dynamic columns) with results of a SELECT statement I have results that are generated by this stored procedure.
I want to join these results with data in another table. I've seen various examples of doing this be creating a temporary table and inserting into it, however, this would not be ideal as the stored procedure returns many dynamic columns which are subject to change. Is there a way to join them dynamically?
Example scenario:
Stored Procedure Returns This:
EXEC uspGetProductCategories

products_id | products_model | Leather Seats | Heated Seats | Tapedeck | Heater | Hybrid | Sunroof | Cruise Control
===================================================================================================================
100         | Saturn Vue     | N             | N            | Y        | N      | N      | N       | N
200         | Toyota Pruis   | Y             | N            | N        | Y      | Y      | N       | N
300         | Ford Focus     | N             | N            | N        | Y      | N      | N       | Y

I want to JOIN it with a SQL query that generates something like:
SELECT * FROM Products_Detail

products_id | manufacturer | purchaser | pay_type
=================================================
100         | GM           | GREG      | P
200         | TOYT         | SAM       | P
300         | FORD         | GREG      | L

In other words...
Is there a painless way to accomplish this? Here is some psedo code of what I'd like to achieve (though I'm aware that this doesn't work):
SELECT pd.*, sp.* FROM Products_Detail pd
    LEFT JOIN uspGetProductCategories sp ON pd.product_id = sp.product_id

Again, I know you can't do this, but hopefully it describes the logic I'm looking for.
Example Desired Output
products_id | manufacturer | purchaser | pay_type | products_model | Leather Seats | Heated Seats | Tapedeck | Heater | Hybrid | Sunroof | Cruise Control
=========================================================================================================================================================
100         | GM           | GREG      | P        | Saturn Vue     | N             | N            | Y        | N      | N      | N       | N
200         | TOYT         | SAM       | P        | Toyota Pruis   | Y             | N            | N        | Y      | Y      | N       | N
300         | FORD         | GREG      | L        | Ford Focus     | N             | N            | N        | Y      | N      | N       | Y

A: If you cannot create a temp table with the data from the dynamic stored procedure, why not just join on the table directly:
DECLARE @cols AS NVARCHAR(MAX),
    @colsNull AS NVARCHAR(MAX),
    @query  AS NVARCHAR(MAX)

select @cols = STUFF((SELECT distinct ',' + QUOTENAME(categories_name)
                    from Categories
            FOR XML PATH(''), TYPE
            ).value('.', 'NVARCHAR(MAX)')
        ,1,1,'')

select @colsNull = STUFF((SELECT ',IsNull(' + QUOTENAME(categories_name)+', ''N'')'+' as '+QUOTENAME(categories_name)
                    from Categories
                    group by categories_name, categories_id
                    order by categories_id
            FOR XML PATH(''), TYPE
            ).value('.', 'NVARCHAR(MAX)')
        ,1,1,'')

set @query = '
            select *
            from Products_Detail pd
            left join
            (
              SELECT products_id,
                    products_model,' + @colsNull + ' from
               (
                  select p.products_id,
                    p.products_model,
                    c.categories_name,
                    ''Y'' flag
                  from products p
                  left join Products_Categories pc
                    on p.products_id = pc.products_id
                  left join Categories c
                    on pc.categories_id = c.categories_id
              ) x
              pivot
              (
                  max(flag)
                  for categories_name in (' + @cols + ')
              ) p
            ) p
              on pd.products_id = p.products_id'

execute(@query)

See SQL Fiddle with Demo

A: Try using this ugly solution if no way to reorganize your code.
SELECT * INTO #tmp
FROM OPENROWSET('SQLNCLI', 'server=INSTANCENAME;database=DBNAME;trusted_connection=yes', 'uspGetProductCategories') A

You must have allowed Ad Hoc Distributed Queries in your server.

A: You can do this:
        INSERT aTemptable
        EXEC yourstoredproc

if #t has been defined but you cannot do select into #t and have it be created dynamically.

A: create proc sp_emp18
(
@cust_id int,@name varchar(20),@order_id int,@order_date date
)
as
begin
select e.cust_id,e.name,d.order_id,d.order_date
from
customer e inner join orders d on e.cust_id=d.cust_id
end

exec sp_emp18 101,'ram',99,'2016-07-21'