text:
Q: Heroku application crashed: at=error code=H10 desc="App crashed" method=GET path="/" *I have been trying to upload my MERN app to Heroku and have been getting these error codes. The web application will run on my local host but the application immediately fails when I try and upload it to heroku. I am relatively new to working with the MERN stack and am trying to figure out how to properly upload an application to Heroku. *
2020-05-26T05:00:40.804369+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-fjord-39421.herokuapp.com request_id=9c5806e4-dd49-4325-8814-dccb9f4398e0 fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=https
2020-05-26T05:00:41.404224+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=murmuring-fjord-39421.herokuapp.com request_id=c325a3c6-b459-4de2-b7f5-fe67457f8d6e fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=httpsenter code here
2020-05-26T05:01:09.373344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-fjord-39421.herokuapp.com request_id=4ad4f358-063e-48d7-a55e-7ccffc32ffb3 fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=httpsenter code here

heroku logs --tail
2020-05-26T04:54:22.910425+00:00 app[api]: Initial release by user woodjack191@gmail.com
2020-05-26T04:54:22.910425+00:00 app[api]: Release v1 created by user woodjack191@gmail.com
2020-05-26T04:54:23.096112+00:00 app[api]: Enable Logplex by user woodjack191@gmail.com
2020-05-26T04:54:23.096112+00:00 app[api]: Release v2 created by user woodjack191@gmail.com
2020-05-26T04:58:40.000000+00:00 app[api]: Build started by user woodjack191@gmail.com
2020-05-26T04:59:47.263635+00:00 app[api]: Deploy 7d333fc9 by user woodjack191@gmail.com
2020-05-26T04:59:47.263635+00:00 app[api]: Release v3 created by user woodjack191@gmail.com
2020-05-26T04:59:47.283454+00:00 app[api]: Scaled to web@1:Free by user woodjack191@gmail.com
2020-05-26T04:59:54.000000+00:00 app[api]: Build succeeded
2020-05-26T04:59:56.664155+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-26T04:59:59.487422+00:00 app[web.1]:
2020-05-26T04:59:59.487434+00:00 app[web.1]: > my-project@0.1.0 start /app
2020-05-26T04:59:59.487434+00:00 app[web.1]: > react-scripts start
2020-05-26T04:59:59.487435+00:00 app[web.1]:
2020-05-26T05:00:02.028314+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.17.10.22/
2020-05-26T05:00:02.028881+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-05-26T05:00:02.029021+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-05-26T05:00:02.029167+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-05-26T05:00:02.029361+00:00 app[web.1]: Starting the development server...
2020-05-26T05:00:02.029362+00:00 app[web.1]:
2020-05-26T05:00:02.141290+00:00 heroku[web.1]: Process exited with status 0
2020-05-26T05:00:02.315545+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-26T05:00:02.318095+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-26T05:00:09.983236+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-26T05:00:12.651901+00:00 app[web.1]:
2020-05-26T05:00:12.651922+00:00 app[web.1]: > my-project@0.1.0 start /app
2020-05-26T05:00:12.651923+00:00 app[web.1]: > react-scripts start
2020-05-26T05:00:12.651923+00:00 app[web.1]:
2020-05-26T05:00:16.868981+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.17.178.250/
2020-05-26T05:00:16.869628+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-05-26T05:00:16.869783+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-05-26T05:00:16.869929+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-05-26T05:00:16.870239+00:00 app[web.1]: Starting the development server...
2020-05-26T05:00:16.870241+00:00 app[web.1]:
2020-05-26T05:00:17.013391+00:00 heroku[web.1]: Process exited with status 0
2020-05-26T05:00:17.057205+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-26T05:00:40.804369+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-fjord-39421.herokuapp.com request_id=9c5806e4-dd49-4325-8814-dccb9f4398e0 fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=https
2020-05-26T05:00:41.404224+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=murmuring-fjord-39421.herokuapp.com request_id=c325a3c6-b459-4de2-b7f5-fe67457f8d6e fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=https
2020-05-26T05:01:09.373344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-fjord-39421.herokuapp.com request_id=4ad4f358-063e-48d7-a55e-7ccffc32ffb3 fwd="71.204.55.234" dyno= connect= service= status=503 bytes= protocol=https
2020-05-26T05:11:05.245937+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-26T05:11:14.187854+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-26T05:11:16.938860+00:00 app[web.1]:
2020-05-26T05:11:16.938887+00:00 app[web.1]: > my-project@0.1.0 start /app
2020-05-26T05:11:16.938887+00:00 app[web.1]: > react-scripts start
2020-05-26T05:11:16.938887+00:00 app[web.1]:
2020-05-26T05:11:18.963210+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.19.50.2/
2020-05-26T05:11:18.963807+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-05-26T05:11:18.963915+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-05-26T05:11:18.964030+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-05-26T05:11:18.964316+00:00 app[web.1]: Starting the development server...
2020-05-26T05:11:18.964319+00:00 app[web.1]:
2020-05-26T05:11:19.093706+00:00 heroku[web.1]: Process exited with status 0
2020-05-26T05:11:19.137119+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-26T05:11:19.140236+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-26T05:11:26.041885+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-26T05:11:28.043546+00:00 app[web.1]:
2020-05-26T05:11:28.043558+00:00 app[web.1]: > my-project@0.1.0 start /app
2020-05-26T05:11:28.043558+00:00 app[web.1]: > react-scripts start
2020-05-26T05:11:28.043559+00:00 app[web.1]:
2020-05-26T05:11:29.727646+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.13.198/
2020-05-26T05:11:29.727983+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-05-26T05:11:29.728062+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-05-26T05:11:29.728128+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-05-26T05:11:29.728294+00:00 app[web.1]: Starting the development server...
2020-05-26T05:11:29.728295+00:00 app[web.1]:
2020-05-26T05:11:29.800107+00:00 heroku[web.1]: Process exited with status 0
2020-05-26T05:11:29.835462+00:00 heroku[web.1]: State changed from starting to crashed

server.js file
const bodyParser = require('body-parser');
const cors = require('cors');
const path = require('path')
const app = express();
require('./database');

app.use(bodyParser.json());
app.use(cors());

// API
const users = require('./api/users');
app.use('/api/users', users);

app.use(express.static(path.join(__dirname, '../build')))
app.get('*', (req, res) => {
    res.sendFile(path.join(__dirname, '../build'))
})

const port = process.env.PORT || 5000;
app.listen(port, () => {
    console.log(`Server started on port ${port}`);
});

package.json file
{
  "name": "my-project",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.19.2",
    "body-parser": "^1.19.0",
    "bootstrap": "^4.5.0",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "mongoose": "^5.9.15",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "node backend/server.js",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install npm && run build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "proxy": "http://localhost:5000",
  "engines": {
    "node": "10.16.0"
  }
}

A: For me, after checking everything else, the problem was in the empty path.
Don't deploy the API with an empty Path --> '/'
Allways give it a path like --> '/api/data'
The empty path makes the API think that favicon.ico is an ID you're trying to pass...
in my case For example i use:
app.use("/api/emps",require('./routes/employees.routes'))

A: I was facing the same problem (Working well on local but crashed on heroku
with my MERN stack); although my coding is a bit different from the one mentioned in the query. Then I found a page which mentioned most of the reasons it can happen(link is https://dev.to/lawrence_eagles/causes-of-heroku-h10-app-crashed-error-and-how-to-solve-them-3jnl).
I tried everything there too, but it didn't work for me. But in the comments section there, people mentioned the following change in the code
Need to run this line in the command module "npm install serve --s"
and then copy this into the package.json exactly as is
"scripts": {

"dev": "react-scripts start",

"start": "serve -s build",

"build": "react-scripts build",

"test": "react-scripts test --env=jsdom",

"eject": "react-scripts eject",

"heroku-postbuild": "npm run build"

}
These above changes worked for me, I hope it helps

A: This can be addressed in 2 ways :
1) This error is generally thrown if you forget to set a start script! Heroku demands a Procfile (if you want to override the default start command of Heroku) to be uploaded along with your app files.
The content of Procfile should be as such:
web: node index.js (i.e specify the node command to be run for your application)
2) If you don't want to upload a Procfile then you can specify your command in the "scripts" in package.json(which you have already done), alongside you need to add "build":"webpack" in package.json.
You've also used "heroku-postbuild" to replace the "build" script......So actually it had to work! But you can try one of the above 2 methods and try to debug it (and hopefully one should definitely work)!

A: Add this to your server.js:
var distDir = __dirname + "/dist/";

app.use(express.static(distDir));

A: In React I did 2 things. One solved :)

*

*Added favicon and manifest using https://favicon.io/favicon-converter/

*Removed unused packages from package.json, you should also add development dependencies to devDependencies


text:
Q: How to hide scrollbar track is there any way to hide the scrollbar track but not the thumb? It should look like this:

Its currently looking like this:

This is the actual css for the scrollbar:

*::-webkit-scrollbar {
    width: 10px;
}
* {
    scrollbar-width: thin;
    scrollbar-color: var(--dark-blue) var(--custom-white);
}
*::-webkit-scrollbar-track {
    background-color: var(--custom-white);
}
*::-webkit-scrollbar-thumb {
    background-color: var(--dark-blue) ;
    border-radius: 20px;
    border: 3px solid var(--custom-white);
}

FINAL CODE:

*::-webkit-scrollbar {
  background-color: transparent;
  width: 15px;
}
*::-webkit-scrollbar-track {
  background-color: transparent;
}
*::-webkit-scrollbar-thumb {
  border-radius: 20px;
  border: 4px solid transparent;
  background-color: rgba(0,0,0,0.2);
  background-clip: content-box;
}

A: Just add overflow: overlay; to the body tag instead of overflow: auto.
both work the same but with OVERLAY your scrollbar will be on top of content just as you want.
Worked for me.

A: You can just add the background-color property to your ::-webkit-scrollbar and set it to transparent.

::-webkit-scrollbar {
    background-color: transparent;
    width: 10px;
}
* {
    scrollbar-width: thin;
    scrollbar-color: var(--dark-blue) var(--custom-white);
}
*::-webkit-scrollbar-track {
    background-color: var(--custom-white);
}
*::-webkit-scrollbar-thumb {
    background-color: var(--dark-blue) ;
    border-radius: 20px;
    border: 3px solid var(--custom-white);
}

A: Alright, since i tried everything with CSS and nothing worked, i figured it would be best to use an external package that helped me achieve this very very easily.
I used this library which is suuper super easy to set up and use. All i had to do was install it and use the component. In the wiki they have an example of use and its very noob-friendly and customizable.

A: *::-webkit-scrollbar {
    border: none;
    background-color: transparent;
 } /* webkit browsers(safari, chrome) */

*{
    scrollbar-color: #404040b3 transparent; /*firefox*/
 }

This is what worked for me finally.

redpajama_set_name: RedPajamaStackExchange


text:
Q: plotting graph in MATLAB I have this points here
x-axis : 0.958 1.043 1.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004
y-axis : 0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214
a vector V1 = [-0.425, 0.977]
How can i plot all these on 1 graph?
With scales:
x-axis: 10^-3 until 10^1
y-axis: 10^-3 until 10^1
Thanks

A: It sounds like you want to do a log-log plot. You could do this:

>> x=[0.958 1.043 1.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004];
>> y=[0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214];
>> loglog(x,y, '.');

Which gives this:

If you want to also plot the vector you can't plot in log-space (at least on the x-axis) because of the negative x value. Plotting in normal space can be done by:

>> x=[0.958 1.043 1.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004];
>> y=[0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214];
>> figure;
>> plot(x, y, '.');
>> hold on;
>> plot([0 -.425], [0 .977]);

The results aren't as pretty:


text:
Q: Getting error when trying to debug on chromes emulator I'm trying to run a sample app by using cordovas camera plugin and I got an error, when trying to debug on chromes emulator
Failed to load resource: the server responded with a status of 404 (Not Found)
(http://localhost:8000/android/www/css/images/ajax-loader.gif)

A: You are debuging your application in chrome emulator. But you are using the ajax-loader.gif placed in platforms/andoroid/www/css/images change the location of the loader to www folder in the root folder.
css/images/ajax-loader.gif.
In chrome emulator, the files in www folder in the root of project is taken.
Change the location of loader and check whether the problem is solved or not

A: The correct path is css/images/ajax-loader.gif


text:
Q: How this css sibling selector works? I found this css code, but need to understand it better:

.tes>li:not(template)~:not(template) {
  color: red;
}

1

2

3

4

5

Style all sibling exept the first one. Please explain that and also the browser support too. Thanks
Demo here

A: .tes>li:not(template)~:not(template) {
  color: red;
}

.tes>li:not(template) - Find the first li inside .tes which is not template - Not clear on what template is
:not() selector is for ommiting some selector from a general call for example:
input:not([type='checkbox']) - this will count for all input types that are NOT checkboxes.
:not() should hold a selector in it (like you would use it regularly on css i.e: p:not(.lead) or as mentioned in the example above.)
~ Is a Subsequent-sibling combinator Which basically says, retrieve all the siblings elements that match the selector on the right, starting from the sibling that is matched in the left.
It's not clear from your demo what is template, but you are asking for all types of elements that are siblings after the first li, but i'm guessing, in your example it just ignores that :not(template) - Because nothing matches template and is retrieving all the elements that are siblings to the first li.
For example this will achieve the same result:

.tes>li ~ li  {
  color: red;
}

1

2

3

4

5


text:
Q: Oracle lock between two connection Is it possible to lock data row between two oracle connections like this pseudo code :
First method request a row and a cursor to lock the row
private CursorVariable formCursor;
private object model;

public object Edit()
{
    using (OracleConnection connection = new OracleConnection(connectionString))
    using (OracleCommand command = connection.CreateCommand())
    {
          // Execute query like "CURSOR cursor_name IS SELECT * FROM tableOne WHERE Id = 1 FOR UPDATE"
          // Get cursor from database and set formCursor with it
          // Set model with result of select
    }
}

Second method update row with modifications made on the UI, it uses cursor to unlock data row
public bool SaveEdit(object modifications)
{
    using (OracleConnection connection = new OracleConnection(connectionString))
    using (OracleCommand command = connection.CreateCommand())
    {
          // update model with modifications
          // Execute a query like "UPDATE table_name SET [col1 = modifications.col1, col2 = modifications.col2,...] WHERE Id = 1 CURRENT OF cursor_name"
    }
}

If edition is canceled the lock is released
public void CancelEdit()
{
    using (OracleConnection connection = new OracleConnection(connectionString))
    using (OracleCommand command = connection.CreateCommand())
    {
          // Release lock
    }
}


text:
Q: AsyncContext, timeouts, and retries We have a client/server web app with a lot of components - including AsyncContext and ning AsyncHttpClient in our proxy - and I'm just trying to figure out how timeouts and retries (and startAsync/complete) work.  Here's the full structure (simplified)...
GWT 2.7 app that in response to an action (eg, button click) makes a call to a servlet on the application server, which goes through our proxy servlet to another host to execute a long running task.  In development, we run/debug the GWT app using the embedded jetty server - in production we deploy the war to tomcat7.
The first servlet uses RestEasy 3.0.8 (and ApacheHttpClient4Executor) to create the call that goes through our proxy servlet.  There we're using ning AsyncHttpClient 1.7.5, startAsync/complete, and a AsyncHandler to call the server on the remote host (which also uses RestEasy). This was setup by someone else who I'm not able to consult currently.
I'm not sure when to call complete() or how to stop/enable retries.  Two of the bigger issues are that we often get IllegalStateException's (IDLE,initial) if we complete() on/around a timeout (either within the proxy on context timeout or a call to the remote server that [AsyncResponse] timed out there); and... Jetty seems to completely restart the request (in the proxy) one time when the context timeout occurs, with no apparent way for us to check if this is happening or (intelligently) stopping it, etc. So if the call was using an input stream, the second/retry uses the same input stream which results in the remote server throwing an EOF exception (because there are no bytes left to read) on the second call, meanwhile the first call it received continues to be processed.  These are both issues with Jetty in our dev environment but I want to understand this to do the right thing on tomcat/production.
What I've tried/learned...

*

*the RestEasy/ApacheHttpClient4Executor call never seems to timeout (and so setting retries doesn't matter) - it either succeeds or fails, based on what happens at the other end(s) of the call (and seemingly waits forever)...  for example...
HttpParams params = client.getParams();
HttpConnectionParams.setConnectionTimeout(params, 5000);
HttpConnectionParams.setSoTimeout(params, 5000);
((AbstractHttpClient) client).setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(3, true));

*setConnectionTimeoutInMs() on AsyncHttpClientConfig seems to do absolutely nothing (unless it's only on how long it takes to make the server connection - I thought it included the full request time)

*if I startAsync with a timeout and execute a request, if/when it times out before the request completes, then context listeners will get an onTimeout event, and Jetty will restart the entire request (leading to the listeners also getting an onStartAsync event for the same context). Tomcat doesn't do this.  Another person seems to have encountered the same thing but there were no replies...
http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02269.html

*

*calling complete() in the onTimeout stops the second request. Calling complete() instead in the onStartAsync instead gives strange results (the second call occurs still, and onComplete in the AsyncHandler gets called at some point but then it throws an IllegalStateException which results in onThrowable being called [??])

*setting retries on AsyncHttpClient in this configuration doesn't seem to do anything (unless it only happens on some combination of asyncTimeout, requestTimeout, etc - that I have yet to figure out)

*setting the response status (to 408 for example) seems to work in rare cases but often does not due to the EOF exception on the server generating a 500 that gets back to the client without me being able to do much about it (the first call is still in progress, I don't know that this is the second call [other than that it failed] or that it occurred due to a timeout, etc)

*very little information can be gathered from methods on AsyncContext. I can use reflection to get some data I can use but without that... how do I know if it's been retried? how do I know what state it is to determine whether to call complete()? etc etc

*there seems to be very little good information on AsyncContext (et al) online, confusing javadoc, and only small/isolated fix suggestions on SO. The best that I've come across so far is this:
http://www.softwareengineeringsolutions.com/blogs/2010/08/13/asynchronous-servlets-in-servlet-spec-3-0/
Bottom line: can anyone explain or point me to good documentation on how AsynContext/AsyncHandler work and/or how to use it properly and/or help me make sense of what I'm seeing here. Thank you!


text:
Q: groovy read from URL file and store it in the list I have file stored in the website, I want to read the file and store each line in array list.
Currently using this code, it works. Is there a better way of doing this part of the code.
def data = u.toURL().text
def keys = new ArrayList()
data.eachLine {
   keys.add(it)
}

A: Why not:
def keys = u.toURL().readLines()

?
As in the docs.

A: you could simplify it a bit:
def keys = []
u.toURL().text.eachLine{ keys << it }

and for such simple kind of job, it's just fine


text:
Q: Discard Values repeated in particular date time intervals I'm working on a de-duplicating a dataframe based on a 14 day interval of repetition, meaning
if value in column b is repeated within a 14 day period then I need to discard the duplicate and if isn't they keep all the values
This is what the data frame looks like:
date    event
2016-01-17  aa
2016-01-18  bb
2016-01-19  cc
2016-01-20  dd
2016-01-17  ee
2016-01-18  ff
2016-01-19  aa
2016-01-20  bb
2016-10-21  cc
2016-10-22  dd
2016-10-23  ee

Here the events aa and bb are repeated within a 14 day period so the two duplicate values need to be taken off
Desired result:
date    event
2016-01-17  aa
2016-01-18  bb
2016-01-19  cc
2016-01-20  dd
2016-01-17  ee
2016-01-18  ff
2016-10-21  cc
2016-10-22  dd
2016-10-23  ee

I could use:
df<- df[order(df[,'date'],-df[,'event']),]
df = df[!duplicated(df$date),]

but this would only take off specific events repeated on same day and not in the 14 day interval

A: You can do the following:
library(data.table)

# convert to data table
setDT(df)

## create groups based on 14 days interval
df$group <- cumsum(ifelse(difftime(df$date,
                                      shift(df$date, fill = df$date[1]),
                                      units = "days") >= 14 ,1, 0)) + 1
# get unique values
df = df[,unique(.SD, by='event'), group][,.(date, event)]

print(df)
         date event
1: 2016-01-17    aa
2: 2016-01-18    bb
3: 2016-01-19    cc
4: 2016-01-20    dd
5: 2016-01-17    ee
6: 2016-01-18    ff
7: 2016-10-21    cc
8: 2016-10-22    dd
9: 2016-10-23    ee


text:
Q: WordPress - check if have posts on front-page.php I have got a WordPress installation and created a front-page.php - I have to check there if the blog has posted.
have_posts() returns always 1, although no blog-posts were published.

A: This code will help you to show the published post.
if( have_posts() ) :
    while( have_posts() ) : the_post();
        echo get_the_title()."<br>";
    endwhile;
else :
    _e( 'Sorry, no posts were found.', 'textdomain' );
endif;

A: No, this snippet does not help me.
I have to check if there are posts from blog via own query. I had a missunderstanding what have_posts() does.


text:
Q: Static Initialization Order for Singletons So I'm reading that for Zero Initialization will initialize:

Every named variable with static or thread-local storage duration that is not subject to constant initialization, before any other initialization

I am using a Singleton with the traditional private constructor and a static public method in which there is a local static singleton object which the method will be return.
My problem is that the class also has a static vector which is zero-initialized and it seems to be getting initialized after the singleton, meaning that I cannot interact with it. Is there something that governs this initialization order or is that simply implementation defined?

This is a simplification of what my code looks like:
class Foo {
    Foo(){ s_vec.push_back(13); }
public:
    static Foo& Get() {
        static Foo singleton;
        return singleton;
    }

    int Front() const { return s_vec.front(); }
    static vector<int> s_vec;
};
vector<int> Foo::s_vec;

I'm running into this problem because elsewhere in the code I'm initializing a static global variable like this and not getting 13: static const auto element = Foo.Get().Front()

A: Constructor for global variables are executed before the start of main, but the order across compilation units is not specified.
The Foo constructor in your example should only be called once you call Foo::Get. If the first time you call it is in main, the static vector will be already initialized.
One situation, where you can run into the race that you describe is when you call Foo::Get in the initialization code of another global object, especially when the code is in another compilation unit.
But in a simple test like this here, the vector should always be initialized first and there will be no possible race:
class Foo {
    Foo() = default;
public:
    static Foo& Get() {
        static Foo singleton;
        return singleton;
    }
    static vector<int> s_vec;
};
vector<int> Foo::s_vec; // will be initialized before main

int main() {
  Foo::Get(); // --> triggers constructor call Foo::Foo
  return 0;
}

(I'm assuming Foo::Get is a static member in the singleton, otherwise you cannot instantiate it. But it does not make a difference conceptually.)
The problematic scenario could look like this:
// other file
struct Bar {
  Bar() { Foo::Get(); }
};
Bar bar; // global object

You have no control about the initialization order of Foo::s_vec (in the first compilation unit) and bar (in the second one).


text:
Q: How to show full text in scroll view in Swift UI I'm writing view that should contain multiline text, I use scroll view to scroll it, but it also wraps my text. Modifiers like .lineLimit(nil) doesn't work.
var body: some View {
    ScrollView{
        Text(lesson.text)
    }
}

So it is screenshots without and with scroll view.

A: var body: some View {
    ScrollView{
        Text(lesson.text)
            .fixedSize(horizontal: false, vertical: true)
    }
}

should solve the problem.
This is default in iOS 13.1 and above.


text:
Q: How can I find every row in a table where the value of a field is contained in a specific string? Usually, I use
SELECT * FROM tableName WHERE fieldName LIKE '%string%'

to find every row in tableName where the value of fieldName contains the string 'string'.
How can I find every row in tableName where the value of fieldName is contained in the string 'string'?
For example, in the following table
names
FirstName | LastName
Bob       | Dylan
Bob       | Marley

I would like to use the string "Bob Marley" in order to find [Bob | Marley] and [Bob | Dylan], so I would say: Find all rows in names where the value of FirstName is contained in "Bob Marley"
I thought of this:
SELECT * FROM tableName WHERE 'string' LIKE %fieldName%

but it doesn't work.

A: Try this:
Select * From tableName where 'string' Like '%' + fieldName + '%'

A: SELECT * FROM tablename WHERE 'string' like '%' + fieldname + '%'

A: Thanks to Chris Nielsen and mmayo, I found this working solution:
Select * From names where 'Bob Marley' Like CONCAT('%', FirstName, '%')

A: SELECT  *
FROM    (
        SELECT  'Bob' AS name, 'Marley' AS lastname
        UNION ALL
        SELECT  'Bob' AS name, 'Dylan' AS lastname
        ) q
WHERE   'Bob Marley' LIKE CONCAT('%', name, '%')

A: Try this:
SELECT *
  FROM tableName
 WHERE LOCATE(fieldName, 'string') > 0;


text:
Q: Call multiple Controller in angularjs from one view I am getting problem in executing multiple controller for one view. I have a main index.html file in which I am displaying counts in header. For that I created a seperate Controller file "headerController" and referred in body
<body ng-controller="headerController">

Now in router provider I had routed to another controller based on URL
$routeProvider.when('/home', {templateUrl: 'resources/assets/partials/home.html', controller: 'HomeCtrl'});

By default my application lands on home page so what I want is first in header it displays the count and than runs the HomeCtrl, but right now it only displays count and does not execute Home controller.
What is the best way to handle this type of scenarios ?

A: I think the best way is to use Razor
and you need to to something like this
public ActionResult Home(string Name)
    {
        if (Name == "/home")
        {
            ViewBag.Title = "Home";
            ViewBag.Form = "resources/assets/partials/home.html";
            ViewBag.Controller = "HomeCtrl";
        }

}


text:
Q: ¿Por qué snowboy me da el error "cannot open shared object file: No such file or directory"? Esto es el código que uso y el problema que me da:
$  cd /rpi-arm-raspbian-8.0-1.1.1
root@rpi3: /rpi-arm-raspbian-8.0-1.1.1
$ python3 demo.py resources/models/hermes.pmdl

Traceback (most recent call last):   File "demo.py", line 1, in <module>
    import snowboydecoder   File "/rpi-arm-raspbian-8.0-1.1.1/snowboydecoder.py", line 5, in <module>
    import snowboydetect   File "/rpi-arm-raspbian-8.0-1.1.1/snowboydetect.py", line 28, in <module>
    _snowboydetect = swig_import_helper()   File "/rpi-arm-raspbian-8.0-1.1.1/snowboydetect.py", line 24, in swig_import_helper
    _mod = imp.load_module('_snowboydetect', fp, pathname, description)   File "/usr/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)   File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)

ImportError: /rpi-arm-raspbian-8.0-1.1.1/_snowboydetect.so: cannot open shared object file: No such file or directory

Tengo todo los documentos que me sirven para hacerlo funcionar
pero lo que no  entiendo es este error:

ImportError: /rpi-arm-raspbian-8.0-1.1.1/_snowboydetect.so: cannot open shared object file: No such file or directory

Esta es la carpeta donde tengo todo:

A: Tu LD_LIBRARY_PATH no incluye la ruta de _snowboydetect.so. Tendrías que añadirla:
export LD_LIBRARY_PATH=/rpi-arm-raspbian-8.0-1.1.1:$LD_LIBRARY_PATH


text:
Q: While loop error with Netwon-Raphson Method I am trying to find use to Newton-Raphson method to find the roots. It does this by making a guess and then improving the guess after each iteration until you get one of the zeros.
Because the Newton-Raphson method quickly finds the zeros, it gives me a small error immediately and after two or three iterations max it should fail to meet the conditions of the while loop. However, the problem is that when I remove the semi-colon after "error" in my loop, I start getting fractions that should break the while loop, but its like Matlab doesn't know that 123/8328423 is less than 1. It continues to run until I manually force the program to stop running.
How do I fix this? I tried format long, format longe, and using double both in the command window, in the scrip file, and somewhere in the loop.
Thank you in advance for any tips, suggestions, or advice that may help!!
A = [1,2,-4;2,-2,-2;-4,-2,1;];
format longe
% syms x y z
% P = x^4 + 3*x^2*y^2-z^3+y+1;
% feval(symengine,'degree',P,x)

syms x

B = mateigenvalue(A);
f(x) = simplify(matdet(B));

x0 = 1;
error = 10;
while(error > .01)
    x1 = x0 - f(x0)/(27*(x0)-3*(x0)^2);
    error = abs(((f(x0)-f(x1))/f(x0))*100)
    x0 = x1;
end

x0 = double(x0)

A: I reckon the main problem is with error.
It starts as double but inside the while-loop it turns into a symbolic variable and you can't easily compare symbolic variables with scalar values (the .01 in the while-loop condition).
Check in your workspace if error is symbolic (or type class(error) and check if sym is returned). I guess it is symbolic because a fraction is returned (123/8328423), as instead Matlab treats double values with decimals, not fractions.
If so, try doing (inside the while-loop) a conversion for error that is, under the line
error = abs(((f(x0)-f(x1))/f(x0))*100);

try putting
error=double(error);

So error will be temporarily converted in double and you can easily compare its value with .01 to check the while-loop condition.
Also, it is bad practice to call a variable error since error() is a built-in function in Matlab. By naming a variable error you cannot use the error() function. Same story goes for other built-in functions.


text:
Q: Strange queryplan jumps on partitioned table on old postgres 9.3 Our solution:
We have a trigger based partitioned table. BUT the insert trigger return NEW because hibernate must have rowcount 1 so all insert is inserted parent table too. But we have an after insert trigger which delete it.
So we have a parent table with 0 records, but very dirty table.
config:
constraint_exclusion    on
And nowadays there is a strange behavior.
Select :
SELECT *
FROM partitioned_table
WHERE partition_column=x;

Somtimes, not immediate after autovacuum the good plan changed to bad plan:
bad plan:
Append  (cost=247.80..29934.72 rows=13299 width=2073) (actual time=0.064..1.848 rows=755 loops=1)
  Buffers: shared hit=517
  ->  Bitmap Heap Scan on public.ftr_ugyletadat ugyletadat0_  (cost=247.80..26405.17 rows=11790 width=2246) (actual time=0.022..0.022 rows=0 loops=1)
        Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain
        Recheck Cond: (ugyletadat0_.idugylet = 16179457::numeric)
        Buffers: shared hit=3
        ->  Bitmap Index Scan on ix_ftr_ugyletadat_idugylet  (cost=0.00..244.86 rows=11790 width=0) (actual time=0.019..0.019 rows=0 loops=1)
              Index Cond: (ugyletadat0_.idugylet = 16179457::numeric)
              Buffers: shared hit=3
  ->  Index Scan using ix_ugyletadat_kulcs_ugylet_32 on public.ftr_ugyletadat_32 ugyletadat0__1  (cost=0.70..3529.55 rows=1509 width=723) (actual time=0.039..0.990 rows=755 loops=1)
        Output: ugyletadat0__1.id, ugyletadat0__1.modositva, ugyletadat0__1.idugylet, ugyletadat0__1.iddokumentum, ugyletadat0__1.kulcs, ugyletadat0__1.osztaly, ugyletadat0__1.doublevalue, ugyletadat0__1.longvalue, ugyletadat0__1.datevalue, ugyletadat0__1.stringvalue, ugyletadat0__1.stringvalue2, ugyletadat0__1.megjegyzesdomain
        Index Cond: (ugyletadat0__1.idugylet = 16179457::numeric)
        Buffers: shared hit=514
Total runtime: 2.353 ms

good plan:
Append  (cost=0.38..3537.94 rows=1510 width=724) (actual time=0.043..1.819 rows=755 loops=1)
  Buffers: shared hit=517
  ->  Index Scan using ix_ftr_ugyletadat_idugylet on public.ftr_ugyletadat ugyletadat0_  (cost=0.38..8.39 rows=1 width=2246) (actual time=0.015..0.015 rows=0 loops=1)
        Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain
        Index Cond: (ugyletadat0_.idugylet = 16179457::numeric)
        Buffers: shared hit=3
  ->  Index Scan using ix_ugyletadat_kulcs_ugylet_32 on public.ftr_ugyletadat_32 ugyletadat0__1  (cost=0.70..3529.55 rows=1509 width=723) (actual time=0.025..0.957 rows=755 loops=1)
        Output: ugyletadat0__1.id, ugyletadat0__1.modositva, ugyletadat0__1.idugylet, ugyletadat0__1.iddokumentum, ugyletadat0__1.kulcs, ugyletadat0__1.osztaly, ugyletadat0__1.doublevalue, ugyletadat0__1.longvalue, ugyletadat0__1.datevalue, ugyletadat0__1.stringvalue, ugyletadat0__1.stringvalue2, ugyletadat0__1.megjegyzesdomain
        Index Cond: (ugyletadat0__1.idugylet = 16179457::numeric)
        Buffers: shared hit=514
Total runtime: 2.300 ms

I remarked thats:

*

*I run VACUUM ANALYZE partitioned_table. Immediatly after the starting changed the plan to good. But the Vacuum analyze run about 10 minutes.

*postgres stistics changes
SELECT relname, reltuples
FROM pg_class
WHERE relname like 'ftr_ugyletadat';
The rel_tuples value always jumps 0 (good plan) or about 2,5 million +-10000 (bad plan).
I created an index on base (empty table) so there is not seq scan just index.
Some posts said a check contraint to base table. it is empty, but couse of Hibernate problem we must insert rows there too.

*

*Why jumps rel_tuples value and why just 0 and about 2,5 million +-
10000 there is no other value?

*What can I do to be faster?

*Is a good plan change main table to view with triggers?

Thanks a lot.
Real plan in good time:
Hash Left Join  (cost=28.95..24265.05 rows=1357 width=2368) (actual time=1.570..5.750 rows=427 loops=1)
  Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet, dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik, dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
  Hash Cond: (dokumentum1_.iddokumentumsablon = dokumentum2_.id)
  Buffers: shared hit=389 read=6
  ->  Nested Loop Left Join  (cost=1.23..24228.66 rows=1357 width=691) (actual time=0.383..3.993 rows=427 loops=1)
        Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet, dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik
        Buffers: shared hit=373 read=6
        ->  Nested Loop Left Join  (cost=0.81..15331.59 rows=1357 width=493) (actual time=0.379..2.802 rows=427 loops=1)
              Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet
              Buffers: shared hit=364 read=6
              ->  Append  (cost=0.38..3987.37 rows=1357 width=404) (actual time=0.373..1.495 rows=427 loops=1)
                    Buffers: shared hit=352 read=6
                    ->  Index Scan using ix_ftr_ugyletadat_idugylet on public.ftr_ugyletadat ugyletadat0_  (cost=0.38..8.39 rows=1 width=2246) (actual time=0.228..0.228 rows=0 loops=1)
                          Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain
                          Index Cond: (ugyletadat0_.idugylet = 24633477::numeric)
                          Buffers: shared hit=16
                    ->  Index Scan using ix_ugyletadat_kulcs_ugylet_35 on public.ftr_ugyletadat_35 ugyletadat0__1  (cost=0.70..3978.98 rows=1356 width=403) (actual time=0.142..0.769 rows=427 loops=1)
                          Output: ugyletadat0__1.id, ugyletadat0__1.modositva, ugyletadat0__1.idugylet, ugyletadat0__1.iddokumentum, ugyletadat0__1.kulcs, ugyletadat0__1.osztaly, ugyletadat0__1.doublevalue, ugyletadat0__1.longvalue, ugyletadat0__1.datevalue, ugyletadat0__1.stringvalue, ugyletadat0__1.stringvalue2, ugyletadat0__1.megjegyzesdomain
                          Index Cond: (ugyletadat0__1.idugylet = 24633477::numeric)
                          Buffers: shared hit=336 read=6
              ->  Index Scan using pk_dokumentum on public.ftr_dokumentum dokumentum1_  (cost=0.43..8.35 rows=1 width=90) (actual time=0.001..0.001 rows=0 loops=427)
                    Output: dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet
                    Index Cond: (ugyletadat0_.iddokumentum = dokumentum1_.id)
                    Buffers: shared hit=12
        ->  Index Scan using nir_bgadokumentum_pkey on public.nir_bgadokumentum dokumentum1_1_  (cost=0.43..6.55 rows=1 width=198) (actual time=0.001..0.001 rows=0 loops=427)
              Output: dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik
              Index Cond: (dokumentum1_.id = dokumentum1_1_.id)
              Buffers: shared hit=9
  ->  Hash  (cost=19.54..19.54 rows=654 width=1677) (actual time=1.143..1.143 rows=692 loops=1)
        Output: dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
        Buckets: 1024  Batches: 1  Memory Usage: 95kB
        Buffers: shared hit=13
        ->  Seq Scan on public.ftr_dokumentumsablon dokumentum2_  (cost=0.00..19.54 rows=654 width=1677) (actual time=0.003..0.479 rows=692 loops=1)
              Output: dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
              Buffers: shared hit=13
Total runtime: 6.160 ms

And the bad plan:
Hash Left Join  (cost=133873.91..182462.47 rows=13552 width=4027) (actual time=2091.267..2092.158 rows=427 loops=1)
  Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet, dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik, dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
  Hash Cond: (dokumentum1_.iddokumentumsablon = dokumentum2_.id)
  Buffers: shared hit=26918
  ->  Hash Right Join  (cost=133846.19..182348.06 rows=13552 width=2350) (actual time=2090.104..2090.457 rows=427 loops=1)
        Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet, dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik
        Hash Cond: (dokumentum1_1_.id = dokumentum1_.id)
        Buffers: shared hit=26905
        ->  Seq Scan on public.nir_bgadokumentum dokumentum1_1_  (cost=0.00..42477.22 rows=1594522 width=198) (actual time=0.003..1028.006 rows=1472449 loops=1)
              Output: dokumentum1_1_.id, dokumentum1_1_.irat, dokumentum1_1_.idugylet, dokumentum1_1_.iddokumentumtipus, dokumentum1_1_.tomoritett, dokumentum1_1_.idszulodokumentum, dokumentum1_1_.idiktatas, dokumentum1_1_.idszotarstatusz, dokumentum1_1_.dokumentumnev, dokumentum1_1_.formatum, dokumentum1_1_.altipus_megnevezes, dokumentum1_1_.email_kuldes_idopont, dokumentum1_1_.id_feladat, dokumentum1_1_.rejtett, dokumentum1_1_.kezzel_iktatva, dokumentum1_1_.erkeztetoszam, dokumentum1_1_.idgeneralttartalom, dokumentum1_1_.generaltalegyezik
              Buffers: shared hit=26532
        ->  Hash  (cost=133676.79..133676.79 rows=13552 width=2152) (actual time=3.282..3.282 rows=427 loops=1)
              Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet
              Buckets: 2048  Batches: 1  Memory Usage: 61kB
              Buffers: shared hit=370
              ->  Nested Loop Left Join  (cost=255.38..133676.79 rows=13552 width=2152) (actual time=0.327..2.772 rows=427 loops=1)
                    Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain, dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet
                    Buffers: shared hit=370
                    ->  Append  (cost=254.95..31274.87 rows=13552 width=2062) (actual time=0.319..1.468 rows=427 loops=1)
                          Buffers: shared hit=358
                          ->  Bitmap Heap Scan on public.ftr_ugyletadat ugyletadat0_  (cost=254.95..27295.89 rows=12196 width=2246) (actual time=0.247..0.247 rows=0 loops=1)
                                Output: ugyletadat0_.id, ugyletadat0_.modositva, ugyletadat0_.idugylet, ugyletadat0_.iddokumentum, ugyletadat0_.kulcs, ugyletadat0_.osztaly, ugyletadat0_.doublevalue, ugyletadat0_.longvalue, ugyletadat0_.datevalue, ugyletadat0_.stringvalue, ugyletadat0_.stringvalue2, ugyletadat0_.megjegyzesdomain
                                Recheck Cond: (ugyletadat0_.idugylet = 24633477::numeric)
                                Buffers: shared hit=16
                                ->  Bitmap Index Scan on ix_ftr_ugyletadat_idugylet  (cost=0.00..251.90 rows=12196 width=0) (actual time=0.117..0.117 rows=431 loops=1)
                                      Index Cond: (ugyletadat0_.idugylet = 24633477::numeric)
                                      Buffers: shared hit=4
                          ->  Index Scan using ix_ugyletadat_kulcs_ugylet_35 on public.ftr_ugyletadat_35 ugyletadat0__1  (cost=0.70..3978.98 rows=1356 width=403) (actual time=0.069..0.692 rows=427 loops=1)
                                Output: ugyletadat0__1.id, ugyletadat0__1.modositva, ugyletadat0__1.idugylet, ugyletadat0__1.iddokumentum, ugyletadat0__1.kulcs, ugyletadat0__1.osztaly, ugyletadat0__1.doublevalue, ugyletadat0__1.longvalue, ugyletadat0__1.datevalue, ugyletadat0__1.stringvalue, ugyletadat0__1.stringvalue2, ugyletadat0__1.megjegyzesdomain
                                Index Cond: (ugyletadat0__1.idugylet = 24633477::numeric)
                                Buffers: shared hit=342
                    ->  Index Scan using pk_dokumentum on public.ftr_dokumentum dokumentum1_  (cost=0.43..7.55 rows=1 width=90) (actual time=0.001..0.001 rows=0 loops=427)
                          Output: dokumentum1_.id, dokumentum1_.modositva, dokumentum1_.idadattartalom, dokumentum1_.iddokumentumsablon, dokumentum1_.nev, dokumentum1_.letrehozasideje, dokumentum1_.leiras, dokumentum1_.meret, dokumentum1_.idugylet
                          Index Cond: (ugyletadat0_.iddokumentum = dokumentum1_.id)
                          Buffers: shared hit=12
  ->  Hash  (cost=19.54..19.54 rows=654 width=1677) (actual time=1.128..1.128 rows=692 loops=1)
        Output: dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
        Buckets: 1024  Batches: 1  Memory Usage: 95kB
        Buffers: shared hit=13
        ->  Seq Scan on public.ftr_dokumentumsablon dokumentum2_  (cost=0.00..19.54 rows=654 width=1677) (actual time=0.004..0.468 rows=692 loops=1)
              Output: dokumentum2_.id, dokumentum2_.modositva, dokumentum2_.idadattartalom, dokumentum2_.nev, dokumentum2_.dokumentumnev, dokumentum2_.letrehozasideje, dokumentum2_.leiras, dokumentum2_.meret, dokumentum2_.iktatando, dokumentum2_.alairassablon, dokumentum2_.groovyclosure, dokumentum2_.bejovo, dokumentum2_.datasource
              Buffers: shared hit=13
Total runtime: 2092.613 ms

Other strange path,
The pg_stat_user_tables n_live_tup is almost constant about 2,5 and somtimes this value setted to reltuples.
Yesterday a vacuum anaylze reduced n_live_tup to 500. This value was 2,5 million. And pg_class reltuples is 0 or this n_live_tup. If this value is low, the plan is fast...
Why increae this value? This table has 0 record, but it is true, a lot of instert a delete run on that table.

VACUUM ANALYZE VERBOSE
Code: 0 SQL State: 00000 --- vacuuming "public.ftr_ugyletadat"
Code: 0 SQL State: 00000 --- index "pk_ugyletadat_x" now contains 3502 row versions in 21 pages
Code: 0 SQL State: 00000 --- index "idx_ugyletadat_dok_x" now contains 3502 row versions in 17 pages
Code: 0 SQL State: 00000 --- index "ix_ftr_ugyletadat_idugylet" now contains 3502 row versions in 14 pages
Code: 0 SQL State: 00000 --- "ftr_ugyletadat": found 0 removable, 3502 nonremovable row versions in 71 out of 71 pages
Code: 0 SQL State: 00000 --- vacuuming "pg_toast.pg_toast_463274"
Code: 0 SQL State: 00000 --- index "pg_toast_463274_index" now contains 11 row versions in 2 pages
Code: 0 SQL State: 00000 --- "pg_toast_463274": found 0 removable, 11 nonremovable row versions in 3 out of 3 pages
Code: 0 SQL State: 00000 --- analyzing "public.ftr_ugyletadat"
Code: 0 SQL State: 00000 --- "ftr_ugyletadat": scanned 71 of 71 pages, containing 0 live rows and 3502 dead rows; 0 rows in sample, 0 estimated total rows
Code: 0 SQL State: 00000 --- analyzing "public.ftr_ugyletadat" inheritance tree

said found 0 live row
and
SELECT relname, n_live_tup FROM pg_stat_user_tables where relname like 'ftr_ugyletadat'

said
ftr_ugyletadat  3364

A: I don't know why, but after an
VACUUM ANALYZE VERBOSE [TABLE]
I don't find 2 days
SELECT relname, n_dead_tup,n_live_tup,n_dead_tup,* FROM pg_stat_user_tables where relname like 'TABLE_NAME';
n_live_tup greater than 0.
So the plan is fast.


text:
Q: convert string into datetime format in Javascript i have a string which, i want to compare with a javascript datetime object.
how to convert string "1/1/1912" into datetime using JavaScript so that i can compare like
if (EDateTime > ('1/1/1912'))  {...}

A: You could do this simply with a split if you can guarantee the date format.
var dateArray = '1/1/1912'.split("/");
new Date(dateArray[2], dateArray[1], dateArray[0]);

A:         var dateArray = '2012-02-17 01:10:59'.split(' ');
        var year = dateArray[0].split('-');
        var time = dateArray[1].split(':');

        var finishDate = new Date(year[0], year[1], year[2], time[0], time[1], time[2])

A: How about using DateJS library?
It can convert 1/1/1912 to Monday, January 01, 1912 12:00:00 AM easily

A: Convert your string to timestamp with Date object.
I found something like:
function toTimestamp(year,month,day,hour,minute,second){
   var datum = new Date(Date.UTC(year,month-1,day,hour,minute,second));
   return datum.getTime()/1000;
}

Year, month and day parts get with regular expressions.

A: This library may be helpful.


text:
Q: Forced PostgreSQL type convertion using JOOQ tool Is there a way to configure JOOQ tool to convert smallint to Boolean using 'forcedTypes' tag for PostgresSQL database, without providing org.jooq.Converter implementation?
This is how the current configuration looks like:
<forcedTypes>
    <forcedType>
        <name>BOOLEAN</name>
        <types>smallint.*</types>
    </forcedType>
<forcedTypes>

JOOQ v3.9.1 is being used.
PostgreSQL v9.6.6.
And unfortunately receives the next exception while storing information into the database:
Caused by: org.postgresql.util.PSQLException: ERROR: column "is_complete" is of type smallint but expression is of type boolean

Also tried with MySQL database and similar convertion from tinyint to Boolean works fine without any errors:
<forcedTypes>
    <forcedType>
        <name>BOOLEAN</name>
        <types>tinyint.*</types>
    </forcedType>
</forcedTypes>

A: No, this doesn't work as you're expecting (and it shouldn't). In jOOQ, the BOOLEAN data type is bound to JDBC as the native BOOLEAN type if the database supports it, e.g. PostgreSQL.
If the database doesn't support the type (e.g. MySQL / Oracle), then jOOQ will bind 0/1/NULL number values. But you cannot enforce this behaviour for a dialect that would otherwise support BOOLEAN types. But then again, why not just write that converter? It's really simple. Just add:
<forcedTypes>
    <forcedType>
        <userType>java.lang.Boolean</userType>
        <converter>com.example.BooleanAsSmallintConverter</converter>
        <!-- A bit risky. Are all smallints really booleans in your database? -->
        <types>smallint.*</types>
    </forcedType>
<forcedTypes>

And then:
class BooleanAsSmallintConverter extends AbstractConverter<Short, Boolean> {
    public BooleanAsSmallintConverter() {
        super(Short.class, Boolean.class);
    }

    @Override
    public Boolean from(Short t) {
        return t == null ? null : t.shortValue() != (short) 0;
    }

    @Override
    public Short to(Boolean u) {
        return u == null ? null : u ? Short.valueOf((short) 1) : Short.valueOf((short) 0);
    }
}

A: You could do that, but I doubt that this is what you had in mind. You will have to create custom cast in PostgreSQL:
CREATE FUNCTION bool2int2(IN bool, OUT int2)
LANGUAGE SQL
AS $$
SELECT CASE WHEN $1 THEN 1::int2 WHEN $1 IS NOT NULL THEN 0::int2 END
$$;

DROP CAST IF EXISTS (bool AS int2);
CREATE CAST (bool AS int2)
WITH FUNCTION bool2int2(bool)
AS ASSIGNMENT;

Then this will work:
DROP TABLE IF EXISTS booltest;
CREATE TABLE booltest (id serial, boolval int2);
INSERT INTO booltest (boolval) VALUES(true),(false),(null::bool);
SELECT * FROM booltest;
 id | boolval
----+---------
  1 |       1
  2 |       0
  3 | (null);


text:
Q: Server Side - Creating a JSON response Attention to all talented coders, First, let me start by saving I have ZERO experience with JSON and not much server side coding experience. Here is what I am trying to do:
I want to build a very simple Backend server in either Java or PHP that responds to a get commands and returns 2 different JSON results based on keyword (i.e. if the keyword starts with A or is blank, return one result. If it starts with B, return a different one). Once again, I have no idea how to go about this and would greatly appreciate if anyone can solve this for me. It's not homework, I'm just trying to learn and pickup some skills. If anyone really enjoys coding and has time to spare, please help me understand how this is done. Any help is greatly appreciated. Really. Thank you all so much in advance.
Here is what I have tried. I ultimately want to send a JSON onbect like below when a keyword is searched.
 <?php

    $data = $_GET['keyword'];

      $nullOrA = substr($data, 0)

     if($nullOrA != "A" || "B" || "C"){
    echo "Cannot find anything related to searched Keyword";
    }

  if($nullOrA == "A"){
    echo json_encode($candStr);
}

if($nullOrA == "B"){
    echo json_encode($jobStr);
}

else if($nullOrA == "C"){
    echo json_encode($companyStr);
}

//JSON object
 $Response Object:

$candStr = {"candidates": [
        {"lastName":"Doe" , "firstName":"John" , "mailingState":"IN" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"temps" , "branch":"Branch AA"},
        {"lastName":"Smith" , "firstName":"Lin" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"gloabl" , "branch":"Branch AB"},
        {"lastName":"Memory" , "firstName":"James" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"lastName":"App" , "firstName":"Tom" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AO"},
        {"lastName":"World" , "firstName":"Yeah" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch CA"},
        {"lastName":"Timmy" , "firstName":"Hungry" , "mailingState":"NY" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accoun" , "branch":"Branch AA"},
        {"lastName":"Hello" , "firstName":"Luke" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"lastName":"James" , "firstName":"Ashley" , "mailingState":"CA" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AD"},
        {"lastName":"Duck" , "firstName":"MAl" , "mailingState":"TN" , "availDate:":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
    ],
$jobStr ="jobOrders": [
        {"name":"Lawyer" , "company":"DHI" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"Business" , "branch":"Branch NA"},
        {"name":"Accountant" , "company":"HTG" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"ncurses_addchstr(s)" , "company":"HTB" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch OA"},
        {"name":"Accountant" , "company":"KNM" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"global" , "branch":"Branch AA"},
        {"name":"Lead" , "company":"KOL" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AU"},
        {"name":"Accountant" , "company":"KNM" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"Dev" , "company":"KNM" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch CA"},
        {"name":"Accountant" , "company":"KNM" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"Native" , "branch":"Branch AA"},
        {"name":"Analyst" , "company":"KNM" , "availDate":"08/15/2013" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch PO"},
    ],
$companyStr = "companies": [
        {"name":"Fruit" , "mailingState":"IN" , "matchPct":"92%", "division":"temps" , "branch":"Branch RA"},
        {"name":"Insect" , "mailingState":"CA" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"Color" , "mailingState":"CA" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"Doe" , "mailingState":"CA" , "matchPct":"92%", "division":"account" , "branch":"Branch AA"},
        {"name":"Doe" , "mailingState":"YH" , "matchPct":"92%", "division":"global" , "branch":"Branch AY"},
        {"name":"Doe" , "mailingState":"CA" , "matchPct":"92%", "division":"temps" , "branch":"Branch MN"},
        {"name":"Doe" , "mailingState":"LK" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"Doe" , "mailingState":"CA" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch LI"},
        {"name":"Doe" , "mailingState":"BH" , "matchPct":"92%", "division":"account" , "branch":"Branch AA"},
        {"name":"Doe" , "mailingState":"CA" , "matchPct":"92%", "division":"accountemps" , "branch":"Branch AA"},
        {"name":"Doe" , "mailingState":"DV" , "matchPct":"92%", "division":"US" , "branch":"Branch YH"},
    ]
}

?>

A: I suggest you might start with a very simple php tutorial
However, this might get you started:
<?php
if ($_GET["keyword"]=="B") {
    echo "a different one!";
} else {
    echo "one result.";
}

You should now be able to access http://yourserver/path/yourphp.php?keyword=A to get one result., and http://yourserver/path/yourphp.php?keyword=B to get a different one!


text:
Q: How can I resize my partition inside extended partition giving its space from outside of extended partition? I am having this set up at the moment :

and I would like to give the unallocated space between /dev/sda3/ and /dev/sda4 to /dev/sda5`. How can I do that now ?

A: There are some steps you must follow:

*

*You must fix your NTFS partition that is dirty. Boot up Windows, open the command line and type chkdsk /f X:, changing X for each of the letter of your volumes. Reboot twice.

*Now with a Live CD without any mounted partition, redimension the sda4 extended partition to fill the unallocated space. Now that space will be inside the extended partition.

*Now redimension/move the partitions as you like to fill the now "free space".

That's all

A: You have to do this on a live CD, unmount all your partitions, including swap, and do it in steps. Right now sda5 and sda6 are mounted, so you can not work with them.
From a live CD, first unmount all your partitions (you  can do this in the gparted menu).
Then, in steps, -> Increase the size of sda4 -> apply changes -> increase the size of sda5 -> apply changes.


text:
Q: How to limit concerns in routing to certain actions for root but not for namespace - Rails 4 So lets consider the following in routes.rb
  concern :shared_actions do
    resources :courses do
      resources :lessons
    end
    resources :users
  end

my admin namespace has the following
  namespace :admin do
    concerns :shared_actions
    get '', to:'dashboard#index', as: '/'
    resources :lessons
  end

and my root path '/' also shares the same concerns using
concerns :shared_actions

So what i want is,for the root path i want only index and show action for the courses path but in the admin namespace i want to have all actions for courses.
Is there a way to do that without writing explicit code for each case?


text:
Q: What is the English term for "unwittingly misspelling words based on their pronunciation?" Note that this is not the same as What is it called when words are deliberately spelled incorrectly but pronunciation is kept unchanged? because that question is about deliberate misspellings, whereas this one is about unwitting misspellings.

Many people unknowingly spell an English word exactly as they would pronounce it, which can lead to a misspelling.
Examples:

1.Elifant or Elifent for elephant.
"She ran away on seeing the elifant."
2.Shiwawa for Chihuahua.
"Their dog is a Shiwawa."

This is related to not knowing the correct spelling of the word, and is a common type of mistake made even by native speakers of English, though probably not with 'elephant'; for instance I remember a native speaker cuttingly reject some good advice from a moderator at a car audio forum with the sentence:

You need not lekcher me about the rules of this forum. I am no neofite here.

Sample sentence for SWR:

Writing 'elifent' for 'elephant' unwittingly, based on its pronunciation would be an example of ______________.

The correct term is not transliteration, and google search did not prominently turn up a pointer to such a word:
https://www.google.co.in/search?q=misspelling+words+according+to+pronunciation
So what is the English word for "misspelling words based on their pronunciation?"

A very good option already suggested kindly by @Lawrence is "phonetic spelling" (or phonetic misspelling) but can someone find a single word to express the same meaning?

A: I'm not sure if it will work perfectly, but you might be able to use phoneticise.

phoneticize verb

*

*to represent speech in writing using a system in which individual symbols reflect speech sounds in a regular manner

*to increase the representation of written language using symbols or letters that correspond more closely or regularly to the sounds of the spoken language

Source: Collins
To expand on that, you could say:

Writing 'elifent' for 'elephant' would be an example of
  phoneticization - the word was misspelt because of how it sounds.

Another Word
1006a shared in the comments another good word that may work: phoneticism.

phoneticism noun

*

*a phonetic scheme of writing

*a form of spelling in which the spoken sound accords with a written symbol

*a way of working out the phonemes in a particular language due to phonetic resemblances

Source: Collins

A: Consider phonetic spelling.

Phonetic spelling constitutes an alteration of ordinary spelling that better represents the spoken language, that employs only characters of the regular alphabet, and that is used in a context of conventional spelling.
  - dictionary.com

The above article calls IPA an example of phonetic orthography, with the label phonetic spelling retained for the case where the ordinary alphabet is used. The following quote is consistent with this usage:

*

*Start with words you already know. This will allow you come up with your own phonetic spellings. "Dog - Dahg" would be a very simple entry. Notice how "ah" makes the long "a" sound. Another example of a phonetic spelling would be "facade - fuh-sahd."
- Phonetics Spelling Dictionary
Here's an article that uses the term phonetic misspelling in the sense you're looking for, courtesy of ... :) yourself:

Let's Teach Spelling - Not Phonetic Misspelling
  - Robert L Hillerich

The inverse (forming sounds from letters) is called phonics:

The goal of phonics is to enable beginning readers to decode new written words by sounding them out, or, in phonics terms, blending the sound-spelling patterns. Since it focuses on the spoken and written units within words, phonics is a sublexical approach and, as a result, is often contrasted with whole language, a word-level-up philosophy for teaching reading.
  - wikipedia

A: The word is "mistake."
There isn't going to be an entirely different word for every single kind of mistake. And not every idea has some obscure word to explain it. It was a "misspelling." Anything beyond that is over thinking it.

A: Either mondegreen (from a mishearing of a line in an old ballad, "They have slain the Earl of Moray, and laid him on the green", which was then transcribed as "...and Lady Mondegreen"), or eggcorn (from a mishearing of acorn and the assumption that the fruit is the egg of an oak) might be useful.


text:
Q: How to add jsonarray into dictionary How to add list of object into dictionary as json array?
my code is:
public override Task TokenEndpoint(OAuthTokenEndpointContext context)
    {
        var role = new UserAccount().GetUserRolesList(context.Identity.Name);

        context.AdditionalResponseParameters.Add("userName",context.Identity.Name);

        var jsonRole = JsonConvert.SerializeObject(role.Select(x => new {x.RoleId,x.Title}),Formatting.None);

        context.AdditionalResponseParameters.Add("roles",jsonRole);
        foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
        {
            context.AdditionalResponseParameters.Add(property.Key, property.Value);
        }
        return Task.FromResult<object>(null);
    }

I want to add roles list as json array but add into dictionary as string.


text:
Q: Where is the pycharm deployment pad? This question sounds extremely stupid and ridiculous, but I don't remember what I did (not anything evil and complicated, though), and the 'tools'->'deployment' item can no longer be found in my pycharm, it no longer appears in the menu.
I am using pycharm professional 2018.3 on a Macbook.

A: You need to enable the Remote Host Access plugin.
File -> Settings -> Plugins, and then check 'Remote Host Access' in the list at the right.  It looks like this in Pycharm 2017.3.3 Professional Edition:

The official JetBrains documentation on the Plugins menu can be found here.


text:
Q: How to run Renovate inside a Ubuntu 20.04 Docker container? I want to run Renovate inside a a Ubuntu 20.04 docker container, but renovate does not seem to work. Here are the step to repdocue my setting:
docker run -it ubuntu:20.04 /bin/bash
apt update
apt upgrade
printf 'y\n1\n\1n' | apt install nodejs
apt install -y npm
npm install -g renovate
renovate --version

renovate --version gives me:
/usr/local/lib/node_modules/renovate/dist/logger/index.js:13
let logContext = process.env.LOG_CONTEXT ?? (0, nanoid_1.nanoid)();
                                          ^

SyntaxError: Unexpected token ?
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/renovate/dist/renovate.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
root@3b484953056f:/# renovate --version
/usr/local/lib/node_modules/renovate/dist/logger/index.js:13
let logContext = process.env.LOG_CONTEXT ?? (0, nanoid_1.nanoid)();
                                          ^

SyntaxError: Unexpected token ?
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/renovate/dist/renovate.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Any ideas what I am doing wrong here? Do I need to setup RENOVATE_LOG_CONTEXT? If so, how can this be done?

A: renovate github discussions is more active than this, you should try there next time.
you should look into github repository, check this repository out for ubuntu example:
https://github.com/renovatebot/docker-ubuntu/blob/master/Dockerfile

A: Check the node and git versions. Must be updated or will get that error.


text:
Q: jackson IOException: Can not deserialize Class com.mycompany.models.Person$Address (of type non-static member class) as a Bean I have a class that looks like this:
public class Person {
    public class Address {
        private String line1;
        private String line2;
        private String zipCode;
        private String state;

        // standard public getters and setters for the class here
   }

private String name;
private String address;

// standard public getters and setters for the class here

}

and here's how I am using jackson with it.
public class JsonTest {
    public static <T> Object fromJson(String jsonAsString, Class<T> pojoClass)
throws JsonMappingException, JsonParseException, IOException {
        return m.readValue(jsonAsString, pojoClass);
    }

    public static String toJson(Object pojo, boolean prettyPrint)
throws JsonMappingException, JsonGenerationException, IOException {
        StringWriter sw = new StringWriter();
        JsonGenerator jg = jf.createJsonGenerator(sw);
        if (prettyPrint) {
            jg.useDefaultPrettyPrinter();
        }
        m.writeValue(jg, pojo);
        return sw.toString();
    }

    public static void main(String[] args) {
         Person p = new Person();
         String json = this.toJson(p, true); // converts 'p' to JSON just fine
         Person personFromJson = this.fromJson(json, Person.class); // throws exception!!!
    }
}

the 3rd line of the main method (where I try to convert json to Person object), throws this exception:
IOException: Can not deserialize Class com.mycompany.models.Person$Address (of type non-static member class) as a Bean

what am I doing wrong?

A: Correct, this used to be something you can not do with current Jackson versions (1.8 and earlier).
But is it absolutely necessary for inner class to be non-static? If not, just add 'static' in declaration of Address and it'll work fine; problem is with the "hidden" this-pointer that non-static inner classes take via constructor.
Jackson 1.9 will actually supports deserialization of simple uses of non-static inner classes, see this Jira entry.

A: Because inner classes do not have a default zero argument constructor (they have a hidden reference to the outer/parent class) Jackson cannot instantiate them.
The solution is to use static inner classes:
public class Outer {
    static class Inner {
        private String foo;
        public String getFoo() { return foo; }
    }
}

Original Answer:
There are some issues in implementation and it seems like you can't serialize such classes, see cowtowncoder for details.


text:
Q: magento 2 Shipping modules does not update rate on zip code changes I got the issue.
When i am enabling default shipping module with my custom shipping module, it is refreshing the shipping section.
But when i am enabling only my custom shipping code, it is not getting refreshed when i am changing pincode.
Is there any update for this issues.


text:
Q: Specify hibernate.multi_tenant_connection_provider without using reflection Currently I am specifying the hibernate multi tenant connection provider and resolver in a properties file using this.
hibernate.multi_tenant_connection_provider: com.app.MapMultiTenantConnectionProvider
hibernate.tenant_identifier_resolver: com.app.MultiTenantCurrentTenantIdentifierResolver

Hibernate is using reflection to load these classes. The problem is that I need these classes to have access to certain variables. E.g. The DropWizard config file and users organisation to know what the database URL is and the tenant id. Currently I'm having to make variables static so that the provider has access to it.
The tutorials like this have all the required info specified in the properties file while I need mine to be dynamic depending on the currently connected user.
Here is an example of the kind of thing I'm having to do with static variables. Overall it makes the code quite messy.
public class MapMultiTenantConnectionProvider extends AbstractMultiTenantConnectionProvider {

    private static Logger log = LoggerFactory.getLogger(MapMultiTenantConnectionProvider.class);

    private Map<String, ConnectionProvider> connectionProviderMap = new HashMap<>();

    public MapMultiTenantConnectionProvider() throws IOException {
    }

    @Override
    protected ConnectionProvider getAnyConnectionProvider() {
        return getConnectionProviderForTenant("chorus");
    }

    @Override
    protected ConnectionProvider selectConnectionProvider(final String tenantIdentifier) {

        return getConnectionProviderForTenant(tenantIdentifier);
    }

    private ConnectionProvider getConnectionProviderForTenant(final String tenantId) {

        final ConnectionProvider connectionProvider;

        if (!connectionProviderMap.containsKey(tenantId)) {

            // Access a static variable here that contains the database URL, username, etc
            final MyConfig config = MyApp.CONFIGURATION;

            final Properties properties = new Properties();
            properties.setProperty("hibernate.connection.url", config.connectionUrl);
            properties.setProperty("hibernate.connection.username", config.username);
            properties.setProperty("hibernate.connection.password", config.password);
            properties.setProperty("hibernate.dialect", config.databaseConfig.getHibernateDialect());

            final DriverManagerConnectionProviderImpl newConnectionProvider = new DriverManagerConnectionProviderImpl();

            newConnectionProvider.configure(properties);

            this.connectionProviderMap.put(tenantId, newConnectionProvider);

            connectionProvider = newConnectionProvider;
        } else {
            connectionProvider = connectionProviderMap.get(tenantId);
        }
        return connectionProvider;
    }
}

I would like to create an instance and pass in the configuration (or anything else needed) like this.
new MapMultiTenantConnectionProvider(configuration)

Is it possible to specify the provider by creating an instance of it instead of defining it in a properties file?

A: You could implement the ServiceRegistryAwareService interface to get access to the Hibernate ServiceRegistry which provides you access to almost all Hibernate configurations. I don't know how you'd normally access this dropwizard configuration, but in case it is available through a managed bean, you could access the ManagedBeanRegistry and access the bean that provides this information. Other than that, there is not much you can do. Please note though, that you current implementation is not thread safe. You should be using a ConcurrentHashMap and use putIfAbsent, or even better, computeIfAbsent.


text:
Q: Is there a workaround for failing gcutil adddisk? The command line request to create a disk from a global image (generated via the web console) fails:

gcutil --service_version="v1beta15" --project=<project-id> adddisk <boot-id> --size_gb="10" --zone="us-central1-b" --source_image="https://www.googleapis.com/compute/v1beta15/projects/debian-cloud/global/images/debian-7-wheezy-v20130816"
ValueError: Invalid argument: https://www.googleapis.com/compute/v1beta15/projects/debian-cloud/global/images/debian-7-wheezy-v20130816

The same succeeds when run from the web console.  Is this a known issue?  Is there a workaround?  I am using gcutil version 1.8.4.

A: This is a regression in gcutil 1.8.4.  If you downgrade to 1.8.3, this command will work.


text:
Q: getBoundingClientRect() doesn't return height and width of SVG rect I need a pair of fresh eyes to show me what I am doing wrong.
I want to get height and width and use them to work out the position of another element.
HTML
<g>
    <rect
        class="graphic"
        draggable="data"
        ng-attr-x="{{ data.x }}"
        ng-attr-y="{{ data.y }}"
        ng-attr-height="{{ data.height }}"
        ng-attr-width="{{ data.width }}"
    ></rect>
</g>

Function for returning values I want
function getSVGRectDimensions(element) {
    //logging
    console.log('firstChild', element[0].firstElementChild);
    console.log('firstChild.Clientrect', element[0].firstElementChild.getBoundingClientRect());

    var viewportOffset = element[0].firstElementChild.getBoundingClientRect();
        if (!element.jquery) {
            element = angular.element(element);
        }
        return {
            left: viewportOffset.left,
            height: viewportOffset.height,
            top: viewportOffset.top,
            width: viewportOffset.width
        }
    }

How I use the function
var svgElement = getSVGRectDimensions(data.element);

In the console I get

From the logs, you can see that height and width of rect > 0.
<rect class="graphic" draggable="data" ng-attr-x="{{ data.x }}" ng-attr-y="{{ data.y }}" ng-attr-height="{{ data.height }}" ng-attr-width="{{ data.width }}" x="1033.78" y="364" height="46.22000000000003" width="106.8900000000001"></rect>

And yet, when I call the function with getBoundingClientRect(), height and width = 0.
firstChild.Clientrect ClientRect {} bottom: 60.999996185302734 height: 0 left: 681.1538696289062 right: 681.1538696289062 top: 60.999996185302734 width: 0 __proto__: ClientRect

Why is that happening?
I also tried to get rid of firstElementChild, which results in returning g instead of rect but still height and width = 0.

A: According to https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect getBoundingClientRect returns four values: top, left, bottom, right.
In your console you can see that these four values are present. Calculating the width and height from these values is trivial
you use:
var viewportOffset = element[0].firstElementChild.getBoundingClientRect();

which returns a DOMRect and then later:
return {
        left: viewportOffset.left,
        height: viewportOffset.height,
        top: viewportOffset.top,
        width: viewportOffset.width
    }

as I said, viewportOffset is a DOMRect which does not have properties width and height. Instead they have right, bottom.
so to work out your width and height, your return code should look like this:
return {
        left: viewportOffset.left,
        height: viewportOffset.bottom - viewportOffset.top,
        top: viewportOffset.top,
        width: viewportOffset.right - viewportOffset.left
    }


text:
Q: Trouble using M2Doc core generation API and SiriusServices I am trying to generate documentation using the core generation API (as described here https://www.m2doc.org/ref-doc/3.1.0/index.html#core-generation-api). But I have the following error:
Couldn't find the 'isRepresentationDescriptionName()' service.
(It works fine when I use the genconf not programmatically).
I tried to add the SiriusServices using SiriusServiceConfigurator, but didn't manage to solve this issue.
Or maybe is it because I didn't add the SiriusSession option that refers to the .aird file?
I have looked at how new services are added in the newEnvironmentWithDefaultServices work but it is seems not applicable for SiriusServices.
    final IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query
            .newEnvironmentWithDefaultServices(null);

    final Monitor monitor = new BasicMonitor.Printing(System.out);
    final ResourceSet resourceSetForModels = session.getTransactionalEditingDomain().getResourceSet();

    resourceSetForModels.createResource(modelUri);
    try (DocumentTemplate template = M2DocUtils.parse(resourceSetForModels.getURIConverter(), templateURI,
            queryEnvironment, classProvider, monitor)) {

        final Map<String, Object> variable = new HashMap<>();
                M2DocUtils.generate(template, queryEnvironment, variable, resourceSetForModels, outputURI, monitor);
            ...

Thanks

A: The Sirius related services need the Sirius Session. The Session is initialized using the SiriusSession option in the .genconf file. It should be set to an URI referencing the .aird file. In the class M2DocUtils you have several methods to create an IQueryEnvironment that take a Map of String where you can add the SiriusSession option, for instance:
M2DocUtils.getQueryEnvironment(ResourceSet, URI, Map<String, String>)

Note that your code needs to be ran inside of Eclipse, not a standalone java program.


text:
Q: The probability distribution of two words in a file using java 8 I need the number of lines that contain two words. For this purpose I have written the following code:
The input file contains 1000 lines and about 4,000 words, and it takes about 4 hours.
Is there a library in Java that can do it faster?
Can I implement this code using Appache Lucene or Stanford Core NLP to achieve less run time?
ArrayList<String> reviews = new ArrayList<String>();
ArrayList<String> terms = new ArrayList<String>();
Map<String,Double> pij = new HashMap<String,Double>();

BufferedReader br = null;
FileReader fr = null;
try
    {
        fr = new FileReader("src/reviews-preprocessing.txt");
            br = new BufferedReader(fr);
            String line;
            while ((line= br.readLine()) != null)
            {
            for(String term : line.split(" "))
                {
                    if(!terms.contains(term))
                        terms.add(term);
                }
                reviews.add(line);
            }
        }
        catch (IOException e) { e.printStackTrace();}
        finally
        {
            try
            {
                if (br != null)
                    br.close();
                if (fr != null)
                    fr.close();
            }
            catch (IOException ex) { ex.printStackTrace();}
    }
long Count = reviews.size();
for(String term_i : terms)
    {
        for(String term_j : terms)
            {
                if(!term_i.equals(term_j))
                {
                    double p = (double) reviews.parallelStream().filter(s -> s.contains(term_i) && s.contains(term_j)).count();
                    String key = String.format("%s_%s", term_i,term_j);
                    pij.put(key, p/Count);
                }
            }
    }

A: Your first loop getting the distinct words relies on ArrayList.contains, which has a linear time complexity, instead of using a Set. So if we assume nd distinct words, it already has a time complexity of "number of lines"×nd.
Then, you are creating nd×nd word combinations and probing all 1,000 lines for the presence of these combination. In other words, if we only assume 100 distinct words, you are performing 1,000×100 + 100×100×1,000 = 10,100,000 operations, if we assume 500 distinct words, we're talking about 250,500,000 already.
Instead, you should just create the combinations actually existing in a line and collect them into the map. This will only process those combinations actually existing and you may improve this by only checking either of each "a_b"/"b_a" combination, as the probability of both is identical. Then, you are only performing "number of lines"דword per line"דword per line" operations, in other words, roughly 16,000 operations in your case.
The following method combines all words of a line, only keeping one of the "a_b"/"b_a" combination, and eliminates duplicates so each combination can count as a line.
static Stream<String> allCombinations(String line) {
    String[] words = line.split(" ");
    return Arrays.stream(words)
        .flatMap(word1 ->
            Arrays.stream(words)
                  .filter(words2 -> word1.compareTo(words2)<0)
                  .map(word2 -> word1+'_'+word2))
        .distinct();
}

This method can be use like
List<String> lines = Files.readAllLines(Paths.get("src/reviews-preprocessing.txt"));
double ratio = 1.0/lines.size();
Map<String, Double> pij = lines.stream()
        .flatMap(line -> allCombinations(line))
        .collect(Collectors.groupingBy(Function.identity(),
                                       Collectors.summingDouble(x->ratio)));

It ran through my copy of "War and Peace" within a few seconds, without needing any attempt to do parallel processing. Not much surprising, "and_the" was the combination with the highest probability.
You may consider changing the line
String[] words = line.split(" ");

to
String[] words = line.toLowerCase().split("\\W+");

to generalize the code to work with different input, handling multiple spaces or other punctuation characters and ignoring the case.


text:
Q: TikZ current page node is in unexpected place Edit: there was a mistake in my original question. The wrong output occurs with "latex", but not with "pdflatex". I'll rephrase the question to be more accurate and succinct.
I am trying to position some object at an absolute position on the page, following the examples from Section 17.13.2 of the TikZ manual ("Referencing the Current Page Node - Absolute Positioning"). I am looking at version 3.0.1a of the manual. The following example is directly from the manual:
\documentclass{article}
\usepackage{tikz}
\begin{document}

This example adds a circle in the middle of the page.

\begin{tikzpicture}[remember picture,overlay]
  \draw [line width=1mm,opacity=.25]
  (current page.center) circle (3cm);
\end{tikzpicture}

\end{document}

When I compile this with "pdflatex bug.tex" (twice), the output is as expected:

When I compile the same file with "latex bug.tex" (twice), and the convert the DVI file to PDF with "dvips bug.dvi -o" and "pdf2ps bug.ps", the output is wrong. The circle is not centered.

Notice that only the circle has moved, not the rest of the page. So the problem is not with dvips or pdf2ps. The mistake is already present in the DVI file. Moreover, there is a difference in the file bug.aux. When compiling with pdflatex, the file contains
\relax
\pgfsyspdfmark {pgfid1}{9782558}{42447667}

When compiling with latex, the file contains
\relax
\pgfsyspdfmark {pgfid1}{9782558}{45729504}

What goes wrong?

A: from pgf & tikz manual (3.0.1a) follows:

101.3.2 Referencing Anchors of Nodes in Different Pictures
As a picture is typeset, pgf keeps track of the positions of all nodes
  inside the picture. What pgf does not remember is the position of the
  picture itself on the page. Thus, if you define a node in one picture
  and then try to reference this node while another picture is typeset,
  pgf will only know the position of the nodes that you try to typeset
  inside the original picture, but it will not know where this picture
  lies. What is missing is the relative positioning of the two pictures.
  To overcome this problem, you need to tell pgf that it should remember
  the position of pictures on a page. If these positions are remembered,
  then pgf can compute the offset between the pictures and make nodes in
  different pictures accessible. Determining the positions of pictures
  on the page is, alas, not-so-easy. Because of this, pgf does not do so
  automatically. Rather, you have to proceed as follows:

*

*You have to use a backend driver that supports position tracking. pdfTEX is one such driver, dvips currently is not.

*You have to say \pgfrememberpicturepositiononpagetrue somewhere before or inside every picture ...

conclusion, so far your way of copmpilation will not give desired result! you need to use pdfLaTeX or XeLatEX or LuaLaTeX ...

A: I cannot reproduce your issue. On my TeXLive 2018 distribution, regardless of whether I compile with latex or pdflatex, I always get an identical entry in the aux file
\pgfsyspdfmark {pgfid1}{9782558}{42447667}

The results are indistinguishable.
This raises the question which LaTeX distribution you are using.
I also cannot follow Zarko's discussion, which in my opinion mixes two things: pgfpictures and tikzpictures. He is quoting from `quoting from section 101, which starts with

This section describes the shapes module.
  \usepgfmodule{shapes}.

It is, of course, not excluded that there are issues with the conversion chain tex -> dvi -> ps -> pdf but at least on my machine I cannot reproduce your issues.

A: After further investigation, I'll answer my own question.
I confirm that the described behavior does not happen with TeXLive 2018; this explains why marmot could not reproduce it. I had been using TeXLive 2017. So it seems that this was indeed a bug and has been fixed.
The other piece of information is that in TeXLive 2017, the bug can be circumvented by putting
 \pdfpageheight=\paperheight

before any code that accesses the "current page" node (and after any code that updates \paperheight, such as when using the geometry package). Maybe this information will be useful to people still using TeXLive 2017 (which ships with the current version of Ubuntu, for example).


text:
Q: Python 2d list to dictionary list I got this list
lst = [['outlook', 'rainy', 2, 3, 'overcast', 4, 0, 'sunny', 3, 2], ['temp', 'hot', 2, 2, 'mild', 4, 2, 'cool', 3, 1], ['humidity', 'high', 3, 4, 'normal', 6, 1], ['windy', 'false', 6, 2, 'true', 3, 3]]

I would like to turn it to dictionary like:
{'outlook': {rainy: 2, 3, overcast: 4, 0, sunny: 3, 2}
'temp': {hot: 2, 2, mild: 4, 2, cool: 3, 1}
'humidity': {high: 3, 4, normal:, 6, 1}
'windy': {false: 6, 2, true: 3, 3}}

So far my attempt:
for elem in lst:
    d[elem[0]] = elem[1::1]

d = {'outlook': ['rainy', 2, 3, 'overcast', 4, 0, 'sunny', 3, 2], 'temp': ['hot', 2, 2, 'mild', 4, 2, 'cool', 3, 1], 'humidity': ['high', 3, 4, 'normal', 6, 1], 'windy': ['false', 6, 2, 'true', 3, 3]}

A: Admittedly not the most readable, but could do this with a nested dict comprehension
>>> {i[0]: {i[j]: i[j+1:j+3] for j in range(1,len(i),3)} for i in lst}
{'outlook': {'rainy': [2, 3], 'overcast': [4, 0], 'sunny': [3, 2]},
 'temp': {'hot': [2, 2], 'mild': [4, 2], 'cool': [3, 1]},
 'humidity': {'high': [3, 4], 'normal': [6, 1]},
 'windy': {'false': [6, 2], 'true': [3, 3]}}

A: Not a one liner. But along the lines of thing you already tried.
d = {}
for elem in lst:
    subd = {}
    for i in range(1, len(elem), 3):
        subd[elem[i]] = elem[i+1:i+3]
    d[elem[0]] = subd


text:
Q: Nested if statement with boolean conditions around dataframe columns I am struggling a bit with one of the requirements that I have. Let me try to explain.
I have a DataFrame with 150 columns. I need to check if the value in column1, column2, column3 and column4 is equal to zero. If yes, then I need to add a new column to the DataFrame and set the value to 1 else set the value to 0.
I did try to code this using a nested if condition statement but I was getting an error "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()". I tried everything that I know and based on solutions provided here but couldn't get past this error.
Can you please let me know how to get this done. Thanks in advance for your help.

A: Try:
df["new_column"]=0
df.loc[(df["column1"]==0) & (df["column2"]==0) &(df["column3"]==0) & (df["column4"]==0), ["new_column"]]=1

A: try to use the following code (apply is a loop on the rows)
Df['new column']=Df.apply(lambda x: 1 if Df['column1']==1 and Df['column2']==1 and  Df['column3']==1 else 0, axis=1)