text:
Q: matlab: using a vector of unknowns in fsolve I need to solve a system of nonlinear equations; in order to use fsolve , I have written an m-file containing my function "myfun". This function is called by the main m-file.
Both the system and the unknowns must be written using a "for" loop.
Example:
function F=myfun(x)
n=20;`
for j=1:n
    c1=sqrt(x(j)^2-3*x(j));
    c2=x(j)^(1/2);
F(j)=c1+c2;
end

My problem is that I have to preallocate memory for my vectors, both F and x, otherwise the solver considers numel(x)=1.
But if I declare
F=zeros(n,1);
x=zeros(n,1);

I have the following output:
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.

Any suggestions? Thanks

A: You don't need the loop, just use
F = sqrt(x.^2-3*x) + x.^(1/2);

Then you also don't need to declare n, c1, c2.
Your error message also doens't sound like it's a problem with the allocation, but more with finding a solution to you fsolve problem.


text:
Q: vue firebase error in my code "Uncaught ReferenceError: StudentsStatus is not defined" I have an array StudentsStatus defined in the data section in my vue component. StudentsStatus : [].
Based on user action I fill this array with data returned from API request.
Then I set a ref to a node in firebase, if the child changed i want to updated the same row in the array with the updated data. Below is my code.
axios.get('http://'+ server.IP + ':' + server.port + '/assigned/' + routeid + '/' + ampm).then((data) => {
    for (var i=0; i < data.data.length ; i++) {
        //  console.log(data.data[i])
        this.StudentsStatus.push(data.data[i])
    }

    axios.get('http://'+ server.IP + ':' + server.port + '/getrouteinfo/' + routeid).then((routeInfo) => {
        this.routeinfo.Device = routeInfo.data[0].Device
        DB.ref('/studentroute/'+ this.routeinfo.Device +'/'+ this.routeinfo.ampm + '/').on("child_changed",
            function(snapshot) {
                let StudentCHK = snapshot.val();
                let myindex = StudentCHK.serial - 1

                console.log(myindex)
                console.log(this.StudentsStatus)
            });
    },

Regardless of the closing brackets, I receive the above error stating that This.StudentsStatus is not defined !!!
What I am doing wrong?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Setting Up Developed Java Project in Eclipse I am trying to set up some project in Eclipse which is already developed and has following file structure.

I know how to setup things in Eclipse and how to run it with Apache Tomcat but when I restart Tomcat it tries to build the web app with tons of errors. The errors are like failed to load libraries (.JAR) and the like. Let me tell you the project is loaded and set in Eclipse perfectly without any single Error. There are many packages in the project as well as JSP files. Why this is not working with Tomcat?

A: Ok, you have to set the build path of your project, that is right button click over the project, then build path. That build path must point to your java libraries, or almost every line of the project will be an error.

A: Get the original WAR file or if there is none, just zip the whole content in a single file which you rename with .war extension. Finally, if you have Eclipse for Java EE version, you can just do File > Import > WAR and select the file. Eclipse will automatically create a new Dynamic Web Project based on the WAR. If you have standard Eclipse version for Java (non-EE), then you need to upgrade Eclispe first.
However, if the WAR doesn't contain source code (the .java files) of the Java classes (the .class files) present in /WEB-INF/classes, then you'll need to decompile them with some Java decompiler like JD and then create the package structure with those decompiled classes in the project's source folder yourself.
As to the exceptions/errors you get when running it locally, you just need to fix them one by one, starting with the firstmost one. More than often some if not all of the subsequent errors will just disppear. If you fail in understanding the first exception/error, just press Ask Question on the right top here.


text:
Q: How to use messenger ipc protocol over SPP Bluetooth connection within Android? How do you use Android Messengers (IPC) when communicating over Bluetooth?
Is there some kind of specification for Android IPC using Messengers over a SPP Bluetooth connection between two smartphones running the same App?
I am not so fond of reinventing the wheel myself and drawing conclusions afterwards about my own design mistakes :)

A:
How do you use Android Messengers (IPC) when communicating over Bluetooth?

You don't.

Is there some kind of specification for Android IPC using Messengers over a SPP Bluetooth connection between two smartphones running the same App?

No, sorry. Messenger is specifically designed, along with the rest of the Binder framework, for communications within a device, not between devices.


text:
Q: ERROR:flutter/runtime/dart_vm_initializer.cc(41) Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index' for json file ,flutter I'm trying to get two int from JSON file
This is the api response
[
    {
        "New_V": 30,
        "Old_V": 29
    }
]

When I use jsonDecode to get these two int I get an error in the tagged code
I keep getting

Unhandled Exception: type 'String' is not a subtype of type 'int' of
'index'

on the code line

newV = vData['New_V'].toInt();

this is my code
isTheirUpdate() async {
   var vData;
   try {
     Response response =
         await get(Uri.parse('https://0000000000000/check_v.json'));
     if (response.statusCode == 200) {
       vData = jsonDecode(response.body);
       print(vData);
       int newV;
       int oldV;
       setState(() {
         newV = vData['New_V'].toInt(); /////////// I get error here "type 'String' is not a subtype of type 'int' of 'index'"
         oldV = vData['Old_V'].toInt();
       });
       if (newV == KCheckAppVersion) {
         isTheirInternet;
       } else if (oldV == KCheckAppVersion) {
         showDialog()
       } else {
         showDialog()
       }
     }
   } on SocketException catch (_) {}
 }

There is something I miss but I don't know what it is
Can someone explain the reason and a fix for this line of code?
Thanks

A: Your variable are string and you can't use toInt() on string, try this way to parse to int:
newV = int.parse(vData[0]['New_V'].toString());
oldV = int.parse(vData[0]['Old_V'].toString());

also you are getting list of map not a single map so vData is list of map and you need to use it like this:
if((vData as List).isNotEmpty){
   setState(() {
      newV = int.parse(vData[0]['New_V'].toString());
      oldV = int.parse(vData[0]['Old_V'].toString());
   });
}


text:
Q: How to implement EVERY and NO operations for a joined 'list' table I have two tables Person and _Person_Name which contains a column Name and a column Owner with Person.Id as foreign key. I'm looking for two search operations I'd call EVERY and NO.
1.) Every
The following returns only the Person IDs for which all corresponding names match for query LIKE '%n%':
SELECT Person.Id as Result FROM Person
INNER JOIN _Person_Name AS __T1 ON Person.Id = __T1.Owner
WHERE __T1.Name LIKE '%n%'
GROUP BY Result
HAVING Count(Result)=(Select Count(*) FROM _Person_Name
  WHERE Person.Id=_Person_Name.Owner)

But the problem is that I also have to deal with other queries for which just a single match suffices, and the HAVING clause applies to all terms in the WHERE clause.
Is there a way to get the same effect as in the HAVING clause in the above query, but somehow express this within the WHERE clause such that other, ordinary conditions can be added to it?
Example:
SELECT Person.Id as Result FROM Person
INNER JOIN _Person_Name AS __T1 ON Person.Id = __T1.Owner
WHERE (EVERY __T1.Name LIKE '%n%')
OR (__T1.Name LIKE 'John')

The second disjunct should just behave in the ordinary way without any restrictions. Now I'm looking for a way to express EVERY like in the above HAVING clause. The query should return __T1.Owner (=Person.Id) whenever it is the case that one field with matching owner has a name field __T1.Name LIKE 'John' or it is the case that all __T1.Name fields with matching owner contain an 'n'.
If it is not possible to express this in the WHERE clause, how can it be expressed?
2.) No
The NO search operation is just like EVERY but the base condition is negated, i.e., I'm looking for the Persons for which none of their associated Name parts matches the query. I suppose I can get that easily if I have a solution for EVERY.

A: Let me start with an idea for NO: you can check if no row exists if you look up by condition LIKE '%n%'. You can do it in the WHERE clause with EXISTS subquery:

WHERE
    NOT EXISTS (
        SELECT 1 FROM _Person_Name AS __T2 WHERE Person.Id = __T2.Owner
        and __T2.Name LIKE '%n%'
        )
OR (__T1.Name LIKE 'John')

NOT EXISTS checks if there is NO match.
Based on this the implementation for EVERY is to see if the negation of your condition for no row is true, so you are looking for NOT LIKE '%n%':

WHERE
    NOT EXISTS (
        SELECT 1 FROM _Person_Name AS __T2 WHERE Person.Id = __T2.Owner
        and __T2.Name NOT LIKE '%n%'
        )
OR (__T1.Name LIKE 'John')

This time NOT EXISTS will make sure no rows found that does NOT match your criteria - therefore EVERY row matched it.


text:
Q: Multithreading Socket communication Client/Server I finished writing a Client/Server Socket communication program that works fine.  Now I'm trying to figure out how to make it so that I can have multiple Client connections to the Server at once.  I've looked around and there seems to be more than a couple of different ways to do this. so I've come here to ask you guys for help/suggestions.
My Server:
public class Server {
    private ServerSocket serverSocket = null;
    private Socket clientSocket = null;

    public Server() {
        try {
            serverSocket = new ServerSocket(7003);
        } catch (IOException e) {
            System.err.println("Could not listen on port: 7003");
            System.exit(1);
        }

        try {
            clientSocket = serverSocket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed");
            System.exit(1);
        }
    }

    public void startServer() throws IOException {
        PrintWriter output = new PrintWriter(clientSocket.getOutputStream(), true);
        BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

        String inputLine, outputLine;

        outputLine = "Connected to Server";
        output.println(outputLine);

        while ((inputLine = input.readLine()) != null) {
            // This just determines users input and server ruturns output based on that

            outputLine = this.getServerOutput(inputLine);
            output.println(outputLine);

            if (outputLine.equals("Bye"))
                break;
        }

        output.close();
        input.close();
        clientSocket.close();
        serverSocket.close();
    }
}

Would I need to make my constructor create threads and startServer() or would be my run method?

A:
how to make it so that I can have multiple Client connections to the Server at once

Right now you are starting your server and immediately waiting for a single client to connect in the constructor.
clientSocket = serverSocket.accept();

Then you handle that single socket connection inside of your startServer() method.  This means that no other clients will be handled.
public void startServer() throws IOException {
    PrintWriter output = new PrintWriter(clientSocket.getOutputStream(), true);
    ...

Typically with a server pattern like this, you would do something like the following:

*

*Setup your server socket in the constructor.

*Create an acceptClients() method which would loop waiting for a client to be accepted.  This could fork a thread to accept the clients in a thread of its own in the background.

*For each client, either fork a thread to handle the connection, passing the thread the clients socket.  Better would be to, as @basiljames shows, use an ExecutorService to manage the threads for you.

Here's some sample code:
public class Server {
    private ServerSocket serverSocket = null;

    public Server(int portNumber) throws IOException {
        serverSocket = new ServerSocket(portNumber);
    }

    // this could be run in a thread in the background
    public void acceptClients() throws IOException {
        // create an open ended thread-pool
        ExecutorService threadPool = Executors.newCachedThreadPool();
        try {
            while (!Thread.currentThread().isInterrupted()) {
                // wait for a client to connect
                Socket clientSocket = serverSocket.accept();
                // create a new client handler object for that socket,
                // and fork it in a background thread
                threadPool.submit(new ClientHandler(clientSocket));
            }
        } finally {
            // we _have_ to shutdown the thread-pool when we are done
            threadPool.shutdown();
        }
    }

    // if server is running in background, you stop it by killing the socket
    public void stop() throws IOException {
        serverSocket.close();
    }

    // this class handles each client connection
    private static class ClientHandler implements Runnable {
        private final Socket clientSocket;
        public ClientHandler(Socket clientSocket) {
            this.clientSocket = clientSocket;
        }
        public void run() {
            // use the client socket to handle the client connection
            ...
        }
    }
}

Using the ExecutorService thread-pools is recommended for just about all Thread implementations like this.  If, however, you are stuck to using raw Thread for some reason, you can do the following instead in your acceptClients() method:
    public void acceptClients() throws IOException {
        while (!Thread.currentThread().isInterrupted()) {
            // wait for a client to connect
            Socket clientSocket = serverSocket.accept();
            // fork a background client thread
            new Thread(new ClientHandler(clientSocket)).start();
        }
    }

A: Change this: public void startServer() throws IOException
To this: public void startServer(Socket clientSocket) throws IOException
Then all you need to do is:
public Server()
{
    try
    {
        serverSocket = new ServerSocket(7003);
    }
    catch (IOException e)
    {
        System.err.println("Could not listen on port: 7003");
        System.exit(1);
    }

    try
    {
        while(true) {
            final Socket socket = serverSocket.accept();
            new Thread(new Runnable() {
                public void run() {
                    try {
                        startServer(socket);
                    } catch(IOException e) {e.printStackTrace();}
                }
            }).start();
        }
    }
    catch(IOException e)
    {
        System.err.println("Accept failed");
        System.exit(1);
    }
}

And lastly, you can remove private Socket clientSocket = null;
That should get you there. Or at least pretty close.

A: You should use ExecutorService. Your client request processing would be the run() of a Runnable and after each accept you can call ExecutorService.submit(runnableTask) to asynchronously service the client.
A sample using ExecutorService.
public class MyServer {

    private static MyServer server;
    private ServerSocket serverSocket;

    /**
     * This executor service has 10 threads.
     * So it means your server can process max 10 concurrent requests.
     */
    private ExecutorService executorService = Executors.newFixedThreadPool(10);

    public static void main(String[] args) throws IOException {
        server = new MyServer();
        server.runServer();
    }

    private void runServer() {
        int serverPort = 8085;
        try {
            System.out.println("Starting Server");
            serverSocket = new ServerSocket(serverPort);

            while(true) {
                System.out.println("Waiting for request");
                try {
                    Socket s = serverSocket.accept();
                    System.out.println("Processing request");
                    executorService.submit(new ServiceRequest(s));
                } catch(IOException ioe) {
                    System.out.println("Error accepting connection");
                    ioe.printStackTrace();
                }
            }
        }catch(IOException e) {
            System.out.println("Error starting Server on "+serverPort);
            e.printStackTrace();
        }
    }

    //Call the method when you want to stop your server
    private void stopServer() {
        //Stop the executor service.
        executorService.shutdownNow();
        try {
            //Stop accepting requests.
            serverSocket.close();
        } catch (IOException e) {
            System.out.println("Error in server shutdown");
            e.printStackTrace();
        }
        System.exit(0);
    }

    class ServiceRequest implements Runnable {

        private Socket socket;

        public ServiceRequest(Socket connection) {
            this.socket = connection;
        }

        public void run() {

            //Do your logic here. You have the `socket` available to read/write data.

            //Make sure to close
            try {
                socket.close();
            }catch(IOException ioe) {
                System.out.println("Error closing client connection");
            }
        }
    }
}

A: private static final int SERVER_PORT = 35706;
private ServerSocket serverSocket;
private final ArrayList<ClientThread> activeClients = new ArrayList<>();

public void startServer() {

    try {
        serverSocket = new ServerSocket(SERVER_PORT);

        final ExecutorService clientPool = Executors.newCachedThreadPool();

        while (!serverSocket.isClosed()) {

            try {
                Future<Socket> future = clientPool.submit(() -> {
                       Socket socket = serverSocket.accept();
                       ClientThread clientThread= new ClientThread(socket);
                       return (socket);
                });

                activeClients.add(future.get());
            } catch (IOException e) {
                clientPool.shutdownNow();
                System.out.println(e.getMessage());
            } catch (InterruptedException | ExecutionException e) {
                System.out.println(e.getMessage());
            }
        }

    } catch (IOException e) {
        System.out.println(e.getMessage());
    }
}

public void stopServer() {

   try {
        serverSocket.close();
        activeClients.forEach(socket -> {
            try {
                socket.close();
            } catch (IOException e) {
                System.out.println(e.getMessage());
            }
        });

   } catch (IOException ex) {
        System.out.println(e.getMessage());
   }

}

private static class ClientThread implements Runnable{
    private final Socket socket;

    public ClientThread(Socket socket) throws IOException {
       this.socket = socket;
    }

    @Override
    public void run() {
        /* Your implementation */
    }
}


text:
Q: CSS - Centering text content in flexbox I'm still trying to wrap my brain around html and css, it's quite confusing. Right now I'm just messing about. Following a tutorial I created a cool navagation page. However, on my own, I'm trying to just create a simple cool heading using ::before and ::after. I can't get the text elements in the ::before or ::after styling of the h1 tag on my header to center.
CSS:
/* ::Before Heading */
.flex-container-heading h1::before{
    content: "This is a very cool";

    /* General */
    background: red;

    /* Sizing */
    height: 10%;
    width: 100%;

    /* Text */
    color: white;
    font-size: 30;
    font-weight: 900;
}

/* Heading */
.flex-container-heading h1{
    /* General */
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Text */
    color: white;
    font-size: 40;
    font-weight: 900;

}

/* ::After Heading */
.flex-container-heading h1::after{
    content: "Isn't it aye?";

    /* General */
    background: red;

    /* Sizing */
    height: 10%;
    width: 100%;

    /* Text */
    color: white;
    font-size: 30;
    font-weight: 900;
}

Here's what it looks like vv

I'm trying to center the text in the red lines

A: Just add this:
   text-align:center;

For example:
    .flex-container-heading h1{
    /* General */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Text */
    color: white;
    font-size: 40;
    font-weight: 900;
    text-align:center;
}


text:
Q: cURL not working (Error #77) for SSL connections on CentOS for non-root users Just recently my server has stopped working for curl requests to https:// addresses for my web server.  Having dug around a little it appears that it's a problem with the user the webserver is running.
If I SSH onto the server as root & call
curl -I -v https://google.com

... I get the following response...
* About to connect() to google.com port 443 (#0)
*   Trying 173.194.67.113... connected
* Connected to google.com (173.194.67.113) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using SSL_RSA_WITH_RC4_128_SHA
* Server certificate:
*       subject: CN=*.google.com,O=Google Inc,L=Mountain View,ST=California,C=US
*       start date: May 22 15:50:20 2013 GMT
*       expire date: Oct 31 23:59:59 2013 GMT
*       common name: *.google.com
*       issuer: CN=Google Internet Authority,O=Google Inc,C=US
> HEAD / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: google.com
> Accept: */*

However, if I log in as any of the cPanel accounts (also used when running via the web server) I get the following...
* About to connect() to google.com port 443 (#0)
*   Trying 173.194.67.101... connected
* Connected to google.com (173.194.67.101) port 443 (#0)
* Initializing NSS with certpath: none
* NSS error -5978
* Closing connection #0
* Problem with the SSL CA cert (path? access rights?)
curl: (77) Problem with the SSL CA cert (path? access rights?)

I've not been able to find a definitive answer to the problem, & my hosting company are refusing to help as it's "Out of support" even though it was working fine last week!
I did find mention on http://curl.haxx.se/docs/sslcerts.html that

"If libcurl was built with NSS support, then depending on the OS distribution,
  it is probably required to take some additional steps to use the system-wide CA
  cert db. RedHat ships with an additional module, libnsspem.so, which enables
  NSS to read the OpenSSL PEM CA bundle. This library is missing in OpenSuSE, and
  without it, NSS can only work with its own internal formats. NSS also has a new
  database format: https://wiki.mozilla.org/NSS_Shared_DB"

... but I can find no information on how I get this working system-wide on my CentOS server.
Info
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

Can anyone shed some light on why this might have suddenly changed, or better still how to fix it?
Thanks

A: For Ubuntu:
sudo apt-get install ca-certificates

Hit this problem trying to curl things as ROOT inside of Dockerfile

A: Turns out that the problem was with face that the script was running from a cPanel "email piped to script", so was running as the user, so is was a user problem, but was not affecting the web server at all.
The cause for the user not being able to access the /etc/pki directory was due to them only having jailed ssh access.  Once I granted full access, it all worked fine.
Thanks for the info though, Remi.

A: I had the same issue on CentOS-7.
It's worked good on me.
Creating empty file.
touch /etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned

There was a curl bug in the distribution image of CentOS-7.
https://bugs.centos.org/view.php?id=16282

A: I just had a similar problem with Error#77 on CentOS7.  I was missing the softlink /etc/pki/tls/certs/ca-bundle.crt that is installed with the ca-certificates RPM.
'curl' was attempting to open this path to get the Certificate Authorities.
I discovered with:
strace curl https://example.com

and saw clearly that the open failed on that link.
My fix was:
yum reinstall ca-certificates

That should setup everything again.  If you have private CAs for Corporate or self-signed use make sure they are in /etc/pki/ca-trust/source/anchors so that they are re-added.

A: Check that you have the correct rights set on CA certificates bundle.
Usually, that means read access for everyone to CA files in the /etc/ssl/certs directory, for instance /etc/ssl/certs/ca-certificates.crt.
You can see what files have been configured for you curl version with the curl-config --configure command :

$ curl-config --configure
 '--prefix=/usr'
 '--mandir=/usr/share/man'
 '--disable-dependency-tracking'
 '--disable-ldap'
 '--disable-ldaps'
 '--enable-ipv6'
 '--enable-manual'
 '--enable-versioned-symbols'
 '--enable-threaded-resolver'
 '--without-libidn'
 '--with-random=/dev/urandom'
 '--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2'

Here you need read access to /etc/ssl/certs/ca-certificates.crt
$ curl-config --configure
 '--build' 'i486-linux-gnu'
 '--prefix=/usr'
 '--mandir=/usr/share/man'
 '--disable-dependency-tracking'
 '--enable-ipv6'
 '--with-lber-lib=lber'
 '--enable-manual'
 '--enable-versioned-symbols'
 '--with-gssapi=/usr'
 '--with-ca-path=/etc/ssl/certs'
 'build_alias=i486-linux-gnu'
 'CFLAGS=-g -O2'
 'LDFLAGS='
 'CPPFLAGS='

And the same here.

A: If you recently reached here as I did when searching for the same error in vain you may find it to be an update to NSS causing failure on CentOS. Test by running yum update and see if you get errors, curl also creates this error. Solution is simple enough just install NSS manually.
Read on...
If you're like me it threw up an error similar to this:
curl: (77) Problem with the SSL CA cert (path? access rights?)

This took some time to solve but found that it wasn't the CA cert because by recreating them and checking all the configuration I had ruled it out. It could have been libcurl so I went in search of updates.
As mentioned I recreated CA certs. You can do this also but it may be a waste of time. http://wiki.centos.org/HowTos/Https
The next step (probably should of been my first) was to check that everything was up-to-date by simply running yum.
$ yum update
$ yum upgrade

This gave me an affirmative answer that there was a bigger problem at play:
Downloading Packages:
error: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
Problem opening package nss-softokn-freebl-3.14.3–19.el6_6.x86_64.rpm
I started reading about Certificate Verification with NSS and how this new update may be related to my problems.
So yum is broken. This is because nss-softokn-* needs nss-softokn-freebl-* need each other to function. The problem is they don't check each others version for compatibility and in some cases it ends up breaking yum.
Lets go fix things:
$ wget http://mirrors.linode.com/centos/6.6/updates/x86_64/Packages/nsssoftokn-freebl-3.14.3-19.el6_6.x86_64.rpm
$ rpm -Uvh nss-softokn-freebl-3.14.3–19.el6_6.x86_64.rpm
$ yum update

You should of course download from your nearest mirror and check for the correct version / OS etc. We basically download and install the update from the rpm to fix yum. As @grumpysysadmin pointed out you can shorten the commands down. @cwgtex contributed that you should install the upgrade using the RPM command making the process even simplier.
To fix things with wordpress you need to restart your http server.
$ service httpd restart

Try again and success!

A: I had faced same issue whenever I tried executing curl on my https server.
About to connect() to localhost port 443 (#0)
Trying ::1...
Connected to localhost (::1) port 443 (#0)
Initializing NSS with certpath: sql:/etc/pki/nssdb

Observed this issue when I configured keystore path incorrectly. After correcting keystore path it worked.

A: The error is due to corrupt or missing SSL chain certificate files in the PKI directory.
You'll need to make sure the files ca-bundle, following steps:
In your console/terminal:
mkdir /usr/src/ca-certificates && cd /usr/src/ca-certificates

Enter this site: https://rpmfind.net/linux/rpm2html/search.php?query=ca-certificates , get your ca-certificate, for yout SO, for example:
ftp://rpmfind.net/linux/fedora/linux/updates/24/x86_64/c/ca-certificates-2016.2.8-1.0.fc24.noarch.rpm  << CentOS. Copy url of download and paste in url:
    wget your_url_donwload_ca-ceritificated.rpm
now, install yout rpm:
rpm2cpio your_url_donwload_ca-ceritificated.rpm | cpio -idmv

now restart your service:
my example this command:
sudo service2 httpd restart

very great
good look

A: Please check the permissions on the the ca certificates installed on server.

A: for me it's fixed by the hint of @DavidG above. And practically i run:
ln -s /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/tls/certs/ca-bundle.crt

Fixed after that!

A: Windows users, add this to PHP.ini:
curl.cainfo = "C:/cacert.pem";

Path needs to be changed to your own and you can download cacert.pem from a google search
(yes I know its a CentOS question)


text:
Q: Flutter 2: maxLength inside the textfield without using onChanged I am trying to find a way to use maxLength and put it inside of the textfield to have a nice rendering. However, I don't want to use the onChanged parameter because I would have to use a setState, but this not the good way to use it.
The parameter maxLength from the flutter's textfield is designed to do not update the state, so that every statefull widgets don't have to rebuild.
So I would like to put the 0/50 inside, at the end of the textfield, on the same line as Title.
From this :

To this :

So somebody have an idea of how to do it without using the parameter onChanged ?
Does flutter has implemented this functionality ?

A: Try with this, hope you get a solution.
TextField(
  maxLength: 250,
  buildCounter: (_, {currentLength, maxLength, isFocused}) => Padding(
    padding: const EdgeInsets.only(left: 16.0),
    child: Container(
        alignment: Alignment.centerLeft,
        child: Text(currentLength.toString() + "/" + maxLength.toString())),
  ),
)

Also, Try with this,
  TextField(
          controller: nameController,
              maxLength: 60,
               prefixIcon: Icon(
                Icons.account_circle,
                color: Colors.black45,
              ),

          ),


text:
Q: Is anyone having problems with bundle install after installing el capitan? When I type bundle install, it gives me this error:

-bash: bundle: command not found

So I tried gem install bundler -v 1.9.7, and got this error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
      You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

A: Try using sudo:
sudo gem install bundler -v 1.9.7

Make sure you're using a new version of ruby, instead of the one that comeswith Mac OS X. You can install a new one with RVM:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby


text:
Q: ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"demographic_detail", :id=>nil} I'm new to programming and sorry if this is a stupid question. I'm writing a test for controllers in Ruby on Rails. The test is expecting a parameter but I'm not sure how to do that. When I run the test with rspec  I get the error you see in the title.
This is PART of the controller's code:
class DemographicDetailController < ApplicationController

  #before_filter :authorize
  include ::Demographic

  def show

  @cinema_id = params[:cinema_id]
  @cinema = Cinema.find(@cinema_id)
  @cinema_name = @cinema.name
  @cinmea_address = @cinema.address.full_street_address
  @cinema_authority_id = @cinema.address.post_code.local_authority_id
  @c_working_age = Population.where(:local_authority_id =>  @cinema_authority_id , :year => Population.maximum("year")).first
  @c_working_age = @c_working_age.working_age_16_to_64

  @c_total_population = totalpopulation(@cinema_authority_id)
  @c_average_income = latestaverageincome(@cinema_authority_id)

  @all_cinemas = Cinema.all

  (...)

  end

and this is the test I wrote for show method:
describe "Demographic" do
  context "when testing the DemographicDetail controller" do
      #let(:params) { { disabled: false } }
      let(:cinema_id) { create(:cinema) }

it "should show demoraphic details successfully" do

  get :show, params: { id: @cinema_id }
  assert_response :success

     end

end

This is the route:
   controller :demographic_detail do
    get '/demographic_detail/show/:cinema_id' => :show
  end

A: Try this
modify the route as
get '/demographic_detail/show' => 'demographic_detail#show'

A: Try this:
get '/demographic_details/:cinema_id' => 'demographic_detail#show'

or
controller :demographic_detail do
    get '/demographic_detail/:cinema_id' => :show
end


text:
Q: Getting the index # of a TCollection Item when added to a TCollection I know that when I add a collection item to a collection, the index is zero-based.  I would like to make it one-based and show the value in a property called Id. Can someone tell me how I can go about this in code?
TCVSClassItem = class(TCollectionItem)
private
 fId: Integer;
 function GetId: Integer;
public
published
 property Id: Integer read GetId;
end;

function TCVSClassItem.GetId: Integer;
begin
 result:=  ????
end;

A: result := Index+1 should do it if I understand correctly your needs


text:
Q: Android R8 compilation - multiple warnings I am using R8 version r8-3.3.28.jar for building android application and getting bunch of warnings which I cannot understand.
Can anyone help here?
Invalid stack map table at 29: tableswitch
0: L?
1: L?
default: L?, error: Source locals {0:Initialized(RL.otbgvycijjopvme.ojojoo),1:Initialized(java.lang.String),2:Initialized(int),3:Initialized(int),4:Initialized(int[]),5:Initialized(RL.otbgvycijjopvme.oooojo),6:Initialized(int)} have different local indices than {0:Initialized(otbgvycijjopvme.ojojoo),1:Initialized(java.lang.String),2:Initialized(int),3:Initialized(L.otbgvycijjopvme.oooojo),4:top,5:Initialized(int),6:Initialized(int[]),7:Initialized(int)}.
Warning in .aar:classes.jar:otbgvycijjopvme/jojojo.class at L/otbgvycijjopvme/jojojo;bf0066ffff(Ljava/lang/String;CC)Ljava/lang/String;:
Invalid stack map table at 5: goto L?, error: Source locals {0:Initialized(otbgvycijjopvme.jojojo),1:Initialized(java.lang.String),2:Initialized(int),3:Initialized(int),4:Initialized(int[]),5:Initialized(otbgvycijjopvme.oooojo)} have different local indices than {0:Initialized(otbgvycijjopvme.jojojo),1:Initialized(java.lang.String),2:Initialized(int),3:Initialized(int),4:top,5:top,6:top,7:top,8:Initialized(int[]),9:Initialized(otbgvycijjopvme.oooojo)}.
Compilation with R8-2.1.75 worked fine.


text:
Q: One field search for multiple values What is the best and optimised way to write a SQL query to search for a term with multiple columns in a table?
For example I have a table of products:
id | title   | color_id
-------------------
 1 | Dress   | 1 (red)
 2 | T-shirt | 3 (blue)
 3 | Pants   | 2 (green)
 4 | Socks   | 1 (red)
 5 | Dress   | 2 (green)
 6 | Shoes   | 2 (green)
 7 | Pants   | 3 (blue)

And a table of colors:
id | color
----------
 1 | Red
 2 | Green
 3 | Blue

And if a user enters in the term Red dress, as a result (s)he must see Product with id 1, and if user enters simply Red, as a result (s)he must see Products with id 1 and 4.
Update: There may be some inputs like dress red or red blue too.
Real version of tables are more complex, but I tried to explain in a simplest way.

A: A simple solution that just "works" could be:
SELECT *
FROM products
JOIN colors ON colors.id = products.color_id
WHERE
    ( title = "red" AND color = "dress" ) OR
    ( color = "red" AND title = "dress" )

This condition might perform better, if the optimiser is dumb enough not to notice it by itself:
WHERE
    ( title = "red" OR title = "dress") AND
    ( color = "red" OR color = "dress")

If you add more properties to the problem (besides "title" and "color"), and if and if storage is not an issue, you may want to merge (and duplicate) all textual properties into a single VARCHAR column, and run a fulltext search on this column.
CREATE TABLE products_properties (
    product_id INT NOT NULL PRIMARY KEY,
    properties VARCHAR (255),
    FOREIGN KEY fk_product (product_id) REFERENCES products(id),
    FULLTEXT ftx_properties (properties)
);

The search becomes very simple:
SELECT products.*, colors.*
FROM products
JOIN colors ON colors.id = products.color_id
JOIN products_properties AS pp ON pp.product_id = products.id
WHERE MATCH(properties) AGAINST ("+red +dress")

This obviously makes no sense in this particular example, but the more properties, the more it will speed up the query. This denormalisation also comes at the cost of an increased complexity to maintain the products_properties table.
Now the problem becomes really hairy if you

*

*have to deal with less normalised inputs such as "red blue"

*have words that belong to both categories (eg. if "red" was also a valid cloth title) and still want to discriminate them (eg. a query like "red blue" returns a cloth named "red" with color "blue")

But it looks like this is outside of the scope of your question.

A: If I were doing this in SQL, I would typically break down the query into individual words before doing the query, then build the query dynamically based on how many words there were.
So for your example, the query might end up looking like this:
SELECT *
FROM products p
JOIN colors c ON c.id = p.color_id
WHERE
p.title LIKE '%red%' OR
c.color LIKE '%red%' OR
p.title LIKE '%dress%' OR
c.color LIKE '%dress%'

If you have lots of tables though, this can start to get pretty complicated.  It's also not very efficient as its unlikely any indexes will be usable.
A better solution would be to use a dedicated text indexing product like Lucene (but that's a whole nother question..)

A: My idea is to use a query like this:
set @search = 'red dress';

SELECT *
FROM
  products INNER JOIN colors
  ON products.color_id = colors.id
WHERE
  (FIND_IN_SET(title, REPLACE(@search, ' ', ','))>0)+
  (FIND_IN_SET(color, REPLACE(@search, ' ', ','))>0) =
  LENGTH(@search)-LENGTH(REPLACE(@search, ' ', ''))+1;

The two replaces inside FIND_IN_SET are used to make a list of properties separated by commas:
red,dress

I'm then checking if title is in this set. If it is present, the value of:
(FIND_IN_SET(title, REPLACE(@search, ' ', ','))>0)

will be evaluated to 1, 0 otherwise. The same is for color.
The number of the properties in the search string can be calculated as:
LENGTH(@search)-LENGTH(REPLACE(@search, ' ', ''))+1

(yes, it is a dirty trick!). If the number of the properties that matches is the same as the properties in the @search string, the row will be returned. Please notice that performances will be poor.
Fiddle is here.


text:
Q: How to combine all features of Material UI Typography and Box Component I am trying to create a custom component combining Material UI Typography and Box Component. But I do see some compilation issues like if I use fontWeight property to Box component it automatically converts the styles, which is not happening in customization process. I have been to many blogs and everyone suggests not to have this approach, but there is a requirement for us to have a re-usable component which can supports multiple css attributes.
This is what I have tried:
import React, {FC} from 'react';
import {BoxProps, TypographyProps} from '@material-ui/core';

export type TypographyBoxProps = BoxProps & TypographyProps;

export const Typography: FC<TypographyBoxProps> = (props) => {
  const {children, component: Component = 'p', ...rest} = props;

  return <Component {...rest}>{children}</Component>;
};

This is how the above final compilation element looks like, which is incorrect, expectation is it should convert the font weight to actual css:

Hello Component!!!


text:
Q: MVVM & WCF - View Model and Model Relationship I am not understanding how my model can be a WCF service.  It makes sense when its an Astoria partial class residing on the client that allows remote calls to do persistence calls, but a WCF service doesn't have properties for model fields that can be used to update a data store.
Even if I could factor out an interface for a model/domain object class into a separate assembly, a silverlight project will not allow me to add that as a reference.
How should my ViewModel encompass my WCF calls?  Ultimately the WCF will call a repository assembly implemented in Linq-to-Sql, but apparently those entities are not my model in this scenario, my WCF classes are?
Thanks for any guidance on this.
Also, posts I have read to give a frame of reference:

*

*http://development-guides.silverbaylabs.org/Video/Silverlight-Prism#videolocation_0

*http://blogs.conchango.com/davidwynne/archive/2008/12/15/silverlight-and-the-view-viewmodel-pattern.aspx

*http://msdn.microsoft.com/en-us/magazine/dd458800.aspx

A: When you create a service reference to a WCF service in a Silverlight project it also generates an interface for that Service, this is similar to David Wynns IFeedService in the articles you listed above. The service reference will also generate proxy objects that represent the objects used by the service (Product, Category etc).
The important thing to note is that the service interface isn't the model, it's how you access the model. Going back to David's example, his ViewModel exposes a list of items (his model), this list is retrieved using the service.
If you're looking to share code between the client and server I'd reccomend looking into something like RIA Services. If this isn't for you then I'd look at a few articles around about sharing code between the server and client (via Add as Link).
Hope this helps


text:
Q: Method for calculating irregularly spaced accumulation points I am attempting to do the opposite of this: Given a 2D image of (continuous) intensities, generate a set of irregularly spaced accumulation points, i.e, points that irregularly cover the 2D map, being closer to each other at the areas of high intensities (but without overlap!).
My first try was  "weighted" k-means. As I didn't find a working implementation of weighted k-means, the way I introduce the weights consists of repeating the points with high intensities. Here is my code:
import numpy as np
from sklearn.cluster import KMeans

def accumulation_points_finder(x, y, data, n_points, method, cut_value):
    #computing the rms
    rms = estimate_rms(data)
    #structuring the data
    X,Y = np.meshgrid(x, y, sparse=False)
    if cut_value > 0.:
        mask = data > cut_value
        #applying the mask
        X = X[mask]; Y = Y[mask]; data = data[mask]
        _data = np.array([X, Y, data])
    else:
        X = X.ravel(); Y = Y.ravel(); data = data.ravel()
        _data = np.array([X, Y, data])

    if method=='weighted_kmeans':
        res = []
        for i in range(len(data)):
            w = int(ceil(data[i]/rms))
            res.extend([[X[i],Y[i]]]*w)
        res = np.asarray(res)
        #kmeans object instantiation
        kmeans = KMeans(init='k-means++', n_clusters=n_points, n_init=25, n_jobs=2)
        #performing kmeans clustering
        kmeans.fit(res)
        #returning just (x,y) positions
        return kmeans.cluster_centers_

Here are two different results: 1) Making use of all the data pixels. 2) Making use of only pixels above some threshold (RMS).

As you can see the points seems to be more regularly spaced than concentrated at areas of high intensities.
So my question is if there exist a (deterministic if possible) better method for computing such accumulation points.

A: Partition the data using quadtrees (https://en.wikipedia.org/wiki/Quadtree) into units of equal variance (or maybe also possible to make use of the concentration value?), using a defined threhold, then keep one point per unit (the centroid). There will be more subdivisions in  areas with rapidly changing values, fewer in the background areas.


text:
Q: passing a value from background.js to popup In background.js, I create a popup like so:
chrome.windows.create({
    focused: true,
    width: 1170,
    url : "settings/index.html",
    type: "popup"
}, function(popup) {
    tab_app = popup.id;
    alert(tab_app);
});

I store the id in tab_app.
how can I pass a value from background.js to my popup?
I'm trying like that:
chrome.tabs.executeScript(tab_app, {code: "alert("+message.add+");"});

but it keeps telling me that this tab id doesnt exist.. im assuming its because its a popup. will appreciate some help.

A: Since it's your extension page, the method of choice is Messaging.
Note: you can't use the per-tab messaging of chrome.tabs.sendMessage, since this explicitly targets the content script context (that doesn't exist for extension pages). You need to use the "broadcast" chrome.runtime.sendMessage that will send to all other extension pages.
If you can have more than one popup-type window at a time, this may be a problem - you need some identifier to go along. You could pass it as a URL parameter or a URL hash, e.g. "settings/index.html?id=foo" or "settings/index.html#foo". If you don't expect more than one popup-type window (you can always check if one is open before opening a new one), it doesn't matter.
If you really need dynamic code loading or execution, not just passing data (doubtful), you need to be mindful of CSP.

*

*You can dynamically load a script from your extension's package by just creating and adding a <script> tag to the document.

*However, you can't, by default, pass a string of code and eval it in the extension context. You could add 'unsafe-eval' to CSP string, but that's a bad idea in general.

*Most probably, you only need some commands to be passed along with data. Pure messaging is great for it, just look at the docs.

This old answer of mine may be of use - I'm using opening a new tab and passing data there to print it.

A: You cannot call executeScript in the your extension pages. If you try to use executeScript in your extension page. It will show error :

Unchecked runtime.lastError while running tabs.executeScript: Cannot
  access contents of url
  "chrome-extension://extension_id/yourPage.html".
  Extension manifest must request permission to access this host

Now you cannot add "chrome-extension://<extension_id>/yourPage.html" under permissions in manifest.json because it is invalid and not allowed.
 Instead you can use message passing.
background.js:
  function createNewtab(){
    var targetId = null;
     chrome.tabs.onUpdated.addListener(function listener(tabId, changedProps) {

      if (tabId != targetId || changedProps.status != "complete")
        return;

     chrome.tabs.onUpdated.removeListener(listener);
      chrome.tabs.sendMessage(targetId, {message : "loadNewTab"},function(response){
          // do nothing yet
      });

     });

    chrome.windows.create({
       focused: true,
       width: 1170,
       url : chrome.extension.getURL("settings/index.html"),
       type: "popup"
       }, function(popup) {
           targetId = popup.tabs[0].id;
    });
}

index.js:
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
    switch (request.message){
        case "loadNewTab":
            alert("HI")
            break;
    }
});


text:
Q: Changing font (or amount of text) on UITextView makes text disappear I have a UITextView which I'm assigning a large amount of text to (~25 lines). It works fine if I don't define a font against the textview, but as soon as I set the font to be anything above size 13, then the text disappears completely (though still scrollable).
The other thing is that if I slowly type in text manually to reach the cross over point, the last line is split in two, and continuing to type just produces blank text.
Its as if the text view can only contain so much visible text and as soon as that is reached the text becomes blank.
Any suggestions welcome.
EDIT:
Actually copying and pasting the above answer text into the text view, and then adding one more line is enough to make it start to turn invisible. Then when reloading the text view with the updated text (i.e answer above plus one line), its all invisible.
Setting the font size is enough to break it, just by doing systemFontOfSize: to 14. The actual font size which causes it varies depending on the amount of text in the text view.
Also using ARC.

A: So what I suggest you do is create a new single view project in Xcode, add a single UITextView to your view, and then manipulate it exactly as you are in the main project. You are doing something wrong - setting the font to nil, someone releasing the textView, or otherwise corrupting it. All messages to it MUST be on the main thread. Add asserts after any object property you are sending to the textView. As you can see huge font huge text is working just fine for me doing as I'm suggesting you do. The ideas is to start with something that works, keep adding code from your main project to the test project until you find exactly what you are doing that is causing the problem.


text: Q: Remove the "Administrator:" text from the title when you run cmd.exe as an administrator In Windows, when I run cmd.exe as an administrator, the title of the Window is "Administrator: CMD". Is there any way I change it back to just "CMD"?


text:
Q: Reusing onclick listener with a string parameter in Android Java I'm mimicking the code in this thread to create a reusable click event that fires up a browser. I want to pass a custom URL destination when instantiating the class. The example has no apparent error in eclipse but crashes when launched:
FATAL EXCEPTION: main
    02-19 12:45:57.416: E/AndroidRuntime(12465): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.ItemActivity}: java.lang.NullPointerException
The error should come from this line
btn.setOnClickListener(new ButtonInternetAccess("http://google.com"));
because it works okay without that line.
Does the class ButtonInternetAccess fail to return the onClickListener which leads to the null value? How can I fix that?
Main Activity:
public class ItemActivity extends ActionBarActivity{
    private static final View View = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_item);
        Bundle b = i.getExtras();
        Button btn = (Button) findViewById(R.id.button_internet_access);
        btn.setOnClickListener(new ButtonInternetAccess("http://google.com"));
    }
}

Button Class:
public class ButtonInternetAccess extends Activity implements OnClickListener {
    String url;
    public ButtonInternetAccess(String url) {
        this.url = url;
    }

    public void onClick(View v) {
        try {
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse(url));
            startActivity(callIntent); // No Error here

            System.out.println(url);
        } catch (ActivityNotFoundException activityException) {
            Log.e("Calling a Phone Number", "Call failed", activityException);
        }
    }

}

layout/activity_item
<TextView
    android:id="@+id/response"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="" />

<include android:id="@+id/header" layout="@layout/button_internet_access">

layout/button_internet_access:
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/button_internet_access"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="go out" />

Error:
02-19 12:45:57.416: E/AndroidRuntime(12465): FATAL EXCEPTION: main
02-19 12:45:57.416: E/AndroidRuntime(12465): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.ItemActivity}: java.lang.NullPointerException
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.os.Looper.loop(Looper.java:137)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread.main(ActivityThread.java:4745)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at java.lang.reflect.Method.invokeNative(Native Method)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at java.lang.reflect.Method.invoke(Method.java:511)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at dalvik.system.NativeStart.main(Native Method)
02-19 12:45:57.416: E/AndroidRuntime(12465): Caused by: java.lang.NullPointerException
02-19 12:45:57.416: E/AndroidRuntime(12465):    at com.app.ItemActivity.onCreate(ItemActivity.java:29)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.Activity.performCreate(Activity.java:5008)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
02-19 12:45:57.416: E/AndroidRuntime(12465):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)

Updated:
I have managed to make a plugin following this link.
Final Work:
Class Internet:
public class Internet implements OnClickListener {

    private String url;
    private Context context;

    public Internet(Context context, String url) {
        this.context = context;
        this.url = url;
    }

    @Override
    public void onClick(View v) {

        if (!url.contains("http://")){
            url = "http://"+url;
        }
        Intent callIntent = new Intent(Intent.ACTION_VIEW);
        callIntent.setData(Uri.parse(url));
        context.startActivity(callIntent);
    }
}

Class StyleButton:
public class StyleButton extends Button{

    public StyleButton(Context context) {
        super(context);
    }

    public StyleButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        initStyleButton(attrs);
    }

    public StyleButton(Context context, AttributeSet attrs, int defStyle,String url) {
        super(context, attrs, defStyle);
        initStyleButton(attrs);
    }

    private void initStyleButton(AttributeSet attrs){
        TypedArray a = getContext().obtainStyledAttributes(attrs,R.styleable.style_Button);
        String Text1 = a.getString(R.styleable.style_Button_myText_1);
        String Text2 = a.getString(R.styleable.style_Button_myText_2);
        setText(Text1 + "\n" + Text2);
        String url = a.getString(R.styleable.style_Button_url);
        System.out.println(url);
        setOnClickListener(new Internet(getContext(),url));
        a.recycle();
    }
}

/layout/item_activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:stylebutton= "http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
    android:id="@+id/response"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""/>
<com.button.StyleButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    stylebutton:myText_1="My Text 1"
    stylebutton:myText_2="My Text 2"
    stylebutton:url="www.google.com"
    />
<com.button.StyleButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    stylebutton:myText_1="Hello!"
    stylebutton:myText_2="It's a Style Button:)"
    stylebutton:url="www.yahoo.com"
    />

/value/attr.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="style_Button">
        <attr name="myText_1" format="string" />
        <attr name="myText_2" format="string" />
        <attr name="url" format="string" />
    </declare-styleable>
</resources>

A: Change Button Class to;
public class ButtonInternetAccess implements View.OnClickListener {

    private String url;
    private Context context;

    public ButtonInternetAccess(Context context, String url) {
        this.context = context;
        this.url = url;
    }

    public void onClick(View v) {

        System.out.println(url);

        Intent callIntent = new Intent(Intent.ACTION_VIEW);
        callIntent.setData(Uri.parse(url));

        try {
            context.startActivity(callIntent);
        } catch (ActivityNotFoundException activityException) {
            Log.e("ONCLICK", "No Activity found", activityException);
        }
    }
}

A: your setOnClickListener should be as below way :
btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                    Intent callIntent = new Intent(Intent.ACTION_CALL);
                    callIntent.setData(Uri.parse("http://google.com"));
                    startActivity(callIntent); // No Error here
                    System.out.println(url);
                } catch (ActivityNotFoundException activityException) {
                    Log.e("Calling a Phone Number", "Call failed", activityException);
                }
            }
        });

It seems you do not need to send the URL to another class as you can do the same to ItemActivity itself.
Edited : In case you wants to geralize one class please update your ButtonInternetAccess to below way :
public class ButtonInternetAccess implements OnClickListener {
    String url;
    Context mContext;
    public ButtonInternetAccess(Context mContext,String url) {
        this.url = url;
        this.mContext=mContext;
    }

    public void onClick(View v) {
        try {
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse(url));
            mContext.startActivity(callIntent);

            System.out.println(url);
        } catch (ActivityNotFoundException activityException) {
            Log.e("Calling a Phone Number", "Call failed", activityException);
        }
    }

}

A: Create your custom button and use it in your project that way it is possible to use it globally.
    public class ButtonInternetAccess extends UIButton implements OnClickListener {
        String url;
    Context mContext;
    public ButtonInternetAccess(Context context, AttributeSet attrs,String url) {
            super(context, attrs);
         this.url = url;
        this.mContext=mContext;
            // TODO Auto-generated constructor stub
        }
        // initialize button and add click listener here.

}
you can add that button to your xml also like
<yourpackagename.ButtonInternetAccess
height=""
width = ""
other properties to include
/>

hope this will help.


text:
Q: LWJGL Textures On Object - Java I'm having trouble drawing a texture on a Rectangle Polygon.
Here is my current code.

texture.bind();

        GL11.glBegin(GL11.GL_QUADS);
        GL11.glColor3d(255, 255, 255);
        //Top
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1, z1+length);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1, z1+length);
        GL11.glTexCoord3f(1, 1, 1);
        //Bottom
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1+height, z1);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1+height, z1);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1+length);
        //Front
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1);
        //Back
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1+length);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1+length);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1+length);
        //Left side
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1, y1, z1+length);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1, y1+height, z1+length);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1);
        //Right side
        GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1+width, y1, z1);
        GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1+length);
        GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
        GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1+width, y1+height, z1);
        GL11.glEnd();

It just doesn't seem to draw except a thin like around the block. Does anyone  know how I would fix this?

A: Is the texture has correct sizes? Or try to use glBindTexture(GL_TEXTURE_2D, texture.getTextureID());


text:
Q: Is this a bug in the jquery callback, Or is it supposed to work like this? Usually callbacks can only callback one value at a time. If you want to callback more than one value you have to use an array.
This I find is the case with jquery functions.
But I have come across something strange, and I am not sure if it is a bug, or an unintended feature.
I am writing a plugin, and I have somehow managed to callback more than one item.
The problem is that I don't know if it is a bug, or not, but it works, and I am worried if I am going to cause myself problems with this.
Ok my plugin is called mydialogue. It is basically an extension of the jquery ui dialogue but some extra stuff that I need.
Ok my plugin starts like this
$.fn.mydialogue = function(options,callback,message){

I have a callback, and a message variable.
Now usually you would use a callback like this.
callback(value);

but I have done this
callback(value,message);

I run my plugin like this
$('text').mydialogue({
    title : "Note",
    message : data.Note,
    width : "420",
    maxlength : "200",
    textid : "Condition_update",
    mybuttons : ["Update", "Cancel"]
}, function (callback, message) {
    alert(message);
});

It is alerting the message fine, but this looks like I have sent back two values in a callback, but surely it shouldn't work, but strangely it does.
The question is how is the callback sending back two items, and should it?
The other question is, am I going to cause myself problems by doing this, or is the fact that this is working just a fluke or a bug in jquery?

I have just got it working with a function now, so no need to send an array back from a function. ok the way I see it now is this. Please correct me if I am wrong.
Whenever you do a callback. like
callback(value,message,toys);
When it comes back the value of callback will always be the first item. eg value
so the following code gives me the value
$('text').mydialogue({
    title : "Note",
    message : data.Note,
    width : "420",
    maxlength : "200",
    textid : "Condition_update",
    mybuttons : ["Update", "Cancel"]
}, function (callback, message) {
    alert(callback);
});

And any further items I add to the callback I have to add after the callback keyword eg
$.fn.mydialogue = function(options,callback,message,toys){

and so if I wanted to get these back from the callback I would do
$('text').mydialogue({
        title : "Note",
        message : data.Note,
        width : "420",
        maxlength : "200",
        textid : "Condition_update",
        mybuttons : ["Update", "Cancel"]
    }, function (callback, message,toys) {
        alert(callback);
    alert(message);
    alert(toys);
    });

Please let me know if this is correct. It takes me a while to understand something. I don't learn as fast as some people do.

Ok I am close to understanding this.
The code you typed was this.
function myFunction(callback, arg1,arg2){
    // do something interesting here!

    // call the callback function, passing it arguments if you wish
    callback(arg1,arg2)
}

And I understand that would work, but I have been more or less doing this.
function myFunction(callback, arg1,arg2){
    // do something interesting here!

    // call the callback function, passing it arguments if you wish
var value=10;
    callback(value,arg1,arg2)
}

and in my callback I get value variable coming back from the callback, even though I didn't specify it in the function arguments.
For instance if I called the function
myfunction(function(callback,arg1,arg2){
alert(callback);
});

If I do this I get the value of the value variable when I alert callback, which would be 10 of course. I just wanted to understand why this is happening. I thought I had done something wrong, but it works, but I was worried it if it was working correctly.
I didn't show all my plugin code because I thought it was irrelavent to the question. So I only showed the code that I thought needed to be shown.

Yes Jamiec I was getting confused which is why I posted the question in the first place.
So really the word callback in the function name is really just a variable. So in effect can I just do this?
function myFunction(value, arg1,arg2){
    // do something interesting here!

    // call the callback function, passing it arguments if you wish
var value=10;
    callback(value,arg1,arg2)
}

so the way I see it is, callback() is the command to call back, and anything inside the brackets are just variables.
So I think you have definately answered my question. In other words I have been using it wrong, but luckily my callbacks are working, because I am using the variable name callback. I think I should change these to avoid confusion in the future. Thanks for the help.

A: There is no bug here, the arguments to a javascript function are somewhat fluid in that I can define a function like this:
function aFunction(arg1){...}

Yet call it like this:
aFunction("someValue",123)

With no ill effect - and I can actually access that non-specified argument using the arguments array (arguments[1] // <-- has value 123).
I can also do this the other way around, I can define a function like this:
function bFunction(arg1,arg2){...}

Yet call it like this:
bFunction("someValue")

In this situation, the value of arg2 is simply undefined

With regard to your edit, you're seriously misunderstanding what this callback is doing, and how it is used.
Forget plugins for a moment, just think javascript. If you define a function like this:
function myFunction(callback){..}

With the intention to pass a function reference in to callback:
//call myFunction, passing a fuunction reference to the first argument
myFunction(function(){..});

It does not magically get passed any further arguments you define on the function taking the callback, ie, if you changed that function above to
function myFunction(callback, arg1,arg2){..}

then the callback function will not magically get passed arg1 & arg2! Its how you call the callback yourself inside the function that matters. If I wanted that to happen, I would need to code it appropriately
function myFunction(callback, arg1,arg2){
    // do something interesting here!

    // call the callback function, passing it arguments if you wish
    callback(arg1,arg2)
}

The function above could then be called like so
myFunction(function(a1,a2){
   // arg1 & arg2 only passed in to this callback because thats how I coded it above
},"valueForArg1","valueForArg2")

Hopefully this explains what is going on in your plugin - your extra parameters passed to the function initialising the plugin will not automagically get passed back to your callback - its all how you code your plugin. You;ve neither explained what your plugin is trying to do with the callback, nor how you are calling the callback function itself.


text:
Q: Qt - no matching function for call to The error is:
no matching function for call to 'Game::drawPanel(int, int, int, int, Qt::GlobalColor)'
     drawPanel(0,0,150,768,Qt::darkCyan);
                                       ^
Im new with Qt and I started making a game. I was following a youtube tutorial and I cant find where is mistake in my code. Its the Opacity problem but on the video, guy didnt provide this argument and it worked.
Game.h
#ifndef GAME_H
#define GAME_H

#include <QGraphicsView>
#include <QGraphicsScene>
#include "Interface.h"

class Game: public QGraphicsView{
    Q_OBJECT
public:
    // constructors
    Game(QWidget* parent=NULL);

    // public methods
    void displayMainMenu();
    QString getWhosTurn();
    void setWhosTurn(QString player);

    // public attributes
    QGraphicsScene* scene;
    Interface* interface;
    QString* fight;     // wskaźnik??

public slots:
    void start();

private:
    void drawPanel(int x, int y, int width, int height, QColor color, double opacity);
    void drawGUI();
    QString whosTurn_;
    QGraphicsTextItem* whosTurnText;
};

#endif //GAME_H

Game.cpp
#include "Game.h"
#include "Interface.h"
#include "Button.h"
#include <QGraphicsTextItem>

Game::Game (QWidget *parent){
    // set up the screen
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFixedSize(1024,768);

    // set up the scene
    scene = new QGraphicsScene();
    scene->setSceneRect(0,0,1024,768);
    setScene(scene);
}

void Game::start(){
    // clear the screen
    scene->clear();

    interface = new Interface();
    interface->placeHexes();
}

void Game::drawPanel(int x, int y, int width, int height, QColor color, double opacity){
    // draws a panel at the specified location with the specified properties
    QGraphicsRectItem* panel = new QGraphicsRectItem(x,y,width,height);
    QBrush brush;
    brush.setStyle(Qt::SolidPattern);
    brush.setColor(color);
    panel->setBrush(brush);
    panel->setOpacity(opacity);
    scene->addItem(panel);
}

void Game::drawGUI(){
    // draw the left panel
    drawPanel(0,0,150,768,Qt::darkCyan);

    // draw the right panel
    drawPanel(874,0,150,768,Qt::darkCyan);

    // place player1 text
    QGraphicsTextItem* p1 = new QGraphicsTextItem("Tekst roboczy 1");
    p1->setPos(25,0);
    scene->addItem(p1);

    // place player2 text
    QGraphicsTextItem* p2 = new QGraphicsTextItem("Tekst roboczy 2");
    p2->setPos(874+25,0);
    scene->addItem(p2);

    // place whosTurnText
    whosTurnText = new QGraphicsTextItem();
    setWhosTurn(QString("PLAYER1"));
    whosTurnText->setPos(490,0);
    scene->addItem(whosTurnText);
}

void Game::displayMainMenu(){
    // create the title text
    QGraphicsTextItem* titleText = new QGraphicsTextItem(QString("RockPaperScisors?"));
    QFont titleFont("comic sans",50);
    titleText->setFont(titleFont);
    int txPos = this->width()/2 - titleText->boundingRect().width()/2;
    int tyPos = 150;
    titleText->setPos(txPos,tyPos);
    scene->addItem(titleText);

    // create the Multiplayer button
    Button* multiplayerButton = new Button(QString("Multiplayer"));
    int bxPos = this->width()/2 - multiplayerButton->boundingRect().width()/2;
    int byPos = 275;
    multiplayerButton->setPos(bxPos,byPos);
    connect(multiplayerButton,SIGNAL(clicked()),this,SLOT(start()));
    scene->addItem(multiplayerButton);

    // create the quit button
    Button* quitButton = new Button(QString("Quit"));
    int qxPos = this->width()/2 - quitButton->boundingRect().width()/2;
    int qyPos = 350;
    quitButton->setPos(qxPos,qyPos);
    connect(quitButton,SIGNAL(clicked()),this,SLOT(close()));
    scene->addItem(quitButton);
}

QString Game::getWhosTurn(){
    return whosTurn_;
}

void Game::setWhosTurn(QString player){
    // change the QString
    whosTurn_ = player;

    // change the QGraphicsTextItem
    whosTurnText->setPlainText(QString("Whos turn: ") + player);
}


text:
Q: Block variable not set Excel I am getting error

rum time error 91 block variable not set

with below code when trying to run in vba excel.. I checked references not sure what I will be missing here
My Code is as follow This was working prior not sure what changed here later :(
Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim XMLFileAddress As String
Dim oDoc As MSXML2.DOMDocument
Dim fSuccess As Boolean
Dim oRSS_version As MSXML2.IXMLDOMNode
Dim oChannel As MSXML2.IXMLDOMNode
Dim oIRN As MSXML2.IXMLDOMNode
    Set oDoc = New MSXML2.DOMDocument
fSuccess = oDoc.LoadXML(MyRequest.responseText)
If NotfSuccess Then
    errormg = "Could Not Download XML"
    GoTo ExitHere
End If
oDoc.async = False
oDoc.validateOnParse = False
 errormg = ""
Set oRSS_version = oDoc.DocumentElement


text:
Q: Check if user has access to Domino server I need to check each user registered in names.nsf if it actually has access to Domino server.
Is there is an simple and programmatic way to find this out (I mean maybe some 2-4 tricky lines of code)?
Otherwise I guess I need to resolve (if defined) in server document [Security\Server Access] 'Access servers' and 'Not access server').

A: Yes: "access server" and "not access server" are the places to look. Just look at the values. If there are groups in there, then you can check the group membership of the user with the admin- client and its "Manage Groups" function where you can list all groups that a specific person belongs to.
Like this it is a question of just some clicks to check if somebody has access to a server or not.
"Not access server" overwrites "access server" here.

A: It's been a while, but if @Torsten's answer doesn't help, look at the @UserNamesList function.
For example, if you're doing analysis rather than doing this within an application, you could create a copy of the domain address book somewhere on your server (it needs to be on the server or @UserNamesList won't work, and you want to do it in a copy so you aren't dirtying up your domain address book because wow you are in trouble if you mess that up), then create a formula agent that runs on selected documents with code like:
GrantAccessGroups := "List of groups" : "that are allowed access";
DenyAccessGroups := "Deny Access" : "some other group" : "any other group" : "that is listed in the server's Server document's Deny Access field";
SELECT @IsMember(Form; "User" : "Person");
FIELD AccessCheckResult := @If(
  !@IsNotMember(@UserNamesList(FullName[1]); DenyAccessGroups); "Denied";
  !@IsNotMember(@UserNamesList(FullName[1]); GrantAccessGroups); "Confirmed";
  "Neither confirmed nor denied"
);
FIELD AccessCheckDate := @Now;
"Lotus Notes used to not like ending agent formulas with a FIELD statement, so this is just a string that does nothing just in case this quirk is still there :-P"

*

*I'm not sure if the form should be "User" or "Person". As long as I'm right about one or the other, though, @IsMember(Form; "User" : "Person") should work!

*@UserNamesList returns the name of all roles and groups for the given user.

*@IsNotMember is true only if there is no overlap between two lists. (If only some of the values in the second argument are in the first, both @IsNotMember and @IsMember return false, so you have to use !@IsNotMember.)

*Setting the AccessCheckDate is just for your own sanity in case things don't work quite right and you have to troubleshoot.
Once you run that, you can change your views to categorize by AccessCheckResult


text:
Q: Access denied When Calling http from https I have a https Web Page.
I call another http webpage by JavaScript inside.
The alert shows Access Denied.
Here is my code.
var url = "http://127.0.0.1:2737/video";
try {
    if (document.all) {
        var xdr = new XDomainRequest();
        xdr.open('GET', url)
        xdr.send();
    }
    else {
        var req = new XMLHttpRequest();
        req.open('GET', url, true);
        req.send(null);
    }
}
catch (e) {
    alert(e);
}

Please help me!

A: I supose you are trying to do this with IE8 or IE9. Is that right?
The problem of this is shown here:

7. Requests must be targeted to the same scheme as the hosting page
This restriction means that if your AJAX page is at
  http://example.com, then your target URL must also begin with HTTP.
  Similarly, if your AJAX page is at https://example.com, then your
  target URL must also begin with HTTPS.

Thus, if this is the case, I am afraid it is not possible to do that


text:
Q: ssdt post deployment script run once I am new to SQL Server Database Tools and may be making incorrect assumptions about what the post deployment scripts are doing.. so correct me if I am wrong.
As far as I am aware the post deployment script will be expected to run after every deployment, not just a single deployment.
If I want to have the post deployment script run a script only one time is there a way to do this without also requiring a version or history table in the database that logs when these scripts were already ran?
I.e. can I have any subsequent amendments to a script be added as a new file within the project with a version number on, and add it to the post deployment script but have the previous script be ignored some how (potentially without first removing it)? regardless of whether it still runs the script during deployment?
Is there a configuration for this sort of thing or is this unintended behaviour?

A: Pre and Post-deploy scripts are designed to be run each time you release the project. Your best practice is to make them repeatable. Add checks so that if the data already exists, you don't run again or something similar. You could build some sort of basic logging table to store this as well - if row not found in the table, run script and put row in table.
You can't tell the project to only run the latest version of a script if there are multiple scripts present because they're all built into one large PreDeploy.sql or PostDeploy.sql file. You'd need something within each section/script that would tell it where to look to know whether or not to run. That could be an existing data check, a table check, version check, or something else, but it would need to know somewhere what to use to know whether or not to run.
There's no way to turn this off other than commenting out the scripts or handling them in some way through SQLCMD variables or other checks. Those would still require you coding in the way each script should run or not. If you give an example or two of what you're trying to accomplish in the Pre/Post Deploy scripts, we can likely give some better guidance.
For our purposes, we make the scripts re-usable and remove them as they've been run. They're still in source control or you can use a snapshot to store that version of the project prior to removing them.


text:
Q: if div has class change content - three cases I have three possible cases for a div - it either has a class .first or .last or none.
I need to change the content another div based on these classes, but I'm doing something wrong...
Can someone give me hand and tell me what I'm doing wrong?
jQuery(document).ready(function ()  {

    if (jQuery('.pricing-plan').hasClass('first')) {
        jQuery('.tagline').text('primeiro');
    }
    else if (jQuery('.pricing-plan').hasClass('last')) {
        jQuery('.tagline').text('ultimo');
    }
    else {
        jQuery('.tagline').text('nada');
    }

});

A: Updated Demo

*

*You have multiple elements with class .pricing-plan and .tagline. In such cases you have to use .each() to iterate over each element.

*Inside each, to get context of current .pricing-plan use $(this)

*In your current code the selector jQuery('.pricing-plan') just
returned/checked first .pricing-plan

Check this,
jQuery(document).ready(function () {
    jQuery('.pricing-plan').each(function () {

        if (jQuery(this).hasClass('first')) {
            jQuery(this).find('.tagline').text('primeiro');
        } else if (jQuery(this).hasClass('last')) {
            jQuery(this).find('.tagline').text('ultimo');
        } else {
            jQuery(this).find('.tagline').text('nada');
        }
    });

});


text:
Q: $http.post in angularJS goes in error in without debugging mode only.in debugging mode its works fine.why? here is my javascript code
 $scope.addUser = function () {
                debugger;
                url = baseURL + "AddUser";
                $scope.objUser = [];
                $scope.objUser.push( {
                    "ID": '0',
                    "UserName": $scope.txtUserName,
                    "Password": $scope.txtPassword,
                    "Role":"Non-Admin"
                });

                $http.post(url,$scope.objUser[0])
                    .success(function (data) {
                        debugger;
                        alert("S");
                        window.location = "../View/Login.html";
                    }).error(function () {
                        debugger;
                        alert("e");

                    });
            }

here is my server method code
[HttpPost]
        public int AddUser(UserModel user)
        {
            //_entity.Configuration.ProxyCreationEnabled = false;
            tblUser objUser = new tblUser();
            objUser.UserName = user.UserName;
            objUser.Password = user.Password;
            objUser.Role = user.Role;
            _entity.tblUsers.Add(objUser);
            _entity.SaveChanges();
               return objUser.ID;
     }

A: You can use promises to get the response. this can be inside into a service and call it whenever you want to use it.
this.addUser = function (obj) {
        var datosRecu = null;
        var deferred = $q.defer();
        var uri = baseUrl + 'addUser';
        $http({
            url: uri,
            method: 'post',
            data: angular.toJson(obj)
        }).then(function successCallback(response) {
            datosRecu = response;
            deferred.resolve(datosRecu);
        }, function errorCallback(response) {
            datosRecu = response;
            deferred.resolve(datosRecu);
        });
        return deferred.promise;
    };

Also .error and .success are deprecated.
PD: the parameter data: inside the $http correspond to the body. if you want to send parameters you should use params:{}
EDIT:
Here i leave you a link how promises work. Angular promises
Basically this helps to process data asynchronously
the example above can be used inside a service like this
myApp.service('myService', function($q, $http){

// here your services....

});

the service can be injected inside to any controller to provide the data that what you want, inside of your functions
myApp.controller('myController', function($scope, myService){

  $scope.list = function(){
      $promise = myService.getAll(); // this will be the name of your function inside your servive
      $promise.then(function(data){
         console.log(data); //here you can se your promise with data like status and messages from the server.
      });
  };

});

Hope it helps.


text:
Q: Missing dynamic (.so) library in fftw 2.1.5 installation I am trying to run simulations using Gadget2, an astrophysics N-body simulation package. It requires a few libraries, including fftw-2.1.5. I have installed fftw using the guidelines given in the user manual:
 ./configure --prefix=<PATH> --enable-typeprefix --enable-mpi
 make
 make install
 make clean
 ./configure --prefix=<PATH> --enable-float--enable-type-prefix --enable-mpi
 make
 make install

The two makes are to get both single and double precision files according to this source. The install happened successfully, and I was also able to compile Gadget2.
But when I try to run Gadget2, I get the following error:
./Gadget2: error while loading shared libraries: libsrfftw_mpi.so.2: cannot open shared object file: No such file or directory

The file libsrfftw_mpi.so.2 is missing in the fftw lib folder, even though a few download sites for fftw packages say that it is part of the contents. What am I missing?

A: Specify the below and run your command again.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=<PATH from your install command>

also don't forget to additionally specify --enable-shared for both configure commands.


text:
Q: How to check difference between 2 numbers I'm developing VBA which should compare 2 numbers for difference and trying to find way to do most efficient.
Tried to inspect which number is higher than deduct smaller number and check for difference between this 2 numbers.
This number param_1 0.543729495662964 to compare with this number param_2 0.304649054452729 and show difference in this case difference = 0.2390804412
Or param_1 0.543729495662964 with param_2 0.599799256372803 and store difference between this two numbers
Then continue with program.
Numbers can't be higher than 1.0 first number(param_1) is static and not changing. param_2 is number which can be higher or lower than param_1 and this is gives me a lot of trouble.


text:
Q: UWP FolderPicker grant access to all sub-paths I am using a FolderPicker in my Windows universal app to have the user choose a directory, and when they've done that I need to access several different files at known subpaths below that directory. I can choose the directory fine, but when I try to access things at subpaths from there I am still denied access. Is there any way to grant access to multiple files in a parent directory without having the force the user to manually select each file that needs to be accessed?
Here is my code that opens the folder picker and adds the chosen directory to my future access list:
var folderPicker = new Windows.Storage.Pickers.FolderPicker();
folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
folderPicker.FileTypeFilter.Add("*");

Windows.Storage.StorageFolder folder = await folderPicker.PickSingleFolderAsync();
if (folder != null) {
       StorageApplicationPermissions.FutureAccessList.AddOrReplace("GitDirectory", folder);
       PathTextBox.Text = folder.Path;
       this.IsPrimaryButtonEnabled = true;
}

(apologies for my naming conventions, I'm new to the Win/C# world so I'm writing in a hodge-podgey way I know)
Here is the code in another class that tries to access a sub path. You can assume that the variable GitDirectory has been previously assigned the result of calling FutureAccessList.GetFolderAsync("GitDirectory"); because it has:
StorageFile iniFile = await GitDirectory.GetFileAsync(@"datafiles\i18n\en_US.ini");
IniData data = iniParser.ReadFile(iniFile.Path);

It is this final line that finally throws this exception:
Access to the path 'E:\Documents\git\asirra\datafiles\i18n\en_US.ini' is denied.
Thanks for any help in advance

A: The problem here is that when you have access to a file via a StorageFile instance at a arbitrary location (user-chosen), you need to use this specific instance to work with the file. You cannot access the file directly by accessing its path (file.Path).
I have checked the IniParser source code on GitHub and found out you can use the IniDataParser API instead, for example the following method:
IniData Parse(StringReader stringReader)

You could read the ini file, and then pass it to the parser:
var iniFile = await GitDirectory.GetFileAsync(@"datafiles\i18n\en_US.ini");
var text = await FileIO.ReadAllTextAsync(iniFile);
var parser = new IniDataParser();
var data = parser.Parse(text);


text:
Q: capture part of url with regex Ok I promise I'll learn regular expressions tonight but right now I need a quick fix.
(Really, I swear I will!)
How do I extract the value of what comes after name= this url:
page?id=1&name=hello
In this case I would be trying to isolate 'hello'.
Thanks!

A: With most engines:
[\&\?]name\=(.*?)(?:&|$)

You've got it in $1.

A: What language are you using? Pretty much every language has a utility that will do this for you so you don't have to resort to regex:
PHP:
parse_str(parse_url('page?id=1&name=hello', PHP_URL_QUERY), $query);
print $query['name']; // outputs hello

Python:
>>> from urlparse import urlparse
>>> from cgi import parse_qs
>>> parse_qs(urlparse('page?id=1&name=hello').query)
{'id': ['1'], 'name': ['hello']}


text:
Q: function to check if a string contains all elements of another string I need to write a function that takes two string arguments, and returns TRUE if the characters of the second string exist in the first one, else returns FALSE. For example: given str1 = 'xBxxAxxCxxAxCxxBxxxAxCxBxxxAxxBxCx' and str2 = "ABC", returns TRUE (str2 = "ABCD", returns FALSE).
I tried different variations of code and cannot get the correct one. I have the following code here where I used in built in function but it doesn't seem to work:
def minSubStr(str1, str2):
    str1 = input("Enter the first string: ")
    str2 = input("Enter the second string to check if the characters exist in the first string: ")
    if str2 in str1:
        return True
    else:
        return False
minSubStr(str1, str2)

A: str2 in str1 check whether the whole string str2 is present as a substring in str1. You need to iterate over str2 to check if every character of str2 is present in str1 using the all() function.
def minSubStr(str1, str2):
    str1 = input("Enter the first string: ")
    str2 = input("Enter the second string to check if the characters exist in the first string: ")
    if all(s in str1 for s in str2):
        return True
    return False

A: A really concise solution is to do the set difference between the characters in the two strings. The set difference will be empty if your condition is met:
return len(set(str2)-set(str1))==0

A: try this out, you need define str1 and str2 prior to calling the function
def minSubStr(str1, str2):
    if str2 in str1:
        print(True)
    else:
        print(False)
str1 = input("Enter the first string: ")
str2 = input("Enter the second string to check if the characters exist in the first string: ")
minSubStr(str1, str2)

A: Well you can optimise the iterations by using set in python.
def minSubStr(str1, str2):
    str1 = set(input("Enter the first string: "))
    str2 = set(input("Enter the second string to check if the characters exist in the first string: "))
    if all(s in str1 for s in str2)::
        return True
    else:
        return False
minSubStr(str1, str2)

A: I think you might need to loop through the characters
for example:
for i in str1:
    if str2 in str1:
        return True
    else:
        return False
minSubStr(str1, str2)

A: Here is another method to check if the string contains all the elements of another string with the help of functools and operator libraries.
from functools import reduce
from operator import and_, or_, contains
def containsAll(str1, str2):
    return reduce(and_, map(contains, len(str2)*[str1], str2))
str1 = input("Enter the first string:")
str2 = input("Enter the second string to check if all characters exist:")
containsAll(str1,str2)


text:
Q: app inventor Autosize text size I have produced a lovely app for a mobile on app inventor 2 that looks awful on my tablet.  I can set component sizes to percentage and autosize so they fill the screen ok but the font size in the components stay much too small.
I looked back at some stuff I did years ago in app inventor 1 and did not have this problem but cannot see how I managed to make the font size change dynamically.

A: you have to use font size method in the Block. you can define the font size according to you auto-size like.
 if my Vertical1 width = size+5  then font = size+5

A: If you go to the Screen1 properties, you can set sizing to responsive. This might fix your problem.

According to the App Inventor page on responsive sizing:

To accommodate this choice, App Inventor includes a screen property called Screen.Sizing.  Screen.Sizing can be set to either fixed or responsive.   When sizing is fixed, App Inventor creates apps for a screen of size 320 pixels wide and 460 pixels high, but it scales the app's appearance to match the actual size of the screen that the app is running on. This display is essentially equivalent to how App Inventor apps were rendered on Tablets prior to App Inventor version 145.


text:
Q: Meteor: template helpers firing on page back I have a helper for a 'userLayout' template, in which I've defined a current user function. It works fine when I navigate to the template (i'm using flow router with subscriptions in the route). However, when I press 'back' in the browser, the helper fires again.
Why is the helper firing for the template I'm leaving when I press 'back'?
My code for one of the offending helpers is here - I suspect the 'context' attribute:
// Return a specific user
findUser: function(context) {
    var id = context.user;
    return Potential_users.find({_id: id});
}

EDIT
The view template itself looks like this:
<template name="userLayoutView">
    {{#each findUser context}}
       ...
    {{/each}}
</template>

And that view is getting called dynamically like so:
<template name="userLayout">

            {{#if currentUser context}}
                {{> userLayoutEditCreate context=context}}
            {{else}}
                {{> userLayoutView context=context}}
            {{/if}}

</template>


text:
Q: Expected utility representation I am stuck on some question on utility theory. The question is as follow:
Consider $A=[0,+\infty)$, and $Q=${F-cumulative distribution function on $A: \int^{+\infty}_0 x dF(x)<\infty$}, the set of distributions of random variables with finite expectation. I am asked to show if an agent's preference is represented by expected utility which is consistent with the axioms of rational choice, then the utility function u must satisfy
$\lim_{x\rightarrow{\infty}} u(x)/x\leq c $
for some constant c.
There is a hint saying that suppose the condition on u(x) is not satisfied, then show there exists a distribution in $Q$ which is inconsistent with the Archimedean axiom.
Thanks so much.

A: 1) Show that if the condition does not hold for $\hat u$ there must exist some $F\in Q$ such that $$\hat U(F) =\int_0^\infty \hat u(x)dF(x)=+\infty.$$
2) Prove that $\hat U(F)=+\infty$ violates the Archimedean axiom.


text:
Q: Handling switching connection from two computers to one LCD screen I have the following equipment:

*

*Dell UltraSharp U2412M Monitor with LED

*Stationary HOME PC

*Ultrabook Samsung Series 9 NP900X4C

*USB Mouse

*USB Keyboard

Here is the diagram of how I currently have this items connected:

Now the switching between different sources (Ultrabook and HOME PC) is inconvenient. I have to do two things:

*

*I need to take USB OUT, that comes from LCD and plug it out of one computer and into the other computer. That is how I get to use the same keyboard and mouse even if on different computers.

*Then I need to switch between Input Source on the LCD manually (from DVI-D to DisplayPort or vica versa).

Now I am searching for the solution of how I would be able to switch more efficiently. I was thinking of some kind of a box, that has all the inputs (USB, HDMI, DVI) and on the other side outputs, where USB is doubled. Now with the switch of a flip it changes currently active outputs. That way it would select only one USB and LCD with AUTO detect setting ON would identify which input source is currently active.

A: You're looking for a KVM switch. They come in all sorts of configurations, including the one you're looking for.


text:
Q: Portable way to include malloc_np.h I'm using a third-party library which includes malloc_np.h. From what I found over internet, this means that the code was supposed to compile under FreeBSD, although simply changing the include to malloc.h made it compilable under Linux (Ubuntu 13.10).
Now I'm writing a CMake script for this library to generate appropriate make files (including NMake makefiles for MSVC 2010).
What is the best way to achieve portability in such a scenario?
My current solution is to test for:
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"

in the CMake script. Depending on the result I issue a
add_definitions (-DINCLUDE_MALLOC_H="#include <malloc[_np].h>")

command and use this macro in the source file instead of #include <malloc_np.h>.
Is this a good practice?

A: Generate time
Use CheckIncludeFile* modules:
include(CheckIncludeFileCXX)

check_include_file_cxx("malloc.h" have_malloc)

if(have_malloc)
  add_definitions(-DINCLUDE_MALLOC_H)
endif()

Compile time
Use boost.predef library to detect os specific features