text:
Q: WARNING: appId set, but please call setLaunchOptions(launchOptions) to complete OneSignal init I have tried setting up onesignal plugin for my ionic project. But, when running in Xcode, I am seeing this warning.
WARNING: appId set, but please call setLaunchOptions(launchOptions) to complete OneSignal init!

How can I fix it? Thanks.

A: Onesignal 3.0.0-beta1 version is not working, downgraded and all clear

A: I also had to deal with that mistake.
setLaunchOptions is automatically inserted by the framework (cordova, ionic etc), so if that error appears it means that something went wrong.
Mine was a certificate error, try to check your certificate and app ID of your app on ios.


text:
Q: Cannot connect Wifly to Arduino I am just an Arduino beginner. I bought an Arduino Uno and a Wifly shield yesterday and I am not able to run the Wifly_Test example program come with WiFlySerial library.
When I look at Serial Monitor, I only saw 2 lines are printed out
1.Starting WiFly Tester.
2.Free memory:XXXX

How can I know that the Wifly Sheild that I bought is not faulty?
I soldered the heard ping to Wifly Shield and stacked it to Aurduino Uno and I can see the LEDs blinking on the Wifly Shield.
Do I need to reset the Wifly Sheild? How do I reset it?
Please point me to the most simple example on how to connect to the router.

A: I have also bought the shield and had trouble to start with.
If you have soldered the pins to the shield that should be fine but make sure you check they all have a connection and that they don't have solder running down the legs of the pins as this causes the shield to be temperamental.
Run the code below which is from the WiFly library (alpha 2 version) that can be found here:
http://forum.sparkfun.com/viewtopic.php?f=32&t=25216&start=30
Once you see that the shield has connected it will ask for an input, type $$$ and press enter... you have now entered the command line and CMD will be displayed.
If you do not know your network settings type scan and this will display them.
Then set your authentication by typing set wlan auth 3 (Mixed WPA1 & WPA2-PSK) or set wlan auth 4 (WPA2-PSK) this depends on the type of authentication you ise so pick the write one for your network.
Then type set wlan phrase YourPharsePhrase (Change YourPharsePhrase to whatever your WPA key is)
Then type join YourSSIDName (Change YourSSIDName to whatever your network name is)
You see something like this:
    join YourSSIDName
    Auto-Assoc YourSSIDName chan=1 mode=MIXED SCAN OK
    Joining YourSSIDName now..
    <2.15> Associated!
    DHCP: Start
    DHCP in 1234ms, lease=86400s
    IF=UP
    DHCP=ON
    IP=10.0.0.116:2000
    NM=255.255.255.0
    GW=10.0.0.1
    Listen on 2000
you are now connected to your network.
Hopefully this will get you up and running.
N.B. REMEMBER TO CAREFULLY CHECK YOUR PINS! I had great trouble with mine because only a small amount of solder is needed but enough to get a good connection, the balance of this was minute but enough that it wouldn't work.  I used a magnifying to check mine in the end.
#include "WiFly.h" // We use this for the preinstantiated SpiSerial object.

void setup() {

  Serial.begin(9600);
  Serial.println("SPI UART on WiFly Shield terminal tool");
  Serial.println("--------------------------------------");
  Serial.println();
  Serial.println("This is a tool to help you troubleshoot problems with the WiFly shield.");
  Serial.println("For consistent results unplug & replug power to your Arduino and WiFly shield.");
  Serial.println("(Ensure the serial monitor is not open when you remove power.)");
  Serial.println();

  Serial.println("Attempting to connect to SPI UART...");
  SpiSerial.begin();
  Serial.println("Connected to SPI UART.");
  Serial.println();

  Serial.println(" * Use $$$ (with no line ending) to enter WiFly command mode. (\"CMD\")");
  Serial.println(" * Then send each command followed by a carriage return.");
  Serial.println();

  Serial.println("Waiting for input.");
  Serial.println();

}

void loop() {
  // Terminal routine

  // Always display a response uninterrupted by typing
  // but note that this makes the terminal unresponsive
  // while a response is being received.
  while(SpiSerial.available() > 0) {
    Serial.write(SpiSerial.read());
  }

  if(Serial.available()) { // Outgoing data
    //SpiSerial.print(Serial.read(), BYTE);
    SpiSerial.write(Serial.read());
  }
}

A: Sorry I forgot to mention , you reset the shield by going to the WiFly library and going to: WiFly/tools/HardwareFactoryReset
Then open the serial monitor and type in any character and this will start the reset.

A: Thanks everyone who tried to answer me. I finally solved my problem by using Arduino 0023 instead of 1.0.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Prove that $\sqrt{a_1}\pm \sqrt{a_2}\pm\ldots\pm \sqrt{a_n}$ is irrational for $a_1,\ldots,a_n\in\mathbb{N}$ and $a_i\neq m^2$ Consider a sequence $a_1,a_2,\ldots,a_n$ such that $a_1,a_2,\ldots a_n\in\mathbb{N_{\ge 1}}$, $a_1\neq a_2\neq \ldots\neq a_n$ and for every $1\le i\le n$, $a_i$ is square-free.
$$ \sqrt{a_1}\pm \sqrt{a_2}\pm\ldots\pm \sqrt{a_n}$$
is an irrational number.
This question originates from solving a AoPS Olympiad problem (prove that $\sqrt{10}-\sqrt{6}-\sqrt{5}+\sqrt{3}$ is irrational) - I was wondering if this could be generalized to sequences of arbitraly length.


text:
Q: Simplifying a drop down form input for date: day month year  There are 29+ days in a month, I am creating a form using select and option.  But this means I will need 31 options for day, 12 for month and a bunch more for the year.
Is there a better way to do it?  I'm not looking for plug-ins, I am trying to make some tidy code to replace some old and messy code.  Can I use a PHP for loop? And how would I go about doing this?  What would it look like (in terms of mixing up the PHP and HTML variables and functions)?

A: This is not the best way to do this, but is what your asking.
Look:
<select name="d">
    <?php for ($i = 1; $i <= 31; $i++): ?>
        <option value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT) ?>"><?php echo $i ?></option>
    <?php endfor ?>
</select>

<select name="m">
    <?php for ($i = 1; $i <= 12; $i++): ?>
        <option value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT) ?>"><?php echo $i ?></option>
    <?php endfor ?>
</select>

and if you need to take the number of the days in the current/specific month use
$current_month = date('m');
$number_of_day_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month , date('Y'));

A: If you are using HTML5, then create an <input type="date">.
Safari, Opera and Chrome already do support this input type. In browsers with no date-input-support, such an input degrades to a simple text field.

*

*The specs: http://www.w3.org/TR/html-markup/input.date.html

*Browser support: http://caniuse.com/#feat=input-datetime
You MUST implement validation on server-side (in PHP in your case) anyway - so text field is not a tragedy. You may also use simple JavaScript to validate user input before submitting the form data as well.
If you want nice calendar widget in all (A-grade-)browsers, you'll need to use a plugin or implement this yourself in JavaScript.

A: If your trying to simply use HTML (no plugin), this should get you started:
<select name="Month">
  <option value="January">January</option>
  <option value="February">February</option>
  <option selected value="March">March</option>
</select>
<select name="Day">
  <option value="1">1</option>
  <option value="2">2</option>
  <option selected value="3">3</option>
</select>
<select name="Year">
  <option value="2013">2013</option>
  <option value="2012">2012</option>
  <option selected value="2011">2011</option>
</select>

Here's the jsfiddle
But I would recommend a JavaScript solution, like jQuery's datepicker (http://jqueryui.com/datepicker/).


text:
Q: @IBOutlet doesn't appear on intellisense I have had this issue since long time and assumed that Xcode's update might fix this. And this issue comes in case of @IBoutlet only. I don't get any suggestion from intellisense. Happens every time.

As an example, @IBAction works fine :

Though it is not a big trouble as I can complete the rest of declaration. But has someone encountered this ?

A: Can't reproduce:

However, having said that, there's an obvious solution: write your own user-defined snippet with your own abbreviation. The result will be far better than what Xcode's code completion gives you (namely nothing):

Now you can type "out" and ask for code completion, get "outlet", enter it, and presto, you've got a name and type placeholder you can fill in by tabbing to them.

A: Yes , I tested it now and encountered the same issue , it's because every end of typing the syntax checker re runs and gives this error


text:
Q: Check for filenames in BlobStorage that starts with a string in Powershell I am currently working with Powershell scripts to manage BlobStorage content in Windows-Azure. I want a script that reads content of a text file and displays names of files in BlobStorage that starts with this content. Im looking for a wildcard search that lists the names in BlobStorage which starts with the content specified in the textfile.
I have thought of a loop that searches through every line in the textfile and looks for names of files in BlobStorage that starts with the specified content in the textfile.
*If we have for example 2 rows in the textfile:*
43345-sdfssd-42342-sdfsf
32423-asdsad-23424-dghfs
And the filenames in BlobStorage are:
43345-sdfssd-42342-sdfsf-250.PNG
43345-sdfssd-42342-sdfsf-650.PNG
92323-asadad-12342-sdfds-1600.PNG
I want to compare the ID in the textfile with name of BlobStorage files, and show the full filenames of all files in BlobStorage containing this ID.
To specify this further here is what i was assuming:
foreach (ID in textfile)
{

  files = find files in BlobStorage with name that starts with ID (ListBlobsWithPrefix?)

  foreach (textfile in files)
  {
            Write filename to console
  }

}

So far i have managed to make a connection to my blobstorage and it works, i can list names of Blobs in the images container. I have checked that everything works with reading the textfile aswell and printing content to console. What i have not managed to do is comparing the textfile ID with the filename of the Blob in BlobStorage and print the results in BlobStorage that starts with the ID. I have tried alot of solutions without any luck.
So far i have came up with this code:
#Make a connection to my BlobStorage
$SAN = "XX"
$SAK="X"

$creds = New-Object Microsoft.WindowsAzure.StorageCredentialsAccountAndKey($SAN, $SAK)
$client = New-Object      Microsoft.WindowsAzure.StorageClient.CloudBlobClient("https://$SAN.blob.core.windows.net",$creds)

$bro = New-Object Microsoft.WindowsAzure.StorageClient.BlobRequestOptions
$bro.UseFlatBlobListing = $true

#Add $images blobcontainer and use flatbloblisting to list blobnames
$imagecontainer = $client.GetBlobDirectoryReference("images")
$images = $imagecontainer.ListBlobs($bro)

#Add textfile and assign it to a variable
$InputFile = Get-Content C:\transcript\hej.txt

#Loop to find everything in the input file and compare it to matching filenames in  blobstorage. Return filenames that starts with the ID/contains the ID in the inputfile.
foreach ($ID in Get-Content $InputFile) {

Appreciate further help/solution.

A: Disclaimer: I have no experience with Azure, but a quick look at MSDN docs leads me to believe this would work:
foreach ($ID in $InputFile)
{
    $image_matches = $images | Where-Object {$_.Name -match '^$ID'}

    # process matching images here
}


text:
Q: Create a function to display HTML/data based on site admins role? I need to make a shortcode to display some HTML on a page based on site admins "role"? Not the logged in user but the site admin's role. By default the role is 'administrator' and the only other role is 'pro_user'. So if they are a "pro_user" I want to echo the the first "HTML type 1" and if not to output "HTML type 2" as you can see below:
I tried this but did something wrong & get blank output on the page.
add_shortcode( 'add_my_form', 'get_form_on_role' );
function get_form_on_role() {
    if( ! is_user_logged_in() ) {
        $user = new WP_User( get_current_user_id() );
        $roles = $user->roles;
        if( $roles[0] == 'pro_user' ) {
            echo 'HTML type 1';
        }elseif( $roles[0] == 'administrator' ) {
            echo 'HTML type 2';
        }
    }
}

A: I think below line of code is unnecessary, which is wrong if you looking for logged in user result.
if( ! is_user_logged_in() )

Please use below code, I make some changes for solution.
//Add a hook for a shortcode 'add_my_form' tag...
add_shortcode( 'add_my_form', 'get_form_on_role' );

//Create sortcode API used function...
function get_form_on_role() {
    if(is_user_logged_in() ) {//If user is logged in...

        //Get current user role information...
        $user = new WP_User( get_current_user_id() );
        $roles = $user->roles;

        $returnTxt = '';//Initialize return text variable...

        if( $roles[0] == 'pro_user' ) {//If user having 'pro_user' role...
            $returnTxt = 'HTML type 1';
        }elseif( $roles[0] == 'administrator' ) {//If user having 'administrator' role...
            $returnTxt =  'HTML type 2';
        }
        return $returnTxt;
    }
}

/*
    This will display 'HTML type 1' is user logged in with 'pro_user' role,
    If logged in user with 'administrator' then it will print 'HTML type 2'...
*/
//You can use sortcode by API like...
<?php echo do_shortcode("[add_my_form]");?>

Reference: Shortcode_API
Let me know if there is any doubt/query regarding this.

A: Thank you! This does work if the user is logged in however this is for a public page in a multisite setting so if possible I would like it to display to all users and base the output on the site admin/owners role.
Sorry if I was using the wrong code that checked if logged in and that misled you as to what I needed.
What I would like is 'HTML type 1' above to return if the sites admin for that pages role is 'pro_user'. It does that now but only if that admin is logged in.
Then if not 'pro_user' or if role='admin' to display 'HTML type 2'.
Is that possible to get the site admins role and not the logged in users role?
The page authors role also would not work in this case.
thank you for your help!!


text:
Q: How do I downgrade puppetdbquery? I'm getting an error on puppet runs which use puppetdb queries:
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `server_urls' for #<Puppet::Util::Puppetdb::Config:0x00000003cd66c8> at /etc/puppet/local-modules/monitoring/manifests/init.pp:14 on node hostname.goes.here
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

By running the puppetmaster with --verbose, I get a warning which looks helpful:
Warning: It looks like you are using a PuppetDB version < 3.0.
This version of puppetdbquery requires at least PuppetDB 3.0 to work.
Downgrade to puppetdbquery 1.x to use it with PuppetDB 2.x.

PuppetDB 3.0 isn't available on the machine in question, so I'm looking at downgrading puppetdbquery.  However, I can't find where/how this is installed.  So far I've checked dpkg (I'm running Debian Jessie), gem and librarian-puppet, but none of them appear to have installed puppetdbquery.
Is there anyway to find where it came from and how to downgrade it?

A: puppetdbquery is a puppet module, and even though it may not be in your Puppetfile, it may be installed as a dependency of one of your other modules.
Take a look in the directories listed in the modulepath on your puppet master.
The error message you quote is found in lib/puppetdb/connection.rb in that module.

A: To track down the file (thanks to ssm's answer for the link the source), I did:
find / -name connection.rb

Then I grepped the results for those which included "It looks like you are using a PuppetDB version < 3.0.", I ended up with one file:
/var/lib/gems/2.1.0/gems/ruby-puppetdb-2.1.1/lib/puppetdb/connection.rb

At first this confused me, because it makes no mention of puppetdbquery, but on closer inspection of the repository, I saw that the gemspec it includes calls itself "ruby-puppetdb", not puppetdbquery.
Therefore, the fix was to run:
gem uninstall ruby-puppetdb --version 2.1.1

I had older versions of the gem installed, so the system fell back to using those instead.
To summarise:
When installed as a gem, puppetdbquery is called ruby-puppetdb


text:
Q: How to use array notation to append data from different tab I want the yellow highlighed data append vertically (right next to "Paul Hill").   Thank you so much for your help.
={'HR 2010'!A2:C5,'HR 2020'!A2:C5}
https://docs.google.com/spreadsheets/d/1malF_5AEMuq3HCZ4G0SXkDJk3x_Vrdgcu4gzdA0HnPA/edit?usp=sharing

A: for vertical use:
={'HR 2010'!A2:C5;'HR 2020'!A2:C5}


text:
Q: Dynamic nested sum I would like to dynamically create nested sums with a dynamic number of parameters aswell.
We do know the number of variables. Lets say we have 3 Variables with S being an array:
$$
i=(1,\dots,m), j=(1,\dots,n),k=(1,\dots,l)
$$
Therefore we have two nested Sums each:
$$
    f_i=\sum_{j=1}^n\sum_{k=1}^l S(i,j,k)\\ g_j=\sum_{i=1}^m\sum_{k=1}^l S(i,j,k)\\ h_k=\sum_{i=1}^m\sum_{j=1}^n S(i,j,k)
$$
With a different set of data we might have 4 variables:
$$
i=(1,\dots,m), j=(1,\dots,n),k=(1,\dots,l),o=(1,\dots,t)
$$
with 3 nested sums each:
$$
    f_i=\sum_{j=1}^n\sum_{k=1}^l\sum_{o=1}^t S(i,j,k,o)\\ g_j=\sum_{i=1}^m\sum_{k=1}^l\sum_{o=1}^t S(i,j,k,o)\\ h_k=\sum_{j=1}^n\sum_{i=1}^m\sum_{o=1}^t S(i,j,k,o)\\ r_o=\sum_{j=1}^n\sum_{k=1}^l\sum_{i=1}^m S(i,j,k,o)
$$
Is there any way to create these nested sums dynamically considering we know the number of parameters?
This is what I've gotten so far but I don't know how to get the list part S[[k[1],k[2],k[3]]] dynamically:
varrange={4,4,4};
numbervars=Length[varrange];
iterator = Table[{k[m], 1, varrange[[m]]}, {m, numbervars}]
{{k[1], 1, 4}, {k[2], 1, 4}, {k[3], 1, 4}}

Sum[S[[k[1], k[2], k[3]]], Evaluate[Sequence @@ iterator]]

Any suggestions?

A: You were almost there ...
If
ind = First/@iterator;
(*{k[1], k[2], k[3]} *)

then
if S is a function S[...]
Sum[S[Sequence @@ ind], Evaluate[Sequence @@ iterator]]

or the equivalent but more elegant and compact form
Sum[S @@ ind, ##] & @@ iterator
Sum[S @@ First /@ {##}, ##] & @@ iterator

give

If S is an array, S[[...]]
just replace S[...] by S[[...]] :
Sum[S[[Sequence @@ ind]], Evaluate[Sequence @@ iterator]]

or use the equivalent compact form :
Sum[S[[##]] & @@ ind, ##] & @@ iterator
Sum[S[[##]] & @@ First /@ {##}, ##] & @@ iterator

or also :
s[i__]:=S[[i]];
Sum[s[[##]] & @@ ind, ##] & @@ iterator

or this might be useful to visually check the summation before evaluation :
check = Sum[foo[[##]] & @@ ind, ##] & @@ iterator
check  /. foo[x__] :> S[[x]]

A: fun[list_, f_] := Total[f @@@ Tuples[list]]

For example:
fun[{Range[3], Range[4], Range[5]}, S]

yields:
(* S[1, 1, 1] + S[1, 1, 2] + S[1, 1, 3] + S[1, 1, 4] + S[1, 1, 5] +
 S[1, 2, 1] + S[1, 2, 2] + S[1, 2, 3] + S[1, 2, 4] + S[1, 2, 5] +
 S[1, 3, 1] + S[1, 3, 2] + S[1, 3, 3] + S[1, 3, 4] + S[1, 3, 5] +
 S[1, 4, 1] + S[1, 4, 2] + S[1, 4, 3] + S[1, 4, 4] + S[1, 4, 5] +
 S[2, 1, 1] + S[2, 1, 2] + S[2, 1, 3] + S[2, 1, 4] + S[2, 1, 5] +
 S[2, 2, 1] + S[2, 2, 2] + S[2, 2, 3] + S[2, 2, 4] + S[2, 2, 5] +
 S[2, 3, 1] + S[2, 3, 2] + S[2, 3, 3] + S[2, 3, 4] + S[2, 3, 5] +
 S[2, 4, 1] + S[2, 4, 2] + S[2, 4, 3] + S[2, 4, 4] + S[2, 4, 5] +
 S[3, 1, 1] + S[3, 1, 2] + S[3, 1, 3] + S[3, 1, 4] + S[3, 1, 5] +
 S[3, 2, 1] + S[3, 2, 2] + S[3, 2, 3] + S[3, 2, 4] + S[3, 2, 5] +
 S[3, 3, 1] + S[3, 3, 2] + S[3, 3, 3] + S[3, 3, 4] + S[3, 3, 5] +
 S[3, 4, 1] + S[3, 4, 2] + S[3, 4, 3] + S[3, 4, 4] + S[3, 4, 5] *)

UPDATE
after clarification (see comment):
funa[list_, array_] := Total[array[[##]] & @@@ Tuples[list]]

For examples:
 mat={{{8, 8, 8, 10}, {8, 7, 9, 4}, {6, 9, 3, 6}}, {{3, 5, 9, 6}, {2, 3, 5,
    9}, {8, 1, 6, 7}}}

testing:
funa[#, mat] & /@ {{Range[2]}, {Range[2], Range[3]}, {Range[2],
   Range[3], Range[4]}}

yields:
{{{11, 13, 17, 16}, {10, 10, 14, 13}, {14, 10, 9, 13}}, {35, 33, 40,
  42}, 150}

Noting the accepted answer (in which the Part comment appears irrelevant but nicely assists in getting code to work, you could also do:
func[varr_, f_] := With[{lst = Range /@ varr},
  Total[f @@@ Tuples[lst]]]

with the test example: func[{4,4,4},S]


text:
Q: Redirecting User to home page when not logged in and trying to access a certain web page vb.net Ok so far i have working the ability to log in and access a certain web page ('bookrepair.aspx') through the use of roles and permissions. I used this to then deny any non-logged on users which works however it throws me up the "Server in '/' Application error". However i would like it to redirect the user to the home page ('home.aspx') and display a message to them saying "Only logged in users can access Book Repair"
So for i have this piece of code in my 'bookrepair.aspx' page
Private Sub Pages_BookRepair_Load(sender As Object, e As EventArgs) Handles Me.Load
    If Not Me.Page.User.Identity.IsAuthenticated Then
        Response.Redirect("Home.aspx")
        MsgBox("Only logged in user's can access Book Repair")
    End If
End Sub

However i still get the "Server in '/' Application error when trying to access it not logged in.
Any ideas?

A: I don't use the User.Identity functionality just because of all the issues you have to address in order to authenticate users.  I make it simple and set a flag in either the Session or ViewState object which would indicated whether or not the user is logged on.  For example:
If Session("LoggedOn") = "NO" Then
    Response.Redirest("MainPage.aspx", False) 'False to indicate that the rest of the code in the procedure is not to be executed.
End IF

It's what works best for me, I have total control over it, do not have to worry that the browser supports it because Session is maintained on the server.  I've never had an issue with it.


text:
Q: Is there a way to use cor function with factor variables without creating dummy variables? (R) I have a dataset with several categorical predictors with varying factor levels. Is there a way to generate a correlation matrix from this data without having to create a bunch of dummy variables?
I'm using multiple linear regression to predict a continuous variable (sales). The predicted values are surprisingly accurate and plotting the predicted vs observed results in a near diagonal line.
I thought that was all I needed to worry about, but in researching, I found I should also plot predicted vs residuals to test for homoscedasticity. I did that and found out I was violating it.
I was looking for a way to resolve this and found a post that said I should use a robust method for computing the covariance matrix. Hence why I want to use the cor() function, though I'm not sure if that's actually the right way of going about this.
And here are the actual graphs:
Predicted vs Actual...

Predicted vs Residual...

A: If your question is simply "is there a way we can run correlations conditional on categorical variables" then yes. The correlation package in R makes this fairly easy. I've shown how to do this with R's native iris data as an example:
library(correlation) # for correlations
library(tidyverse) # for using grouping function

iris %>%
  group_by(Species) %>%
  correlation()

Which gives you this matrix of grouped correlations that don't require dummy coding at all:
# Correlation Matrix (pearson-method)

Group      |   Parameter1 |   Parameter2 |    r |        95% CI | t(48) |         p
-----------------------------------------------------------------------------------
setosa     | Sepal.Length |  Sepal.Width | 0.74 | [ 0.59, 0.85] |  7.68 | < .001***
setosa     | Sepal.Length | Petal.Length | 0.27 | [-0.01, 0.51] |  1.92 | 0.202
setosa     | Sepal.Length |  Petal.Width | 0.28 | [ 0.00, 0.52] |  2.01 | 0.202
setosa     |  Sepal.Width | Petal.Length | 0.18 | [-0.11, 0.43] |  1.25 | 0.217
setosa     |  Sepal.Width |  Petal.Width | 0.23 | [-0.05, 0.48] |  1.66 | 0.208
setosa     | Petal.Length |  Petal.Width | 0.33 | [ 0.06, 0.56] |  2.44 | 0.093
versicolor | Sepal.Length |  Sepal.Width | 0.53 | [ 0.29, 0.70] |  4.28 | < .001***
versicolor | Sepal.Length | Petal.Length | 0.75 | [ 0.60, 0.85] |  7.95 | < .001***
versicolor | Sepal.Length |  Petal.Width | 0.55 | [ 0.32, 0.72] |  4.52 | < .001***
versicolor |  Sepal.Width | Petal.Length | 0.56 | [ 0.33, 0.73] |  4.69 | < .001***
versicolor |  Sepal.Width |  Petal.Width | 0.66 | [ 0.47, 0.80] |  6.15 | < .001***
versicolor | Petal.Length |  Petal.Width | 0.79 | [ 0.65, 0.87] |  8.83 | < .001***
virginica  | Sepal.Length |  Sepal.Width | 0.46 | [ 0.20, 0.65] |  3.56 | 0.003**
virginica  | Sepal.Length | Petal.Length | 0.86 | [ 0.77, 0.92] | 11.90 | < .001***
virginica  | Sepal.Length |  Petal.Width | 0.28 | [ 0.00, 0.52] |  2.03 | 0.048*
virginica  |  Sepal.Width | Petal.Length | 0.40 | [ 0.14, 0.61] |  3.03 | 0.012*
virginica  |  Sepal.Width |  Petal.Width | 0.54 | [ 0.31, 0.71] |  4.42 | < .001***
virginica  | Petal.Length |  Petal.Width | 0.32 | [ 0.05, 0.55] |  2.36 | 0.045*

p-value adjustment method: Holm (1979)
Observations: 50

Of course, you will need to run the specifics such as which correlation to use, etc. but this should do the trick. For the follow up questions noted in the comments section of your question, that is a different matter.

A: You're going to want to use the lmtest package for re-estimating the model along with the sandwich package for the robust covariance matrix
fit <- lm(sales ~ race + age + ...)

install.packages(sandwich)
install.packages(lmtest)
library(sandwich)
library(lmtest)

coeftest(fit, vcov = vcovHC(fit, type="HC"))

Type "HC" is the original White's estimator, the default in vcovHC is "HC3" and the reason for this is given in the documentation ?vcovHC


text:
Q: How to pass ng-repeat value to controller I am using an ng-repeat directive with filter like so:

</div

i.e Showing {{data.length}} Persons. (I am expect  to pass the length value to controller)
But i need to pass the filtered length value to controller because i do same logic based on the filtered length value.

A: 1.Method 1
ng-repeat="item in filtered = (data | filter:filterExpr)"

Would create the filtered list.
filtered.length will show the filtered length.
2.Method 2
Use $watch for detecting the filtered length.
$scope.length = $scope.data.length;
$scope.$watch("search", function(query) {
    $scope.length = $filter("filter")($scope.data, query).length;
});

Example

var app = angular.module('angularjs-starter', [])

app.controller('MainCtrl', function($scope, $filter) {
  $scope.data = [{
    "name": "Martin",
    "age": 21
  }, {
    "name": "Peter",
    "age": 26
  }, {
    "name": "Arun",
    "age": 25
  }, {
    "name": "Maxwell",
    "age": 22
  }];

  $scope.counted = $scope.data.length;
  $scope.$watch("search", function(query) {
    $scope.filteredData = $filter("filter")($scope.data, query);
  });

});

  <meta charset="utf-8">
  <title>Demo</title>

  <link rel="stylesheet" href="style.css">

  <input ng-model="search" type="text">

Showing {{data.length}} Persons;

Filtered {{filteredData.length}}

      {{person.name}}


text:
Q: Yii2: Not getting all the images in 2amigos Gallery Widget for Yii2 Im using 2amigos Gallery Widget for Yii2 to display images
<?php foreach ($img as $key=>$row): ?>
<div class="classes_inside_item bordered_wht_border">
<?php
foreach (explode(';',rtrim($row['images'],';')) as $key_img => $value_img)
{
?>
<?php
$images=[Yii::getAlias('@web').'/'.$value_img];
?>
<?php
}
?>
</div>
<?php echo dosamigos\gallery\Gallery::widget(['items' => $images]); ?>
<?php endforeach; ?>

By using above code im able to show only one image though it has 3 images in database (images path is saved in database path like /uploads/img1;/uploads/img2;/uploads/img3)
I need to first obtain all the path in array and then pass this array to Gallary Widget to show images

A: If this helps at all, I'm reading my images from a table into a collection and then looping them like this:
$items = array();
foreach ($cImages as $oImage) {
    $item = [
                'url' => '/images/listingimages/' . $oImage->file_name,
                'src' => '/images/listingimages/thumbs/' . $oImage->file_name,
                'options' => array('title' => $oImage->name),
            ];
    $items[] = $item;
}

And then loading $items into the widget.


text:
Q: Engine.io or SockJS, which one to choose? I have run into trouble with Socket.io regarding memory leaks and scaling issues lately. My decision to use Socket.io was made over a year ago when it was undoubtedly the best library to use.
Now that Socket.io causes much trouble, I spent time looking for alternatives that became available in the meantime and think that both Engine.io and SockJS are generally well suited for me. However, in my opinion both have some disadvantages and I am not sure which one to choose.
Engine.io is basically the perfect lightweight version of Socket.io that does not contain all the features I do not require anyway. I have already written my own reconnection and heartbeat logic for Socket.io, because I was not satisfied with the default logics and I never intended to use rooms or other features that Socket.io offers.
But - in my opinion - the major disadvantage of Engine.io is the way connections are established. Clients start with slower jsonp-polling and are upgraded if they support better transports. The fact that the clients which support websockets natively (number increasing steadily) have a disadvantage in the form of a longer and unstable connection procedure over those clients which use outdated browsers, contradicts my sense of how it should be handled.
SockJS on the other hand handles the connections exactly as I would like to. From what I have read it seems to be pretty stable while Engine.io has some issues at this time.
My app is running behind an Nginx router on a single domain, therefore I do not need the cross-domain functionality SockJS offers. Because of providing this functionality, however, SockJS does not expose the cookie data of the client at all. So far I had a 2-factor authorization with Socket.io via cookie AND query string token and this would not be possible with SockJS (with Engine.io it would).
I have read pretty much all what is avilable about and pros and cons of both, but it seems there is not much being discussed or published so far, espacially about Engine.io (there are only 8 questions tagged with engine.io here).

*

*Which of the 2 libraries do you prefer and for which reason? Do you use them in production?

*Which one will likely be maintained more actively and could have a major advantage over the other in the future?

A: Have you looked at Primus? It offers the cookie requirements you mention, it supports all of the major 'real-time'/websocket libraries available and is a pretty active project. To me it also sounds like vendor lock-in could be a concern for you and Primus would address that.
The fact that it uses a plugin system should also a) make it easier for you to extend if needed and b) may actually have a community plugin that already does what you need.

Which of the 2 libraries do you prefer and for which reason? Do you use them in production?

I have only used SockJS via the Vert.x API and it was for an internal project that I would consider 'production', but not a production facing consumer app. That said, it performed very well.

Which one will likely be maintained more actively and could have a major advantage over the other in the future?

Just looking over the commit history of Engine.io and SockJS, and the fact that Auttomatic is supporting Engine.io makes me inclined to think that it will be more stable, for a longer period of time, but of course that's debatable. Looking at the issues for Engine.io and SockJS is another good place to evaluate, but since they're both split over multiple repos it should be taken with a grain of salt. I'm not sure where/how Automattic is using Engine/Socket.io, but if it's in WordPress.com or one of their plugins, it has substantial production-at-scale battle testing.
edit: change answer to reflect cookie support confirmed by Primus author in comments below

A: I'd like to redirect you to this (quite detailed) discussion thread about SockJS and Engine.io
https://groups.google.com/forum/#!topic/sockjs/WSIdcY14ciI
Basically,

SockJS detects working transports before marking the connection
  as open. Engine.io will immediately open the connection and upgrade
  it later.
flash, one of the Engine.io fallbacks
  (and not present in SockJS) loads slowly and in environments
  behind proxies takes 3 seconds to timeout.
SockJS doesn't use flash and therefore doesn't need to work around
  this issue.
  SockJS does the upgrade on start. After that you have
  a consistent experience. You send what you send, you receive
  what you receive.

Also, as far as I can tell, engine.io-client (the client-side) library for engine.io, does not support requirejs builds, so that's another negative point. (SockJS does build perfectly).

A: You may also consider node-walve. Complete WebSocket basic. Extremely performant as fully stream based.
Example of how to use:
walve.createServer(function(wsocket) {
  wsocket.on('incoming', function(incoming) {
    incoming.pipe(process.stdout, { end: false });
  });
}).listen(server);

It may not be the best choice if you feel not secure in the nodejs environment (e.g. extending prototypes for API sugar), contributing to the project (though the code is more readable as socket.io).


text:
Q: How to check whether column in table contains any of a set of values? If I have a set of strings, what SQL statement would determine which of those strings are found in one column of a table?
I would want it to return which strings are found, or Null if none are found.

A: SELECT DISTINCT Column1 FROM Table1 WHERE Column1 IN ("String1","String2","String3")


text:
Q: JSF 2 : Ajax errors not displayed Im currently trying out the ajax feature, and im curious about how can i display the error messages occured when i do the ajax stuff ?
For example, i have a primefaces button :
<p:commandButton value="Refresh" update="debugPanel messages"
   action="#{checkbocLabBean.submit}"/>

When testing that button, nothing seems to happen, until i check the server logs, there's an exception. It turns out that i have a typo. Should be #{checkboxLabBean.submit}.
The only thing i can think of right now is to have disable the ajax, adding ajax="false" in my case, and the error will show up.
Is there any other ways to show errors right into the browser in development phase when using ajax requests ?

A: Ajax requests happens asynchronously. They do by default not affect the entire document. Exceptions thrown during PrimeFaces' ajax requests are delegated to <p:ajaxStatus>. You can do your thing in <facet name="error">.
<p:ajaxStatus>
    <f:facet name="start">Loading...</f:facet>
    <f:facet name="success"><h:outputText value="" /></f:facet>
    <f:facet name="error">An error has occurred!</f:facet>
</p:ajaxStatus>

If you rather want to replace the current document with the error page -which is a very reasonable choice- then it's good to know that PrimeFaces uses jQuery under the covers and that you can configure jQuery as follows to do so:
<script>
    jQuery.ajaxSetup({
        error: handleXhrError
    });

    function handleXhrError(xhr) {
        document.open();
        document.write(xhr.responseText);
        document.close();
    }
</script>

See also:

*

*How to safeguard webapplication on server-side errors?

*Handling of server-side HTTP errors in jQuery's ajax requests


text:
Q: Demandware - Pipeline not found for current domain I already made pipeline. Which is working fine. Suddenly it give error like

2015-12-18 02:39:08.091 GMT] ERROR system.core ISH-CORE-2368 Sites-SiteGenesis-Site core Storefront [uuid] [request-id]-0-00 [timestamp] "Error executing pipeline: Hello com.demandware.beehive.core.capi.pipeline.PipelineExecutionException:Pipeline not found (Hello) for current domain (Sites-SiteGenesis-Site)"

Does anybody know how to solve this?

A: In the event that your pipeline can not be found for the selected domain, please go trough and verify all of the following:

*

*Double check Pipeline-Node naming
Pipeline URLs are generated by their name and your desired entry node, in this scenario, I would expect a file named Hello.xml in you cartridge's pipeline directory, and a start node named Start, would be accessed via {instanceURL}/on/demandware.store/Sites-mySite-Site/Hello-Start

*Try and force upload of your cartridges
Occasionally the files on the server will not be updated correctly when a save is made; to force an update, right click your project, click Demandware > Upload Cartridges

*Check your Cartridge Path
If you are using a shared instance, or your instance is re-provisioned, you may need to check your cartridge path to be sure your custom cartridge(s) are still there.

*Check your Code Versions
Occasionally you may increment / change your code version - if you do, make sure that the path you select in Studio is the one that you have selected in Business Manager.

*Tech Support
Should you still have issues following the four steps above, please file a support ticket and the tech-support team will be able to provide you with more assistance.


text:
Q: /dev/sdb contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should When I open gparted, I get the following warning:

/dev/sdb contains GPT signatures, indicating that it has a GPT table.
  However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted—possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition table?

This is on a SSD if it makes any difference.
What is this and how do I fix it?


text:
Q: how to select/target a submit button among several buttons from html to javascript I want to select a button from a markup that contains three buttons, I tried calling the specified one directly but the code is not responding, but when I try to add the even listener on the body,obviously it takes the effect on the three buttons, which I don't like because I want to use them for special purposes like add and clear.

type your desired language here

    <form  id = 'task-form'>

        <input type="text" class="type" id="task">
        <input type="submit" class="btn " value="add">

    </form>

type your desired language here

      <form id="task-form2">
        <input type="text" class="type filter">
        <input type="submit" class="btn " id="yes" value="clear">
      </form>

That is the html for refrence. My aim exactly is to target the first input of type submit with value of add to add some created items to the empty 'ul' tag.
//document.body.addEventListener('submit' , addTask)
const additem = document.querySelector('#task');
const form = document.querySelector('.form-container');
const filter = document.querySelector('#spa input');
const clear = document.querySelector('#spa');
const listfat = document.querySelector('#evnt-sec ul');
console.log(form);
console.log(additem);
loadEventListeners();

function loadEventListeners() {
  form.addEventListener('submit' , addTask);
  //filter.addEventListener('click' , keyUp);
 // clear.addEventListener('submit' , clearItem);
}
form.addEventListener('submit' , function(e){
  if (additem.value ===''){
  alert('no value has been passed');}
const item = document.createElement('li');
item.className = 'append';
item.appendChild(document.createTextNode(additem.value));
const link = document.createElement('a');
item.appendChild(link);
link.innerHTML = '';
console.log(item);
additem.value =' ';
listfat.appendChild(item);
e.preventDefault();
});

And that is my js code above for refrence. I tried to grab the parent by using 'form-container' but it doesn't work, by using task-form yet it doesn't work and lastly by using the body the three buttons in my markup respond which is not what I want, since the code work by adding event on the body makes me believe that probably there's nothing wrong with the "function part of code".
I think I need more explanation on how to target the button and if possible I also need an explanation why the code isn't responding properly as this will really help me.

A:
my aim exactly is to target the first input of type submit with value
of add

document.querySelector("input[type='submit'][value='add']").addEventListener(...)

But really, the clicking of the submit button will automatically trigger the submit event of the form, so you probably should target that instead:
document.querySelector("#task-form").addEventListener("submit", ...);

But, in actuality, your use case doesn't seem like you are actually submitting form data anywhere, in which case, you should not be using a form element in the first place, nor any submit buttons. You need regular buttons and handle their click event.
You also seem to have a lot of unnecessary code and your if condition's true block contains code that should run when the test is false.

const addItem = document.querySelector('input[type="button"][value="add"]');
const task = document.querySelector('#task');
const clear = document.querySelector('#spa');
const listfat = document.querySelector('#evnt-sec ul');

addItem.addEventListener('click' , function(e){
  if (task.value ===''){
    e.preventDefault();
    alert('no value has been passed');
  } else {
    const item = document.createElement('li');
    item.className = 'append';
    item.textContent = task.value;
    const link = document.createElement('a');
    item.appendChild(link);
    link.innerHTML = '';
    console.log(item);
    task.value ='';
    listfat.appendChild(item);
  }
});

type your desired language here

        <input type="text" class="type" id="task">
        <input type="button" class="btn " value="add">

type your desired language here

      <input type="text" class="type filter">
      <input type="button" class="btn " id="yes" value="clear">


text:
Q: How to solve those two polynomials which contains a lot of floor function? Solve for $x$ : $$3x^2-2x\lfloor x\rfloor + 4\lfloor x^2\rfloor + x - 4\lfloor x\rfloor-\frac{7}{2}=0$$
Then solve for $x$ : $$\lfloor 3x^2-2x\lfloor x\rfloor + 4\lfloor x^2\rfloor + x - 4\lfloor x\rfloor-\frac{7}{2}\rfloor=0$$
And yes, the second equation is the same as the first one but it is inside a floor function.
I don't know how to solve those complicated equation. How would you solve it ?
Thanks for the help !

A: By analyzing the first equation, I was able to find all the solutions.
Firstly, we know $3$ things about the floor functions :

*

*$\forall x \in \mathbb R$, $x-1\le\lfloor x\rfloor\le x$

*$\forall x \in \mathbb R_+$, $x^2-x\le x\lfloor x\rfloor\le x^2$

*$\forall x \in \mathbb R$, $x^2-1\le\lfloor x^2\rfloor\le x^2$
Ok now, let's use those inequalities to solve the first equation !
Case $1$ : $x\ge 0$
$$x^2-x\le x\lfloor x\rfloor\le x^2$$
$$-2x^2\le -2x\lfloor x\rfloor\le -2x^2+2x$$
$$3x^2-2x^2\le 3x^2-2x\lfloor x\rfloor\le 3x^2-2x^2+2x$$
$$x^2+4x^2-4\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor\le x^2+2x+4x^2$$
$$5x^2-4+x\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x\le 5x^2+2x+x$$
$$5x^2-4+x-4x\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor\le 5x^2+2x+x-4x+4$$
$$5x^2-3x-4-\frac{7}{2}\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}\le 5x^2-x+4-\frac{7}{2}$$
$$5x^2-3x-\frac{15}{2}\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}\le 5x^2-x+\frac{1}{2}$$
Ok now, solve for $5x^2-3x-\frac{15}{2}=0$ and for $5x^2-x+\frac{1}{2}=0$
We get $0$ solution for the second one and $2$ for the first one. Caution, the solution must be greater or equal than $0$. And the solution which satisfies this rule is $\frac{6+2\sqrt{159}}{20}$.
So, if there is a solution greater or equal to $0$, $x$ needs to be between $0$ and $\frac{6+2\sqrt{159}}{20}$.
Now we have $2$ possibilities : $\lfloor x \rfloor = 0$ or $\lfloor x \rfloor = 1$
Case $1.1$ : $\lfloor x \rfloor = 0$
So the function $3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}$ is simplified into $3x^2+x-\frac{7}{2}=0$
And we get the solution (greater than $0$) : $$\frac{-1+\sqrt{43}}{6}$$
which is equal to $0$ when we use the floor function.
Case $1.2$ : $\lfloor x \rfloor = 1$
After some simplification, we get :
$3x^2-x+4\lfloor x^2 \rfloor-\frac{15}{2}$
$\lfloor x^2 \rfloor$ could be equal to $1$ or $2$ because here $1\le x\le\frac{6+2\sqrt{159}}{20}$ so $1\le x^2 \le\frac{6+2\sqrt{159}}{20}^2$
Case $1.2.1$ : $\lfloor x^2 \rfloor=1$
We get : $3x^2-x+4-\frac{15}{2}=3x^2-x-\frac{7}{2}$
There is one solution greater or equal than $0$, where the floor is equal to $1$ and where the floor of the square is equal to $1$. It is : $$\frac{1+\sqrt{43}}{6}$$
Case $1.2.2$ : $\lfloor x^2 \rfloor=2$
There isn't a solution which satifies every parameters (greater or equal than $0$, the floor of the number is equal to $1$ and the floor of the square is equal to $2$)
Case $2$ : $x\lt 0$
We get : $$5x^2-x-\frac{15}{2}\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}\le 5x^2-3x+\frac{1}{2}$$
Ok now, solve for $5x^2-x-\frac{15}{2}=0$ and for $5x^2-3x+\frac{1}{2}=0$
We get $0$ solution for the second one and $2$ for the first one. Caution, the solution must be less than $0$. And the solution which satisfies this rule is $\frac{2-2\sqrt{151}}{20}$.
So, if there is a solution less than $0$, $x$ needs to be between $\frac{2-2\sqrt{151}}{20}$ and $0$.
Now we have $2$ possibilities : $\lfloor x \rfloor = -1$ or $\lfloor x \rfloor = -2$
Case $2.1$ : $\lfloor x \rfloor = -1$
We get : $3x^2+3x+4\lfloor x^2\rfloor + \frac{1}{2}=0$
Case $2.1.1$ : $\lfloor x^2\rfloor=1$
If that's the case, then $x=-1$. However, when $x =-1$, it's not equal to $0$. So it's wrong.
Case $2.1.2$ : $\lfloor x^2\rfloor=0$
Then we have : $3x^2+3x + \frac{1}{2}=0$. And here there is 2 solutions which satisfies everything (less than $0$, floor equal to $-1$ and floor of the square to $0$.
And it's : $$\frac{-3-\sqrt{3}}{6}, \frac{-3+\sqrt{3}}{6}$$
Case $2.2$ : $\lfloor x \rfloor = -2$
We have : $3x^2+5x+4\lfloor x^2\rfloor + \frac{9}{2}=0$
$\lfloor x^2 \rfloor$ is equal to $1$ because here $\frac{2-2\sqrt{151}}{20}\le x\le -1$ so $1\le x^2 \le\frac{2-2\sqrt{151}}{20}^2$
We get now : $3x^2+5x + \frac{17}{2}=0$. However, there is no solutions.
So finally, there is $4$ solutions : $$x=\left\{\frac{-3\pm\sqrt{3}}{6},\frac{\pm 1+\sqrt{43}}{6}\right\}$$
Ok so after a lot of thinking, I found a way to solve for the second equation.
First, we have inside the floor function : $\lfloor x\rfloor$ and $\lfloor x^2\rfloor$.
This allows us to deduce when we have discontinuities in the function.
For $x\ge 0$, we have at $1$,$\sqrt{2}$,$\sqrt{3}$,... discontinuities.
Now, let us recall something I said earlier.
For $x\ge 0$ :
$$5x^2-3x-\frac{15}{2}\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}$$
$$5x^2-3x-\frac{15}{2}\ge 1\text{ for }x\ge \frac{6+2\sqrt{179}}{20}$$
So we know for sure that for $x\ge \frac{6+2\sqrt{179}}{20}$, $3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}\ge 1$.
The solutions needs to be in the interval $[0,\frac{6+2\sqrt{179}}{20}[$.

*

*For $x\in[0,1[$, we have this : $3x^2+x-\frac{7}{2}$ (it's easy to show that it is increasing in this interval)

$$3x^2+x-\frac{7}{2}\ge 1\text{ for }x \ge \frac{-2+2\sqrt{91}}{12}$$
But $\frac{-2+2\sqrt{91}}{12}\gt 1$, plus because this function is increasing and we know it is equal to $0$ at $x=\frac{-1+\sqrt{43}}{6}$
The interval $[\frac{-1+\sqrt{43}}{6},1[$ is a solution to this equation.

*

*For $x\in[1,\sqrt{2}[$, we have this : $3x^2-x-\frac{7}{2}$ (it is increasing in this interval)

$$3x^2-x-\frac{7}{2}\ge 1\text{ for }x \ge \frac{1+\sqrt{55}}{6}$$
But $\frac{1+\sqrt{55}}{6}\lt \sqrt{2}$, plus because this function is increasing and we know it is equal to $0$ at $x=\frac{1+\sqrt{43}}{6}$
The interval $[\frac{1+\sqrt{43}}{6},\frac{1+\sqrt{55}}{6}[$ is a solution to this equation.

*

*For $x\in[\sqrt{2},\frac{6+2\sqrt{179}}{20}[$ because $\frac{6+2\sqrt{179}}{20}\lt\sqrt{3}$, we have this : $3x^2-x+\frac{1}{2}$ (it is increasing in this interval)

If $x=\sqrt{2}$ then we would have $-\sqrt{2}+\frac{13}{2}$ which is bigger than $1$. And because it's increasing, it'll always be bigger than $1$. So there is no solutions in this interval.
For $x\lt 0$, we have at $-1$,$-\sqrt{2}$,$-\sqrt{3}$,... discontinuities.
$$5x^2-x-\frac{15}{2}\le 3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}$$
$$5x^2-x-\frac{15}{2}\ge 1\text{ for }x\le \frac{1-3\sqrt{19}}{10}$$
So we know for sure that for $x\le \frac{1-3\sqrt{19}}{10}$, $3x^2-2x\lfloor x\rfloor+4\lfloor x^2\rfloor+x-4\lfloor x \rfloor-\frac{7}{2}\ge 1$
The solutions needs to be in the interval $]\frac{1-3\sqrt{19}}{10},0[$.

*

*For $x\in ]-1,0[$, we have $3x^2+3x+\frac{1}{2}$ (it is decreasing from $-1$ to $-\frac{1}{2}$ and it is increasing from $-\frac{1}{2}$ to $0$).

This equation is equal to $0$ when $x=\frac{-3\pm\sqrt{3}}{6}$.
However, we know it's decreasing then increasing. So the intervals $]-1,\frac{-3-\sqrt{3}}{6}$ and $]\frac{-3+\sqrt{3}}{6},0[$ are others solutions.

*

*For $x=-1$, we have $\frac{9}{2}\gt 1$. It's not a solution.

*For $]\frac{1-3\sqrt{19}}{10},-1[$ because $\frac{1-3\sqrt{19}}{10}\gt -\sqrt{2}$, we have $3x^2+5x+\frac{17}{2}$ (it is decreasing in this interval)
It can be shown really easy that $\forall x\in\mathbb R$, $3x^2+5x+\frac{17}{2}\gt 1$.
So finally, we get :
$$x\in\left\{\left]-1,\frac{-3-\sqrt{3}}{6}\right]\cup\left[\frac{-3+\sqrt{3}}{6},0\right[\cup\left[\frac{-1+\sqrt{43}}{6},1\right[\cup\left[\frac{1+\sqrt{43}}{6},\frac{1+\sqrt{55}}{6}\right[\right\}$$
Hope this is the end...


text:
Q: Is there something similar to Source Code Outliner Power Toy for VS2010? I absolutely love the Source Code Ouliner power toy that I use in VS2005 but am upgrading to 2010 and it seems they haven't yet released a new version. Is there anything similar that shows you a basic outline of the file you are currently navigating?

A: ReSharper, amongst many other features, has a File Structure window which does the same as Source Outliner.

A: For a free one, try the Solution Navigator in the Microsoft Productivity Power Tools.

A: Like you, I found this a totally great plug in that saved on the order of minutes per day.  No more searching for functions!  Luckily Source Outliner has been re-created for VS2010 and is still free.  However, sbohlen updated it and it now runs on the (free) DXCore environment.  I have been using it ever since I upgraded to VS2010.
You can read along as I got this set up, downloaded all the parts and got it running.
http://unhandled-exceptions.com/blog/index.php/2010/05/23/plugins-for-dxcorecoderushxpresscoderushrefactor-pro-201014-rtm-available/
The download is here:
http://code.google.com/p/dxsourceoutliner/downloads/list
You will also need the DXCore community installer from http://www.devexpress.com
But as a ReSharper user for years now, I will use the File Structure - same sort of view and already built in to R#.


text:
Q: Hide/Show ion fab button programmatically can anyone help me to find a way to hide/show specific button from the list of button of ion-fab

A: i would dynamically render the list of fabButtons so that you only add the buttons to the list that are needed for the example
This is not the complete solution but something to get you started
import { Component } from "@angular/core";

@Component({
  selector: "app-tab1",
  templateUrl: "tab1.page.html",
  styleUrls: ["tab1.page.scss"]
})
export class Tab1Page {
  fButtons = [
    { iconName: "logo-vimeo", isActive : true },
    { iconName: "logo-instagram", isActive : false },
    { iconName: "logo-facebook", isActive : true }
  ];
  constructor() {}

  getActive() {
    return this.fButtons.filter((i:any) => {
      return i.isActive === true
    })
  }
}

the template
  <ion-fab vertical="bottom" horizontal="end" slot="fixed">
    <ion-fab-button>
      <ion-icon name="share"></ion-icon>
    </ion-fab-button>
    <ion-fab-list side="top">
      <ion-fab-button *ngFor="let b of getActive()">
        <ion-icon name={{b.iconName}}></ion-icon>
      </ion-fab-button>
    </ion-fab-list>
  </ion-fab>

A: If you use Ionic framework, then use this sample code
<IonFabList side="top">

  <IonFabButton *ngIf="..." color="primary">
    <IonIcon icon="logo-facebook" />
  </IonFabButton>

  <IonFabButton *ngIf="..." color="primary">
    <IonIcon icon="logo-twitter" />
  </IonFabButton>

  <IonFabButton *ngIf="..." color="primary">
    <IonIcon icon="logo-youtube" />
  </IonFabButton>

  <IonFabButton *ngIf="..." color="primary">
    <IonIcon icon="logo-vimeo" />
  </IonFabButton>

</IonFabList>

in *ngIf write your conditions


text:
Q: Seeking short story about teenage hovercar thieves forced to race to their deaths by the government I'm looking for a short story that I read in the late 1970s or early 1980s, English-language in the US, possibly part of a Scholastic-published offering or anthology.
The plot involves two teenage juvenile delinquent brothers who are unrepentant hovercar thieves and joyriders (I'm pretty sure it was hovercars, though it could have been regular cars).
They have been caught yet again, and the justice system, desperate for a solution to the problem of rampant hovercar joyriding, puts them into a program where they are forced to race hovercars on a track until they lose the desire, or die in the process. (The analogy used is similar to forcing kids caught smoking cigarettes to smoke a box of cigars until they get sick -- a form of aversion therapy.)
In the first race, the older brother chooses a car with a low-profile color for himself, and a high-profile color for his brother so he can keep an eye on him.
As the racing progresses, the brothers face dangers in the form of their fellow racers, as well as deadlier obstacles on the track itself (including at one point, a tank -- though as a barrier, not a weapon).

A: The story is "The Speeders" by Arthur Tofte.  From Bev Hankins at goodreads:

"The Speeders" by Arthur Tofte: In the world of the future, the government has supposedly ensured that vehicles will be safe--no speeding and no accidents. But there are always the young joyriders who will find their way around the laws and restrictions. These young men find that when thy joyride and manage to break the speeding laws one too many times that they are incarcerated--not in prison, but in Traverse Park. In what seems like a speed-demon's paradise, all bets are off. The speeders can go as fast as they want and drive as recklessly as they want. Is it really the freedom from restrictions that it appears? Or is there a more chilling motive behind the speeder's park?


text:
Q: Chart.js 2.1.6 background color for each section i'am refering to this post:
chart.js Line chart with different background colors for each section
and i can't make it work with chart.js version 2.1.6 (API has changed), any idea ?

A: I did this:
Chart.pluginService.register({
  beforeDraw: function (chart, easing) {
    if (chart.chartArea) {
      var helpers = Chart.helpers;
      var ctx = chart.chart.ctx;
      var chartArea = chart.chartArea;
      var chartWidth = chartArea.right - chartArea.left;
      var chartHeight = Math.abs(chartArea.top - chartArea.bottom);
      ctx.save();

      var pattern = document.createElement('canvas');
      pattern.width = 40;
      pattern.height = chartHeight;
      var pctx = pattern.getContext('2d');

      pctx.fillStyle = "#f0f2f5";
      pctx.fillRect(0, 0, 20, chartHeight);
      pctx.fillStyle = "#ffffff";
      pctx.fillRect(20, 0, 20, chartHeight);

      var pattern = ctx.createPattern(pattern, "repeat");
      ctx.fillStyle = pattern;

      ctx.fillRect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
      ctx.restore();
    }
  });


text:
Q: Angular2: best practice for getting values from a QueryList of inputs so I create a list inputs:
template: `
        <div *ngFor="#item of m_checkboxes">
          <label class="pull-left">{{item.name}}</label>
          <Input #checkInputs type="checkbox" (change)="onChange($event.target.value)" [checked]="item.checked" value="{{item.value}}" class="pull-left" style="margin-right: 2px">
        </div>

and I create a QuestList of the inputs via:
  @ViewChildren('checkInputs')
  inputs:QueryList<any>

and when any one of the checkboxes of the inputs is clicked I map loop over the Observables, but I am forced to go into NativeElement to grab the checked value and I feel there must be a better way...
this is what I do now, which works... but is it best practice?
 private onChange(value) {
        this.inputs.map(v=>{
            console.log(v.nativeElement.checked); // grab value from native :-(
        });

    }

thanks
Sean

A: Rather than inspecting the DOM elements, I think it would be better to inspect the data - the values of item.checked, wherever those are in your components. If the reason you're inspecting the DOM is to update the data values, that's what two-way data bindings are for. I believe simply changing [checked]="item.checked" to [(ngModel)]="item.checked" will make the binding two-way so Angular2 will update your data values for you.


text:
Q: How to redirect to external URL and collect client data in Meteor My goal is to create a link which redirects to an external URL and track client data like OS, Browser etc.
To achieve this, I created two separate routes. One client route which redirects to a template that tracks client data and redirects to the server route.
Here are my routes:
Router.route('/:_id', {name: 'url', controller: 'UrlController'});
Router.route('/redirect/:_id', {name: 'urlRedirect', where: 'server'}).get(function () {
    var url = Urls.findOne(this.params._id);
    if (url) {
        this.response.writeHead(302, {
            'Location': url.url
        });
        this.response.end();
    } else {
        this.redirect('/');
    }
});
UrlController = RouteController.extend({
    action: function () {
        this.render('redirect');
    },
    data: function () {
        return Urls.findOne(this.params._id);
    }
});

And here is the template:
Template.redirect.onRendered(function () {
    var client = new ClientJS(); // Create A New Client Object
    var userAgent = client.getUserAgent(); // Get User Agent String
    console.log(userAgent);
    Router.go('urlRedirect', {_id: this.data._id});
});

Now my question is, is it possible to collect client data from the server route (do I need the internal redirection from :_id to /redirect/:_id)?
If a user has been redirected and he clicks on the browser's 'back' button, he will see the empty redirect template. How can I fix this?

A: You can get header information from the nodejs request object in your route. For example, how to get the user-agent string:
Router.route('/asd', {where: 'server'}).get(function () {
    var request = this.request;
    var response = this.response;
    var headers = request.headers;
    var userAgent = headers["user-agent"];
    console.log(userAgent);
    response.end();
});


text:
Q: how to remove existing field like 'name' in catalog->manage products->general tab for magento 1.5? i want to remove some fields like description,short description from catalog->Manage Products->continue->general tab in admin panel...here i can add new field but can't delete existing fields..i tried so much but finally i am not getting the right page where i have insert or delete the code for making/removing fields.Can Anybody help me...with best regards....

A: These are system fields and are generally relied upon in other parts of the system, so they are not meant to be removed. Can you give more detail about why you are trying to do this?

A: Name, description, short description, etc are the system attributes. You cannot delete them from admin panel. However, you can delete them from database. Follow the article link below which explains on how to delete system attributes in Magento.
Magento: How to delete System Attribute?
Thanks.


text:
Q: Como Concatenar los parametros de un reporte hecho en reporting services dentro del select Tengo dos parametros:
@p_month @p_year y tengo que concatenarolo mas un constante dentro del select
Esto es permitido o está bien?
Select @p_month + p_year + "00" as perido, campo2, campo3,...campo n FROM TABLA
Esperando una respuesta. Gracias.


text:
Q: Show that Then $B'$ is a basis $\iff $ the matrix $P = \{[v'_{1B}],\ldots,[v_{nB}]\}$ (The $B$ coordinates of $B'$ vectors) is invertible Let $V$ be a vector space, over a field $K$, of dimension $n$. Let $B = \{x_1, \ldots, x_n\}$ be a basis  and $B' = \{v'_1,\ldots,v'_n\}$ be a set of $n$ elements in $V$.
Then $B'$ is a basis $\iff $ the matrix $P = \{[v'_{1B}],\ldots,[v_{nB}]\}$ (The $B$ coordinates of $B'$ vectors) is invertible. I am having difficulty with the backwards direction.
Suppose that $P$ is invertible. I am stuck with not much insight on how to proceed. Hints appreciated.


text:
Q: PostgreSQL obtain and release LOCK inside stored function I have a function that needs to perform a long update on multiple large tables. During the update 2-3 tables at a time need to be locked in EXCLUSIVE mode.
Since not all the tables need to be locked at the same time, ideally I'd want to LOCK only those tables I'm updating at the time, and then remove the lock once I'm done.
Eg.
-- Lock first pair of tables
LOCK TABLE tbl1_a IN EXCLUSIVE MODE;
LOCK TABLE tbl1_b IN EXCLUSIVE MODE;

-- Perform the update on tbl1_a and tbl1_b

-- Release the locks on tbl1_a and tbl1_b
--  HOW???

-- Proceed to the next pair of tables
LOCK TABLE tbl2_a IN EXCLUSIVE MODE;
LOCK TABLE tbl2_b IN EXCLUSIVE MODE;

Unfortunately, there's no the equivalent of UNLOCK statement in plpgsql. The normal way to remove LOCK is to COMMIT the transaction, but that is not possible inside a function.
Is there any solution for this? Some way to explicitly release the lock before function is done? Or run some kind of sub-transaction (perhaps by running each update in a separate function)?
UPDATE
I accepted that there is no solution. I'll write each update into a separate function and coordinate from outside the db. Thanks everyone.

A: In pg11 you now have PROCEDUREs which let you release locks via COMMIT. I just converted a bunch of parallel executed functions running ALTER TABLE ... ADD FOREIGN KEY ... with lots of deadlock problems and it worked nicely.
https://www.postgresql.org/docs/current/sql-createprocedure.html

A: Not possible. From documentation: Once acquired, a lock is normally held till end of transaction. But if a lock is acquired after establishing a savepoint, the lock is released immediately if the savepoint is rolled back to. This is consistent with the principle that ROLLBACK cancels all effects of the commands since the savepoint. The same holds for locks acquired within a PL/pgSQL exception block: an error escape from the block releases locks acquired within it.
http://www.postgresql.org/docs/9.3/static/explicit-locking.html

A: In Postgres 11 or later, consider a PROCEDURE which allows transaction control. See:

*

*Do stored procedures run in database transaction in Postgres?

With functions, there is no way. Functions in Postgres are atomic (always inside a transaction) and locks are released at the end of a transaction.
You might be able to work around this with advisory locks. But those are not the same thing. All competing transactions have to play along. Concurrent access that is not aware of advisory locks will spoil the party.
Code example on dba.SE:

*

*Postgres UPDATE ... LIMIT 1
Or you might get somewhere with "cheating" autonomous transactions with dblink:

*

*How do I do large non-blocking updates in PostgreSQL?

*Does Postgres support nested or autonomous transactions?
Or you re-assess your problem and split it up into a couple of separate transactions.


text:
Q: Invariant measure of a subgroup Let $G$ be an abelian group with a $G$-invariant metric $d$. Let $H$ be a countable dense subgroup of $G$. Let $\mu$ be a non-atomic $\sigma$-finite Borel measure on $G$ that is $H$-invariant. Must it be $G$-invariant?
EDIT: Sorry, this was not stated correctly. I have corrected the question (added the word "non-atomic"). As stated in the answer, this is not true for $\mu$ to be any measure for you can just place an atom on every element of $H$. I'm curious if there are any non-locally finite (and non-atomic) examples.

A: It's not true as stated.  You can take $\mu$ to be counting measure on
$H$, i.e. $\mu(A) = \#(A \cap H)$.  This is trivially $H$-invariant
and $\sigma$-finite (the countably many points of $H$ each have finite
measure, and the rest of $G$ has measure zero), but it is not
$G$-invariant.
For a non-atomic example, take for instance $G = \mathbb{R}^2$, $H = \mathbb{Q}^2$, and $\mu$ the product of Lebesgue measure on $\mathbb{R}$ with counting measure on $\mathbb{Q}$, i.e. $\int f\,d\mu = \sum_{q \in \mathbb{Q}} \int_{\mathbb{R}}  f(x, q)\,dx$.
However, if you suppose $\mu$ is Radon, then it's true.  Let $g \in G$
be arbitrary and let $K \subset G$ be an arbitrary compact set.  Let
$\epsilon > 0$, and let $h_n$ be a sequence in $H$ which converges to
$g$.  Since $\mu$ is Radon we can find an open set $U \supset K$ such
that $\mu(U) \le \mu(K) + \epsilon$.  Then for sufficiently large $n$,
we have $K + (g - h_n) \subset U$ as well.  (If not, then passing to a subsequence we can find for each $n$ some $x_n \in K$ for which $x_n + g - h_n \notin U$.  By compactness, passing to a further subsequence, $x_n$ converges to some $x \in K$.  Then $x_n + g - h_n \to x$ which is absurd because $x \in K \subset U$.)
Thus $$\mu(K+g) =
\mu(K+(g-h_n)) \le \mu(U) \le \mu(K) + \epsilon.$$  Since $\epsilon$
was arbitrary we have $\mu(K+g) \le \mu(K)$, and the reverse
inequality follows by symmetry.  Using again the fact that $\mu$ is
Radon, every Borel set can be approximated in measure from within by
compact sets, and so this suffices to conclude that $\mu$ is
$G$-invariant.
I think this is true, with much the same proof, for any topological group $G$ (not necessarily abelian or metrizable or locally compact) and any dense subgroup $H$ (not necessarily countable).  If $G$ is not abelian then it says that if $\mu$ is  invariant under left (respectively, right) multiplication by $H$, then $\mu$ is left (right) invariant. If $G$ should fail to be first countable you can replace the sequence $h_n$ in the above argument with a net.


text:
Q: Why do we use superposition instead of tensor product in interferometer? In the description of a neutron interferometer here, it says:

In an interferometer the incident beam is split into two (or more) separate beams. The beams travel along different paths where they are exposed to different potentials (which results in different phases). At some point the beams are brought together again and allowed to interfere. The resulting beam is the superposition of the separated beams:
  $$ \psi  = \psi_I + \psi_{II} $$

I am interested in why the total wavefunction is not written as $\psi=\psi_I\otimes \psi_{II}$? Because when they are separated, they should be considered in two physical systems and we should use tensor product to describe them, even they are later combined together, right?

A: In a nutshell: these are not two different systems, but the probability amplitudes of the two different states of the same system.
I do agree that simple discussions of two interfering waves (electromagnetic or particle waves) are in practice only complicating the matter, as opposed to thinking of a single wave in a multiply connected geometry. They however make the math manageable.

A: The confusion comes from "and allowed to interfere". Superposition is not interaction, and they are describing a superposition of two beams of neutrons.
It is  similar to the superposition of two laser beams split from the same original, which show interference fringes due to the superposition of the two beams, and it is well known that photons do not interact except in high orders with very low probabilities.
The whole neutron interferometer is considered one physical system where the neutrons are not interacting with each other  , it is only the potentials that change in too complicated a way to really solve the total system wavefunction, but the addition of the two partial ones at the end  is a good approximation.
Tensor products would have been used in the density matrix formalism where individual neutrons are considered. The psis in your quote are the beam psis , not the individual neutron ones.


text:
Q: Angular 7 behavior subject with class object I have below class
export class filter {
    public PageRecords: number;
    public SearchText: string;
    public SortColumn: string = null;
    public SortDirection: string = null;
    public StartingPos: number;
}

Below behavior subject
filterParam = new BehaviorSubject(new filter);

Updating subject
this.filterParam.next(<filter>{StartingPos  : 1,PageRecords : 10 })

When I get the value of subject
this.filterParam.value

It only have two props StartingPos and PageRecords which I updated. it lost other props.
How to resolve this?

A: It is because you don't pass directly a Filter object class. You are casting some dynamic json to a filter object but only with this two properties.
You can do something like this:
const filterParam = new filter();
filterParam.StartingPos = 1;
filterParam.PageRecords = 10;

this.filterParam.next(filterParam);

EDIT:
I didn't notice that you want just update two values from the BehaviorSubject value. As @ritaj suggested in a comment below this aswer you can do something like he suggested:
this.filterParam.next(Object.assign(this.filterParam.value, {StartingPos: 1, PageRecords: 10 }

Object.assign() copies the values (of all enumerable own properties) from one or more source objects to a target object. It has a signature of Object.assign(target, ...sources). The target object is the first parameter and is also used as the return value. Object.assign() is useful for merging objects or cloning them shallowly.

A: Based on the meaning of the name of your class parameters, I think you want one single filter class and you just want to notify others when this filter is changed.
I recommend this code:
filter = new filter;
filterParam = new BehaviorSubject<filter>(this.filter);

// later change the filter like this
changeFilter() {
  this.filter.StartingPos = 1;
  this.filter.PageRecords = 10;
  this.filterParam.next(this.filter);
}


text:
Q: Delete Function: Laravel 5 new to laravel framework here. I'm having quite a problem here calling out the delete function in my resource controller. Seems like it is not deleting the selected id. Thanks for your help in advance.
resources/views/bufashaccts/allAccounts.blade.php
@extends('adminlte::page')

    <meta charset="utf-8">
    <title></title>

view accounts!

@foreach($bfaccounts as $userAccount)

{{ $userAccount->acct_firstname }}

{{ $userAccount->acct_middlename }}

{{ $userAccount->acct_lastname }}

    @if ($userAccount->id)
        <form action="/Accounts" method="POST">
            {{ csrf_field() }}
            {{ method_field('DELETE') }}

                <button type="button">delete</button>

        </form>
    @endif
    id }}/edit">
        <button type="button">edit</button>

@endforeach

app/http/controllers/AccountsController.php
<?php

namespace App\Http\Controllers;

use App\bufashaccounts;
use Illuminate\Http\Request;

class AccountsController extends Controller
{

    public function index()
    {
        $bfaccounts = bufashaccounts::all();

        return view('bufashaccts.allAccounts', compact('bfaccounts'));
    }

    public function create()
    {
        return view('bufashaccts.addAccounts');
    }

    public function store(Request $request)
    {
        bufashaccounts::create($request->all());

        return "success!";
    }

    public function show($id)
    {
        $bfshowAccounts = bufashaccounts::findOrFail($id);

        return view('bufashaccts.viewAccounts', compact('bfshowAccounts'));
        //return $bfshowAccounts;
    }

    public function edit($id)
    {
        $bfeditAccounts = bufashaccounts::findOrFail($id);

        return view('bufashaccts.editAccounts', compact('bfeditAccounts'));
    }

    public function update(Request $request, $id)
    {
        $bfeditAccounts = bufashaccounts::find($id);
        $bfeditAccounts->update($request->all());

        return redirect('Accounts');
    }

    public function destroy($id)
    {
        //$bfdeleteAccounts = bufashaccounts::findOrFail($id);
        //$bfdeleteAccounts->delete();
        //return 'delete';
        $bfaccounts = bufashaccounts::findOrFail($id);
        $bfeditAccounts->delete();

        //return view('bufashaccts.allAccounts', compact('bfaccounts'));
        return redirect('/Accounts');
    }
}

A: You would need to change your form to be something like:
<form action="{{ url("/Accounts/$userAccount->id") }}" method="POST">
    {{ csrf_field() }}
    {{ method_field('DELETE') }}
    <button type="submit">delete</button>
</form>

Hope this helps!

A: *

*Add this in your route file
Route::delete('account/delete/{id}', ['as' => 'account.delete', 'uses' => 'AccountsController@destroy'])

*Modify your blade file
<form action="{{ route('account.delete') }}" method="POST">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<button type="submit" class="btn btn-danger">Delete</button>

Try this way. Hope it will work.


text:
Q: ios/xcode/objective-c: swap uilabel for uitextfield based on internet connection For a settings page, I would like to show either an editable textfield if Internet access is available or else a uilabel if there is no Internet.
I know how use .hidden element to hide and show elements e.g.
[label1 setHidden:YES];

but I don't know how to put label and textfield in same position.
Thanks for suggestions

A: You only need to create a textfield and enable/disable it while internet is on/off.
You should create a textfield in viewDidLoad or any other function.
//create a textfield
UITextField* textField = [[UITextField alloc] initWithFrame:frame];
[self.view addSubview:textField];

After Creation
if (<internet is on>) {
    //some code
    textField.enabled = YES;
}
else {
    //some code
    textField.enabled = NO;
}


text:
Q: Setting the base url of an ASP.NET app behind a proxy server I have the same issue as the poster of this question
Running ASP.NET MVC application behind a proxy with different root relative path
except that I'm running "classic" ASP.NET 4.0 in IIS 7. Basically, the application is deployed to http://machine/MyApp, but it is being accessed through a proxy server as: http://someotherMachine/SomeDirectory/MyApp. So, ASP.NET thinks that /MyApp is the root, but in this case it really isn't. Is there some magical setting of ASP.NET or IIS that I can set telling it, "Hey, by the way the root of this application is actually SomeDirectory not MyApp?"

A: Can you just create a directory like SomeDirectory on your web server, set that as the root application, and then create a virtual directory under SomeDiretory that points to MyApp?


text:
Q: What is the name of this special type of n-tuple? Consider the set, $S$, of $n$-tuples defined inductively as follows:

*

*$(1, 2, \ldots, n) \in S$

*if $(x_1, x_2, \ldots, x_i, x_{i+1}, \ldots, x_n) \in S$, then $(x_{i+1}, \ldots, x_{n}, x_1, x_2, \ldots, x_{i}) \in S$

What is the name of these types of $n$-tuples?
Note, the $n$-tuple $(2, 4, 1, 3)$ demonstrates that $S$ is a strict subset of all permutations.

A: These are cyclic permutations of the tuple $(1, 2, \ldots, n)$.
Thanks, @joriki.


text:
Q: Randomness in Z3 Results I am using the Z3 Python interface as part of a research tool that I am writing, and I noticed some pretty odd behavior when I run the Z3 solver repeatedly on the same query: In particular, I seem to not get the same results each time, even though I explicitly reset the solver before running. For reference, here's my code:
import z3

with open("query.smt", "r") as smt_reader:
    query_lines = "".join(smt_reader.readlines())
    for i in xrange(3):
        solver = z3.Solver()
        solver.reset()

        queryExpr = z3.parse_smt2_string(query_lines)
        equivalences = queryExpr.children()[:-1]
        for equivalence in equivalences:
            solver.add(equivalence)

        # Obtain the Boolean variables associated with the constraints.
        constraintVars = [equivalence.children()[0] for equivalence
                          in equivalences]
        # Check the satisfiability of the query.
        querySatResult = solver.check(*constraintVars)

        print solver.model().sexpr()
        print solver.statistics()
        print ""

The code above re-creates the Z3 solver thrice and checks the satisfiability of the same query. The query is located here.
While the above section of code is not exactly how I will be using the Z3 Python interface, the problem stemmed from a realization that the Z3 solver, when called twice at different points of the code on the same query, returned different results. I was wondering if this was intentional, and whether there was any way to disable this or to ensure determinism.

A: I'm assuming by different you meant a different model.
If the result changes from sat to unsat, then it is a bug.
That being said, if we solve the same problem twice in the same execution path, then Z3 can produce different models. Z3 assigns internal unique IDs to expressions. The internal IDs are used to break ties in some heuristics used by Z3. Note that the loop in your program is creating/deleting expressions. So, in each iteration, the expressions representing your constraints may have different internal IDs, and consequently the solver may produce different solutions.
See the following related question:

*

*Z3 timing variation


text:
Q: Bug or Feature in Audit "STOP! Look and Listen."? Answer to review in audit not visible outside audit I just got access to the review queues (late answers). I tried to be thorough and opened the question in a new tab, since the answer I should review was odd and I thought maybe someone just copied an old comment or something. I wanted to see the whole context to write an informed comment to that answer since the user who committed it was new.
The question didn't have the answer I saw for review nor did it have any other comments on it from other reviewers and I thought: "Oh, thats weird."
I waited some time and reloaded the tab with the question - the answer did not show up, so I clicked on "No action needed." (Obviously, the answer was not visible like in reviews I did previously, so why bother? And I did not skip it since I did a review after all.)
I got the

STOP! Look and Listen.
This was an audit, designed to see if you were paying attention. You
  didn't pass. This answer was of very poor quality, and needed
  significant improvements to be useful – passing over such posts hurts
  the ability of others to find and answer good questions. Please try to
  fix such posts by editing, downvoting, closing, or flagging as "very
  low quality".
Don't worry, we've already handled this post appropriately – but
  please take a minute to look it over closely, keeping in mind the
  guidance above.

dialog.
I think that the answer to review is not shown under the question when having an audit is a bug. Or are there real situations where the item to review is not visible for the reviewer outside of the review tab?
Furthermore now I'm uncertain how to do reviews. Usually when I see a poor answer or question which was already downvoted 5 times and has 3 similar comments about poor quality I press "No action needed" too. I don't want to skip, since I did a review and I think a fourth poor quality comment does not add any more value.

A:
I think that the answer to review is not shown under the question when having an audit is a bug.

No, it's not a bug.  It's a deleted post, and since you don't have 10k rep, you can't see deleted posts.

Usually when I see a poor answer or question which was already downvoted 5 times and has 3 similar comments about poor quality I press "No action needed" too.

Then you're doing the wrong thing, and the audit is correctly informing you of this.  If a post is a bad post, you shouldn't be doing nothing.  As the audit message says, you should be acting on the post with votes, comments, edits, comment votes, flags, etc.  Other people having voted on the post doesn't mean you can't vote.  If all of the earlier comments cover everything there is to cover, upvote those that apply, and if they don't cover everything, add anything that you feel you have to add.  If the post is that bad (and it is, if it's an audit) then the post also merits flags; you should be casting those flags.


text:
Q: Django Many-to-Many data model I'm trying to create a data structure that involves Products, Customers and Orders. Customers and Products are independent tables, while the Orders references Products and Customers.
Orders table fields:

*

*Time stamp

*Customer

*Product along with Quantity

Here is my attempt at creating a django model to achieve this:
from django.db import models

class Customer(models.Model):
    name = models.CharField(max_length=30)
    latitude = models.FloatField(default=0)
    longitude = models.FloatField(default=0)

class Product(models.Model):
    name = models.CharField(max_length=30)
    weight = models.FloatField(default=0)

class Order(models.Model):
    customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
    timestamp = models.DateTimeField(auto_now=True)
    products = models.ManyToManyField(Product)
    quantity = ?

How do I create a quantity field that maps to a particular product? Alternate models to achieve the same results are also welcome.

A: Use through in your ManyToManyField.
from django.db import models

class Customer(models.Model):
    name = models.CharField(max_length=30)
    latitude = models.FloatField(default=0)
    longitude = models.FloatField(default=0)

class Product(models.Model):
    name = models.CharField(max_length=30)
    weight = models.FloatField(default=0)

class Order(models.Model):
    customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
    timestamp = models.DateTimeField(auto_now=True)
    line_items = models.ManyToManyField(Product, through='OrderItem')

class OrderItem(models.Model):
    product = models.ForeignKey(Product)
    order = models.ForeignKey(Order)
    quantity, price, discount, ...

A: I would suggest a model which contain a product and its quantity in an order. Something like below.
class ProductOrder(models.Model):
    product = models.ForeignKey(Product)
    quantity = models.IntegerField()

Then in order:
class Order(models.Model):
    customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
    timestamp = models.DateTimeField(auto_now=True)
    products = models.ManyToManyField(ProductOrder)


text:
Q: Matlab: How to find the right-most point of a white line within the imrect? i've got a question regarding the imrect() function, which is part of the image processing toolbox in MatLab.
I'd like to find a starting point within an image with it's (x,y) coordinate.
I use the imrect function for setting a region to limit and specify the lookup area,
but I can't get the point where the ROI mask is getting back mapped to the original size of the image.
As you can see on the image there is a specified rectangle (cyan-colored), which I want to inspect for the white line, especially the nearest point to the right edge of the rectangle. I experimentated with only looking up on the last column of the rectangle, but as I mentioned before, the re-mapping onto the global image coordinates failed.
So in this example, the white point I'd like to get would be around (98,302)

The original (x,y) coordinates are relevant, so a cropping of the image to the rectangle is not acceptable.
So, do you have any ideas?
Thanks for any helping comments.
Kind regards,

A: Oh my gosh.
I should often go outside and take a big bag of air.
It really helps while stuck on a problem.
For all people with same issues, see the answer in the following part.
imshow(im);
h1 = imrect;
pos = getPosition(h1); % to get the current position of the rectangle
setPosition(h1,[pos(1) pos(2) 1 pos(4)]); %for just selecting one row of the rect
BW = createMask(h1);
test = BW.*im; % get the masked content of the image
[x,y] = find(test); % find the non-zero element and return x and y


text:
Q: Gtk C Application - Set PWD so pictures work I have a simple Gtk GUI application written in C. I want to be able to render external images within a frame in my main window. The code for this is as follows:
GtkWidget myImage;
myImage = gtk_image_new_from_file("assets/image.png");
gtk_fixed_put(FTK_FIXED(frame), myImage, 0, 0));

The image shows as expected, but only if I cd into the directory where it exists. ie:
cd /tmp/bin/
./gtktest

If I run it from another location, like so, the image is never found.
/tmp/bin/gtktest

Is there a way to have the application set the present working directory (PWD) to the location of the binary itself?
Thank you.

A: You are using a relative path to cwd but you need to use either a relative path based on the location of the program binary or an absolute path based on the filesystem's  root like /usr/lib/yourprogram/assets.
If you want to build a relative path based on the location of the binary, which might be more flexible in some situations, then you should use dirname(). Like this:
char *my_location = dirname(argv[0]); // argv[0] contains the path to the binary

Check man 3 dirname for more info.

A: Put the assets inside a GResource and compile them directly into your program.

A: You could call chdir(2) from inside your Gtk program, or its Glib wrapper g_chdir


text:
Q: How to pass too many inputs to child components in Angular 2+. Passing too many inputs to child component using @Input may slow down the performance? For a while I've these 3 fields but in future I may need to pass complete Associate object. Likewise If I've many more objects coming in picture for future then how to pass this data to child component. Can it make our performance slow.
<child-component [firstName]="firstName" [lastName]="lastName" [siblings]="siblings">

A: Passing many objects won't slown down the performance rather than using a single object.
I would advice you to create @Input to fit the child component needs and not the parent original format.
The child component shouldn't care to know if the firstName comes from a User or an Address object and your child component code will be easier to read if you stick with the data you really need.
For performance purpose, a good practice is to add OnPush changeDetection strategy on the child component so the change detection will only be triggered if one the the inputs changes.
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ],
  changeDetection: ChangeDetectionStrategy.OnPush
})


text:
Q: Code coverage not working when used in conjunction with the parallel_spec task I would like to know why parallel rspec is showing a different coverage percentage and missed resources compared to when I run without parallelisation.
Here is the output:
    Sysctl[net.ipv6.conf.all.accept_redirects]
      Sysctl[net.ipv6.conf.all.disable_ipv6]
      Sysctl[net.ipv6.conf.default.accept_ra]
      Sysctl[net.ipv6.conf.default.accept_redirects]
      Sysctl[net.ipv6.conf.default.disable_ipv6]
      Sysctl[net.ipv6.conf.lo.disable_ipv6]
      Sysctl[vm.min_free_kbytes]
      Sysctl[vm.swappiness]
      Systemd::Unit_file[puppet_runner.service]
      Users[application]
      Users[global]
    F

Failures:

  1) Code coverage. Must be at least 95% of code coverage
     Failure/Error: RSpec::Puppet::Coverage.report!(95)

       expected: >= 95.0
            got:    79.01
     # /usr/local/bundle/gems/rspec-puppet-2.6.11/lib/rspec-puppet/coverage.rb:104:in `block in coverage_test'
     # /usr/local/bundle/gems/rspec-puppet-2.6.11/lib/rspec-puppet/coverage.rb:106:in `coverage_test'
     # /usr/local/bundle/gems/rspec-puppet-2.6.11/lib/rspec-puppet/coverage.rb:95:in `report!'
     # ./spec/spec_helper.rb:22:in `block (2 levels) in <top (required)>'

Finished in 42.12 seconds (files took 2.11 seconds to load)
995 examples, 1 failure

Failed examples:

rspec  # Code coverage. Must be at least 95% of code coverage

2292 examples, 2 failures

....................................................................

    Total resources:   1512
    Touched resources: 1479
    Resource coverage: 97.82%
    Untouched resources:

      Apt::Source[archive.ubuntu.com-lsbdistcodename-backports]
      Apt::Source[archive.ubuntu.com-lsbdistcodename-security]
      Apt::Source[archive.ubuntu.com-lsbdistcodename-updates]
      Apt::Source[archive.ubuntu.com-lsbdistcodename]
      Apt::Source[postgresql]

    Finished in 1 minute 25.3 seconds (files took 1.43 seconds to load)
    2292 examples, 0 failures

A: Because it is not entirely clear from the question, I assume here that you have set up code coverage by adding a line to your spec/spec_helper.rb like:
at_exit { RSpec::Puppet::Coverage.report!(95) }

The coverage report is a feature provided by rspec-puppet.
Also, I have assumed that you have more than one spec file that contain your tests and that these are being run in parallel by calling the parallel_spec task that is provided by puppetlabs_spec_helper.
The problem is this:
For code coverage to work properly, all of the Rspec tasks need to run within the same process (see the code here).
Meanwhile, for parallelisation to occur, there must be multiple spec files, which are run in parallel in separate processes. That limitation arises from the parallel_tests library that is used by the parallel_spec task. See its README.
The code coverage report, therefore, only counts resources that were seen inside each process.
Example:
class test {
  file { '/tmp/foo':
    ensure => file,
  }
  file { '/tmp/bar':
    ensure => file,
  }
}

Spec file 1:
require 'spec_helper'

describe 'test' do
  it 'is expected to contain file /tmp/foo' do
    is_expected.to contain_file('/tmp/foo').with({
      'ensure' => 'file',
    })
  end
end

Spec file 2:
require 'spec_helper'

describe 'test' do
  it 'is expected to contain file /tmp/bar' do
    is_expected.to contain_file('/tmp/bar').with({
      'ensure' => 'file',
    })
  end
end

spec_helper.rb:
require 'puppetlabs_spec_helper/module_spec_helper'
at_exit { RSpec::Puppet::Coverage.report!(95) }

Run in parallel:
Total resources:   2
Touched resources: 1
Resource coverage: 50.00%
Untouched resources:

  File[/tmp/bar]

Finished in 0.10445 seconds (files took 1.03 seconds to load)
1 example, 0 failures

Total resources:   2
Touched resources: 1
Resource coverage: 50.00%
Untouched resources:

  File[/tmp/foo]
Must be at least 95% of code coverage (FAILED - 1)

4 examples, 0 failures

Took 1 seconds

Run without parallelisation:
Finished in 0.12772 seconds (files took 1.01 seconds to load)
2 examples, 0 failures

Total resources:   2
Touched resources: 2
Resource coverage: 100.00%


text:
Q: Set wpf datagrid cell value programmatically I have a simple datagrid with 2 columns, ProductCode and Description.
When user compile a ProductCode in the first column and move to the next column, the program should compile the Description cell with the description of the product found in the Products table.
What is the best approach to do this?

A:
What is the best approach to do this?

Define a class with two properties, ProductCode and Description, that implements the INotifyPropertyChanged interface. You can then lookup the description of the products in the setter of the ProductCode property, e.g.:
public class Product : INotifyPropertyChanged
{
    private string _productCode;
    public string ProductCode
    {
        get { return _productCode; }
        set
        {
            _productCode = value;
            NotifyPropertyChanged();
            LookupProduct();
        }
    }

    private string _description;
    public string Description
    {
        get { return _description; }
        set { _description = value; NotifyPropertyChanged(); }
    }

    private void LookupProduct()
    {
        //loop up product based on _productCode here
        //...and set the Description property:
        Description = "...";
    }

    public event PropertyChangedEventHandler PropertyChanged;
    private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}

You should of course also set or bind the ItemsSource property of the DataGrid to an IEnumerable<Product>.


text:
Q: A random variable independent of its order statistic Suppose I have $n$ random variables $X_i \overset{iid}{\sim} f(x_i) $. Is it possible that the $r^{th}$ order statistic $X_{(r)}$ is independent of arbitrary random variable $X_i$?  I really want this to be true, but my gut says no.
Follow-up.  Is is possible to show $X_{(1)}-X_i$ is independent of $X_{(1)} -X_j$ where $i \neq j$.  Now I believe this is true, but again, I am having a hard time being able to show why.


text:
Q: Wordpress get_page 'read more' tag So I want to use the read more tag here:
http://codex.wordpress.org/Customizing_the_Read_More
But I'm using the get_page function as such:
$page_id = 1;
$include = get_page($page_id);
$content = apply_filters('the_content',$include->post_content);

When I've inserted the more tag via the page WYSIWYG it gets ignored when I echo $content.
I think I need to add something into apply_filters but I'm not sure what

A: You need to change post_content to post_excerpt to echo the WYSIWYG excerpt
        $page_id = 1;
        $include = get_page($page_id);
        $content =  apply_filters('the_content',$include->post_excerpt);
        echo $content;


text:
Q: Find object by realm.js Hello I use realm database with react-native.
I have Item schema and find one item by id.
var items = realm.objects('Item');
var item = items.filtered('id == $0', item_id);
console.log(item.name); // It should be printed name, but undefined

I can't find item. so use lodash.
var item = _.find(realm.objects('Item'), _.matchesProperty('id', item_id));
console.log(item.name); // print "ABCD"

How do I get item by id?

A: realm.objectForPrimaryKey('Item', item_id)

A: filtered returns a Results object which is very similar to a javascript Array.
So your code should be:
var items = realm.objects('Item').filtered('id == $0', item_id);
var item = items[0];
console.log(item.name); // should print the name

A: you can use objectForPrimaryKey function but must set primaryKey you schema
Set primarykey
const BookSchema = {
  name: 'Book',
  primaryKey: 'id',
  properties: {
    id:    'int',    // primary key
    title: 'string',
    price: 'float'
  }
};

Usage
const findObject = realm.objectForPrimaryKey('Item', item_id);


text:
Q: saving nodes created by user on JavaFX GUI enter image description hereI made a GUI on JavaFX that's for creating timetables. when I open the app I can add plans (Buttons) to day columns (VBox). ofc the changes aren't saved after I close the app: the next time I open it the table is empty.
my question is how can I make it save nodes that the user creates so the next time i open the app they're there?
this is the exact part where the nodes get added for what it's worth:
void ask_add_plan(ActionEvent event)
    {
        Button b = (Button) event.getSource();
        VBox v = (VBox) b.getParent();

        AnchorPane pop_up = new AnchorPane(); //this pop up is to specify things about the plan
                                              //but i removed unnecessary code for simplicity

        VBox pop_up_v = new VBox();

        Button add = new Button("Add");

        add.setOnAction(e->{
            Button plan = new Button(what_to_do.getText());

            v.getChildren().add(plan);

            container.getChildren().remove(pop_up); //container is the anchor pane everything's in
        });

        pop_up_v.getChildren().add(add);

        pop_up.getChildren().add(pop_up_v);

        container.getChildren().add(pop_up); //container is the anchor pane everything's in
    }

A: The JavaFX nodes are just the presentation of your data.  They are not meant to be saved.  Store the actual data itself in a private field in your class.

*

*In your Application.stop method, write the data to a file.

*In your Application.start method, read that file and use it to rebuild JavaFX nodes.

private static final Path PLANS_FILE =
    Path.of(System.getProperty("user.home"), "plans.txt");

private final List<String> plans = new ArrayList<>();

void ask_add_plan(ActionEvent event) {

    // ...

    add.setOnAction(e -> {
        String planText = what_to_do.getText();

        plans.add(planText);

        Button plan = new Button(planText);
        v.getChildren().add(plan);
        container.getChildren().remove(pop_up);
    });
}

@Override
public void start(Stage primaryStage)
throws Exception {

    // ...

    if (Files.exists(PLANS_FILE)) {
        plans.addAll(Files.readAllLines(PLANS_FILE));

        // Add UI elements for each stored plan.
        for (String planText : plans) {
            Button planButton = new Button(planText);
            v.getChildren().add(planButton);
            container.getChildren().remove(pop_up);
        }
    }
}

@Override
public void stop()
throws IOException {
    Files.write(PLANS_FILE, plans);
}

The above is just a simplified example.  The file doesn't have to store just strings.
I get the impression that the data created in the application is more complex than just plan strings.  For complex data, XML may be more a suitable file format.  Or you can use Java serialization.  Or, you can invent your own file format.
You also don't have to read from and write to a file.  You can use a database, if you're comfortable with database programming.  Or you can use Preferences (though Preferences are not well suited to storing lists of complex data).

A: You should use MVP (model-view-presenter) pattern. Saving data in UI layer is not a good practice. Create a model with data and then serialize it.