text:
Q: William Rowan Hamilton and Algebra as Time This question ended up longer than I intended (though most of the bulk is interesting remarks by Hamilton), so I thought it might be good to include my question at the beginning before the admittedly-lengthy background:
Question:  Why did Hamilton view the scalar part of a quaternion as representing time?  Does the modern viewpoint of quaternions in physics admit an interpretation that involves time but does not require relativity and related thoughts as a prerequisite?
Background: It strikes me as remarkably ahead-of-his-time that Hamilton preferred to think, or perhaps insisted on thinking, of algebra as the study of a time variable.  In fact, while I'm certainly no math-historian, by my reading he is actually quite uncomfortable with the relatively newfound spread of abstraction in algebra, particularly in terms of imaginary numbers.  He laments on the chasm between this abstraction and the firm footing of science:
Yet a natural regret might be felt, if such were the destiny of Algebra; if a study, which is continually engaging mathematicians more and more, and has almost superseded the Study of Geometrical Science, were found at last to be not, in any strict or proper sense, the Study of a Science at all....

...and later...

The author acknowledges with pleasure that he agrees with M. Cauchy, in considering every (so-called) Imaginary Equation as a symbolic representation of two separate Real Equations: but he differs from that excellent mathematician in his method generally, and especially in not introducing the sign $\sqrt{-1}$ until he has provided for it, by his Theory of Couples, a possible and real meaning, as a symbol of the couple (0, 1).

As a solution to his quandry, Hamilton postulates that the interpretation of algebra as the study of time is the way to base algebra with imaginary numbers on a scientific footing, writing:

It is the genius of Algebra to consider what it reasons on as
flowing, as it was the genius of Geometry to consider what it reasoned on as fixed.

In his treatise on the subject: "Theory of Conjugate Functions, or Algebraic Couples; with a Preliminary and Elementary Essay on Algebra as The Science of Pure Time," he develops a tremendous amount of basic algebra (from addition and ordering to indeterminate forms and exponentiation) through this lens.  The sticky part is that he does not seem (to me, at least) to resolve the issue at hand; that of providing an intuitive formulation of algebra in which one can relate time and imaginary numbers, at least beyond that of Cauchy's theory of couples referenced above.  And yet he himself, however, declares victory on the matter, writing that this "Theory of Couples is published to make manifest that hidden meaning."  He is so taken by this point of view that he later interprets quaternions as a "scalar plus vector" as a "time plus space" element of spacetime:
Time is said to have only one dimension, and space to have three dimensions. […] The mathematical quaternion partakes of both these elements; in technical language it may be said to be "time plus space", or "space plus time": and in this sense it has, or at least involves a reference to, four dimensions.
Ever since Einstein and Minkowski (and others), it is quite commonplace to think in terms of spacetime (and indeed the concept apparently dates back to d'Alembert in 1754), but without relativity/Lorenz metrics/etc. at one's disposal, it is striking how dedicated Hamilton was to the point of view of relating time and imaginary quantities.
Question (redux):
It is really Hamilton's strikingly-modern interpretation of the scalar part of a quaternion as representing time that is the basis for this question.  Why did he do this?  Does the modern viewpoint of quaternions in physics admit an interpretation that involves time but does not require relativity and related thoughts as a prerequisite?

A: I believe that he may have been influenced by Kant. According to a quote from this website: "Kant maintains that geometry discovers the universal laws of space, and algebra discovers the universal laws of time. Space and time are "pure intuitions" by which perception can take place, so they are a priori and universal."

A: Hamilton had started down this very abstract path of showing that geometry described space and algebra described time, but was forced to abandon it after realizing it couldn't work.  He was then attracted by the notion of algebra as a language — and specifically a system of symbols.  If you read on in the source for that quote about "space plus time", he summarizes the whole idea with this couplet:

And how the One of Time, of Space the Three,
  Might in the Chain of Symbol girdled be.

He thought of the scalar part of the quaternion and the "vector" part as related but separate symbols, just as he considered geometry and algebra to be related but separate.  He was not unifying them.
Thus, it seems to me that this question rests on two mistaken notions.  First, it doesn't give enough credit to the long history of dynamics and the treatment of space and time on similar (though not precisely equal) footings — or even Hamilton's own important place in that history.  Second, it gives too much credit to the fact that the separate components of a quaternion are all bound up in a single object, while ignoring the fact that they are fundamentally different types of elements within that object.  That is, Hamilton was trying to draw parallels between space and time, but he was still clearly trying to keep them separate.  So I will argue that Hamilton's interpretation is actually not strikingly modern, because it was not unifying space and time.  As for its place in modern physics, I think this answer on physics.se explains it in pretty good detail.
While Einstein and Minkowski famously treated space and time as four-dimensional, this was not an innovation that they introduced; it already had a long history in physics.  Instead, their innovation was to unify space and time, so that they can transform into one another via what we now call a Lorentz transformation.(1)  Prior to them (and Poincaré, Lorentz, and maybe even FitzGerald), space and time were always kept quite distinct; they could be considered at the same time, but would never mix.  So we can distinguish between the ancient parallel treatment of space and time, as opposed to the modern unified treatment of spacetime.
And this restricted combination had a long history already, starting at least with Descartes who treated time with its "durations" in the same way as space with its "extensions" — which are notions we now call dimensions.  Of course, Newton, Kepler, Galileo (and surely the list goes on) used four coordinates for space and time.  KConrad's comment points out the d'Alembert had already been quite explicit about combining space and time into four dimensions, and even taking their product — which makes sense since his operator combines them as in $\partial_t^2 - \partial_x^2 - \partial_y^2 - \partial_z^2$.  But of course, Lagrange is the one we now think of as Hamilton's most direct influence.(2)  And Lagrangian mechanics are much like Hamilton's own mechanics in that they are all about the relation between evolution through time and space.

(1)  Note that Lorenz and Lorentz are two different people.  Though both names appear in relativity and closely related fields.  Lorentz is the one you want to associate with metrics.
(2) That's not to dispute Kristal's assertion that Kant influenced Hamilton — his "Pure Time" essay reads like a text generator that was fed the Critique of Pure Reason.  But Kant was in no way combining the two — never mind aunifying them.  As far as I can tell, the reason Kant spoke about both of them was because he regarded them as distinct.


text:
Q: Getting error while connecting Vibur DBCP to Oracle DB I am trying to setup Vibur DBCP to work against an Oracle 11g DB instance but I keep getting an Oracle exception.
This is the URL = jdbc:oracle:thin:@//db.vonagenetworks.net/MY_SERVICE
This URL works when I use it with our Tomcat Connection Pool.
I get the following error….
org.vibur.dbcp.ViburDBCPException: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack

    at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:114) ~[vibur-dbcp-1.1.1.jar:?]
    at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:53) ~[vibur-dbcp-1.1.1.jar:?]
    at org.vibur.objectpool.ConcurrentLinkedPool.create(ConcurrentLinkedPool.java:119) ~[vibur-object-pool-2.0.0.jar:?]
    at org.vibur.objectpool.ConcurrentLinkedPool.<init>(ConcurrentLinkedPool.java:110) ~[vibur-object-pool-2.0.0.jar:?]
    at org.vibur.dbcp.pool.PoolOperations.<init>(PoolOperations.java:73) ~[vibur-dbcp-1.1.1.jar:?]
    at org.vibur.dbcp.ViburDBCPDataSource.start(ViburDBCPDataSource.java:196) ~[vibur-dbcp-1.1.1.jar:?]
    at contactmanager.dao.DataSourceInitializer.initializeDataSources(DataSourceInitializer.java:96) [DataSourceInitializer.class:?]
    at contactmanager.dao.DataSourceInitializer.init(DataSourceInitializer.java:49) [DataSourceInitializer.class:?]
    at javax.servlet.GenericServlet.init(GenericServlet.java:160) [servlet-api.jar:3.0.FR]
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) [catalina.jar:7.0.47]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) [catalina.jar:7.0.47]
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) [catalina.jar:7.0.47]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176) [catalina.jar:7.0.47]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460) [catalina.jar:7.0.47]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.47]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.47]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.47]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.47]
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983) [catalina.jar:7.0.47]
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660) [catalina.jar:7.0.47]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_17]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [?:1.7.0_17]
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) [?:1.7.0_17]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_17]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_17]
    at java.lang.Thread.run(Thread.java:722) [?:1.7.0_17]
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack

    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) ~[ojdbc6.jar:11.2.0.3.0]
    at java.sql.DriverManager.getConnection(DriverManager.java:579) ~[?:1.7.0_17]
    at java.sql.DriverManager.getConnection(DriverManager.java:221) ~[?:1.7.0_17]
    at org.vibur.dbcp.pool.ConnectionFactory.doCreate(ConnectionFactory.java:139) ~[vibur-dbcp-1.1.1.jar:?]
    at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:110) ~[vibur-dbcp-1.1.1.jar:?]
    ... 25 more
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack

    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) ~[ojdbc6.jar:11.2.0.3.0]
    at java.sql.DriverManager.getConnection(DriverManager.java:579) ~[?:1.7.0_17]
    at java.sql.DriverManager.getConnection(DriverManager.java:221) ~[?:1.7.0_17]
    at org.vibur.dbcp.pool.ConnectionFactory.doCreate(ConnectionFactory.java:139) ~[vibur-dbcp-1.1.1.jar:?]
    at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:110) ~[vibur-dbcp-1.1.1.jar:?]
    ... 25 more

A: This appears to be a common problem when the Oracle database server has run out of available processes and for this reason no more new connections can be made to the server. Please check this and this link for more details.
The second link suggests that the number of processes in Oracle database can be increased via: alter system set processes=100 scope=spfile;
I am thinking that it will be best to set the number of processes in Oracle to a slightly higher number than what is the maximum number of connections which you have configured for vibur-dbcp, ie if you have configured poolMaxSize=100, then set the number of processes in Oracle to, say, 150. If more than one application connects to the same Oracle database server, you may need to multiply poolMaxSize by the number of connecting applications and then to add some spare extra 50 or 100 to it.
Please let me know whether this has helped.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to reorder lists for lists based on a certian column value? I'm reading a csv file which has data in the form.
person,1,125,321,123,532
person,1,123,521,123,632
person,10,324,345,12,456
chair,7000,123,45,12,643

I can read it with my_data = np.genfromtxt(filename,delimiter=",",dtype=None)
and then I have a ndarray.
I'd like to re order them based on their second column value.
The output should be an ndarray in the form
[
[[person,1,125,321,123,532],[person,1,123,521,123,632]]
[person,10,324,345,12,456]
[chair,7000,123,45,12,643]
]

My way is to
my_data = np.genfromtxt(filename,delimiter=",",dtype=None)
tem = []
for x in range(0,8000,22):
    fake_array=([a_value for a_value in my_data if (a_value[1]==x)])
    if (len(fake_array)>0):
        tem.append(fake_array)

This gives me the write result But I feel its a very bad way to do this.
Can anyone suggest me an optimized way to do this??
Especially cause I iterate from 0 to 8000 even though there might be only 10 values.
And nested in this iterating through all rows of the array.
I think the function numpy.unique https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html can be used as well.
I'm not sure how to implement it ?

A: You should use the python library pandas here instead of of trying to do everything in numpy (it's too low level for what you're doing). With pandas you can do want you want via:
import pandas as pd
df = pd.read_csv(file_name)
df_sorted = df.sort_values(by="col_2")

A: Just do this,
my_data = my_data[my_data[:,1].argsort()]

A: Try using the code below:
df = pd.read_csv("D:/path/test.csv",header=None,sep=',')
df=df.rename(columns={0:"Name",1:"Value1",2:"Value2",3:"Value3",4:"Value4",5:"Value5"})
df=df.sort_values(by="Value1")

You will get the output below:
    Name    Value1  Value2  Value3  Value4  Value5
0   person  1   125 321 123 532
1   person  1   123 521 123 632
2   person  10  324 345 12  456
3   chair   7000    123 45  12  643


text:
Q: In Magento 2, what is the best practice for loading some CSS for a custom widget, so that the stylesheet only loads when the widget is present? I have created a Magento 2 widget that displays a list of categories, similar to the one shown in this guide. The widget outputs the correct HTML, so now I need to add some styling to it to make it look nice.
In my reading on the internet, I have found that I can tell Magento to load a CSS file

*

*under the default layout file, which I presume will make it appear on all pages, or

*in a layout file that is specific to a single layout handle (for example, catalog_product_view).

What I am not understanding is how I can tell Magento to ONLY load that CSS file if the widget is present on a given page. Obviously, I can simply hard-code the path to a CSS file in the widget template itself, but this seems hacky. It would also mean that Magento has no way to know to compile/minify that CSS file.
I found a similar question about Magento 1, but the only answer is suggesting to do the exact thing I want to avoid: Having to hard-code the CSS include in the template file.
Disclaimer: Some of my assumptions may be incorrect, so feel free to correct me accordingly.

A: Within your custom widget module create the following file:
view/frontend/web/css/source/_extend.less

Add the following code to _extend.less:
@import 'widget/example.less';

Create your .less file here:
view/frontend/web/css/source/widget/example.less


text:
Q: How can I solve Question 8 of Edexcel IGCSE FPM Januray 2014 Paper 2? This is a question which i just can't seem to understand. For part (a) of question 8 the Mark Scheme (Answers) say 3a+3e

A: Note that $a$ is the "upwards" hypotenuse of a 30-60-90 right triangle, and $b$ is the same but downward facing. The horizontal distance traversed by $a$ (ignoring vertical displacement) is $OA/2$, same with $b$, and notice that the vertical components of $a$ and $b$ cancel each other. Therefore $a+b$ is a vector of length $OA$ in the horizontal-right direction. Since $\vec{AB}$ is a horizontal-right vector of length $2OA$, we have $\vec{AB}=2(a+b)=2a+2b$. (Thus I think the answer key is incorrect here.)


text:
Q: What is meant by "He Seconds Me"? I asked my friend to refer me to one of his friends. He replied "I referred you. He Seconds Me". Can someone tell me what is the meaning of "He Seconds Me" here?

A: From ODO:

second verb
  [with object]
  formally support or endorse (a nomination or resolution or its proposer) as a necessary preliminary to adoption or further discussion:
Bridgeman seconded Maxwell's motion calling for the reform
     express agreement with:
     her view is seconded by most Indian leaders today

"He seconds me" means either "He has formally put another referral in as well," or "He agrees with me."
Generally second as a verb is used in committees and other fora with set procedures: a motion which is to be voted on must be proposed [put forward] by its primary supporter and then seconded [openly supported]  by someone else.
There are also seconds in boxing, who second (support) each fighter.


text:
Q: In retrospect, has it been a good idea to use three-valued logic for SQL NULL comparisons? In SQL, NULL means "unknown value". Thus, every comparison with NULL yields NULL (unknown) rather than TRUE or FALSE.
From a conceptional point of view, this three-valued logic makes sense. From a practical point of view, every learner of SQL has, one time or another, made the classic WHERE myField = NULL mistake or learned the hard way that NOT IN does not do what one would expect when NULL values are present.
It is my impression (please correct me if I am wrong) that the cases where this three-valued logic helps (e.g. WHERE myField IS NOT NULL AND myField <> 2 can be shortened to WHERE myField <> 2) are rare and, in those cases, people tend to use the longer version anyway for clarity, just like you would add a comment when using a clever, non-obvious hack.
Is there some obvious advantage that I am missing? Or is there a general consensus among the development community that this has been a mistake?

A: I think the crux of the problem is that as well as "UNKNOWN" it is also used to mean "NOT APPLICABLE" or "ABSENT" e.g. You have a PERSONS table with a SPOUSE_ID. What do you put in their for a single person? In most cases a designer will make this field NULLable to be filled with the partners ID when available and left blank for sad singles and happy bachelors.
In my experience this is actually the most common use for NULLs. So while a comparison of two UNKNOWN values should result in another UNKNOWN; a comparison between two ABSENT values should result in equality -- but SQL does not allow for this.
It would have been trivial to add another extra operator (say "==") to the mass of SQL keywords and operators which would indicate you want 2 nulls to be considered equal.
While I think the relational model is sound and has a long future ahead, I think the mess that is SQL is due for a total rethink. It would be nice if we could start again from the very beginning and have an API based on Codd's original relational algebra.

A: The problem here is that NULL isn't a value--it's a nebulous set of values, and you don't know which one it is. Setting equality here is meaningless, because then the values wouldn't be NULL. It enforces the mathematical underpinnings of relational databases. In many ways, it's like asking why infinity = infinity isn't valid.

A: In your particular example, it doesn't make a big difference, but in general, this behavior is necessary for queries to give valid results.
Three-valued logic is just an instance of the more general principle that any expression which contains a NULL evaluates to NULL. E.g. NULL - 17 yields NULL.
This happens because NULL means unknown or not-applicable. Let's say you don't know the balance on a given bank account. Then you withdraw $17. What is the balance now? The only reasonable answer is "I still don't know". Giving any number would be wrong.
Even if a database does not contain any NULL's in the stored data, SQL queries can easily return unknown results. A valid query can return an empty set, and a lot of operations, like taking the MAX of a given column, will not have a meaningful result for an empty set. So NULL's are unavoidable, and you need some way to handle them which does not give you misleading output.
Eliminating three-valued logic would mean that any boolean expression would either be true or false, even if the answer is unknowable or meaningless. So you would not be able to distinguish between a valid result and an invalid result, which would make the database pretty useless (if not dangerous).

A: This seems to be a duplicate question...
https://stackoverflow.com/questions/7078837/why-doesnt-sql-support-null-instead-of-is-null
I don't think it's a mistake - this behavior is described in the ANSI standard.
Most databases allow you to change behavior of the equality operator.
set ansi_nulls on
if null = null
   print 'this will not print'
set ansi_nulls off
if null = null
   print 'this should print'

Also, you can note that many programming languages expect similar semantics when comparing objects against null.

A: TRUE and FALSE make statements about the content of a value. NULL indicates the complete absence of any value at all. If NULL behaved the same way as FALSE, then you would be unable to account correctly for the absence of data in a query, something that is very important in a database. I think that alone makes NULL different enough from TRUE/FALSE that it merits being handled specially.


text:
Q: SQLite search by month I ned to search the records based on  a month but i have no success for now, with the complete date it's ok, but searching by month it's not. Here is my helper:
    public String getSingleTransacaoSum(String date) {

    SQLiteDatabase db = this.getReadableDatabase();
    double sum = 0;

    //Cursor cursorf = db.rawQuery("SELECT * FROM " + TABLE_TRANSACOES
        //  + " WHERE data = ? ", new String[] { date });

    Cursor cursor = db.rawQuery("SELECT * FROM "+TABLE_TRANSACOES+" WHERE strftime('%m', ' DATETIME') = ?",new String[] { date });

    while (cursor.moveToNext()) {
        sum += cursor.getDouble(cursor.getColumnIndex("valor"));
    }
    cursor.close();
    return String.valueOf(sum);
}

Activity:
    btGetSum.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            try {
                dia = (String) spinDia.getSelectedItem();
                mes = (String) spinMes.getSelectedItem();
                ano = (String) spinAno.getSelectedItem();
                String dataSendTo = dia + "/" + mes + "/" + ano;

                dbhelper.getSingleTransacaoSum(dataSendTo);

                tvValor.setText("R$ "
                        + dbhelper.getSingleTransacaoSum(dataSendTo));

            } catch (Exception erro) {
                mensagemExibir("Erro Ao Buscar", "" + erro.getMessage());
            }

        }
    });

If anyone can help, thanks.

A: DATETIME is a bad name for a column, it is the name of a function.
You have to remove the column name in apostrophes strftime (...):
SELECT * FROM TABLE_TRANSACOES WHERE STRFTIME('%m', column_with_datetime) = ?

A: This should be able to be done usinga LIKE clause, IE the following
SELECT * FROM TABLE_TRANSACOES
WHERE DATETIME LIKE '%<month>%'

or in java,
db.rawQuery("SELECT * FROM "+TABLE_TRANSACOES+" WHERE DATETIME LIKE '%/"+monthYouWantToSearchFor+"/%'");

I'm assuming that DATETIME is the column you want to query.


text:
Q: JAR File sometimes runs but doesn't work, or doesn't run at all I created a GUI program that involves making many API calls in Eclipse. Works completely fine when running from Eclipse, BUT...
I exported my program as a JAR file and when I try to run it, from the terminal or from double-clicking, it throws a NoClassDefFoundError. I made sure all the packages were selected and the right Main-Class was chosen, still no luck.
I tried exporting it as a Runnable JAR file and when I double-click it, it runs and opens the GUI but doesn't work as intended. However, when I run it from the terminal, it works as intended. I have no clue why.
The error from the JAR file I get in the terminal is:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Don't really know the solution to this, as some sources online say to change things on my machine that involves admin access, which I dont have because I work on a company laptop.
For the Runnable JAR file, my GUI works as intended up until the first HttpRequest. I have to request an access token for oAuth, but my request isnt being made or something, because I'm getting a null return for which I check for.
Here is the code where that gets printed:
try {
        HttpPost request = new HttpPost(url);

        request.addHeader("Content-Type", "application/json");

        StringEntity params;
        params = new StringEntity("{\"grant_type\": \"authorization_code\","
                            + "\"client_id\": \"\","
                            + "\"client_secret\": \"\","
                            + "\"code\": \"" + code + "\"," + "\"redirect_uri\": \"\"}");
        request.setEntity(params);

        String content = execute(request, client);

        if (content != null) {
            textArea.append("Response received\n\n");
        } else {
            textArea.append("An error occurred. No response received, please restart the process.");
            return;
                    }

Just to be clear, the program works perfectly fine when running from Eclipse.
Not really sure how to fix this, if anyone has any ideas I would appreciate your help :)

A: That error means org.apache http-client library is not in the jar. Probably you have it linked in your Eclipse project, but it is not exported into the jar.
You have to create runable jar ("fat-jar")
This is Eclipse guide:

*

*From the menu bar's File menu, select Export.

*Expand the Java node and select Runnable JAR file. Click Next.

*In the Runnable JAR File Specification page, select a
'Java Application' launch configuration to use to create a runnable
JAR.

*In the Export destination field, either type or click Browse to
select a location for the JAR file.

*Select library handling strategy:
Package required libraries into generated JAR
source
If that doesn't help, please provide screenshots, how you export this jar from Eclipse, and how org.apache http-client is linked.

A: I figured out a quick fix. After exporting the Runnable JAR, create a shortcut. Right-click the shortcut and choose Properties.
Under the Shortcuts tab, look for target and change it to "C:\Program Files\Java\jdk1.8.0_192\bin\javaw.exe" -jar "C:\Users\{user}\Documents\program.jar"
So the location of your javaw.exe file, followed by -jar and then the location of the jar file.
Then hit apply and close the window. My program worked after that.


text:
Q: Ubuntu 18.10 freezes within 10 seconds after log in I have installed ubuntu 18.10 on my asus rog gl-553vd. But after logging in the display is freezing after 10 seconds.
Can you guys please help me  out?

A: The problem is the nVidia graphics card. You can fix it adding the grub config parameter nouveau.modeset=0. You can see how to do this in this video: https://youtu.be/NOg5ILhTYNY


text:
Q: A tag for plotly dash-svg? I am developing a plotly dash app using dash-svg (below),
https://github.com/stevej2608/dash-svg
I have a problem to make an htmltag for svg graph using dash-svg.
I cannot find to make an link inside the svg graph, like "https://www.google.com".
If anyone knows the answer for "Clickable svg circle", please help me...
import dash
from dash import html
from dash_svg import Svg, G, Path, Circle

app = dash.Dash(__name__)

app.layout = html.Div([
    html.Header([
        Svg([
            G([
                Path(d='...'),
                Circle(cx="420.9", cy="296.5", r='45.7'),
                Path(d='M520.5 78.1z')
            ], fill='#61DAFB')
        ], viewBox='0 0 841.9 595.3', className="App-logo", alt="logo"),
        html.P(["Edit ", html.Code("usage.py"), " and save to reload."]),
        html.A("Learn Dash", className="App-link", href="https://dash.plotly.com/",  target="_blank", rel="noopener noreferrer")
    ], className="App-header")
], className="App")

if __name__ == '__main__':
    app.run_server(debug=True)

A: You can try setting the Svg component as the children of html.A component, like this:
html.A(
            [
                Svg([
                    G([
                        Path(d='...'),
                        Circle(cx="420.9", cy="296.5", r='45.7'),
                        Path(d='M520.5 78.1z')
                    ], fill='#61DAFB')
                ], viewBox='0 0 841.9 595.3', className="App-logo", alt="logo"),

            ],
            target="_blank",href="https://google.com"
),


text:
Q: Select specific rows and columns from an MySQL database I'm currently doing a student attendance program using c# and MySQL.
I created a database called std_info where it keeps students information and there are nibm_id, nic, name,address,number,batch in that table
2nd table name is std_att to get student attendance and the columns are nibm_id, nic, name, batch
What i want is to retrive only nibm_id, nic, name, batch from std_info table to std_att
The primary key is nibm_id
here is what i was trying to do so far
cmd.CommandText = "insert into std_att (nibm_id, nic, name, batch) SELECT * (nibm_id, nic, name, batch)  FROM `std_info` where nibm_id like '" + textBox1.Text + "%'";

Please show me a way to do this. Thank You!

A: cmd.CommandText = "insert into std_att (nibm_id, nic, name, batch) SELECT nibm_id, nic, name, batch  FROM `std_info` where nibm_id = '" + textBox1.Text + "%'";

There are obviously a lot better ways to get this done, and the above is vulnerable to SQL injections etc, but I can understand if this is for a simple quick piece of work.
Like some of the users have said, don't have duplicate columns in std_att  table since they are already in the main table std_info
I would also try to find the nibm_id before the insert bit, to validate in-app and not let the db freak out on it's side (if nibm_id can't be found)


text:
Q: Origin 'null' has been blocked by CORS policy, Zuul proxy I have implemented a distributed security management for two microservices one is called policy-data-cache for storing and retreiving policies from local database and another for users and security management with JWT named user-data-cache (it plays the Zuul proxy and commons security config for all microservices simultaneously). Below my steps for implementing the previous scenario:
1) create eureka server (discovery service):
@SpringBootApplication
@EnableEurekaServer
public class ProactiveCommonsEurekaApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProactiveCommonsEurekaApplication.class, args);
    }
}

its configuration application.yml is:
server:
      port: 8761
    eureka:
      instance:
        hostname: localhost
      client:
        registerWithEureka: false
        fetchRegistry: false
        serviceUrl:
          defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

2) create eureka client for policy-data-cache microservice:
@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages = { "org.proactive.policy.data.cache", "org.proactive.utils.security" })
public class ProactivePolicyDataCacheApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProactivePolicyDataCacheApplication.class, args);
    }

    @Bean
    public CorsFilter  corsFilter() {
        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        final CorsConfiguration config = new CorsConfiguration();
        config.setAllowCredentials(true);
        config.addAllowedOrigin("*");
        config.addAllowedHeader("*");
        config.addAllowedMethod("OPTIONS");
        config.addAllowedMethod("HEAD");
        config.addAllowedMethod("GET");
        config.addAllowedMethod("PUT");
        config.addAllowedMethod("POST");
        config.addAllowedMethod("DELETE");
        config.addAllowedMethod("PATCH");
        source.registerCorsConfiguration("/**", config);
        return new CorsFilter(source);
    }

}

its controller is:
@RestController
public class PolicyController {

    @Autowired
    PolicyService policyService;

    @Autowired
    PolicyRepository policyRespository;

    @RequestMapping("/getPolicy")
    public List<PolicyDto> getPolicy() {
        return policyService.findAll();
    }

}

its configuration file is:
spring:
  profiles: default
  mvc:
      dispatch-options-request: true
eureka:
  client:
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

server:
  port: 8082

3) create the zuul proxy in user-data-cache microservice:
@SpringBootApplication(scanBasePackages = {"org.proactive.user.data.cache", "org.proactive.security.config" ,"org.proactive.utils.security"})
@EnableDiscoveryClient
@EnableZuulProxy
@RefreshScope
public class UserDataCacheApplication {

    public static void main(String[] args) {
        SpringApplication.run(UserDataCacheApplication.class, args);
    }

    @Bean
    public CorsFilter  corsFilter() {
        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        final CorsConfiguration config = new CorsConfiguration();
        config.setAllowCredentials(true);
        config.addAllowedOrigin("*");
        config.addAllowedHeader("*");
        config.addAllowedMethod("OPTIONS");
        config.addAllowedMethod("HEAD");
        config.addAllowedMethod("GET");
        config.addAllowedMethod("PUT");
        config.addAllowedMethod("POST");
        config.addAllowedMethod("DELETE");
        config.addAllowedMethod("PATCH");
        source.registerCorsConfiguration("/**", config);
        return new CorsFilter(source);
    }
}

its configuration file is:
server:
  port: 8083
eureka:
  client:
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

compression:
    enabled: true
    mime-types: application/json,text/css,application/javascript
    min-response-size: 2048

zuul:
  ignoredServices: '*'
  ignored-headers: Access-Control-Allow-Credentials, Access-Control-Allow-Origin
  routes:
    policies:
      path: /policy/**
      service-id: policy-data-cache
      sensitiveHeaders: Cookie,Set-Cookie,Authorization

spring:
    mvc:
      dispatch-options-request: true

# Increase the Hystrix timeout to 60s (globally)
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 60000

At the end when I type http://localhost:8083/policy/getPolicy and put Bearer token on Authorization header in postman I get this error:
{
    "timestamp": "2018-11-13T15:22:46.634+0000",
    "status": 401,
    "error": "Unauthorized",
    "message": "Unauthorized",
    "path": "/getPolicy"
}

and when I'd like display policies list and parse them in a browser, I get this error:
OPTIONS http://desktop-556u68e.mshome.net:8082/login 401
Access to XMLHttpRequest at 'http://desktop-556u68e.mshome.net:8082/login' (redirected from 'http://localhost:8083/policy/getPolicy') from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status

The whole error in Zuul proxy (user-data-cache) is traced as below:
com.netflix.zuul.exception.ZuulException: Forwarding error
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:191)
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:166)
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:114)
    at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:117)
    at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193)
    at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157)
    at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:118)
    at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96)
    at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116)
    at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81)
    at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:165)
    at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequest(ZuulController.java:44)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.proactive.security.config.JwtAuthenticationFilter.doFilterInternal(JwtAuthenticationFilter.java:80)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:155)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:123)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: policy-data-cache
    at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127)
    at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73)
    at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45)
    at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)
    at rx.Subscriber.setProducer(Subscriber.java:209)
    at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138)
    at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.subscribe(Observable.java:10423)
    at rx.Observable.subscribe(Observable.java:10390)
    at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)
    at rx.observables.BlockingObservable.single(BlockingObservable.java:340)
    at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112)
    at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:186)
    at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:51)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
    at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10327)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.subscribe(Observable.java:10423)
    at rx.Observable.subscribe(Observable.java:10390)
    at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:51)
    at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:410)
    at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:378)
    at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:344)
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:161)

Please any help is very appreciated thanks in advance for your
contribution.

A: i think error is when you access url 'http://desktop-556u68e.mshome.net:8082/login' response code is 401.
so you should config Security login page is permitAll.
some config code, please foucs configure(HttpSecurity http) method
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

    @Nonnull
    private final AdminRepository adminRepository;

    /**
     * Http安全配置
     *
     * @param http Http安全
     */
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.formLogin().loginPage("/login").permitAll().and().authorizeRequests().anyRequest().authenticated();
    }

    /**
     * 添加视图控制器
     *
     * @param registry 视图控制器注册
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("login");
    }

    /**
     * 用户详情服务
     *
     * @return 用户详情服务
     */
    @Bean
    public UserDetailsService userDetailsService() {
        return new AdminService(adminRepository);
    }

}
``


text:
Q: preg_replace proper regex for repeating character OK I'm stuck again, this time it's a problem with the regex... Was searching google, was searching SO, but there wasn't a post that made me happy... So to make a long story short:

*

*§text = Database entry string -> could be everything

*$text gets parsed and the regex should replace everything between 2 * with:
[bla].$matchedtext.[blub]
So I've tried to find the right regex for that and that's what I came up with:
$text= preg_replace('~(/\*([^\"]*?)\*/)~', "$1$2", $text);

And the 2 * per match should disappear as well :/...
Obviously it doesn't work, elsewhise I wouldn't post :D -> Any ideas?

A: This should probably do it:
preg_replace('/\*([^"*]*)\*/', '\1', $text);

A few comments on your earlier regular expression:
[^\"]*?

The non-greedy * is not necessary; when you're looking at a negative character set, simply add the '*' inside the character set. Also, the double quote doesn't need escaping.
[^"*]*

You only need memory groups for things you wish to remember; in your case, you don't want to know that you matched a beginning and ending asterisk. So you can do your whole matching with just one memory group.


text:
Q: Extract xhtml styles to css? I'm about to update one of my old projects.
I was using mixed css files and inline style properties. A lot of <h:form style="display:inline-block;" /> <h:outputText style="text-size: 1.1em" /> and so on.
What is the best way to factor all these styling statements out into a css file? To having no more styling definitions in the xhtml pages.
Or is there already a tool capable of?
ty

A: I dont know whether this will work correctly but here it is,
http://lab.xms.pl/css-generator/

A: Here is a tool that could help you. In any case you gonna have to check by yourself the generated style sheet if everything is correct, as errors can easily be created with this kind of tool.


text:
Q: In ggplot2, How can I fully present my ylab which has been partly blocked by the y-ticks? Here is my original question:
In ggplot2, how can I set y-labs separately for double-panel plots?
**And after I used the method given by "baptiste", which is also the correct anwser, and as soon as I change the word size bigger, part of the word has been curtained by the panel's white margin, so, how to fix this problem? **
Here is the code revised of his code:
g = ggplotGrob(p)
g = gtable_add_grob(g, list(textGrob("upper panel", just = "top", rot=90, gp=gpar(fontsize=20)),

                         textGrob("lower panel", just = "top", rot=90, gp=gpar(fontsize=20))),

                         t = c(3,5), l = 1)
g$widths[[1]] = unit(1, "line")
grid.newpage()
grid.draw(g)

Here is the plot:

A: Well, when you're changing fontsize like that, try making the width wider. Or in this case, set it to a proportion of the grobheight
g = ggplotGrob(p)
g = gtable_add_grob(g,
    ng<-list(textGrob("upper panel", just = "top", rot=90, gp=gpar(fontsize=20)),
    textGrob("lower panel", just = "top", rot=90, gp=gpar(fontsize=20))),
    t = c(3,5), l = 1
)
g$widths[[1]] = unit(.5, "grobheight", ng)
grid.newpage()
grid.draw(g)


text:
Q: Heap Sort : how to correct my coding and to implement my logic? for an array input 2 5 8 3 4 6
i am getting 2 4 5 3 8 6
i am trying to implement heap sort and i am a beginner and i don't know what error comes here and i am simply trying to implement the logic of heap sort just by building a heap and interchanging the last element with the the largest first index element and thereby decreasing the size of the array.
  #include<stdio.h>
  #include<conio.h>

to build a get the highest element in the starting index
  heapify(int *a,int i,int no)
  {

      int largest = i;
      int left = 2*i;
      int right = 2*i+1;
      if(left<=no && a[left]>largest)
      {
        largest=left;
      }

      if(right<=no && a[right]>largest)
      {
          largest=right;
      }

      if(largest!=i)
      {
          int temp=a[largest];
          a[largest]=a[i];
          a[i]=temp;
          heapify(a,largest,no);
      }
  }

to heap sort the elements in the array and
  heapsort(int *a,int no)
  {
      while(no>1)
      {
          int temp=a[1];
          a[1]=a[no];
          a[no]=temp;
          --no;
          heapify(a,1,no);
      }
  }

to print the lements in the array
  printarr(int *a,int no)
  {
      int i=1;

      for(;i<=no;i++)
          printf("%d",a[i]);
  }

this is the main function.
  int main()
  {
      int i,j,k,no,size;

      printf("Enter the no of elements");
      scanf("%d",&no);
      int a[no+1];
      size=no;

      for(i=1;i<=no;i++)
      {
        scanf("%d",&a[i]);
      }

      printarr(a,no);
      j=no/2;

      for(i=j;i>0;--i)
      {
        heapify(a,i,no);
      }

      heapsort(a,no);
      printarr(a,no);

      getch();

      return 0;
  }

A: You are comparing the index with array value in heapify function
 if(left<=no && a[left]>largest)

and
if(right<=no && a[right]>largest)

This shuold be
 if(left<=no && a[left]>a[largest])

and
if(right<=no && a[right]>a[largest])


text:
Q: How to get the current value and update the state (Object) of a Parent component in Children component I have this state in my Parent component
const [formData, setFormData] = useState({
    firstName: "",
    middleInitial: "",
    lastName: "",
    imageFile: "",
    extension: "",
    mobileNumber: "",
    email: "",
    agreement1: false,
    agreement2: false,
    agreement3: false,
  });

and I pass it into the Child Component as a props but having an issue changing the value of agreement1 , agreement2 and agreement3 which is a Boolean
 setFormData({ ...formData, firstName: e.target.value })

This is the code in the Child Component to update the state into the Parent Component and it works perfectly fine. but when I try to update the Boolean I don't know how to access the previous boolean value before updating it.
I want to do something like this.
setBooleanValue((prevVal)=> !prevVal)

so every time I click on it . I toggle the value of the boolean
setFormData({...formData,agreement2: (prevVal) => !prevVal})

I try this but it doesn't work as expected

A: you can try using the state update function as below:
setFormData((prev) => ({...prev,agreement2: !prev.agreement2}))


text:
Q: Qt (C++): Get QProcess stdout and stderr separately I want to get the stderr of a QProcess (ideally as a QIODevice), but I can't figure out how. Another thread is reading from stdout using the methods QProcess inherits from QIODevice, so QProcess::MergedChannels and QProcess::setReadChannel(...) are out of the question. QProcess::readAllStandardError() is also not ideal.

A: You have to connect some slot to readyReadStandardError() signal of QProcess to read data by QProcess::readAllStandardError() and be store it for concatenation, in addition to finished() signal to make concluding calls, similar to how you would do that for standard output.
connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(readErrData()));
connect(&process, SIGNAL(finished(int , QProcess::ExitStatus)),
         this, SLOT(finalizeProcessTask(int , QProcess::ExitStatus)));


text:
Q: how to create presence/absence data frame with data of columns? I have a data frame similar to
df <- data.frame(sp1=c("e1", "e2", "e4"), sp2=c("e1", "e3", "e4"), sp3=c("e2", "e3", "e5"))

  sp1 sp2 sp3
1  e1  e1  e2
2  e2  e3  e3
3  e4  e4  e5

So I want to construct a data frame of presence (1)/absence (0) similar to:
   sp1 sp2 sp3
e1  1   1   0
e2  1   0   1
e3  0   1   1
e4  1   1   0
e5  0   0   1

in this case all the sp elements has the same length, but in the real data could be that some columns present less or more elements: sp4=c("e1", "e3")
how can I construct the data frame (or matrix) ?
thanks so much !!

A: You can extract the unique levels from the data and use sapply with table.
lvls <- sort(unique(unlist(df)))
sapply(df, function(x) table(factor(x, lvls)))

#   sp1 sp2 sp3
#e1   1   1   0
#e2   1   0   1
#e3   0   1   1
#e4   1   1   0
#e5   0   0   1

A: Here is an alternative tidyverse way without pivot_longer
library(dplyr)
library(tidyr)
df %>%
  mutate(x = paste(sp1, sp2, sp3, sep = ", ")) %>%
  separate_rows(x) %>%
  mutate(across(starts_with("sp"), ~ifelse(. == x, 1, 0))) %>%
  group_by(x) %>%
  slice(1) %>%
  column_to_rownames("x")

   sp1 sp2 sp3
e1   1   1   0
e2   0   0   1
e3   0   1   1
e4   1   1   0
e5   0   0   1

A: We could use mtabulate
library(qdapTools)
t(mtabulate(df))
   sp1 sp2 sp3
e1   1   1   0
e2   1   0   1
e3   0   1   1
e4   1   1   0
e5   0   0   1

A: A tidyverse approach:
Data
df <- data.frame(sp1=c("e1", "e2", "e4"), sp2=c("e1", "e3", "e4"), sp3=c("e2", "e3", "e5"))

Libraries
library(tidyverse)

Code
df %>%
  pivot_longer(cols = everything()) %>%
  #This separate if you have more than one value inside the cell
  separate_rows(value,sep = ",") %>%
  #Auxiliary variable
  mutate(aux = 1) %>%
  pivot_wider(names_from = name,values_from = aux) %>%
  replace(is.na(.),0)

Result
# A tibble: 5 x 4
  value   sp1   sp2   sp3
  <chr> <dbl> <dbl> <dbl>
1 e1        1     1     0
2 e2        1     0     1
3 e3        0     1     1
4 e4        1     1     0
5 e5        0     0     1

A: A way will be to use %in%.
x <- sort(unique(unlist(df)))
data.frame(+sapply(df, `%in%`, x=x), row.names = x)
#   sp1 sp2 sp3
#e1   1   1   0
#e2   1   0   1
#e3   0   1   1
#e4   1   1   0
#e5   0   0   1


text:
Q: jQuery: passing a variable to a click hander for dynamically created DOM element I am attempting to attach an event handler to a dynamically created DOM element in the following way:
var createdElement = $('<a>', {
    click: function (data) {
        alert("click");
    }
});

This works as expected, but now I want to pass a variable to the click function. Can anyone suggests how to do this.

A: Thecodeparadox's answer works in the general case, but always passes the same value to the click handler, regardless of the <a> element on which it was triggered.
If you want the value to depend on the clicked element, you can call on() on the element itself:
var createdElement = $("<a>").on("click", {
    yourData: "something"
}, function(event) {
    alert("Data is " + event.data.yourData);
}).appendTo("body");

However, the code above uses a different syntax than the one in your question. If you want to keep defining the click handler in a property/event map, you can use data() to associate a value with the element once and for all:
var createdElement = $("<a>", {
    click: function() {
        alert("Data is " + $(this).data("yourData"));
    }
}).data("yourData", "something").appendTo("body");

(Note that I added calls to appendTo("body") so the new element becomes part of the DOM and the click event gets a chance to be triggered. Feel free to ignore this if you're adding the element to the DOM later in your code.)


text:
Q: Smalltalk user defined subclass issue. I have created a class named animal and I want to create two subclasses of that class I just created lynx and rabbit. However when ever I try to compile the program I get the following error on the line where I define my first subclass of animal, lynx:
Object: #lynx error: did not understand #lynx
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
Symbol(Object)>>doesNotUnderstand: #lynx (SysExcept.st:1407)
UndefinedObject>>executeStatements (newanimal.st:121)
Object: nil error: did not understand #comment:
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #comment: (SysExcept.st:1407)
UndefinedObject>>executeStatements (newanimal.st:123)
newanimal.st:125: key lynx not found
newanimal.st:125: expected Eval, Namespace or class     definition
newanimal.st:134: expected Eval, Namespace or class definition
newanimal.st:137: expected expression

I define the lynx subclass right after I have defined animal which is a subclass of object. Here is my code for both classes.
Object subclass: #animal .
animal instanceVariableNames: ' animals '.
animal class instanceVariableNames: ' id type '.
animal comment: 'I am the class for all animals' .

animal class extend [
    create: type [
        (animals := nil) ifTrue: [ self init ].
        (type == 'rabbit') ifTrue: [animals := rabbit new] .
        (type == 'lynx') ifTrue: [animals := lynx new] .
        ^ animals .
    ]
    getid ["returns the animals unique id"
        | tempAnimal temp |
        tempAnimal := grid asArray at: 'id' .
        "temp :=  ."
    ]
    getrow: id ["returns the animals grid row"
        | tempAnimal temp |
        grid do: [:each |
            tempAnimal := grid at: each .
            (tempAnimal at: id == id) ifTrue: [temp:= tempAnimal at: 'row'. ^ temp ] . ]

    ]
    getcol: id ["returns the animals grid col"
        | tempAnimal temp |
        grid do: [:each |
            tempAnimal := grid at: each .
            (tempAnimal at: id == id) ifTrue: [temp:= tempAnimal at: 'col'. ^ temp ] . ]

    ]
    getdirection: id ["returns the animals movement direction"
        | tempAnimal temp |
        grid do: [:each |
            tempAnimal := grid at: each .
            (tempAnimal at: id == id) ifTrue: [temp:= tempAnimal at: 'direction'. ^ temp ] . ]
    ]
    setdirection ["sets animals movement direction"
        | direction |
        direction := grid rand .
        ^ direction .
    ]
]
animal extend [
    init [
        animals := Dictionary new.
    ]
]

#animal subclass: #lynx
lynx instanceVariableNames: ' direction '.
lynx class instanceVariableNames: ' lynxdictionary '.
lynx comment: 'I am the subclass of animal that is lynxs' .

lynx class extend [
    new [
        lynxdictionary := Dictionary new .
        lynxdictionary add: 'type' -> 'lynx' .
        direction := animal setdirection .
        lynxdictionary add: 'direction' -> direction .
        lynxdictionary := grid placerow:lynxdictionary .
        ^ lynxdictionary .
    ]
    act [
        | row col tempAniaml |
    ]
]

A: Expanding on Uko's comment:
The compiler can probably not tell that animal is a class because the name is not capitalized. Instead, the compiler thinks it's a variable name. That variable looks to be uninitialized and is therefore nil. That's why you're getting a MessageNotUnderstood exception for the message send #lynx.

A: You are missing a period:
#animal subclass: #lynx. "<---- added period here"
lynx instanceVariableNames: ' direction '.

Your previous code:
#animal subclass: #lynx
lynx instanceVariableNames: ' direction '.

could be rewritten as:
#animal subclass: #lynx lynx instanceVariableNames: ' direction '.

Hence the error stating that the Symbol #lynx did not understand the #lynx message


text:
Q: windows nodejs child_process exec echo always print childProcess instance like this:

I has try with cmd.exe, powershell.exe, git-bash.exe, both of them have this behavior. Why?

A: If evaluated REPL input is an expression, evaluated result is printed in console, otherwise undefined is printed.
As the reference states, childprocess_exec() returns child process object:

Returns: <ChildProcess>


text:
Q: Android:Sqlite insertion of hardcoded data I have insert two fields namely truck_id and employee_id in a table.
Sorry to ask this question. But as I am new to android,please help me out.
public void insert(String[] employeeName,int[] truck_id){

    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues vals = new ContentValues();

    vals.put(COLUMN_TRUCKID, "CM-3456");
    vals.put(COLUMN_NAME,"Sachin");
    //vals.put(KEY_PIN, "12345");

    vals.put(COLUMN_TRUCKID, "HR-6788");
    vals.put(COLUMN_NAME,"Sameer");
    //vals.put(KEY_PIN, "54321");

    vals.put(COLUMN_ID, "AM-6123");
    vals.put(COLUMN_NAME,"Sahu");
    //vals.put(KEY_PIN, "3452");

    db.insert("Login", "John",
            vals);
    db.insert("Login", "Sameer",
            vals);

    db.execSQL(COLUMN_NAME);

    //myDataBase.close();
}

A: ContentValues is a Map, so it can only contain one entry at a time for each column name. So, you need to insert each item separately after settings its values.
vals.put(COLUMN_TRUCKID, "CM-3456");
vals.put(COLUMN_NAME,"Sachin");
db.insert("Login", null, vals);

vals.put(COLUMN_TRUCKID, "HR-6788");
vals.put(COLUMN_NAME,"Sameer");
db.insert("Login", null, vals);

Remove this line, or else bad things will happen:
db.execSQL(COLUMN_NAME);


text:
Q: Merging plots in TikZ Is there a way to get the second plot at position "HERE" of the first plot?
MWE:
\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}

%% First plot
\begin{tikzpicture}[scale=1.5, domain=0:2*pi]
    \draw[very thin,color=gray] (0, 2*pi);
     \draw[->] (0,0) -- (2*pi,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$y$};
    \draw[color=blue]   plot (\x,{sin(\x r)});
    \node[below left, red] at (0, -1.2) {HERE};
\end{tikzpicture}

% Second plot
\begin{tikzpicture}[scale=1.5, domain=0:2*pi, rotate=-90]
    \draw[very thin,color=gray] (0, 2*pi);
    \draw[->] (0,0) -- (2*pi,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$y$};
    \draw[color=blue]   plot (\x,{cos(\x r)});
\end{tikzpicture}

\end{document}

A: Not an answer to the direct question but a simple illustration for mapping sine/cosine values using sin and cos paths.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}

\foreach \x in {-pi/2,0,pi/2}{
\draw[dashed,red!30] (\x,0) -- ++(0,2*pi);
\draw[dashed,red!30] (0,-\x) -- ++(-2*pi,0);
}

\draw (0,0) circle (pi/2);
\begin{scope}[shift={(-pi/2,1.5*pi)}]
\draw (0,0) node[left] {0}-- (pi,0) (0,1) node[left] {1};
\draw[ultra thick,blue] (pi,1) cos (pi/2,0) sin (0,-1) node[left] {-1} ;
\end{scope}

\begin{scope}[rotate=-90,shift={(-pi/2,-1.5*pi)}]
\draw (0,0) node[above] {0}-- (pi,0) (0,-1) node[above] {-1};
\draw[ultra thick,blue] (0,1) node[above] {1} cos (pi/2,0) sin (pi,-1);
\end{scope}

\end{tikzpicture}
\end{document}

I don't know the actual intention but it can be furnished by putting arbitrary points on the circle and lines can be extended to intersect the curves etc.

A: You can put the second plot in a scope within the first tikzpicture and shift it to where you'd like it. The shifting values should probably be adjusted, I don't know exactly how you want it. By rotating around the origin, it is perhaps easier to find out the shifting values.
There's a problem with the bounding box though, a lot of empty space is added above the plot. You can fix that by saving suitable coordinates for the corners, reset the bounding box, then use the saved coordinates to define a new bounding box.
\documentclass[12pt,border=2mm]{standalone}
\usepackage{tikz}

\begin{document}

%% First plot
\begin{tikzpicture}[scale=1.5, domain=0:2*pi]
    \draw[very thin,color=gray] (0, 2*pi);
     \draw[->] (0,0) -- (2*pi,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$y$};
    \draw[color=blue]   plot (\x,{sin(\x r)});
    \node[below left, red] at (0, -1.2) {HERE};

% Second plot
\begin{scope}[rotate around={-90:(0,0)},shift={(1.2cm,0)}]
    \draw[very thin,color=gray] (0, 2*pi);
    \draw[->] (0,0) -- (2*pi,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$y$};
    \draw[color=blue]   plot (\x,{cos(\x r)});
\end{scope}

\coordinate (upperright) at (7,2);
\coordinate (lowerleft) at (current bounding box.south west);
\pgfresetboundingbox
\useasboundingbox (upperright) rectangle (lowerleft);

\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{document}

A similar result can be obtained by switching the x- and y-coordinates in the plot, and changing the drawing of the axis. Some bounding box juggling was required here as well.
\documentclass[12pt,border=2mm]{standalone}
\usepackage{tikz}

\begin{document}

%% First plot
\begin{tikzpicture}[scale=1.5, domain=0:2*pi]
    \draw[very thin,color=gray] (0, 2*pi);
     \draw[->] (0,0) -- (2*pi,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$y$};
    \draw[color=blue]   plot (\x,{sin(\x r)});
    \node[below left, red] at (0, -1.2) {HERE};

% Second plot
\begin{scope}[yshift=-1.2cm]
    \draw[very thin,color=gray] (-2*pi,0);
    \draw[->] (0,0) -- (0,-2*pi) node[right] {$x$};
    \draw[->] (-1.2,0) -- (1.2,0) node[above] {$y$};
    \draw[color=blue]   plot ({cos(\x r)},-\x);
\end{scope}

\coordinate (upperleft) at (-1.5,2);
\coordinate (lowerright) at (current bounding box.south east);
\pgfresetboundingbox
\useasboundingbox (upperleft) rectangle (lowerright);

\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{document}


text:
Q: Javascript: how to get nested JSON {
"category": [
    {
        "category_id": "1",
        "category_name": "Editor's Choice ",
        "cover_url": "http://www.example.com"
    },
    {
        "category_id": "2",
        "category_name": "New Releases",
        "cover_url": "http://www.example.com"
    }
],
"success": 1

}
The problem is that i'm scraping with nodejs an html page from my local cinema website, i have 3 arrays (ar1,ar2,ar3) which cointain titles of the film programmed from now to the next three days.
i'm using this way to get the json (this is only for one day), that is the "heart" of the function, where i generate the array that will be strigify then:
            var len = titolo1.length;
            while(j!=len){
                obj1={titolo:titolo1[j],locandina:film1[j]};
                js[j]=obj1;
                j++;
            }

then  in other point of server code (out of function!) i do  res.send(JSON.stringify(js, null, 4))
and this is the result:
[
{
    "titolo": " The Gunman ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/RIBqwqVPwUp6VIWeRZlS-150x214.jpg"
},
{
    "titolo": " Doraemon il film ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/doraemon-il-film-le-avventure-di-nobita-e-dei-cinque-esploratori_notizia-2-150x214.jpg"
},
{
    "titolo": " Child 44 – Il bambino numero 44 ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/Child-44-trailer-italiano-e-locandina-del-thriller-con-Gary-Oldman-e-Tom-Hardy-2-150x214.jpg"
},
{
    "titolo": " Run All Night – Una notte per sopravvivere ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/locandina2-150x214.jpg"
},
{
    "titolo": " Ritorno al Marigold Hotel ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/36366-150x214.jpg"
},
{
    "titolo": " I 7 nani ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/xHIrTDXTLZF1jBd7CQNf-150x214.jpg"
},
{
    "titolo": " Adaline – L'eterna giovinezza ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/adaline-poster-150x214.jpg"
},
{
    "titolo": " Avengers: Age of Ultron – 2D ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/ultron.poster-2-150x214.jpg"
},
{
    "titolo": " Fast and Furious 7 ",
    "locandina": "http://www.metropoliscinemas.it/wp-content/uploads/49946-150x214.jpg"
}

]
now, i'd like to reach this type of json:
{
"day1": [
    {
        "title": "blablablalbal",
    },
    {
        "title": "blablablalbal",
    }
],
"day2": [
    {
        "title": "blablablalbal",
    },
    {
        "title": "blablablalbal",
    }
],
"day3": [
    {
        "title": "blablablalbal",
    },
    {
        "title": "blablablalbal",
    }
]

}
how can i do that?
Sorry for my english.

A: Marco -
If you will always have 3 arrays, the simple answer is:
var films = {day1: ar1, day2: ar2, day3: ar3};
res.send(JSON.stringify( films, null, 4 ));

You could also write a simple function to join and name the data. Run the example below to test.
If this is not what you want then please provide more information.
Example:

Calendario Eventi

   <textarea id="stdout" style="width:90%;height:20em;padding:1em;border:1px black solid;background-color:aliceblue;"></textarea>


text:
Q: how to Start exe with elevated rights when domain user logs in I need to start a windows forms application with admin rights whenever a domain user logs in.
I am trying to start the application with service and task scheduler but the application UI does not show up. However I can see it running in the task manager. and if I add a timer and terminate the app. it terminates after correct interval as well.
Can someone help me on how to develop/deploy an application so that it shows "the UI" when whenever any user logs in to the machine. should I add some registry entry that will start me application or is there any other way to achieve this..

A: To check if user has logged in into a domain, you can use
System.Security.Principal.WindowsIdentity.GetCurrent.Name which gives you "domain\username".
and for starting your application once user logged in, you have to run your program at start up, try this link.
And to run your app at startup using group policy (recommended) try this.

A: It seems to me that when the user logs in, the task does not really work because there are not enough rights. Try it like this:
you need to create a new task that simply launches the program you want to use without UAC dialogs. When creating this task, in the General tab, enter the name of the task (remember this name, you will need it later) and check the box that says "Run with highest privileges - Run with highest privileges". This puts the task to run with administrator rights.
To make sure there are no compatibility issues, go to the "Configure for" drop-down list at the bottom of the Create Task window and select Windows ® 7, Windows Server ™ 2008 R2.
On the Actions tab - Actions, you need to create an action that launches the program. Everything is very simple here: select the action "Start a program", specify the path to the program that will be executed, and click OK.
Your last stop is on the Settings tab. Here you need to make sure that the checkbox "Allow task to be run on demand" is checked. Also, make sure that when the task is already running, another instance will not be started by choosing the option "Do not start a new instance"
The second step in this procedure is to create a shortcut that launches the task you just created, which in turn launches the program of your choice without the UAC line appearing.
An important difference when creating a shortcut to a task compared to a normal shortcut on the desktop is to enter schtasks / run / tn Task Name - Schtasks / run / tn "Task Name" (Task Name must be replaced with the actual task name) in the Item Location field. In this command, the / Run parameter simply performs a specific task, and / tn allows you to enter the name of the task you want to run.
Once the shortcut is created, if you click on it, it will work like the task you created, and this in turn launches the program specified with administrator rights, but without UAC.
Thus, you can create a task to run the created shortcut.


text:
Q: Amount of current after DC/DC conversion for PC/104 Let say I have a AC to DC adapter with output 19V 7.9A connected to a 150W DC to DC power supply board (PC/104) with input 14-30V and output 5V.
What is amount of current I'll get from the 5V output board? Is it 150W/5V = 30A or 7.9A?
Sorry if this is so primitive question but I can't find corresponding reference.

A: It'll probably be more on the order of 135W out, or 27A @ 5V, since the first supply is only capable of 150W, and the DC-to-DC converter's efficiency is going to be on the order of 90%.

A: The AC/DC and DC/DC will only draw what current they need.
Take the current for the PC/104 board, call it x.
x × 5 V is its power.
Divide by 90% (as Dave Tweed said) to get input power to the input power to the DC/DC.


text:
Q: How can I update component value in controller or route with ember? My click-editable component like:
Template:
{{#if isEdit}}

    {{input type="text" value=editValue class="form-control"}}

      <button type="button" class="btn no-margin-btn btn-info" {{action "updateValue"}}>{{fa-icon 'check'}}</button>

{{else}}
  ....
{{/if}}

And:
export default Ember.Component.extend({
  tagName: "",
  isEdit: false,
  canEdit: true,
  category: 'input',
  editValue: Ember.computed.oneWay('value'),

  actions:{
    updateValue() {
      this.sendAction('onUpdate', this.get('valueModel'), this.get('valueColumn'), this.get('editValue'), this.get('isEdit'));
    }
  }
});

Use in my template:
{{#each model.quotationWorkItems as |quotationWorkItem index|}}
  {{click-editable valueModel=quotationWorkItem valueColumn='name' value=quotationWorkItem.name onUpdate=(action "updateInput")}}
{{/each}}

In the controller:
import Ember from 'ember';

export default Ember.Controller.extend({
  ....

  actions: {
    updateInput(updateModel, updateColumn, value, isEdit) {
      updateModel.set(updateColumn, value);
      updateModel.save().then(()=> {
        this.get('model').reload();
        this.set('isEdit', false);
      }, ()=> {
        alert('wrong');
      });
    }
  }
})

Route:
import Ember from 'ember';

export default Ember.Route.extend({
  ...

  model(params) {
    return this.store.find('quotation', params.quotation_id);
  },

  setupController(controller, model) {
    controller.set('model', model);
    ...
  }
})

Quotation model:
import DS from 'ember-data';

export default DS.Model.extend({
  quotationStocks: DS.hasMany('quotationStock'),
  quotationWorkItems: DS.hasMany('quotationWorkItem'),
  ...
});

QuotationWorkItem model:
import DS from 'ember-data';

export default DS.Model.extend({
  transactionType: DS.belongsTo('transactionType'),
  quotation: DS.belongsTo('quotation'),

  ...
});

This code can update model value, but problem isEdit is the component value. When isEdit send to controller and set another value, it can not work. So I think can not change component value in ember controller?
this.set('isEdit', false);

The code can not work in controller. I'm using Ember 2.4.0.

A: You need to bind the controller isEdit property to the component isEdit property.
{{click-editable isEdit=isEdit valueModel=quotationWorkItem valueColumn='name' value=quotationWorkItem.name onUpdate=(action "updateInput")}}

This will overwrite the isEdit property in the component (data down).


text:
Q: ASP MVC Controller Method not always called from $.getJSON request I have a controller method that returns a jSON object and in one calling situation, it works and in another calling situation, it does not work. When the URL in my browser is this:
http://localhost:65247/Client -- it works.
But, when my url looks like this:
http://localhost:65247/Client/UserAdmin?id=6 -- it DOES NOT work
In a nutshell, clients have users. From within the client, I wish to work on a specific user (this is the UserAdmin view). In this case, the client id is 6. From within the UserAdmin view that was launched with Id=6, I then wish to select a user from a dropdown. The idea was to use javascript and $.getJSON to fetch data for the specific user so as not to have to refresh the entire page. I use this approach in other parts of the app. The only difference I can see is with the URL in the browser. It would appear the presence of parameters via the '?' is futzing things up a bit.
Any ideas??
Thanks in advance.
John

A: It is probably a routing issue. Your url need to match a route to work (else the framework doesn't know what action to execute). If you only have the default route your url should be: http://localhost:65247/Client/UserAdmin/6.
My suggestion would be to use the built-in helpers to generate your urls. Then you don't have to change anything if you change your routes. You can use the url helpers like this:
<%=Url.Action("ActionName", "ControllerName")%>


text:
Q: CodeDomProvider failed to resolve my assemblies in website Bin folder when dynamically compiling code All,
I have asp.net website and in my bin folder I have all neccessary assemblies that my dynamically compiled code references. I compile my code at run time using CodeDomProvider.
When I compile my expression with the following line
compiler.CompileAssemblyFromSource(expr);

I get an error: Metadata file 'NHibernate.dll' could not be found, although that assembly is in the bin folder.
NOTE: I have similar code that works in a windows app, if not identical.
Here's my code:
        CodeDomProvider compiler = _GetCompiler();
        CompilerParameters compilerParams = _GetCompilerParams();
        CompilerResults results = compiler.CompileAssemblyFromSource(compilerParams, expr);
        if (results.Errors.Count > 0)
            throw new InvalidOperationException("Failed to compile criteria expression for the following reason: " + _GetAllCompilerErrors(results.Errors));

private CodeDomProvider _GetCompiler()
    {
        Dictionary<string, string> providerOptions = new Dictionary<string, string>();
        providerOptions.Add("CompilerVersion", "v2.0");

        CodeDomProvider compiler = new CSharpCodeProvider(providerOptions);
        return compiler;
    }

    private CompilerParameters _GetCompilerParams()
    {
        CompilerParameters compilerParams = new CompilerParameters();
        compilerParams.GenerateInMemory = true;
        compilerParams.GenerateExecutable = false;
                    compilerParams.ReferencedAssemblies.AddRange(new string[] {
            "System.dll",

            "NHibernate.dll",
        });
        return compilerParams;
    }

A: I was also having the same problem just solve it by adding the explicitly the
 bin folder in path
instead of "NHibernate.dll"   use like below :
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)+ "\\NHibernate.dll")

it will now look for the "NHibernate.dll" in the bin directory the same worked for me
i Hope it will work for you also


text:
Q: link_to get rails error: wrong number of arguments (1 for 0) I am using a simple link_to which we use always in my rails app but it is giving this error.
wrong number of arguments (1 for 0)
My code in view.
<%= link_to category.name store_path %>

The path is correct when running in the url and also in the console.
2.2.3 :003 > app.store_path
=> "/store"

I don't understand why this picking up an argument over here.

A: you are missing ,
<%= link_to category.name, store_path %>


text:
Q: Probability of the score of two rolls I have a probability problem and this is the request:
What is the probability that the score of the first roll is higher than the score of a second roll. The rolls are equilibrated and independent. (I think one per time)
I have solved this problem with this method: $P(X>Y)=P(X-Y>0)= \frac{15}{36}$ with the help of a grid with all the possible $X-Y$ scores.
Is this a good way of resolution? If not, help me with a good method.
Thank you

A: There is no problem with your solution; enumeration is a terrific technique and sometimes it's all there is.  If you want a method that can handle a large number of cases better:
The probability of a tie is $\frac 16$.  If we aren't in a tie then $P(X>Y)=P(Y>X)$ by symmetry.  Thus $$P(X>Y)=\frac 12\times \left( 1-\frac 16\right)=\frac 5{12}$$ just as you got.  Note that you could use this method to easily handle the case of an $N$ sided die.


text: Q: adding or delete componet based on button click in react this is my application. based on button click i want to load componet or delete component. but i am getting error attached snapshot. please help me. Thanks a lot in advance.


text:
Q: How to remove this error while passing command through terminal? PS W:\laravel_xampp\htdocs\blog> php artisan migrate
Migration table created successfully.
In Connection.php line 664:
SQLSTATE[42000]: Syntax error or access violation: 1071 Spec
  ified key was too long; max key length is 767 bytes (SQL: al
  ter table users add unique users_email_unique(email))
In Connection.php line 458:
SQLSTATE[42000]: Syntax error or access violation: 1071 Spec
  ified key was too long; max key length is 767 bytes

A: As outlined in the Migrations guide to fix this all you have to do is edit your AppServiceProvider.php file and inside the boot method set a default string length:
use Illuminate\Support\Facades\Schema;

public function boot()
{
   Schema::defaultStringLength(191);
}


text:
Q: Rounding R simple features linestring geometry coordinates I need to round the coordinates of a simple features object (containing approx. 1,000,000 linestring features) to the nearest 5 decimal places. The code below does this correctly, but runtime is very slow because the last line of the for loop (indata$geometry[i] <- st_linestring(coords) takes several seconds for each iteration.
Does anyone know a more efficient way to code this?
indata <- st_read(dsn=dir, layer=layer)
indata <- st_cast(indata,"LINESTRING")

for (i in 1:nrow(indata)) {
  coords <- st_coordinates(indata$geometry[i])
  coords <- round(coords, 5)
  indata$geometry[i] <- st_linestring(coords) #This is the slow part
}

A: I don't think you can improve much upon what you have without writing out a shapefile. The limitation seems to be dealing with linestring. However, you can use the st_set_precision function to set the precision and write out a file. It doesn't change the geometry precision until your write a file. You can read more about how precision works in the st_binary section of the sf manual on page 48 of the sf manual. Basically it is related to the number of zeros.
outdata <- st_set_precision(indata, precision=10^5)
st_write(outdata, "/path/to/file.shp")
indata <- st_read("/path/to/file.shp")


text:
Q: BigQuery Java API - QueryReponse.getSchema() gives null We use Java API for accessing BigQuery. At present we experience a lot of query failures when QueryResponse object has null schema info in it. Typically rerun of the same query passes. Questions:

*

*Javadoc says null is a sign of unsuccessful query. Why in this particular case BigQuery is not throwing GoogleJsonResponseException as it usually does in other cases to report error?

*Our read queries are very simple and table contains ~5m records why do we experience a lot of such faults? What is the reason for them? BQ bugs? Unavailability periods?

Thanks for help.

A: It may just be that the job is not yet done. Check the getJobComplete() field to make sure the query job has completed. If it hasn't, use getQueryResults() to retry. You might also try increasing the timeout of the original query by calling setTimeoutMs() in the query request.