text:
Q: Trying to understand why AJAX objects added into DOM return undefined I have a problem when calling a ajax call that after the ajax data is appended into the DOM, any Javascript referring to the appended html returns that the object is undefined.
The forms use  tags with Javascript submits and some Javascript to modify hidden fields, thats why the eval() is in there.
edit: This is an example of a 'href' tag and why I have the eval in there:
javascript:document.faultList.sortBy.value='4';document.faultList.sortByPrev.value='3';document.faultList.Action01.value='SetMyRequestItem';

Its how the previous developer has created this software/website before my time instead of using a REST style system.
This is my code:
function ajaxFormUpdate(formID,linkClass){
        $(formID+' '+linkClass).click(function(){
            eval($(this).attr('href'));
            serialised = $(this).closest(formID).serialize();
            $.ajax({
                    type: "POST",
                    url: 'jadehttp.dll?EbdMulti_www_01',
                    data: serialised,
                    success: function(data) {
                        //console.log(data)
                        $(formID).html($(data).find(formID));
                        loadHandlers();
                        }
            });
            return false
        });

    }
    function loadHandlers(){
        ajaxFormUpdate('#faultList','.ajaxLink');
        ajaxFormUpdate('#accessCardList','.ajaxLink');
        ajaxFormUpdate('#facilityList','.ajaxLink');
        ajaxFormUpdate('#carParkingList','.ajaxLink');
        ajaxFormUpdate('#visitorList','.ajaxLink');
    }
    loadHandlers();

A: Resolved this by changing .html() to .replaceWith() (thanks jgauffin for putting me on the right track) and using the following click handler instead of the standard .click()
$(".selector_class").live('click', function() { alert("new element clicked"); });


text:
Q: Why was this question on detecting infinite loops closed? FINAL EDIT
I rewrote the original question (which was not mine) and ultimately ported it to Computer Science, where it's actually doing rather well. So my final thoughts on the matter are:

*

*From my perspective, it was too difficult to determine where the "right" place for this question was. Multiple people suggested multiple places for it, including "just rewrite it yourself and put it back on SO" (which was what I originally did). At first I thought the theoretical version of the question belonged on theoretical CS, which perhaps it would have if it weren't for the existence of (non-theoretical) CS--which I didn't even know about.

*It's troubling to me that this question is only welcome on a beta site. I firmly believe that this content belongs somewhere on StackExchange; the CS exchange site seems to be doing fairly well, but it could still ultimately be deleted. I'm not sure why, as a community, we're so quick to reject questions like this, given that there was no clear consensus regarding where it actually belonged.

Original post:
I found this question quite interesting, even though I admit that it doesn't show a lot of research effort. Still, it could be improved as the OP discovers more about their situation.
It was closed as not constructive with no explanation, though. While it's true that there might not be enough information presented in the question itself to determine what's actually happening, something is causing the behavior observed, and people observing similar behavior might want or need to know what kinds of things might cause it; furthermore, once we and the OP discover what's actually wrong, the cause can be posted as an answer and accepted. Just because there will be a multiplicity of answers until that happens hardly means that this question is going to " solicit debate, arguments, polling, or extended discussion."

A: The original question is more of a question about how servers work: what can cause a server process to die and be restarted? Closing it as not constructive or not a real question is bogus — it shows that the close voters didn't understand the question. While the question is relevant to how to program server applications, and therefore strictly speaking on-topic, the fact that it isn't understood by a sizable part of the SO community shows that it would be better off elsewhere. Server Fault would undoubtedly reject it as too elementary; it would fit perfectly on Unix & Linux. I've voted to reopen it, but if SO doesn't want it, please punt it over to U&L.
Your new question is a very different one. It asks specifically how to detect infinite loops. This straddles the border between programming and computer science. It wouldn't be amiss on Computer Science. I don't feel it to be off-topic enough to vote to close, but if SO doesn't want it, please punt it over to CS.

A: I am down as one of the voters to close. But I voted for Off Topic.
This is not a programming question - it is is there an OS that can detect infinite loops, so I think is not an SO question.
If there was an example OS that did this then I think it is a SuperUser question - especially the original as it asks about Linux.
The more general question is rather a debate but might be answereable on Computer Science - or possibly Programmers.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Howto force all Windows to open not Maximized i found some useful hints here:
i this answer from 2012 "Window Rules" is used
Force All Windows To Open At A Set Resolution ('width x height' pixels)
but i did not found "Window Rules" inside in the version from March 2021.
i tried use modified the answer here:
How to configure my system so that all windows start maximized?
like so:

but Firefox still opens maximized.
Motivation
When I drag the maximized windows a bit onto another monitor, they often suddenly snap to the top left corner, which I don't want.
And often the Windows is just to large.
Operating System:
Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.11.0-34-generic
OS Type: 64-bit

A: the settings of plasma can be overlaid by the individual apps and some start maximized. therefore e.g. the test with Firefox was unsuccessful. but had effect after using this Firefox addon:
https://addons.mozilla.org/en-US/firefox/addon/change-maximized-to-resizable/
I had previously set Cascade for new windows in 'Windows Managment'> 'Place Windows'> with ccsm. The tool turned off again. It looks like this rule is now in effect. I don't know it's coming from CCSM.


text:
Q: Independence of Combination of Normal Random Variables $\newcommand{\Cov}{\operatorname{Cov}}$
I have a practice question I'm trying to answer in studying for an upcoming exam:
$X\sim N(0,1)$ and $Y\sim N(0,1)$ and I have $\rho(X,Y)=0.4$. Define a random variable $Z = X + wY$ that also has a normal distribution. What value of $w$ makes $Z$ independent of $X$?
My thoughts is solve for when $\Cov(X,Y) = 0$, so I was going to set it up as:
$\rho(X,Y) = \frac{\Cov(X,Y)}{\sigma_X \sigma_Y}$ and solve $0.4 = \frac{\Cov(X,Y)}{1}$ so $\Cov(X,Y) = 0.4$ and then I'd have $\Cov(X,Y) = \Cov(X,wY) = w\Cov(X,Y) = 0.4w$ and solve $0.4w = 0$ so $w = 0$ is when $Z$ is independent of $X$? But I have a feeling I'm not approaching this correctly and am doing something wrong. Can someone please help guide me in the right direction?

A: $\newcommand{\Cov}{\operatorname{Cov}}$
You need $\Cov(Z,X)=0$, not $\Cov(X,Y)=0$.
Then
$$
0=\Cov(Z,X)= \Cov(X+wY,X)=\Cov(X,X)+w\Cov(Y,X),
$$
and recall that $\Cov(X,X)=1$, etc.
Also, you omitted to add that the pair $(X,Y)$ is jointly normally distributed.  Without that, your conclusion that $X+wY$ is necessarily normal is not justified.


text:
Q: Tomcat6 response.sendRedirect() 404 error I was wondering if anyone has experienced this problem I am having and, if so whether they could provide me with a solution.
I have an 'index.jsp' page which sits outside the WEB-INF folder and consists of the following code:
<html>
   <body>
      <%response.sendRedirect("home.htm");%>
   </body>
</html>

The page should redirect to 'home.jsp' which sits inside the WEB-INF folder.
The problem i am experiencing is that when I deploy my application in tomcat using Eclipse, the redirect works!
However, when i launch my application in tomcat by running 'startup.sh' from within the tomcat/bin folder I get a 'HTTP Status 404' error.
I am using tomcat 6.0.33

A: Files in /WEB-INF folder are not publicitly accessible. That folder is intented for resources which are not supposed to be accessed directly by the webbrowser, such as JSP include files, JSP files which require a preprocessing (front controller) servlet, etcetera.
Your home.jsp seem to be just a normal JSP file which is intented to be accessed directly by URL. So, put it outside the /WEB-INF folder. This way it's just available by http://localhost:8080/context/home.jsp.
As to your concrete requirement, letting index.jsp redirect to something else makes really no sense. Just change the <welcome-file> setting in web.xml to be home.jsp instead of index.jsp.
<welcome-file-list>
    <welcome-file>home.jsp</welcome-file>
</welcome-file-list>

This way the home.jsp will be opened when the enduser visits http://localhost:8080/context folder directly without specifying any resource file.
Oh, please note that the .htm extension is not the same as .jsp extension. Fix that accordingly as well, if necessary.

A: If you want to redirect to 'home.jsp', you have to write 'home.jsp' as sendRedirect parameter.

A: First of all, the initial page to go to is controlled in the web.xml file by the  element.  In stand-alone Tomcat, this defaults to /index.html, then /index.htm, and finally /index.jsp.
It may be that when you start tomcat from within Eclipse, the web plugin does it's own thing with the default web.xml and so the defaults may be slightly different.
Secondly, If you just want index.jsp to redirect to home.htm, you shouldn't wrap the scriptlet with HTML markup tags.  If tomcat decides to flush the output before your scriptlet is executed, the sendRedirect() method will be ignored, as the HTTP headers will have already been written.
Finally, I assume that you have some kind of mapping set up in your web application that handles the 'home.htm' request and forwards to home.jsp?

A: Why are you expecting it to redirect to home.jsp when the argument to sendRedirect is home.htm? Is there a typo? If the file is in fact under WEB-INF, it will not be accessible to the browser. Exposing the contents of WEB-INF to the world would open up numerous potential security holes. You would need to do the following if you want home.jsp to include the contents of WEB-INF/home.htm:
<jsp:include page="/WEB-INF/home.htm" />


text:
Q: How can I enable NTLM and TLS 1.2 with Xamarin on Android? I am working with a client app in Xamarin on Android and I need TLS 1.2 and NTLM.
So far, I have been using the regular System.Net.HttpClientHandler and it has worked fine - it looks like this:
new System.Net.Http.HttpClientHandler()
        {
            Credentials = credentials
        };

But now I have a new customer and I need TLS 1.2. So I made this code for Android:
new Xamarin.Android.Net.AndroidClientHandler()
        {
            Credentials = credentials
        };

With the environment variable:
XA_HTTP_CLIENT_HANDLER_TYPE=Xamarin.Android.Net.AndroidClientHandler

Now, this AndroidClientHandler works as far as the certificate goes. But I also need NTLM to work. To me it seems like the AndroidClientHandler only has support for Basic and Digest authentication schemes (see Xamarin.Android.Net.AuthenticationScheme).
I also tried with the ModernHttpClient, but it seems to me that it uses Mono the same way System.Net.Http.HttpClientHandler does, so TLS 1.2 doesn't work there either.
It seems to me that this should be a pretty common case, but I still can't find a relevant example on the web. I hope I am just missing something obvious. How have you guys solved this?

A: I believe it would be beneficial for you to read through:
https://github.com/xamarin/xamarin-android/blob/0c3597869bc4493895e755bda8a26f778e4fe9e0/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs#L40-L56
/// <para>
/// The class supports pre-authentication of requests albeit in a slightly "manual" way. Namely, whenever a request to a server requiring authentication
/// is made and no authentication credentials are provided in the <see cref="PreAuthenticationData"/> property (which is usually the case on the first
/// request), the <see cref="RequestNeedsAuthorization"/> property will return <c>true</c> and the <see cref="RequestedAuthentication"/> property will
/// contain all the authentication information gathered from the server. The application must then fill in the blanks (i.e. the credentials) and re-send
/// the request configured to perform pre-authentication. The reason for this manual process is that the underlying Java HTTP client API supports only a
/// single, VM-wide, authentication handler which cannot be configured to handle credentials for several requests. AndroidClientHandler, therefore, implements
/// the authentication in managed .NET code. Message handler supports both Basic and Digest authentication. If an authentication scheme that's not supported
/// by AndroidClientHandler is requested by the server, the application can provide its own authentication module (<see cref="AuthenticationData"/>,
/// <see cref="PreAuthenticationData"/>) to handle the protocol authorization.</para>
/// <para>AndroidClientHandler also supports requests to servers with "invalid" (e.g. self-signed) SSL certificates. Since this process is a bit convoluted using
/// the Java APIs, AndroidClientHandler defines two ways to handle the situation. First, easier, is to store the necessary certificates (either CA or server certificates)
/// in the <see cref="TrustedCerts"/> collection or, after deriving a custom class from AndroidClientHandler, by overriding one or more methods provided for this purpose
/// (<see cref="ConfigureTrustManagerFactory"/>, <see cref="ConfigureKeyManagerFactory"/> and <see cref="ConfigureKeyStore"/>). The former method should be sufficient
/// for most use cases, the latter allows the application to provide fully customized key store, trust manager and key manager, if needed. Note that the instance of
/// AndroidClientHandler configured to accept an "invalid" certificate from the particular server will most likely fail to validate certificates from other servers (even
/// if they use a certificate with a fully validated trust chain) unless you store the CA certificates from your Android system in <see cref="TrustedCerts"/> along with
/// the self-signed certificate(s).</para>

Basically this says: It supports Basic and Digest authentication. If there's an authentication scheme that's not supported in AndroidClientHandler that is requested by the server, the application can provide it's own authentication module to handle the protocol authorization.
We then can see that the RequestedAuthentication property will list out the about each scheme supported by the server.:
https://github.com/xamarin/xamarin-android/blob/0c3597869bc4493895e755bda8a26f778e4fe9e0/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs#L116-L124
/// <summary>
/// If the website requires authentication, this property will contain data about each scheme supported
/// by the server after the response. Note that unauthorized request will return a valid response - you
/// need to check the status code and and (re)configure AndroidClientHandler instance accordingly by providing
/// both the credentials and the authentication scheme by setting the <see cref="PreAuthenticationData"/>
/// property. If AndroidClientHandler is not able to detect the kind of authentication scheme it will store an
/// instance of <see cref="AuthenticationData"/> with its <see cref="AuthenticationData.Scheme"/> property
/// set to <c>AuthenticationScheme.Unsupported</c> and the application will be responsible for providing an
/// instance of <see cref="IAndroidAuthenticationModule"/> which handles this kind of authorization scheme
/// (<see cref="AuthenticationData.AuthModule"/>
/// </summary>

This tells us that if it returns Unsupported as our AuthenticationScheme, then we need to submit our own IAndroidAuthenticationModule that handles the challenge.
Here is an enum of the AuthenticationScheme:
https://github.com/xamarin/xamarin-android/blob/24f2aec113857b5c583e14959b9af08ad45b22b1/src/Mono.Android/Xamarin.Android.Net/AuthenticationScheme.cs
namespace Xamarin.Android.Net
{
    /// <summary>
    /// Authentication schemes supported by <see cref="AndroidClientHandler"/>
    /// </summary>
    public enum AuthenticationScheme
    {
        /// <summary>
        /// Default value used in <see cref="AuthenticationData.Scheme"/>
        /// </summary>
        None,

        /// <summary>
        /// <see cref="AndroidClientHandler"/> doesn't support this scheme, the application must provide its own value. See <see cref="AuthenticationData.Scheme"/>
        /// </summary>
        Unsupported,

        /// <summary>
        /// The HTTP Basic authentication scheme
        /// </summary>
        Basic,

        /// <summary>
        /// The HTTP Digest authentication scheme
        /// </summary>
        Digest
    }
}

Thus we would have to implement a custom IAndroidAuthenticationModule by extending this interface on your implementation:
https://github.com/xamarin/xamarin-android/blob/24f2aec113857b5c583e14959b9af08ad45b22b1/src/Mono.Android/Xamarin.Android.Net/IAndroidAuthenticationModule.cs
Then you'd pass that implementation into the AuthenticationData.AuthModule property:
https://github.com/xamarin/xamarin-android/blob/24f2aec113857b5c583e14959b9af08ad45b22b1/src/Mono.Android/Xamarin.Android.Net/AuthenticationData.cs#L37
You would then pass that into the main client's PreAuthenticationData property.
https://github.com/xamarin/xamarin-android/blob/0c3597869bc4493895e755bda8a26f778e4fe9e0/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs#L113
I hope this helps!


text:
Q: Unshifting / Adding to Front of Firebase Object Using AngularFire or Vanilla JavaScript I have an array / object stored on Firebase that I add items to using AngularFire's $add function.  $add is the equivalent of using .push on a regular JavaScript array.  The value you specify is added to the end of the array.
Is there anyway to add my value to the front of this array / object stored on Firebase?  Something that does the same thing as .unshift in vanilla JavaScript?
I would prefer an AngularFire solution, but vanilla JavaScript solutions are fine if there isn't one.

A: Since the data isn't stored in an array (prior to AngularFire 0.8 due out next week), and objects are unsorted in js, there is technically no concept of front/back. This is achieved in Firebase by sorting your data keys or by using priorities. See ordered data for more on this topic.
In AngularFire, priorities are stored on records as $priority. You can set this value before saving a record to control its sort ordering:
var data = $firebase(ref);
data.$on('loaded', function() {
   data['foo'].$priority = 99;
   data.$save('foo');
});

To place an item first in the list, you would simply assign it a smaller priority than the other records.


text:
Q: Google Analytics referral sources We're using Google and Facebook SSO allowing our users to sign up and login with these services. However, if a user signs up or logins in with either service (rather than creating a standard email login), we lose the referral source in Google Analytics -- and, instead, sign up and upgrade sources are attributed to accounts.google.com or Facebook.com. Anyone have some thoughts on a workaround?

A: This requires some backend work. Whenever one of your users clicks on the login button with either services, you backend should 'remember' him using a cookie or any other parameter. In that way whenever he comes back from exactly the url of your Facebook SSO or accounts.google.com you should set the GA tracker referrer parameter to the one of your site's URL. You can do this in basic js code like this
ga('set', 'referrer', 'mydomain.com');

In this way you won't see these invalid referrals anymore.


text:
Q: Splitting user input and fill into a array with a loop (java) I need to make a calculator for students grades using java. The user types in the name and score for a student on a single line separated by commas. It needs to take 10 students details. But I can not work out how to split the user input string using commas, and fill it into my array. Any help would be appreciated. Thanks
public static void main (String[] args){

    Scanner scan = new Scanner(System.in);
    String[][] student = new String[10][];

    for (int index=1; index <=10; index++){
    String userinput = scan.nextLine();

A: You want String#split, which will return a String[].
Also, arrays in Java are zero-based, so you need
for(int index = 0; index < student.length; index++)

A: No need for the loop. If you want to fill in your array, you should use the split() method of the String class, like so:
String userInput = scan.nextLine();
// input comma-separated grades
String[] grades  = userInput.split(",");

And now you have a grades array with each element as an individual grade


text:
Q: How do I access pagination in UsersResponse from the Relationships endpoint in InstaSharp? I have an InstaSharp.Endpoints.Relationships.Authenticated object EP_RELATIONSHIPS, and I can call EP_RELATIONSHIPS.Follows() to get a list of users I'm following. I follow a few hundred people, but I only get a result of 50.
When I check the JSON data on the Instagram API page using the API Console, I can see that there's a pagination URL.
Other return objects such as InstaSharp.Model.Responses.MediasResponse have an object called  .Pagination that seem to provide this functionality.
Is this library incomplete? Why is there no pagination in the Relationships endpoint response and how can I accomplish pagination without having to re-write my own version of this part of InstaSharp?

A: The latest version of Instasharp (https://github.com/InstaSharp/InstaSharp) has the 'Pagination' property in the class.
There is also an implementation of the pagination being used to return multiple page sets in the library also in the Tags.RecentMultiplePages(..) method, which could in the future be made more generic and rolled out to multiple methods.

A: You could create your own object that has the pagination -> next_url | next_cursor. Grab the json from the response and Deserialize it into your own object..

A: To further clarify Damian's answer, if you look at the unit tests on the InstaSharp github, you can see an example of how to use Pagination:
    public async Task Follows_NextCursor()
    {
        //This test will fail if testing with an account with less than one page of follows
        var result = await relationships.Follows();
        result = await relationships.Follows(457273003/*ffujiy*/, result.Pagination.NextCursor);
        Assert.IsTrue(result.Data.Count > 0);
    }


text:
Q: Read file from internal storage I have an AsyncTask to download a file to internal storage in my android app. I want to read this file later but I don´t know how can I do this. This is my AsyncTask´s code:
private class GetFile  extends AsyncTask<Void, Void, Void> {

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            // Showing progress dialog
            pDialog = new ProgressDialog(ComprobadorDos.this);
            pDialog.setMessage("Por favor espere...");
            pDialog.setCancelable(false);
            pDialog.show();

        }

        @Override
        protected Void doInBackground(Void... arg0) {

            try {

                    File fileEvents = new File(context.getFilesDir().getAbsolutePath() + "/agenda_hoy.json");

                    if (fileEvents.exists()) {
                        fileEvents.delete();
                    }

                    String buffer;
                    URLConnection conn = new URL(CALLBACK_URL).openConnection();
                    conn.setUseCaches(false);
                    conn.connect();
                    InputStreamReader isr = new InputStreamReader(conn.getInputStream());
                    BufferedReader br = new BufferedReader(isr);

                    FileOutputStream fos = context.openFileOutput("agenda_hoy.json", Context.MODE_PRIVATE);

                    while ((buffer = br.readLine()) != null) {
                        fos.write(buffer.getBytes());
                    }

                    fos.close();
                    br.close();
                    isr.close();

            } catch (Exception e) {
                Log.d(LOG_TAG, e.getMessage());
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            // Dismiss the progress dialog
            if (pDialog.isShowing())
                pDialog.dismiss();

        }

    }

I hope this is a good code, if someone knows a better practice please tell me how can I do this.

A:     //Get the text file
    File fileEvents = new File(context.getFilesDir().getAbsolutePath() + "/agenda_hoy.json");

    //Read text from file
    StringBuilder text = new StringBuilder();

    try {
        BufferedReader br = new BufferedReader(new FileReader(fileEvents));
        String line;

        while ((line = br.readLine()) != null) {
            text.append(line);
            text.append('\n');
        }
        br.close();
    }
    catch (IOException e) {
        //You'll need to add proper error handling here
    }

//you now have the file content in the text variable and you can use it
//based on you needs
Log.d("MYAPP",text.toString());


text:
Q: How to add wildcard for disable accounts with PowerShell? I have the following PowerShell command which I run to show me all the numbers that have been assigned to users. However, I'd like to narrow it down to show me ONLY accounts which have been disabled BUT still have an number assigned, I've tried a few wildcards within 'enabled' but then it fails to run.
Get-ADUser -Properties "msRTCSIP-Line",mail,l,c,Enabled,CanonicalName -LDAPFilter "(msRTCSIP-Line=tel:+44*)" |
    Select Name,CanonicalName,mail,l,c,Enabled,"msRTCSIP-Line" |
    ft -AutoSize

A: The enabled/disabled status is encoded in the userAccountControl attribute. Try an LDAP filter like this:
(&
    (objectclass=user)
    (objectcategory=user)
    (useraccountcontrol:1.2.840.113556.1.4.803:=2)
    (msRTCSIP-Line=tel:*)
)

or collapsed:
(&(objectclass=user)(objectcategory=user)(useraccountcontrol:1.2.840.113556.1.4.803:=2)(msRTCSIP-Line=tel:*))

A: I think the best way is to get all disabled accounts then pipe it to your code :
Search-ADAccount -AccountDisabled -UsersOnly | %{
    Get-ADUser $_ -Properties "msRTCSIP-Line",mail,l,c,Enabled,CanonicalName -LDAPFilter "(msRTCSIP-Line=tel:+44*)" |
    Select Name,CanonicalName,mail,l,c,Enabled,"msRTCSIP-Line"
}


text:
Q: If output comes in negative value, how to make it null? Hi I am working on one query, what I want to do is, whenever output comes in negative value,
I want to make it null, following is my query, can anyone help me with this ?
select (to_char((coalesce(14515200/3600000,0) - (coalesce(30512.65/3600,0) - (coalesce(1800/3600,0) + (coalesce(1800/3600,0))))),'FM99,999,999,999'))::character varying as test

A: If you want a result of NULL for negative values, use
nullif(greatest(/* your expression */, 0), 0)

The only drawback here is that a result of exactly 0 will also become NULL. If you want to avoid that, you could use a user defined function:
CREATE FUNCTION neg_to_null(double precision) RETURNS double precision
   LANGUAGE plpgsql AS
'BEGIN; RETURN CASE WHEN $1 < 0.0 THEN NULL ELSE $1; END;';

I use PL/pgSQL to avoid function inlining.

A: Move your logic to the from clause and use case:
select (case when test_n >= 0 then test_n::character varying end)
from (select . . .  as test_n -- your expression as number) x

If your expression actually uses values from a table, you can use a subquery, CTE, or lateral join to define test_n.


text:
Q: execute multiple threads on pyqt I'm trying to execute two concurrent processes, the first one calculates constantly (ex. every 0.1 seconds) the frequency recorded by the microphone, while the second one gets the frequency and paint a representation every 0.5 seconds.
I'm a little bit confused on how to implement threads, I'm not able to execute parallel threads.
Here a piece of code:
class MicrophoneThread(QtCore.QThread):
    def __init__(self):
        super(MicrophoneThread , self).__init__()

    def __del__(self):
        self.wait()

    def run(self):
        print("Microphone Thread")
        while True:
            time.sleep(0.1)
            self.emit(SIGNAL('listen()'))

class PaintThread(QtCore.QThread):
    def __init__(self, el):
        super(PaintThread , self).__init__(el)

    def __del__(self):
        self.wait()

    def run(self):
        i = 0
        while True:
            i += 1
            time.sleep(0.5)
            self.emit(QtCore.SIGNAL('update(QString)'), str(i))

From the MainWindow I instantiate the threads.
    threadOne = MicrophoneThread(self)
    self.connect(threadOne , QtCore.SIGNAL('listen()') , self.listen, Qt.DirectConnection)
    threadOne.start()

    threadTwo = PaintThread(self)

    self.connect(threadTwo , QtCore.SIGNAL('update(QString)') , self.changeIndicatorAngle, Qt.DirectConnection)
    self.connect(threadTwo , QtCore.SIGNAL('update(QString)') , self.changeNoteLabel, Qt.QueuedConnection)
    threadTwo.start()

Only MicrophoneThread starts, while the second one doesn't work.
Any suggestion or document to read is appreciated.

A: I solved the problem by my self, the issue was so simple.
I instantiate the first Thread in the MainWindow when the program starts, while I instantiate the second one only when I click on a button on another form.
So I have a MainWindow in which I run the MicrophoneThread, and another one Form in which I run the PaintThread when I click on a button.


text:
Q: How to disconnect a network on Android Q? According to documentation if we remove the network suggestion list, the system will disconnect from that network, but it doesn't work.
int statusCode = wifiManager.removeNetworkSuggestions(new ArrayList<>());

Here I'm removing all the networks suggested by our app, the status code is WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS but the network is not actually disconnected.

A: The way to connect to a Wifi accessory is by using the ConnectivityManager with a call to connectivityManager.registerNetworkCallback.
After doing your stuff with the connection (accessory) you can call connectivityManager.unregisterNetworkCallback to disconnect from it.


text:
Q: Passing Values from PopUp Window I have created a file manager popup window which currently am only using to upload files. Now I want to configure it so that it can be called from a form and after selecting files pass the file names to the parent window.
Is it possible to do that? If so, how can I pass values from popup windows to it's opener?

A: Did you tried the Window opener Property ?
Maybe can you post some code in order to have a better comprehension of what you want ?


text:
Q: What is Perl's equivalent to awk's /text/,/END/? I am looking to replace a nasty shell script that uses awk to trim down some HTML. The problem is I cannot find anything in Perl that does the aforementioned function
awk '/

State<\/TH>/,/END/'

How can I do this in Perl?
the expected output would be

State

The Perl flipflop operator gives me WAY more. (Everything between the asterisks is junk)
*
Browse Monitors (1 out of 497)

 Use the Monitor Description Report to view current monitor configuration settings.*

State

A: I think this will work:
perl -ne 'print if /text/ .. /END/'

expr1 .. expr2 will be false until it encounters a line where expr1 is true.
Then it will be true until it encounters a line where expr2 is true.

Update: if you need to trim the non-matching text from the front of the first matching line, this will work
perl -ne 'print if s/.*TEXT/TEXT/ .. s/END.*/END/`

or
perl -ne 'print if s/.*(TEXT)/$1/ .. s/(END).*/$1/'

if TEXT is a long string that you only want to type once. The change will edit the line while it does the pattern match.

A: As a one-liner (slightly changed since first post):
perl -n -e '$started = 1 if /

State<\/TH>/; next unless $started; print; last if /END/;'

From the perlrun man page:

   -n   causes Perl to assume the following loop around your program,

which makes it iterate over filename
  arguments somewhat like sed -n or awk:
          LINE:
            while (<>) {
                ...             # your program goes here
            }

And then the core of the body is to wait for the start, then print every line until the end.


text:
Q: Multi-threaded Java Application on a Cluster? I have a multi-threaded java application for some research simulations. The lab I am working in has a large linux cluster, as well as a bunch of personal computers. I am a grad student, and have been programming in java for a long time, but I'm not very familiar with clusters. If I run my application on the cluster, will it be able to allocate the various threads to the different nodes? I am assuming this is not the case.. what is the best way to do this? I have seen Terracotta, Hadoop and Jini from doing some google searches, but it is unclear to me how they differ and which option (maybe none of the ones mentioned here) is best? I would like to avoid doing client/server programming, and if there exists a software solution which would be able to allocate the threads created by my program - that would be best.
Thanks,
Joe

A: For a simple interface for distrubted compting I would suggest you try Hazelcast.  This has distributed Queue, Executors and others.  You can just add tasks and they will be performed on the next available CPU where-ever and coding it is much the same as on one computer. (Same interfaces)

A: If you google "java grid computing" you will find some great frameworks that will do what you need.


text:
Q: Draw rectangle on google map I am extend a SupportMapFragment which contain google map here, I lay my google map on a frameLayout according to How to handle onTouch event for map in Google Map API v2?. Ondraw()method is called , but the problem is rectangle is never been showed, even when I use setWillNotDraw(false); here.
I already got the right position of the rectangle, the only problem is it is not showed. Following is my most part of code:
Add-on:When I remove the google map it works as I expect, actually the rectangle drawed on the background frameLayout, so it will be covered by the map, now the way I solve the question is add a image view as a rectangle and dynamic change its size when touch moving. I have no idea how to draw directly on the top of this viewgroup(framelayout) at the moment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    //stash reference to google map
    mGoogleMap = getMap();
    //show the location
    mGoogleMap.setMyLocationEnabled(true);
    mTouchView = new TouchableWrapper(getActivity());
    mTouchView.addView(view);

    return mTouchView;
}

private class TouchableWrapper extends FrameLayout {

    //box is used to illustrate the drawing box, the painter is used to set the color of the box.
    private Box mCurrentBox = null;
    private Paint mBoxPaint;

    public TouchableWrapper(Context context) {
        super(context);
        mBoxPaint = new Paint();
        mBoxPaint.setColor(0xffff0000);
    //  mBoxPaint.setStrokeMiter(20);
        mBoxPaint.setStrokeWidth(8);
        this.setWillNotDraw(false);
        setWillNotDraw(false);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        // decide when the child should hold the motion event.
        return true;    //always let the relative layout to hold the motion event.
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        PointF curr = new PointF(event.getX(), event.getY());
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                 mMapIsTouched = true;
                mCurrentBox = new Box(curr);//original code for draw Rectangle.
                Log.d(TAG, "action.down box is"+mCurrentBox);
                break;

            case MotionEvent.ACTION_MOVE:
                Log.i(TAG, "action_move");
                if (mCurrentBox != null) {
                    mCurrentBox.setmCurrent(curr);
                    Log.d(TAG, "action.move box is"+mCurrentBox);
                    this.invalidate();  //TODO
                }
                break;

            case MotionEvent.ACTION_UP:
                Log.i(TAG, "action_up");
                mMapIsTouched = false;
                mCurrentBox = null;
                break;
                }
            return true;
        }

    @Override
    protected void onDraw(Canvas canvas) {
        float left = 0;
        float right = 0;
        float top = 0;
        float bottom = 0;
        if (mCurrentBox!=null) {
             left = Math.min(mCurrentBox.getmOrigin().x, mCurrentBox.getCurrent().x) ;
             right = Math.max(mCurrentBox.getmOrigin().x, mCurrentBox.getCurrent().x) ;
             top = Math.min(mCurrentBox.getmOrigin().y, mCurrentBox.getCurrent().y) ;
             bottom = Math.max(mCurrentBox.getmOrigin().y, mCurrentBox.getCurrent().y) ;
            canvas.drawRect(left, top, right, bottom, mBoxPaint);
            }
        Log.i(TAG, "value is"+left+right+top+bottom);
        }

A: You could wrap the Map in a FrameLayout containing also a Drawable (your rectangle). In that way, once you find where the rectangle shall be, you could hide and show it without having to redraw it.
You can see here for an example.


text:
Q: Flutter local notification sometimes doesn't work in the release version of the app I'm using flutter_local_notification periodicallyShow() method. but sometimes it doesn't show the notification, sometimes it does, just in the release version! While in the debug mode, it works fine! (running on the device as an emulator)
I tried all of these:

*

*flutter build apk --no-shrink

*add keep.xml file to my android/app/src/main/res directory

*edit AndroidManifest.xml based on this (add permission, etc.).

also, I want to try these options (later):
this example.
and using proguard-rules.pro file like this.
What should I do?!
Is there any solution?!
Thank you.
code snippet:
final AndroidNotificationDetails _androidNotificationDetails =
      const AndroidNotificationDetails(
    'channel ID',
    'channel name',
    playSound: true,
    priority: Priority.max,
    importance: Importance.max,
  );
Future<void> scheduleNotifications() async {
await FlutterLocalNotificationsPlugin().periodicallyShow(
      1,
      "title",
      "body",
      RepeatInterval.everyMinute,
      NotificationDetails(android: _androidNotificationDetails),
      androidAllowWhileIdle: true,
    );
}

(if it helps: one time, when I plugged my phone into the charger adapter, it worked perfectly. and then I unplugged my phone, after that its timing became messy!!!)

A: I had this issue too. My solution was to use flutter create name_of_project again, and after creating another project, i copied all the files from the old project to the folder of my new project. Inside my pubspec.yaml, i updated the firebase_messaging from the ^11.3.0 and local_notifications from ^9.4.0 to those versions below:
 flutter:
   sdk: flutter
.
   cupertino_icons: ^1.0.2
   firebase_messaging: ^12.0.1
   flutter_local_notifications: ^9.7.0```

 Don't forget to put:

 <uses-permission android:name="android.permission.INTERNET"/> in your android\app\src\main\AndroidManifest.xml.

 After all, you just need to run:

   > flutter build apk --split-per-abi --no-shrink
   or
   > flutter build apk --no-shrink


text:
Q: Get Web Browser tool to successfully load a page I am trying to get my web browser tool in my c# application to load a webpage which contains a video. however, my page initially threw a ton of java script errors and hardly any of the page would load.
I looked around stackoverflow and came across a post saying to enable emulation in my registry using this function
private static void EnsureBrowserEmulationEnabled(string exename = "EXENAME.exe", bool uninstall = false)
    {

        try
        {
            using (
                var rk = Registry.CurrentUser.OpenSubKey(
                        @"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true)
            )
            {
                if (!uninstall)
                {
                    dynamic value = rk.GetValue(exename);
                    if (value == null)
                        rk.SetValue(exename, (uint)11001, RegistryValueKind.DWord);

                    MessageBox.Show("Successfully enabled");
                }
                else
                {
                    rk.DeleteValue(exename);
                    MessageBox.Show("Already Enabled");
                }

            }
        }

        catch
        {
            MessageBox.Show("Error, put something here");
        }
    }

this allowed me to not get any errors and i can hear audio from the video playing, but the whole webbrowser tool is white. No errors are thrown so i am completely stuck on how to progress from here to getting the display to show up.

A: For people struggling with this issue, I discovered 2 fixes.
1) use CefSharp browser package for c# and enable flash player etc there, this way was very buggy for me
2) force a new tab to open in chrome by calling Process.Start("chrome", you url); this was much easier but not as satisfying.


text:
Q: H2 Database not found error: 90146. H2 database is not created on start Just created a simple spring-boot project from the spring initializer. I went to add a local h2 db for testing and am unable to login. Seems that it cannot create the test db when starting up but cannot figure out why this may be the case.
spring:
  h2:
    console:
      enabled: true
      path: /h2
  datasource:
    url: jdbc:h2:mem:testdb;
    username: sa
    password:
    driver-class-name: org.h2.Driver
    platform: h2
  jpa:
    show-sql: true
    hibernate:
      ddl-auto: create
    properties:
      hibernate:
        dialect=org:
          hibernate:
            dialect:
              H2Dialect: org.hibernate.dialect.H2Dialect

Database "mem:testdb" not found, and IFEXISTS=true, so we cant auto-create it [90146-199] 90146/90146

A: just append this to your application.properties file.
spring.datasource.url=jdbc:h2:mem:testdb
spring.data.jpa.repositories.bootstrap-mode=default

A: As Stuck said.
Simply remove the semicolon:
wrong:    jdbc:h2:mem:testdb;
correct:  jdbc:h2:mem:testdb

A: I have the same problem with windows. I just change spring.datasource.url in application property file to jdbc:h2:file:C:/data/sample and run project. after that set JDBC URL to  jdbc:h2:file:C:/data/sample. look like picture
JDBC URL

A: In earlier version of spring, default url will be jdbc:h2:mem:testdb and testdb was created by default. from 2.3.0 onwards, if url is not mentioned it will auto generate database name. auto generated database name can be found in the spring logs.

A: I had a same problem and I changed the version of Spring Boot to 2.1.3 and it works

A: I had the same error and I found these to be helpful:
Adding a pre-2019 version to the pom.xml file as below:
<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.193</version>
</dependency>

This fixes the error but isn't the right way to do it. The newer version of H2 Database do not create a new database as it doesn't exist by default and are enabled to false for security purposes.
A better way would be adding making changes to url as:
jdbc:h2:mem:testdb;IFEXISTS=FALSE;

Hope it helps. I made changes in my application.properties file.

A: wrong:
spring.datasource.url=jdbc:h2:mem:testdb

This below solution worked for me
spring.datasource.url=jdbc:h2:file:~/test;

A: If you are using spring boot in order to use h2 DB, make sure you have dependencies on your pom.xml file
<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
     <groupId>com.h2database</groupId>
     <artifactId>h2</artifactId>
     <scope>runtime</scope>
</dependency>

Your application.yml makes it possible to access h2 DB by URI /h2-console preceded by server URL and to connect to DB named "testdb" with username "sa" and no password, after the application has been started on the server.

A: maybe you have to setting about h2.
In application.properties

spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=true
spring.datasource.generate-unique-name = false
spring.h2.console.path=/h2-console
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver

when you put these codes in Application.properties you can see how it work!


text:
Q: reading nanosecond resolution from recorded pcap files in C++ I've recorded some pcap files with tcpdump with option --time-stamp-precision nano given,
and I can print the timestamps of these pcap files with tcpdump using a command like
tcpdump -r <my_pcap_file> -ttt
However, I can't seem to read the timestamp using libpcap, the best I'm getting now is microsecond resolution.
I found a recent post here that mentions that it's not supported yet in libpcap:
https://github.com/google/gopacket/issues/298
Is this still true? Or do I need to check out pcapgo mentioned in the post?

A: The answer to the post below answered my question!
Read nanosecond pcap file using libpcap
At first I was using a pcap file that actually had microsecond resolution,
and I assumed that using
pcap_open_offline_with_tstamp_precision(pathname, PCAP_TSTAMP_PRECISION_NANO, errbuf);
to open the pcap file should make the tv_usec in struct timeval be in nanoseconds, but this seems to be true only when the pcap file actually has nanosecond time stamps.


text:
Q: The name 'Marshal' does not exist in the current context I got the code below from the bitmapmixer sample (DirectShow.NET) and i tried to reimplement it. The original sample works fine. In my version when I try to compile i get errors.
private void AddHandlers()
    {
        // Add handlers for VMR purpose
        this.Paint += new PaintEventHandler(Form1_Paint); // for WM_PAINT
        this.Resize += new EventHandler(Form1_ResizeMove); // for WM_SIZE
        this.Move += new EventHandler(Form1_ResizeMove); // for WM_MOVE
        SystemEvents.DisplaySettingsChanged += new EventHandler(SystemEvents_DisplaySettingsChanged); // for WM_DISPLAYCHANGE
        handlersAdded = true;
    }

    private void RemoveHandlers()
    {
        // remove handlers when they are no more needed
        handlersAdded = false;
        this.Paint -= new PaintEventHandler(Form1_Paint);
        this.Resize -= new EventHandler(Form1_ResizeMove);
        this.Move -= new EventHandler(Form1_ResizeMove);
        SystemEvents.DisplaySettingsChanged -= new EventHandler(SystemEvents_DisplaySettingsChanged);
    }

ERRORs

Error   1   The name 'Marshal' does not exist in the current context        Form1.cs
Error   2   The name 'Marshal' does not exist in the current context        Form1.cs
Error   3   The name 'Form1_ResizeMove' does not exist in the current context   Form1.cs
Error   4   The name 'Form1_Paint' does not exist in the current context        Form1.cs
Error   5   The name 'Form1_ResizeMove' does not exist in the current context   Form1.cs
Error   6   The name 'Form1_ResizeMove' does not exist in the current context   Form1.cs
Error   7   The name 'SystemEvents_DisplaySettingsChanged' does not exist in the current context    Form1.cs
Error   10  The name 'Form1_ResizeMove' does not exist in the current context           Form1.cs
Error   11  The name 'SystemEvents_DisplaySettingsChanged' does not exist in the current context    Form1.cs

Any help is appreciated.
Thanks.

A: The Marshal class is in the System.Runtime.InteropServices namespace. Do you have an appropriate using directive?
using System.Runtime.InteropServices;

As for the other errors - do you have those methods in your class? If not, remove the lines which are trying to subscribe event handlers for them...

A: public static class Marshal is a Member of System.Runtime.InteropServices
you just have to add:
using System.Runtime.InteropServices;
in that .cs file


text:
Q: Manipulating POST data to work with Symfony2 forms when used in a REST API Background:
I am writing a RESTful API on symfony. I want the client to be able to post to a url using the content type application/json and post a json object of form that the controller action is looking for.
Im using a pretty basic controller setup for this. Lets assume for demonstration purposes that im trying to authenticate a simple username password combo.
public function loginAction( Request $request )
{
    $user = new ApiUser();
    $form = $this->createForm(new ApiUserType(), $user);
    if ( "POST" == $request->getMethod() ) {
        $form->bindRequest($request);
        if ( $form->isValid() ) {
            $em = $this->getDoctrine()->getEntityManager();
            $repo = $this->getDoctrine()->getRepository('ApiBundle:ApiUser');
            $userData = $repo->findOneByUsername($user->getUsername());
            if ( is_object($userData) ) {
                /** do stuff for authenticating **/
            }
            else{
                return new Response(json_encode(array('error'=>'no user by that username found')));
            }
        else{
            return new Response(json_encode(array('error'=>'invalid form')));
        }
    }
}

Now the issue that i have, and have i have tried var_dumping this till the cows come home, is that for what ever reason symfony does not want to take the application/json content-body and use that data to populate the form data.
Form name: api_apiuser
Fields: username, password
What would be the best way to handle this type of task. I am open to suggestions as long as i can get this working. Thanks for your time with the matter.

A: Youll need to access the RAW request body and then use json_decode. Youll probably need to change your bindRequest method to something like the following:
public function bindRequest(Request $request)
{
       if($request->getFormat() == 'json') {
           $data = json_decode($request->getContent());
           return $this->bind($data);
        } else {
           // your standard logic for pulling data form a Request object
           return parent::bind($request);
        }
}

I havent really messed with SF2 yet so this is more guessing based on the API, exp. with sf1.x and things ive garnered from presentations on the framework.  It might also be better to make a completely different method like bindJsonRequest so things are a bit more tidy.

A: Ive actually found a similar way to fix this, AFTER checking if the method is post and before binding the request to the form i do this:
if ( "POST" === $request->getMethod() ) {
    if (0 === strpos($request->headers->get('Content-Type'), 'application/json')){
        $data = json_decode($request->getContent(), true);
        $request->request->replace(is_array($data) ? $data : array());
    }
    $form->bindRequest($request);
    /** Rest of logic **/
}

A: Yeah, what the form is waiting for during binding is an array containing keys that correspond to your ApiUser properties.
So if you send a POST request with the string:
{ username: 'user', password: 'pass' }

You will have to transform it into an array using json_decode for example:
$data = json_decode($request->getContent()); // $request->request->get('json_param_name');

Then you bind this array to the form using $form->bind($data);
The form will update your ApiUser properties corresponding to array's keys (username, password).
If you're building a RESTful json api, I would advice you to automatize this process using serializers/transformers, like https://github.com/schmittjoh/JMSSerializerBundle/blob/master/Resources/doc/index.rst


text:
Q: How can I make my list unique in dart language? List<List<int>> intArr = [
    [0, 0],
    [1, 1],
    [1, 1],
];

I want to get an output like below in the above list. How can I do it?

[0,0],[1,1]

A: import 'package:collection/collection.dart'; // Must be imported

  /// Below codes must be inside a function
  List<List<int>> intArr = [[0, 0],[1, 1],[1, 1]];
  List<List<int>> newList = [];
  Function eq = const ListEquality().equals;

  for (var i in intArr) {
    if (!newList.any((v) => eq(v, i))) {
        newList.add(i);
    }
  }

I referred to Jahidul's comment.


text:
Q: Eclipse opens compiled python instead of source code on breakpoint I am having some trouble with my Eclipse debugger. Every time I set a breakpoint on Python source files, when the breakpoint is hit Eclipse opens up the associated pyc compiled file.
Below are a few things I have tried:

*

*Creating a new Eclipse project with the code

*Deleting all settings files within the code

*Switch to a new workspace

*Re-install eclipse and PyDev completely.

The problem persists. I don't know what could possibly be causing this. The issue only occurs when a breakpoint is set. However, that renders breakpoints useless in Eclipse.
This issue only began after I tried to set up Visual Studio for Python development. In Visual Studio this issue does not occur.

A: Can you check if you have pydevd installed somewhere in your system and remove it if that's the case? (i.e.: run without debugging import pydevd and if you find it remove it from your interpreter).
The PyDev debugger is used in other products (such as PyCharm and Visual Studio), so, my guess is that a non-compatible version is installed somewhere instead of using the version which is shipped along with Eclipse/PyDev.


text:
Q: Python for loop parameters Hi im just wondering what the 4 would do in this code
for y in range(0, height, 4):

Thanks

A: Range with just one parameter: end.
Range with two parameters: start, end.
Range with three parameters: start, end, step.
So in your specific case
 for y in range(0, height, 4)

0, 4, 8, ..., n, where n < height.

A: The 4 in the range function used in the for loop indicates the increment step. suppose the value of height is 20. Then the values for y will be set as 0, 0+4=4, 4+4=8, ... till 20 in subsequent iterations of the for loop.
For a more detailed description of range function check out the python documentation at:
http://docs.python.org/2/library/functions.html#range

A: plus 4 each time you hit the range.
For example,
 for y in range(0, 14, 4)

you will get 0, 4, 8, 12


text: Q: [webdriver][JAVA] Mouse hover over the url adress bar How do i hover my mouse towards the address bar of the browser? Is it even possible? My case is that,after accessing a particular URL, when i again hover the mouse towards the address bar, i will be getting a messenger window opened.


text:
Q: i am trying to login. its work but if there is no internet connection the my apps destroy this is my login activity that i made there is a problem in it if internet connection is available its work properly but if there is no internet connection it shows crashed message please help me to solve this problem
i used Json
public class LoginActivity extends Activity implements OnClickListener{

private EditText etUser,etPassword;
private ImageView bLogin,bCancel,bRegister;
private Spinner spPermission;
private static String[] PERMISSIONS = {"Admin","Donor","Accepter"};

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_layout);

    etUser = (EditText)findViewById(R.id.etUserName);
    etPassword = (EditText)findViewById(R.id.etPassword);
    etUser.setText("");
    etPassword.setText("");

    spPermission = (Spinner)findViewById(R.id.spPermission);

    ArrayAdapter<String> permAdapter  = new ArrayAdapter<String>(LoginActivity.this,android.R.layout.simple_spinner_item,PERMISSIONS);
    permAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spPermission.setAdapter(permAdapter);

    bLogin = (ImageView)findViewById(R.id.imLogin);
    bCancel= (ImageView)findViewById(R.id.imCancel);
    bRegister = (ImageView)findViewById(R.id.imRegister);

    bLogin.setOnClickListener(this);
    bCancel.setOnClickListener(this);
    bRegister.setOnClickListener(this);
}

@Override
public void onClick(View view) {

    switch(view.getId())
    {
    case R.id.imLogin:
        String uName = etUser.getText().toString();
        String password = etPassword.getText().toString();
        String type  = spPermission.getSelectedItem().toString();
        String message = "POST";

        LoginTask task = new LoginTask(this);
        task.execute(message,uName,password,type);

        break;
    case R.id.imCancel:
        finish();
        break;
    case R.id.imRegister:
        startActivity(new Intent(getApplicationContext(), Registration.class));
        break;
    default:
        break;
    }

}

public class LoginTask extends AsyncTask<String, Void, String>{

    private Context context;
    private JSONParser jsonParser = new JSONParser();
    private JSONObject json;
    private String login_url = //"http://192.168.1.3/login.php";
            "http://10.0.2.2/login.php";
    private String s;
    private String USER_TYPE;

    public LoginTask(Context c)
    {
        context  = c;
    }
    @Override
    protected String doInBackground(String... params)
    {

        String message = params[0];
        if(message.equals("POST"))
        {
             List<NameValuePair> list = new ArrayList<NameValuePair>();
             final String uName = params[1];
             final String uPass = params[2];
             final String uType = params[3];
             USER_TYPE = uType;
             list.add(new BasicNameValuePair("username", uName));
             list.add(new BasicNameValuePair("password",uPass));
             list.add(new BasicNameValuePair("type", uType));

             json = jsonParser.makeHttpRequest(login_url, params[0], list);
        }
        try
        {
            s = json.getString("message");
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return s;
    }
    @Override
    protected void onPostExecute(String result)
    {
        try {
            int success = json.getInt("success");
            if(success==1)
            {
                Toast.makeText(context, result, Toast.LENGTH_LONG).show();
                Intent i = new Intent(context.getApplicationContext(),MainView.class);
                i.putExtra("type", USER_TYPE);
                context.startActivity(i);
            }
            else
                //Toast.makeText(context, result, Toast.LENGTH_LONG).show();
                Toast.makeText(context, "Sorry No connection", Toast.LENGTH_LONG).show();

        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

}

A: change youur doInBackground() method to:
@Override
protected String doInBackground(String... params) {

    String message = params[0];
    if (message.equals("POST")) {
        try {
            List<NameValuePair> list = new ArrayList<NameValuePair>();
            final String uName = params[1];
            final String uPass = params[2];
            final String uType = params[3];
            USER_TYPE = uType;
            list.add(new BasicNameValuePair("username", uName));
            list.add(new BasicNameValuePair("password", uPass));
            list.add(new BasicNameValuePair("type", uType));

            json = jsonParser.makeHttpRequest(login_url, params[0], list);
        }

        s = json.getString("message");
    }catch(Exception ex){
        ex.printStackTrace();
    }catch(JSONException e){
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return s;
}

}

A: before calling asyntask check your internet connection as following
place this in some constants class
 public static boolean isConnectingToInternet(){
    ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    if (connectivity != null)
    {
        NetworkInfo[] info = connectivity.getAllNetworkInfo();
        if (info != null)
            for (int i = 0; i < info.length; i++)
                if (info[i].getState() == NetworkInfo.State.CONNECTED)
                {
                    return true;
                }

    }
    return false;
}

and while calling asyntask check connectivity with following
 if(Constants.isConnectingToInternet()) {LoginTask task = new LoginTask(this);
    task.execute(message,uName,password,type);}

It will definitely work.

A: you class will be like
 public class LoginActivity extends Activity implements OnClickListener{

    private EditText etUser,etPassword;
    private ImageView bLogin,bCancel,bRegister;
    private Spinner spPermission;
    private static String[] PERMISSIONS = {"Admin","Donor","Accepter"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_layout);
    Constants.context=this;
        etUser = (EditText)findViewById(R.id.etUserName);
        etPassword = (EditText)findViewById(R.id.etPassword);
        etUser.setText("");
        etPassword.setText("");

        spPermission = (Spinner)findViewById(R.id.spPermission);

        ArrayAdapter<String> permAdapter  = new ArrayAdapter<String>(LoginActivity.this,android.R.layout.simple_spinner_item,PERMISSIONS);
        permAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spPermission.setAdapter(permAdapter);

        bLogin = (ImageView)findViewById(R.id.imLogin);
        bCancel= (ImageView)findViewById(R.id.imCancel);
        bRegister = (ImageView)findViewById(R.id.imRegister);

        bLogin.setOnClickListener(this);
        bCancel.setOnClickListener(this);
        bRegister.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {

        switch(view.getId())
        {
        case R.id.imLogin:
            String uName = etUser.getText().toString();
            String password = etPassword.getText().toString();
            String type  = spPermission.getSelectedItem().toString();
            String message = "POST";
     if(Constants.isConnectingToInternet()) {LoginTask task = new LoginTask(this);
task.execute(message,uName,password,type);}

            break;
        case R.id.imCancel:
            finish();
            break;
        case R.id.imRegister:
            startActivity(new Intent(getApplicationContext(), Registration.class));
            break;
        default:
            break;
        }

    }

    public class LoginTask extends AsyncTask<String, Void, String>{

        private Context context;
        private JSONParser jsonParser = new JSONParser();
        private JSONObject json;
        private String login_url = //"http://192.168.1.3/login.php";
                "http://10.0.2.2/login.php";
        private String s;
        private String USER_TYPE;

        public LoginTask(Context c)
        {
            context  = c;
        }
        @Override
        protected String doInBackground(String... params)
        {

            String message = params[0];
            if(message.equals("POST"))
            {
                 List<NameValuePair> list = new ArrayList<NameValuePair>();
                 final String uName = params[1];
                 final String uPass = params[2];
                 final String uType = params[3];
                 USER_TYPE = uType;
                 list.add(new BasicNameValuePair("username", uName));
                 list.add(new BasicNameValuePair("password",uPass));
                 list.add(new BasicNameValuePair("type", uType));

                 json = jsonParser.makeHttpRequest(login_url, params[0], list);
            }
            try
            {
                s = json.getString("message");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return s;
        }
        @Override
        protected void onPostExecute(String result)
        {
            try {
                int success = json.getInt("success");
                if(success==1)
                {
                    Toast.makeText(context, result, Toast.LENGTH_LONG).show();
                    Intent i = new Intent(context.getApplicationContext(),MainView.class);
                    i.putExtra("type", USER_TYPE);
                    context.startActivity(i);
                }
                else
                    //Toast.makeText(context, result, Toast.LENGTH_LONG).show();
                    Toast.makeText(context, "Sorry No connection", Toast.LENGTH_LONG).show();

            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    }

    }

and your Constants class will be
public class Constants {
    public static final Context context=null;
    public static boolean isConnectingToInternet(){
        ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        if (connectivity != null)
        {
            NetworkInfo[] info = connectivity.getAllNetworkInfo();
            if (info != null)
                for (int i = 0; i < info.length; i++)
                    if (info[i].getState() == NetworkInfo.State.CONNECTED)
                    {
                        return true;
                    }

        }
        return false;
    }
}


text:
Q: how to compress text and image files using hibernate? what mechanisms one can use to compress following ? Since I am using multiple databases I want it to be under the hood like how hibernate handle using Dialects.
 @Lob
 @Type(type = "org.hibernate.type.TextType")
 private String data;

or
@Lob
private byte[] data;

A: LOB which stands for "Large object file" is not neccesary contains text information, so I think mapping it to String field, even with the help of @Type annotation is not the preferred solution, if your DBMS(es) supports CLOB or similar things.
TL;DR I think the second piece of code is way better LOB mapping.


text:
Q: Javascript variable not setting correctly for first time My problem is that my variable flag is not getting updated some how, I have even tried to do that with setTimeout function but no luck!
JavaScript
function confirmed(msg, okFtn, cnclFtn){
    flag=false;
    $(document.createElement('div')).html('\

'+msg+'\

\
            <button value="yes" class="button small gradient blue left rnd5 cnfrm">OK</button>\
            <button value="no" class="button small gradient blue left rnd5 cnfrm">Cancel</button>\

')
        .modal({
            onShow: function (dialog) {
                $('.simplemodal-close').remove();
                $("#simplemodal-container").css({'height': 'auto','width':'auto'});
                $(window).trigger('resize.simplemodal');
            },
            onClose: function(){
                console.log(flag);
                if(flag)
                    return true;
                else
                    return false;
            }
        });
    $('button.cnfrm').click(function(){
        flag=true;
        if ($(this).val() == 'yes') {
            if(okFtn && typeof okFtn === 'function')
                okFtn();
        } else {
            if(cnclFtn && typeof cnclFtn === 'function')
                cnclFtn();
        }
        setTimeout(function(){$.modal.close();}, 1000);
    });
}

This is Fiddle link of what I am saying.
Since variable is not setting up so $.modal.close() is not working fine, what I want is just closing modal dialog if and only if button OK or cancel is clicked.

A: http://www.ericmmartin.com/projects/simplemodal/
From the documentation:
onClose: Useful for adding effects to the closing of the modal dialog elements. After you've applied effects, etc., you'll need to call $.modal.close(); so SimpleModal can re-insert the data correctly and clean up the dialog elements.
You need to include a call to $.modal.close() in your onClose() handler, e.g.
        onClose: function(){
            console.log(flag);
            if(flag) $.modal.close();
        }

ps. As for the flag variable, it's getting set up exactly as you expected it to. It's not the problem.


text:
Q: Insert char into char array C (string) I got the char array "anana" and I am trying to get a "B" into the beginning in the char array so it spells "Banana" but I cannot wrap my head around how to construct a simple while loop to insert the B and then move every letter one step to the right

A: Assuming:
char array[7] = "anana";

Then:
memmove(array+1, array, 6);
array[0] = 'B';

The memmove function is specifically for cases where the data movement involves an overlap.

A: You can use a more traditional approach using...
#include <stdio.h>

int main()
{
  char s[] = "ananas";
  char b[7] = "B";

  for(int i = 0; i < 7; ) {
    char temp = s[i++];
    b[i] = temp;
  }

  printf("%s", b);

  return 0;
}

A: Please follow these steps:

*

*Create a new array of size 7 (Banana + terminator). You may do this dynamically by finding the size of the input string using strlen().

*Place your desired character say 'B' at newArray[0].

*Loop over i=1 -> 7

*Copy values as newArray[i] = oldArray[i-1];


text:
Q: updating records by putting sum(column) value I have table1 like this:
+-----+-----+------+
| cat | val | type |
+-----+-----+------+
| A   | 100 | c1   |
| H   | 25  | c2   |
| H   | 50  | c3   |
| H   | 30  | c2   |
| A   | 15  | c3   |
| H   | 10  | c1   |
| H   | 15  | c1   |
| B   | 10  | c4   |
| H   | 20  | c4   |
| H   | 15  | c3   |
+-----+-----+------+

I need to add the sum(val) group by type to only one H belonging to each type
So I have after grouping by type we have say table2 :
+-----+-----+
| cat | val |
+-----+-----+
| c1  | 125 |
| c2  | 55  |
| c3  | 80  |
| c4  | 30  |
+-----+-----+

I need 125 added to any one H values with type c1, 55 added to any one H values with c2, and so on..If there is no H with c1,then it should create that record.
So finally we get:
    +-----+-----+------+
    | cat | val | type |
    +-----+-----+------+
    | A   | 100 | c1   |
    | H   | 25  | c2   |
    | H   | 130 | c3   |
    | H   | 85  | c2   |
    | A   | 15  | c3   |
    | H   | 135 | c1   |
    | H   | 15  | c1   |
    | B   | 10  | c4   |
    | H   | 50  | c4   |
    | H   | 15  | c3   |
    +-----+-----+------+

How do I do it without doing table1 union table2 (with 'H' as cat) group by type? Also I don't have update privileges and cannot use stored procedures. I also have to keep in mind that table1 is a result of a query involving multiple inner joins that I don't want to use over and over again for select statements.

A: See whether this makes sense. I've added the ID column just to display the final result in the same order as the input (for easier reading).
SQL> -- T1 is what you currently have; it can/could be your current query
SQL> with t1 (id, cat, val, type) as
  2    (select 1, 'A', 100, 'C1' from dual union all
  3     select 2, 'H', 25 , 'C2' from dual union all
  4     select 3, 'H', 50 , 'C3' from dual union all
  5     select 4, 'H', 30 , 'C2' from dual union all
  6     select 5, 'A', 15 , 'C3' from dual union all
  7     select 6, 'H', 10 , 'C1' from dual union all
  8     select 7, 'H', 15 , 'C1' from dual union all
  9     select 8, 'B', 10 , 'C4' from dual union all
 10     select 9, 'H', 20 , 'C4' from dual union all
 11     select 10,'H', 15 , 'C3' from dual
 12    ),
 13  -- sum VAL per type
 14  t1_sum as
 15    (select type, sum(val) sum_val
 16     from t1
 17     group by type
 18    ),
 19  -- find row number; let any H be number 1
 20  t1_rn as
 21    (select id, cat, val, type,
 22       row_number() over (partition by type
 23                          order by case when cat = 'H' then 1 end) rn
 24     from t1
 25    )
 26  -- the final result; add SUM_VAL to the first H row per type
 27  select r.cat, r.val + case when r.rn = 1 then s.sum_val else 0 end val,
 28    r.type
 29  From t1_rn r join t1_sum s on s.type = r.type
 30  order by r.id;

CAT        VAL TYPE
--- ---------- ----
A          100 C1
H           80 C2
H          130 C3
H           30 C2
A           15 C3
H          135 C1
H           15 C1
B           10 C4
H           50 C4
H           15 C3

10 rows selected.

SQL>

[EDIT: trying to clarify how to use your large query]
Suppose that this is that very large and complex query of yours:
select a.cat,
       case when a.cat = 'A' then b.val
            when a.cat = 'Z' then c.val
            else 'H'
       end val,
       c.type
from a join b on a.id = b.id and a.x = b.y
       join c on c.id = b.idx
where a.date_column < sysdate
  and c.type = 'X';

As I've said, create a view based on it as
create or replace view v_view as
select a.cat,
       case when a.cat = 'A' then b.val
            when a.cat = 'Z' then c.val
            else 'H'
       end val,
       c.type
from a join b on a.id = b.id and a.x = b.y
       join c on c.id = b.idx
where a.date_column < sysdate
  and c.type = 'X';

and use it as a source for "my" query (from line 14 onwards):
with t1_sum as
  (select type, sum(val) sum_val
   from v_view                      --> here's the view
   group by type
  ), etc.

Or, use the "huge" query itself as the initial CTE:
with t1 as
-- this is your "huge" query
(select a.cat,
       case when a.cat = 'A' then b.val
            when a.cat = 'Z' then c.val
            else 'H'
       end val,
       c.type
from a join b on a.id = b.id and a.x = b.y
       join c on c.id = b.idx
where a.date_column < sysdate
  and c.type = 'X'
),
-- sum VAL per type
t1_sum as
  (select type, sum(val) sum_val
   from t1
   group by type
  ), etc.


text:
Q: Excel Spreadsheet - How to remove white space characters from text from an entire row? I would like to know how I can format the text for an entire row in Microsoft Excel. I would like to remove white space characters between text from an entire row.
This is what I have right now:

Essentially, this is what I would like to achieve:

My inputs are set as text. If I use the Find and Replace feature, then 0s will be removed only if it is located at the beginning of the input. How can I remove all white spaces using the Find and Replace feature, whilst still keeping 0s at the beginning of the text value?

A: There are two methods you could use:
SUBSTITUTE function
You can use the SUBSTITUTE function to create a new column that replaces all spaces with an empty string, removing all spaces from the text:

Which results in:

Find and replace
If you remove the spaces with Find & Replace, Excel by default removes any leading 0's and interprets the cell as a number.
Setting the number formatting to Text is not sufficient. Instead prepend a single quote to the cell and then use the Find & Replace functionality:

A: Select the Range and right click- Format Cells...- Custom set to: 0000000000- Then Replace all space:


text:
Q: Can I attach to a service and debug it in AndroidStudio? I compile my own AOSP Android images.
In AndroidStudio, is it possible to attach to a service i.e. to the SystemServer process and debug it (similar to gdb's attach)? If it is not possible in AndroidStudio, is there some other native debugger that I can use for the symbolic debugging of a java service?

A: Yes. You can do it.
You could attach to any process by select [Run > Attach Debugger to Android process]

[


text:
Q: Android Studio; Layout; Design view; In Android Studio 3.1.3 on Windows 7 x64 when in design view of XML file I want to drag-and-drop anything, for example, TextView I can't edit it in design view because I can't see it. I see only it:

On video tutorials, everything is ok as always :/
How can I fix it?

A: Well, that looks like you just have your Design in blueprint mode.
Blueprint mode is just showing outlines of your views. This is usefull when having many small / overlapping views. So if you start with an empty layout you won't see much.
If you didn't know about this mode yet, check the button "Select Design Surface (B)" above the blue surface whether it is active? Maybe switching to "design" might help.

However, you can also continue using this. It works exactly as the "design mode". If you add some layout in the Text tab (at the bottom of this view) you should be seeing whether it works or something else is completely wrong.
Try adding some lines like these to your layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

Now you hopefully see whether the blueprint changes. So at least you know whether the designer is broken or just the view. If everything works fine you should see something like this:

The editor is also a bit picky about errors. You didn't provide your XML layout but in case of errors, the designer might have trouble rendering the view.
You can see errors on the top right of this view - a red "!" (exclamation mark).

If you click on it you get more details. For instance if you forgot to set the width or height of a view you get an error message as follows:

If you go anything like this, try solving the errors (next time provide the XML layout if there is any).
Last but not least, be aware that while gradle is building your project the designer is not working. You should getting a message though. However try the usual suspects (invalidate, clear, rebuild, restart AS, ...) if nothing works.

A: Can you see your buttons and other elements when you run your project on emulator? If yes then you probably got same problem as me. By trial and fail I found that the problem is with backwards compatibility. Try to start new project and uncheck backwards compatibility (that option you've got after selecting activity type for your project).
I still can't find a way to fix this and make it work with backwards compatibility enabled. Here is another post on this topic I've found (and either still no answer): android design editor doesn't work with backwards compatibility enabled


text:
Q: Artifact cannot be resolved from gitlab repository - only in pom.xml, while GET works? I created a commons artifact in a gitlab repository.
I can already download the artifact from within a webbrowser:
https://git.my-company.com/api/v4/projects/295/packages/maven/com/example/hello-commons/1.0.0/hello-commons-1.0.0.jar

But when I try letting maven fetch the dependency, I get the following error:

[WARNING] The POM for com.example:hello-commons:jar:1.0.0 is missing,
no dependency information available Downloading from gitlab-maven:
https://git.my-company.com/api/v4/projects/295/packages/maven/com/example/hello-commons/1.0.0/hello-commons-1.0.0.jar

This is my pom.xml, what might be missing?
<repositories>
    <repository>
        <id>gitlab-maven</id>
        <url>https://git.my-company.com/api/v4/projects/295/packages/maven</url>
    </repository>
</repositories>
<distributionManagement>
    <repository>
        <id>gitlab-maven</id>
        <url>https://git.my-company.com/api/v4/projects/295/packages/maven</url>
    </repository>
</distributionManagement>

A: I didn't know that a private token has to be set into ~/.m2/settings.xml as follows:
<settings>
  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Private-Token</name>
            <value>PRIVATE_TOKEN_UUID</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>
</settings>

The token must be of scope read_api.

A: Check in your local m2 repository (C:\Users\YourUserName.m2\repository) If the folder com/example/hello-commons has been created. If the folder created but download failed it won't retry for a while. Try to delete  that folder and run your maven build again


text:
Q: How to properly use the SCAN function in SAS I have two columns in SAS that list data as organized below:
|--------act_route_path --------| Off_At_Loc |-------Misroute_Loc

HOU-FTW-AMA-AQE-FMT  |-----   AMA-----|---------- ?????

I am creating a new column, Misroute_Loc, in which I wish to populate using the Off_At_Loc column. I am attempting to use the SCAN function to accomplish this, but am not having any success. In the above example I want the output into Misroute_Loc to be FTW.
The code I am using looks like the below:
Misroute_Loc=scan(act_route_path,Greater,-4,3);

The greater column is telling me the position in which AMA(Off_At_Loc) begins.
I can get the above code to run, however it is not pulling back FTW as I want it to.

A: Supposing path is a - delimited list of places and you want to extract the place in path before the off place.
data want;

  path = 'HOU-FTW-AMA-AQE-FMT';
  off = 'AMA';

  * find the off place (as a word);
  p = indexw(path, trim(off), '-');

  * scan backwards one word from path part up to the off place;
  if p > 2 then before_off = scan(substr(1,path,p-2), -1, '-');
run;


text:
Q: Alinhar 2 Informações em uma coluna com Table Utilizando *ngFor Então, eu gostaria de alinhar minha tabela,  atualmente ela está vindo assim:

Porém o esperado seria algo como:

no caso, cada parte do objeto em determinada coluna de fila (aparecendo tanto status quanto o nome da fila em 1 Linha, alinhado com a coluna Fila)
eu tenho o seguinte código:
component.html

     {{item.groupName}}

    Status
     {{item.groupStatus}}

    Fila Principal
     {{item.mainQueue}}

    Filas Secundárias
    <ng-container *ngFor="let item of jsonReturn">

             {{subItem.queueName}}
             {{subItem.queueStatus}}

    </ng-container>

component.css
    table {
    border-collapse: collapse;
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    text-indent: initial;
  }

  th {
  font-size: 12px;
  font-weight: 500;
  color: #2196f3;
  border-radius: 4px;
  font-family: Roboto, "Helvetica Neue", sans-serif;
  white-space: nowrap;
  background-color: #e8eaf6;
  }

  th, td {
  padding: 8px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: rgba(0,0,0,.12);
  text-align: center !important;
  min-width: 100px;
  }

  tr:hover {
      background-color: #c5cae9 !important;
  }

Exemplo de Objeto:
    jsonReturn:any = [
    {groupName:"Grupo",groupStatus:"Ativo",mainQueue:"Fila 1",
    queueStatus:[{queueName:"Fila 2",queueStatus:"Aberta"},{queueName:"Fila 3",queueStatus:"Aberta"},{queueName:"Fila 4",queueStatus:"Aberta"}]},

    {groupName:"Grupo 1",groupStatus:"Desativado",mainQueue:"Fila 2",
    queueStatus:[{queueName:"Fila 1",queueStatus:"Fechado"},{queueName:"Fila 3",queueStatus:"Aberta"},{queueName:"Fila 4",queueStatus:"Aberta"}]},

    {groupName:"Grupo 2",groupStatus:"Ativo",mainQueue:"Fila 3",
    queueStatus:[{queueName:"Fila 1",queueStatus:"Aberta"},{queueName:"Fila 2",queueStatus:"Aberta"},{queueName:"Fila 3",queueStatus:"Aberta"}]},

    {groupName:"Grupo 3",groupStatus:"Ativo",mainQueue:"Fila 4",
    queueStatus:[{queueName:"Fila 1",queueStatus:"Aberta"},{queueName:"Fila 2",queueStatus:"Aberta"},{queueName:"Fila 3",queueStatus:"Aberta"}]}
  ]


text:
Q: how to get property out of json response in cypress i have cypress request call returning Json array
 {ids:[one, two, three]}
How can i parse out one of the array values from the body of response and pass it to the next test?

A: Considering the given information I guess what you want is Asserting Network Calls from Cypress Tests.
There is a good example in the cypress-example-recipes
I guess you could do something like
describe('Test', () => {
  let ids;

  it('gets expected response', () => {
    cy.server()
    cy.route('GET', '/url').as('response')
    cy.visit("url")

    // log the request object
    cy.get('@response').then(console.log)

    // confirm the request status
    cy.get('@response').should('have.property', 'status', 200)

    // confirm the request's response
    cy.get('@response').its('response').then((res) => {
      expect(res.body).to.deep.equal({
        "ids": ["one", "two", "three"]
      })

      // store the ids in a variable
      ids = JSON.parse(res.body)?.ids
    })
  })
})


text:
Q: Opening apps on buttons Im trying to open. Google Search on my application. But the problem is. when I click the button. the COMPLETE ACTION USING windows is popping up instead of the google search.. search the net for more than an hour but it seems I cant find the solution.. here is my code..
@Override
public void onClick(View view) {
    Intent intent = new Intent("android.intent.action.MAIN");
    intent.setComponent(ComponentName.unflattenFromString("com.google.android.googlequicksearchbox"));
    intent.addCategory("android.intent.category.LAUNCHER");
    startActivity(intent);

A: This is due to Android's nature to allow users to make their own decisions. If, for instance, they have Bing installed and prefer it as a search engine over Google, they will have the option to select it. As far as I know, there is no way to open a specific app this way. If the user selects Google and makes it the default app for this action, it will auto-open in successive times, but they must make that conscious decision first.

A: have you probably tried to follow this guide..?
It describes well about what you might need..
hope it helps..

A: List<ResolveInfo> resolveInfoList = getPackageManager().queryIntentActivities(intent, 0);
for(int i = 0; i < resolveInfoList.size(); i++) {
    ResolveInfo info = resolveInfoList.get(i);
    if (info.activityInfo.packageName.equals("com.google.android.googlequicksearchbox") {
        // that's the one you want
    }
}

I don't have Eclipse available right now to test it, but this should help you get there. Also check out the documentation for queryIntentActivities()
PS: I'm not sure about that packageName for google search

A: Try this. This code will search the meaning of value of query variable on google.
String url = "http://www.google.com/search?q=" + "Meaning of " +query;
Intent intentSearch = new Intent(Intent.ACTION_VIEW);
intentSearch.setData(Uri.parse(url));
startActivity(intentSearch);


text:
Q: Solve the matrix equation $\varphi(B)=B$ Consider a map
$$ \varphi:A\to \exp\bigg(\frac{A}{\log(B)}\bigg) $$
where $A,B\in {PSL(2,\Bbb Z)},$ (modular group).

Solve $\varphi(B)=B.$

The solution is $A=\log^2(B).$ However make a change of variables and define $A:=\log^2(\mathfrak C)$ for $\mathfrak C$ an infinite set of matrices in the modular group. So $\mathfrak C=\{C_k\}$ for $C_k\in PSL(2,\Bbb Z)$ for $\forall k=1,2,\cdot\cdot\cdot$. This is compact notation. One could also write out the infinite number of equations $-$ one equation for each $C\in\mathfrak C.$ I will write a few out just to be clear:
$$ \varphi_1(B)=\exp\bigg( \frac{\log^2(C_1)}{\log(B)} \bigg)=B$$
$$ \varphi_2(B)=\exp\bigg( \frac{\log^2(C_2)}{\log(B)} \bigg)=B $$
$$... $$
So in compact notation one has:
$$\varphi(B)=\exp\bigg(\frac{\log^2(\frak C)}{\log(B)}\bigg)=B$$

Solve $\varphi(B)=B.$

I've been trying to classify the solution space for hours, but I need to take a break and I thought I'd ask for some hints.

A: More of an extended comment:
We end up with:
$$C_1=B$$
$$C_2=B$$
$$ \cdot\cdot\cdot $$
This is due to manipulating the equations algebraically.
It's interesting to note that there is something of substance here. We have a smoothly varying space of objects, in this case, matrices in the modular group. We could have a different group of objects. The main idea is:
If one varies $B$ via $\varphi(B)$ then we get something like a continuously varying space of objects.


text:
Q: Swift enum with associated values So far I've been using the rawValue to obtain the text according to the case like in this example:
enum Level1: String {
    case question1 = "q1"
    case question2 = "q2"
    case question3 = "q3"
}

print(Level1.question1.rawValue)

But now I would like to have the answers too. I tried to make it work with associated values but I don't know neither how to assign the value to the properties or even if it's possible. For example: questionText = "q1", answerText = "a1".
enum Level2 {
    case question1(questionText: String, answerText: String);
    case question2(questionText: String, answerText: String);
    case question3(questionText: String, answerText: String);
}

A: Enums with associated values cannot be type of string. But they can implement e.g. CustomStringConvertible protocol:
enum ScreenName: CustomStringConvertible {

    case Category(categoryId: String, categoryName: String)
    ...

    var description: String {
        switch (self) {
        case let .Category(_, categoryName):
            return "Category - \(categoryName)"
        ...
        }
    }
}

So then you can call ScreenName.Category(categoryId: "1", categoryName: "products").description and you will get "Category - products"

A: You use the enums with associated values in the following way:
enum Level2 {
    case question1(questionText: String, answerText: String)
    case question2(questionText: String, answerText: String)
    case question3(questionText: String, answerText: String)
}

// initialise
let level = Level2.question2(questionText: "Question", answerText: "Answer")

// read

switch level {
case .question1(let question, let answer):
    print(question + answer)
case .question2(let question, let answer):
    print("something")
case .question3(let question, let answer):
    print("something else")
}

I would suggest to read more here: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html
P.S: I would suggest to rethink if you really need to use enums in your case and not structs.
An example with using structs is:
struct Level {
    let question: String
    let answer: String
}

let levels = [Level]()

But this is another topic. I hope I have answered your question.

A: Associated values are not like RawRepresentable(your first enum) in that its values are assigned at runtime, and can differ for each use. And basically, enums with associated values are not suitable for your needs.
Try this:
struct Challenge {

    let question: String
    let answer: String?
}

struct Level1 {

    static let challenge1 = Challenge(question: "q1", answer: nil)
    static let challenge2 = Challenge(question: "q2", answer: nil)
    static let challenge3 = Challenge(question: "q3", answer: nil)
}

struct Level2 {

    static let challenge1 = Challenge(question: "q1", answer: "a1")
    static let challenge2 = Challenge(question: "q2", answer: "a3")
    static let challenge3 = Challenge(question: "q3", answer: "a3")
}

Later you can retrive them:
let currentChallenge = Level1.challenge2

A: I think I found the answer I was looking for. I'll post below the code I'm going to use applied to the example used. Thanks for your answers.
    enum Level1: String {
    case question1 = "q1";
    case question2 = "q2";
    case question3 = "q3";

    init() {
        self = Level1.question1
    }

    func answer() -> String {
        switch self {
        case .question1:
            return "a1"
        case .question2:
            return "a2"
        case . question3:
            return "a3"
        }
    }
}

var currentLevel: Level1 = Level1();
print(currentLevel.rawValue);  //returns "q1"
print(currentLevel.answer());  //returns "a1"


text:
Q: Is it possible to use a conditional inside where clause in LinQ? I have a simple LinQ query in this way:
myList.Where(x=> x.Property.Property2 == 5);

However, Property could be null and then I get an error. So I would like to know if there is any way to check if it is null, if not null, do the comparation, if it is null, throw an exception.
Because if not, I have to use a foreach to check each element, in this way:
List<MyType> myLstResult = new List<MyType>();
foreach(MyType iterator in myList)
{
    if(iterator.Property == null)
    {
        throw new ArgumentNullException();
    }
    if(iterator.Property.Property2 == 5)
    {
        myLstresult.Add(iterator);
    }
}

Thanks.

A: Yes you can extend the lambda just like that:
myList.Where(x=>
    {
        if (x.Property == null)
            throw new ArgumentNullException();
        return x.Property.Property2 == 5;
    });

This will of course only work in "normal" linq. Linq-to-sql or -entity query providers will probably not be able to translate that to sql.

A: I would avoid the exception instead.
You could either use the new C#6 null propagation operator:
myList.Where(x=> x.Property?.Property2 == 5);

or this simple approach:
 myList.Where(x=> x.Property != null && x.Property.Property2 == 5);

However, if you really want to throw an exception i would use  a plain  loop which is also easier to debug. This is recommended since LINQ queries should not cause side effects or throw exceptions:
https://msdn.microsoft.com/en-us/library/bb513730.aspx

However, we recommend that you avoid calling any method in a query
  expression that can create a side effect such as modifying the
  contents of the data source or throwing an exception

So either the foreach loop that you've already shown(my favourite) or a try-catch:
List<MyType> myLstResult = null;
try
{
    myLstResult = myList.Where(x=> x.Property.Property2 == 5).ToList();
}
catch(NullReferenceException nullref)
{
    throw new ArgumentNullException("MyType.Property must not be null", nullref);
}
// ...

Rene has shown another approach which i would not recommend to throw an exception. This can't be translated from LINQ providers like Linq-To-Sql or Linq-To-Entities and violates the aforementioned guidelines.
Update: maybe a ThrowIfArgumentNull extension method like this comes in handy:
public static IEnumerable<TSource> ThrowIfArgumentNull<TSource, TNullable>(this IEnumerable<TSource> enumeration, Func<TSource, TNullable> mightBeNullSelector, string argumentName)
    where TNullable : class
{
    foreach (TSource item in enumeration)
    {
        if (mightBeNullSelector(item) == null)
            throw new ArgumentNullException(argumentName);
        yield return item;
    }
}

You would use it in this way:
List<MyType> myLstresult = myList
    .ThrowIfArgumentNull(x => x.Property, "MyType.Property")
    .Where(x => x.Property.Property2 == 5)
    .ToList();


text:
Q: How to depricated Fix import { Plugins } from '@capacitor/core'; Does anyone know what is the fix for the decricated import of ionic Plugins?
I'm following a tutorial and I cant proceed until I fix it..
i used plugin

npm install capacitor-face-id
Enter link description here

import { Plugins, PluginResultError } from '@capacitor/core';
const { FaceId } = Plugins;

Many thanks

A: I assume you are using Capacitor 3.
This plugin seems to be compatible only with Capacitor 2 (see issue #181).
In Capacitor 2 this import type is used.


text:
Q: How do I avoid Compton drawing shadows on the Gnome-Do window? Compton can draw shadows under windows, which is nice, but unfortunately it draws shadows under the Gnome-Do window, which ends up like this:

Is it possible to keep that from happening?

A: *

*Add it to shadow-exclude array:
# Shadow
...
shadow-exclude = [ "class_g = 'Do'" ];

in
/home/<user>/.config/compton.conf

*Or specify it with compton launch command. Example:
compton -c --shadow-exclude 'class_g = "Do"'

Reference: man compton


text:
Q: Как опуститься в массив на два индекса вперед при проверки вхождения у меня есть список, к примеру это string[] zoo = {"Козел", "Овца","Осёл", "Лев", "Жираф"}  у меня есть проверка на то, входит ли переменная string animal = "Овца" в список. if(zoo.Contains(animal)){ // что то делать}, но мне нужно, чтобы когда такой находился, я бы опускался вниз по массиву. т.е когда овца есть в списке, я хочу получить льва, когда козел - осла.

A: Как пример
string[] zoo = {"Козел", "Овца","Осёл", "Лев", "Жираф"};
for(int i=0; i<zoo.Length-2; i++)
    if (zoo[i] == "Овца") Console.WriteLine(zoo[i+2]);

Вывод
Лев


text:
Q: Página em wordpress está sendo redirecionada para o site "oficial do wordpress" Realizei o backup de um site em wordpress para rodar localmente e realizar alguns testes, porém toda vez que clico em visitar o site no menu superior sou redirecionado para o site oficial (live).
Já realizei o update da coluna option_value na tabela wp_options, e até defini as constantes no wp-config.
define("WP_SITEURL","http://meubackup.dev");
define("WP_HOME","http://meubackup.dev");

E ainda continuo sendo redirecionado para o site em produção.

A: No painel do Wordpress vá até a aba Configurações -> Geral e insira o link correto