text:
Q: two variable function How can I show that this problem isn't differentiable at $(0,0)$?
at first, I think that this function isn't continuous at $(0,0)$ that implies it's not differentiable. Am I right?
Is there any other solution to prove whether this function is differentiable?
Thanks.
$$f(x,y) = \begin{cases} 2xy\frac{x^2-y^2}{x^2+y^2}, & \mbox{if } x^2+y^2 \neq 0 \\ 0, & \mbox{otherwise}\end{cases}$$

A: The OP has a duplicate here Differentiability at $(0,0)$.
However, I think it could be useful make a general comment here on the topic of Differentiability and Continuity for functions of several variables. Any other contribution or observation will be appreciate.
1. Firstly you might check whether or not f is continuos in (0,0)
    by calculating the limit as $(x,y)\to(0,0)$. If it is discontinuos then
    it can't be differentiable, infact:
NOTE
continuity is a necessary condition since differentiability implies continuity
2. Then you have to check whether or not partial derivatives in (0,0)
        exist by calculating them as limits of the incremental ratio; if
        the partial derivatives do not exist then $f$ can't be
        differentiable, infact:
NOTE
existence of partial derivatives is a necessary condition since differentiability implies their existence
Even is $f$ is continuos in $(0,0$ and partial derivatives exist in $(0,0)$ you can't conclude anything yet about differentiability at $(0,0)$.
3. To be sure you need to check that partial derivatives are continuos
    in $(0,0)$ by calculating $f_x$ and $f_y$ for $(x,y)\neq(0,0)$ and the
    calculationg their limit at (0,0). If their are continuos you are
    done, infact:
NOTE "Differentiability theorem"
if all the partial derivatives exist and are continuous in a neighborhood of (0,0) then (i.e. sufficient condition) the function is differentiable at $(0,0)$
4. If partial derivatives are not continuos at $(0,0)$ you can't yet
    conclude anything about differentiability. You need to check
    directly differentiability by definition that:
$$\lim_{(h,k)\rightarrow (0,0)} \frac{\| f(h,k)-f(0,0)-(f_x(0,0),f_y(0,0))\cdot (h,k)\|}{\| (h,k)\|}=0$$
NOTE
In this case you can also skip "3" and try directly with "2" and"4" to check differentiability.

A: From $f(x,0)=f(0,y)\equiv0$ it follows that $f_x(0,0)=f_y(0,0)=0$. This implies that $df(0,0)=0$ if $f$ is at all differentiable at $(0,0)$. We therefore have to check whether
$$\lim_{(x,y)\to(0,0)}{f(x,y)-f(0,0)-0\over\sqrt{x^2+y^2}}=0\ .$$
To this end we express $f$ in polar coordinates $r$, $\phi$ and obtain
$${f(x,y)-f(0,0)-0\over\sqrt{x^2+y^2}}={\hat f(r,\phi)\over r}={1\over2} r\sin(4\phi)\to0\qquad(r\to0+)\ .$$
This shows that in fact $df(0,0)=0$.


text:
Q: Duplicate and rename by increment of 1 I have a file 00185.txt, how do I create a batch file to duplicate this file and rename to 00186.txt, then continue to duplicate another 150 times by an increment of one.
eg. original file is 00185.txt, duplicate this and rename to 00186.txt, then the next would be 00187.txt, all the way to 00300.txt.
Any help would be greatly appreciated. Thank you.

A: @echo off
setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION

if not exist "00185.txt" echo Stack overflow example > "00185.txt"

set first=186
set /A last=%first% + 150
for /L %%A IN (%first%,1,%last%) do @copy /B /Y "00185.txt" "00%%A.txt" > nul

redpajama_set_name: RedPajamaStackExchange


text:
Q: Excel Formula: Reference a cells value whilst maintaining original cell reference Sorry for the hash of a title. Not sure how to explain this...
I have a cell that now stores a value of the Row kind of like a counter.
I need to extend a formula to now account for the number now stored in Cell A30.
My current formula is as follows:
=SUMIFS(J7:J30,K7:K30,">="&B38,K7:K30,"<="&C38, C7:C30, "FALSE")
The numbers in bold need to pull the value from Cell A30. Is this possible?

A: Use the non volatile INDEX:
=SUMIFS(J7:INDEX(J:J,A30),K7:INDEX(K:K,A30),">="&B38,K7:INDEX(K:K,A30),"<="&C38, C7:INDEX(C:C,A30), "FALSE")

What this does is create a range reference form row 7 to the row indicated in A30 for each of the referenced columns.
For Example:
If A30 has 200 as a value:
J7:INDEX(J:J,A30)

Would reference the range J7:J200


text:
Q: MongoDB - Filter array with array I have one data example like this one in MongoDB.
{
  id: 628a8683fc489c315b330ade,
  examName : 'Final Exam',
  schedule:
  {
    scheduleDate : '2021-10-18T17:00:00.000+00:00'
    scheduleName : 'Package Test'
    package:[
       {
         exclude_question:[1,2],
         namePackage:testing
         packageId:628a89c2fc489c315b330b01
       }

    ]
  },
  question:[
    {
       id:1,
       question:'hello can u test it?'
       answer:'No'
    }
    {
       id:3,
       question:'Is it working?'
       answer:'No'
    }
    {
       id:2,
       question:'Should i repeat?'
       answer:'Yes'
    }
  ]
}

Condition:
Basically at schedule.package it is possible to have more than one value, but I have already filtered it so only one value is in the array.
Now I need to filter the question with exclude_question. Value of exclude_question is an array id of the question and now I need to only show the question that is not in exlcude_question.
So the output that I expect is like this one:
{
  id: 628a8683fc489c315b330ade,
  examName : 'Final Exam',
  schedule: {.......},
  question:[
    {
       id:3,
       question:'Is it working?'
       answer:'No'
    }
  ]
}

It only shows the question with id: 3 because it is not in exclude_question. I'm kinda confused about how to get the value from the array inside the array to filter the question array. If you have any suggestions I will very thankful.

A: *

*$set - Create exclude_questions field:
1.1. $reduce - Iterate every document of schedule.package, merge ($concatArrays) exclude_question array value into an new array and return it.

*$set - Set the value for question field.
2.1. $filter - Filter the document in question array field with the document's id $not $in exclude_questions array.

*$unset - Remove exclude_questions field.
db.collection.aggregate([
  {
    $set: {
      exclude_questions: {
        $reduce: {
          input: "$schedule.package",
          initialValue: [],
          in: {
            $concatArrays: [
              "$$value",
              "$$this.exclude_question"
            ]
          }
        }
      }
    }
  },
  {
    $set: {
      question: {
        $filter: {
          input: "$question",
          cond: {
            $not: {
              $in: [
                "$$this.id",
                "$exclude_questions"
              ]
            }
          }
        }
      }
    }
  },
  {
    $unset: "exclude_questions"
  }
])

Sample Mongo Playground

A: You can use the aggregation like following,

*

*you already mentioned shedule.package has always one element, so the arrays what you need to exclude. For safety operator we use $ifNull

*$filter to exclude the questions that you need to exclude

*$unset to remove the varaible that we set in the first step

here is the code
db.collection.aggregate([
  {
    "$addFields": {
      "exe_qus": {
        "$ifNull": [
          { "$arrayElemAt": [ "$schedule.package", 0 ] },
          []
        ]
      }
    }
  },
  {
    "$addFields": {
      "question": {
        "$filter": {
          "input": "$question",
          "cond": {
            $not: {
              $in: [ "$$this.id", "$exe_qus.exclude_question" ]
            }
          }
        }
      }
    }
  },
  {
    "$unset": "exe_qus"
  }
])

Working Mongo playground

A: Here's another way to do it.
db.collection.aggregate([
  {
    "$set": {
      "question": {
        "$filter": {
          "input": "$question",
          "as": "q",
          "cond": {
            "$not": [
              {"$in": ["$$q.id", {"$first": "$schedule.package.exclude_question"}]}
            ]
          }
        }
      }
    }
  }
])

Try it on mongoplayground.net.


text:
Q: Solutions of the LP problem
I am asked to find all the solutions of the following linear programming problem
  using the simplex method.
$$\min(2x + 3y + 6z + 4w)$$
  $$\begin{aligned}
x+2y+3z+w &\geq 5\\
x+y+2z+3w &\geq 3\\
x,y,z,w &\geq 0
\end{aligned}$$

To solve this problem we use the Two-Phase method, don't we?
Then I found that there are infinite many solutions, $(x,y,z,w)=(1-m, 2-0.4m, 0, 0.2m), 0≤m≤1$.
Could you tell me if this is right?

A: $x+2y+3z+w \geq 5\\ x+y+2z+3w \geq 3 \\ \implies 2x+3y+5z+4w \ge 8 \implies 2x+3y+6z+4w \ge 8 +z \ge 8 $
so the min is $8$ when $z=0$


text:
Q: GCP Logging - read only logs that are not exported to any sink Using GCP's Java SDK, I'd like to read only logs that are not configured to be exported to any sink.
When I call com.google.cloud.logging.Logging.listLogEntries() I get all of the logs, including logs are exported to sinks I have configured.
Any way to collect only log entries that are not configured to be exported to any sink?

A: You need to use EntryListOption to get filtered log entries as explained on this page.
  Page<LogEntry> entries = logging.listLogEntries(
        EntryListOption.filter("logName=projects/" + options.getProjectId() + "/logs/test-log"));
        Iterator<LogEntry> entryIterator = entries.iterateAll().iterator();
        while (entryIterator.hasNext()) {
          System.out.println(entryIterator.next());
        }

Any way to collect only log entries that are not configured to be exported to any sink?

In order to achieve this,

*

*you need to get all sinks using REST api or equivalent java client

*iterate over sinks to get each filter query

*build a dynamic filter to use with the above EntryListOption


text:
Q: Xamarin.Forms MediaElement in 4.6.0847, files, and UWP I'm using the new experimental MediaElement in Xamarin Forms and want to play files from the Video library on UWP. Using a file picker, I get an absolute path, create a FileMediaSource and set the MediaElement.Source. When I try to play an MP4 file, MediaElement.MediaFailed is called and no video plays. Nothing interesting in the event args.
I have set the experimental flag, and this works fine when compiled on Android. It also works on UWP if I create a MediaSource using a Uri. Could this be an issue with file access due to sandboxing on UWP? Any ideas? TIA.


text:
Q: Elasticsearch with postman - no handler found for uri I'm working on a scraping project and I want to store my data in an elasticsearch database. My connection between my scraper and elasticsearch seems to be ok because I have some data.
I installed elasticsearch through a docker image like this :
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.12.1

It's the first time that I use elasticsearch so i want to play a bit with it so i decided to use Postman. When I'm trying to get an ES item through postman I get this error :
{"error": "no handler found for uri [http://localhost:9200/scrapy-wouahome/_doc/nJQ55nkBYs4cp5KYjzfQ] and method [GET]"}

I configured the proxy params like this : proxy params
This this my request to get an item by id : get an item with postman
I also tried to get my item through the curl method and it's working : get an item with curl
And I tried to access to my item directly through my browser and it's also working: get an item with my browser
So it seems I can access to my elasticsearch database but I guess I missed something in my postman's configuration. I'm a beginner with postman and elasticsearch so I would appreciate your help.
Of course I did some research about this error but I didn't find anything relevant..

A: Finally i just turn off the ssl certificate and proxy and it's works !!


text:
Q: NoSuchElementException and SyntaxError during web-scraping I am having some difficulties in applying this suggestion to fix the following error:
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"./ancestor-or-self::form"}

got when I use the following code:
from selenium import webdriver

query = ' I want to try to translate this text'
chrome_options = webdriver.ChromeOptions('/chromedriver')
driver = webdriver.Chrome()
driver.get('https://translate.google.com/')
search = driver.find_element_by_css_selector('#source')
search.send_keys(query)
search.submit()

As explained here: NoSuchElementException - Unable to locate element, I should use something like this
WebDriverWait wait = new WebDriverWait(driver, 10);

wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("source"));

But I get a SyntaxError (due to WebDriverWait wait = ).
I have tried also to follow these answers:
NoSuchElementException (SyntaxError: too many statically nested blocks)
Selenium Webdriver - NoSuchElementExceptions
but I am still getting errors:
try:
    search = driver.find_element_by_css_selector('#source')

    break
except NoSuchElementException:
    time.sleep(1)

gives me break outside the loop; whereas this
try:
    search = driver.find_element_by_css_selector('#source')

except NoSuchElementException:
    pass

does not change anything (still gives me the error: NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"./ancestor-or-self::form"})
Could you please help me to find a way to fix these errors?
Update: I also tried to use driver.implicitly_wait(60) and I have got the same NoSuchElementExpection error.
More detail on the error:
---> 23     search.submit()
     24
     25

~/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py in submit(self)
     83         """Submits a form."""
     84         if self._w3c:
---> 85             form = self.find_element(By.XPATH, "./ancestor-or-self::form")
     86             self._parent.execute_script(

A: <textarea id="source" class="orig tlid-source-text-input goog-textarea" rows="1" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off" style="overflow: auto hidden; box-sizing: border-box; height: 70px; padding-bottom: 18px;"></textarea>

Xpaths can be either:
//*[@id='source']

/html/body/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div/div[1]/textarea

Basically wait for an element and send the query and hit submit.
search = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, //*[@id='source']))
search.send_keys(query)
search.submit()

Also add these
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

A: You have done everything wright in your code shared at top except this line: search.submit(). As you are calling submit() method of web element and element search defined by you is no form rather its an Textarea,hence NoSuchElementException . Because submit method is applicable for only form type of elements. If you remove this line your code will work just fine.
from selenium import webdriver
query = ' I want to try to translate this text'
chrome_options = webdriver.ChromeOptions('/chromedriver')
driver = webdriver.Chrome()
driver.get('https://translate.google.com/')
search = driver.find_element_by_css_selector('#source')
search.send_keys(query)

Output

Note :
To know how to use different wait mechanisms in selenium python, below could be a good read:
https://selenium-python.readthedocs.io/waits.html


text:
Q: Can't add shopify image through url I am having trouble regarding this code:
<!doctype html>

<title>{{ page_title }}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="{{ page_description | escape }}">
<link rel="canonical" href="{{ canonical_url }}">
<link rel="stylesheet" href="{{ 'some.css' | asset_url }}" type="text/css">

<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
{{ content_for_header }}
{{ 'bootstrap.min.css' | asset_url | stylesheet_tag }}

{% section 'header'%}

{{ content_for_layout }}

{{ 'bootstrap.min.js' | asset_url | script_tag }}
{{'https://cdn.shopify.com/s/files/1/0585/4674/9577/files/Untitled-1.jpg?v=1655109717' |
img_url: '150x'| image_tag'}}

The error for image is this:
Liquid error: input to image_tag must be an image_url

A: As written in the documentation and in your error you need to provide an image_url filter with width or height in order to use the image_tag HTML filter.
Also, the filter img_url is deprecated.
I assume that this image is stored in the Files of the Shopify store, so it would be best to use an img tag with a file_img_url filter.


text:
Q: Why can glGenerateMipmap(GL_TEXTURE_2D) and setting GL_TEXTURE_MIN_FILTER to GL_LINEAR solve the black texture problem? I have tried to load an image into an OpenGL texture use stb_image, and here is the code:
unsigned int texture;
glGenTextures(1, &texture);

int width, height, nrChannels;
stbi_set_flip_vertically_on_load(true);
unsigned char* data = stbi_load("awesomeface.png", &width, &height, &nrChannels, 0);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);

stbi_image_free(data);

I think this code could work, but it give me a black texture, which should be the image.
After spending a lot of time on solving this problem, I finally found two ways to solve it:

*

*add glGenerateMipmap(GL_TEXTURE_2D) after glTexImage2D()

*add glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) after glBindTexture()
Either of these two methods will solve the problem, but I don't know why.
Can anyone explain how it works?

A: It's due a combination of two default values:

*

*GL_MIN_FILTER has a default value of GL_LINEAR_MIPMAP_LINEAR and

*GL_TEXTURE_MAX_LEVEL has a default value of 1000.

Since there is only one texture level present, the texture is considered incomplete.
The fixes work because either of them solves one of the problems. Generating mipmaps solves the problem that the mipmaps are missing while setting the minification filter to GL_NEAREST (or GL_LINEAR for that purpose) sets the filter to a mode where mipmaps are not required.
This is a very common problem, and is also mentioned in the Common Mistakes article of the OpenGL wiki.


text:
Q: Validity of the code Consider the following code :
void populate(int *arr)
{
   for(int j=0;j<4;++j)
       arr[j]=0;
}

int main()
{
   int array[2][2];
   populate(&array[0][0]);
}

There was a discussion regarding this on a local community whether the code is valid or not(Am I supposed to mention its name?). One guy was saying that it invokes UB because it violates
C++ Standard ($5.7/5 [expr.add])

"If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined."

But I don't see anything wrong with the code,the code is perfectly OK for me.
So, I just want to know is this code valid or not? Am I missing something?

A: You have an array of arrays.  array[1] follows array[0] in memory, because arrays are contiguous.  If p == array[0], then p[1] follows p[0], because arrays are contiguous.  So, you are right: all the memory for array is contiguous.
In pictures, array looks like this.
+-----------------+-----------------+
|      [0]        |      [1]        |
+-----------------+-----------------+

Now, let's break down array[0] and array[1], they individually look like this:
+--------+--------+
|  [0]   |  [1]   |
+--------+--------+

So, the final picture is:
+--------+--------+--------+--------+
| [0][0] | [0][1] | [1][0] | [1][1] |
+--------+--------+--------+--------+

Now, the question is, can you access this contiguous memory the way you are.  The answer is, it is not guaranteed by the standard.  The arrays are contiguous, but the standard doesn't allow indexing the way you have done.  In other words:
&array[0][0]+2 == &array[1][0], but (&a[0][0] + 2) + 1 is undefined whereas &a[1][0] + 1 is valid.  If this seems strange, it is, but as per the quote you posted from the standard, you are only allowed to calculate a pointer that is either inside an array or at most one past the array (without dereferencing that "one past" pointer).
In practice, I doubt that this would fail anywhere, but the according to the standard at least, your code is invalid because of undefined behavior.
See this post on comp.lang.c as well.

A: That is not going to always work. C has arrays of arrays, not 2D arrays. The sub-arrays are not always specified to be contiguous in memory(static arrays might be, check C/C++ standard)  In this particular example, I suspect it works correctly. However, if you had dynamically allocated the memory being passed in, you quite possibly would fail, because malloc(or new) might have put the subarrays quite far apart.
If, however, you want to linearly walk down '2d' memory, you can construct a 2D accessor against a 1D array and it will work fine and things like memset will work against the 1D array.

A: Your array is two arrays of int[2], while your function populate() treats it as a single array of int[4]. Depending on exactly how the compiler decides to align the elements of array, this may not be a valid assumption.
Specifically, when j is 2 and you try to access arr[2], this is outside the bounds of main's array[0] and is therefore invalid.

A: In C everything is stored in linear memory segments. You are passing address of a[0][0] which would be same as address of a[0] so
a[i][j] is same as a[i*ColSize+j] because everything is stored linearly. But if you allocate memory dynamically it would fail because that time all rows might not be stored in contiguous location. then a[i][j] would be *(&a[i]+j).


text:
Q: TypeScript EsLint warning overruled by TypeScript error In my EsLint configuration file I have the rule @typescript-eslint/no-unused-vars added as warning.
Now it shows an error instead of a warning. It seems that general TypeScript overrules EsLint errors? See my screenshot below: ts(x) over eslint(x).

My EsLint configuration:
extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
parserOptions: {
    project: './tsconfig.json',
    ecmaVersion: 2020
},
rules: {
    '@typescript-eslint/no-unused-vars': 'warn',

     // ..
}

tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2021",
    "jsx": "react",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "allowJs": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "lib": [
      "es2021",
      "dom"
  ]
  }
}

What would be a possible issue? And how can I let EsLint overrule these generic errors?

A: rules: {
   "@typescript-eslint/no-unused-vars": [
      "warn",
      {
        "vars": "all",
        "args": "after-used",
        "ignoreRestSiblings": false
      }
    ]
}


text:
Q: What is the best way to run a PHP script at a particular time? I have a site where auctions end a varying times.  I need to send an automated email to the seller and the buyer after the auction is finished to notify them of the auction ending and the results.  Obviously I can't really wait for someone to load the page to run the script so is there a good way to automate this by checking the current time and comparing that to the time of the auction end and running that script?
The site is on a UNIX server so a cron job is an option, but I'm concerned that running a cron job like that will put quite a load on the server.

A: A cron job runs at most once per minute.
Whatever load it generates on the server really depends on the kind of script you're going to run. Btw, I'm assuming that you're using cli to run the script (rather than just doing a curl http://mysite.com.
If your script takes longer than one minute (you should monitor this), simply either:

*

*Increase the interval time between runs or,

*Use a lock file to make sure no two instances of your script can run at the same time.
if (($fp = fopen('/tmp/mylockfile', "r+")) === false) {
    die("Could not open lock file");
}
if (!flock($fp, LOCK_EX | LOCK_NB)) {
    die("Could not obtain lock");
}
// run your code here

// release the lock and close file
fclose($fp);

OTOH If the script needs to run more than once per minute, you would need a different mechanism entirely.

A: Use Cron. It allows you to run any command at most once per minute: http://clickmojo.com/code/cron-tutorial.html
As far as server load goes, it generally won't be a concern unless you are running a massive number of database calls very often on a very low-end server. I speak in generalities, but the idea is sound.
If you are using something else (besides PHP) to run your auction timer mechanism, I recommend you attach some code to that timer mechanism that also executes a mail-sending script when the timer runs down to zero and determines a winner.

A: Q: What is the best way to run a PHP script at a particular time, or interval?
A: Use cron
Q: Does a cronjob create a big load on the server?
A: Depends off course off your script. But checking if an auction should be closed, close it and send two emails shouldn't be to difficult. Be sure to create some kind of lockfile to make sure that if your script runs longer than the interval set, it isn't run twice.
Q: running a script with shorter intervals than 1 minute
A: Can't answer this one for you. Sorry :)

A: Run the PHP script as a command line script. This will not put a load on the webserver - just a load on the server and you can easily run it via CRON.
If you add #!/usr/bin/php to the top of the script and change the execute bit on the file with chmod +x scriptname.php you can directly execute the script without passing it through php
http://php.net/manual/en/features.commandline.php

A: A couple of things you need to do this:

*

*Store something in your auction information indicating whether you've sent this e-mail yet or not (could be a boolean or a date for when it was sent which might be null).  Although I have to assume you need to do something besides send this e-mail?  Like mark the auction as closed so no more bidding can take place?

*A bit of code that finds auctions which need this e-mail sent: e.g. they've ended and have not yet been reminded.

*Something to repeatedly execute the bit of code in 2.  You could use cron.  Alternatively you can write a pretty simple daemon for unix that runs constantly in a loop of (wait at least a few ms or more; do some stuff).  The latter is a lot more work but in my opinion scales much better.  See http://pear.php.net/package/System_Daemon for some useful tools if you're interested in this approach.
One thing to consider is how much you want to be careful about accidentally double-sending this e-mail.  If you're only running this code in a single thread it's pretty easy but if you ever want to build out to the point where you have several different distributed machines that create and send these e-mails you have to be a bit more careful.  If you're running it out of cron can you guarantee one run of it will always be finished before another one starts?


text:
Q: How to select a specific div as a page for jQuery booklet plugin? i am using jQuery booklet plugin http://builtbywill.com/code/booklet/installation  to display a book on my website by default it will select all the direct child of b-load class as a page of the book but i just want to select a specific set of div with class name myPages.
i tried to modify plugin by just replacing src.children() by src.children('div.myPages') but it didn't work and it will destroy the whole structure of the web page.
So please tell me how can i do this?
-Thanks

A: According to what I understood, I think modifying src.children() to src.children('div.myPages') is sure your going to screw up your layout because the script is going to add the "paging styles" for the divs on the spot.
So a better easy method that I could think is to put up a separate div to hold the div.mypages and append all the div.mypages onto that div.
Here you may see a working example http://jsfiddle.net/dNfV7/1/
Hope this helps!

A: You could use find():
  children().find(".myPages")

It will select the specific class.


text:
Q: How to organize Visual Studio publish folder? I have a few questions about the publishing process of an ASP NET Core app in Visual Studio:

*

*Is it possible to change the name of wwwroot without repercurssions?

*

*I mean, in html code for the Razor Page, if have elements that fetch
images and fonts from that directory. Some have inline CSS. But
whenI    change the name of the root folder, it spoils everything.
Doesn't    keep the fonts or the original style.

*In the runtimes folder, I have folders for Unix, Win x64, Win x86,
    etc. Can't I specify one of these OS, in the Build Settings, for
    example?

*Is it possible to keep the all the dependency files, dll files, in a
specific folder, when I publish?
This is only to have a better organization in the end.
Thank you in advance.

A: *

*By default, WWWRoot folder in the Asp.Net Core project is treated as a web root folder. Static files can be stored in any folder under the web root and accessed with a relative path to that root.
We can rename WWWRoot folder to any other name as per our choice and set it as a web root by the below method while preparing hosting environment in the Program.cs.
public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
               //custom the web root foler.
                webBuilder.UseWebRoot("wwwroot1");
                webBuilder.UseStartup<Startup>();
            });

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-3.1

*In order to build a cross-platform asp.net core application, we could specify the target runtime identity with RuntimeIdentifiers(RID).
https://learn.microsoft.com/en-us/dotnet/core/tools/csproj#runtimeidentifiers
Also, we could opt in to it in the publish Overview.

Check this for more details.
https://stackify.com/cross-platform-net-core-apps/
https://learn.microsoft.com/en-us/dotnet/core/rid-catalog

*Whether to package dependency files or not, we usually call this solution deployment mode(self-contained deployment and framework-dependent deployment).
https://learn.microsoft.com/en-us/dotnet/core/deploying/


text:
Q: How to move query from Redshift to Presto Case when source='a' then '\'qwerty Rs\' + {%raw%}{#difference}{%endraw%} + \' xyz\''
when source='b' then '\'qwerty Rs \' + {%raw%}{#difference}{%endraw%} + \' qwerty\''
when source='c' then '\'qwerty Rs \' + {%raw%}{#difference}{%endraw%} + \' qwerty\''
when source='d' then '\'qwerty Rs \' + {%raw%}{#difference}{%endraw%} + \' qwerty\''
else null end as insight_text

The above query block is in Redshift SQL, and I need to convert this to Presto SQL.


text:
Q: What is the purpose of source maps? Can someone please explain what the point is of source maps? Because as I see it, my concatenated and minified file gets loaded (talking about JavaScript), alongside 100+ modules. How is this not affecting performance when I'm loading twice the size as before?

A: The point of a source map is that you can run minified Javascript or transpiled Javascript (which is not particularly readable in a debugger by itself),  but when you open the debugger, the source map is loaded by the debugger and it gives you a readable form of your source for debugging purposes.  The source map is not loaded if the browser is not configured for source map debugging.
Source maps are also extremely useful if you are transpiling code from something like TypeScript or ES6 down to ES5 Javascript so you can see the actual code that you wrote originally in the debugger rather than only the transpiled and minified output.
The alternative before the days of source maps was to have separate versions of your site or options on your site that would load non-minified JS so that you could debug with normal symbols, but this of course isn't actually debugging the exact same code so even then, this could still leave you having to try to debug minified code.
You can read here about how source maps are enabled in the Chrome debugger.  If you're watching what is downloaded by the browser, then make sure that you are using a browser that does not have source maps enabled when checking if they are downloaded.

A: Because you only load the sourcemap when you open the debugger.
Actual users, who don't open the debugger, still get the benefit of the minification.

A: A source map is a developer tool. It's practical to know the original source when an error occurs within minified source, so you can track down the source of the error.
Source maps are thus only loaded by debuggers, and will not be loaded by default. However, you should consider disabling source maps for production environments, because debug data usually shouldn't be on production environments: for performance and (more importantly) security reasons


text:
Q: Django - Passing a json or an array in URL for an API call I want to pass a number off variables (either as a JSON or Array) via an API, such as:
{'age': 35, 'gender':'female', ...etc}

I am not sure how to pass this information into the Djano URL.  I could set up individual parameters in the URL, but I got quite a few to pass.  there must be an easier way of doing it
SOLUTION:
Solved by switching of a POST Call in the API and setting up the serializers for each variable so that they can be passed through the request.

A: I am using axios to make calls from django backend. In my case I can do:
js.file:
function search(token, status, q) {
    return (dispatch) => {
        dispatch(start(token));
        axios
            .get(`${serverIP}/invoices/sales-invoice/`, {
                params: {
                    status: status,
                    q: q,
                },
            })
            .then((res) => {
                dispatch(successSearch(res.data, status));
            })
            .catch((err) => {
                dispatch(fail(err));
            });
    };
}

Here I am sending 2 params, but you can actually send object, for example user info.
And than in views get them
views.py:
def list(self, request, *args, **kwargs):
        status = request.query_params.get('status')
        q= request.query_params.get('q')

These is exapmple with DRF model viewset


text:
Q: Connect to Mysql, driver not found I'm trying to connect my java code with mysql via JDBC. It gives me error

Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:msyql://localhost:3306/fruitfarm
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at fruitFarm.DBRunner.getConnection(DBRunner.java:20)
    at fruitFarm.DBRunner.main(DBRunner.java:27)

I've downloaded the driver and I used eclipse to add to the build path.

A: wrong URI
jdbc:msyql => jdbc:mysql
Official driver documentation has an example


text:
Q: WPF binding with ContentControl not working I'm just starting to use WPF, but my binding doesn't work.
When I start the application the screen is just blank.
This is my XAML
<Window x:Class="HelloWPF.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <ContentControl Content="{Binding PersonOne}" Width="auto" Height="auto" >
        <ContentControl.ContentTemplate>
            <DataTemplate>
                <StackPanel>
                    <TextBlock Text="{Binding FirstName}" FontSize="15" />
                    <TextBlock Text="{Binding Age}" FontSize="12" />
                </StackPanel>
            </DataTemplate>
        </ContentControl.ContentTemplate>
    </ContentControl>
</Grid>

This is the code:
public partial class MainWindow : Window
{
    public Person PersonOne;
    public MainWindow()
    {
        InitializeComponent();

        PersonOne = new Person();
        PersonOne.Gender = Gender.Female;
        PersonOne.Age = 24;
        PersonOne.FirstName = "Jane";
        PersonOne.LastName = "Joe";

        this.DataContext = this;
    }
}

And this is the person class
public class Person
{
    public string LastName { get; set; }
    public string FirstName { get; set; }

    public int Age { get; set; }
    public Gender Gender { get; set; }
}

public enum Gender
{
    Male,
    Female
}

What am I doing wrong?

A: You cannot bind to fields, only properties, so change this:
public Person PersonOne;

to this:
public Person PersonOne {get;set;}

BTW, you probably need to create a ViewModel rather than putting the Data inside the Window itself.


text:
Q: What is the JSON body content when calling RSA's REST Initialize method for On-Demand Authentication? According to RSA documentation, https://community.rsa.com/docs/DOC-76775, to have a token sent to a user for authentication, the user enters their username and ODA pin, then an email will be sent to the user with the token to authenticate.
Assuming all the hardware and servers are set up correctly, what is the JSON body content that needs to be sent to have the token emailed?
If we send an Initialize, by itself, we cannot specify a pin:
{
  'clientId':'myClientId',
  'subjectName':'user123',
  'context':{
    'authnAttemptId':'',
    'messageId':'messageId',
    'inResponseTo':''
  }
}

If we send an Initialize and include the pin in the subjectCredentials, we get a VERIFY_ERROR:
{
     'clientId':'myClientId',
     'subjectName':'user123',
     'subjectCredentials': [
        {
            'methodId': 'SECURID',
            'collectedInputs': [
                {
                    'name': 'SECURID',
                    'value': 'usersODAPin'
                }
            ]
         }
      ],
      'context':{
        'authnAttemptId':'',
        'messageId':'messageId',
        'inResponseTo':''
      }
}

What is the JSON body content that needs to be sent to have the token emailed?

A: Turns out there really was a server configuration error.
So, the successful and correct way is the later:
{
     "clientId":"myClientId",
     "subjectName":"user123'"
     "subjectCredentials": [
        {
            "methodId": "SECURID",
            "collectedInputs": [
                {
                    "name": "SECURID",
                    "value': "<user ODA Pin>"
                }
            ]
         }
      ],
      "context":{
        "authnAttemptId":"",
        "messageId":"messageId",
        "inResponseTo":""
      }
}

And then follow it up with a proper Verify post with a body like so:
{
    "clientId": "myClientId",
    "subjectName": "user123",
    "subjectCredentials": [
        {
            "methodId": "SECURID_NEXT_TOKENCODE",
            "collectedInputs": [
                {
                    "name": "SECURID_NEXT_TOKENCODE",
                    "value": "<user pin and token>"
                }
            ]
        }
    ],
    "context": {
        "authnAttemptId": "<authnAttemptId from initialize call>",
        "messageId": "messageId",
        "inResponseTo": "<messageId from initialize call>"
    }
}

And remember to have the following headers:
content-type: application/json
client-key: <your access key>

Since there was such a lack of information on the web about this, i'll leave the post up for a while.  If it gets no activity or votes to delete - i'll delete it.


text:
Q: Odoo AttributeError: 'module' object has no attribute 'getppid' -- windows os.getppid I am able to run Odoo v8 code in windows. But when I debug the code, the error occurs:
ppid = os.getppid()

AttributeError: 'module' object has no attribute 'getppid'

Environment:
Windows 7, eclipse, pydev, Odoo v8 code(latest code several days ago), debug mode.

A: Simply uninstall gevent from your python packages
pip uninstall gevent

and you will be able to run your Odoo server in normal or debug mode.


text:
Q: Layout changes using Tkinter I am trying to make a full screen app for my Raspberry Pi. I got the code working to a degree. All I want to do now is split the top red section into 3 parts which I can put labels in containing data that will frequently change.
#!/usr/bin/python

from tkinter import *
from tkinter import ttk

root = Tk()
root.title("Learning Number Bonds!")

test = StringVar(value="XX + XX = XXX")
score = StringVar(value="0")
question = StringVar(value="7/10")
time = StringVar(value="8s")

w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))

topFrame = Frame(root, bg="red", width=w, height=h/4)
##Label(topFrame, text="test").grid(row=1, column=1)
topFrame.pack()

bottomFrame = Frame(root, bg="blue", width=w, height= h-(h/4))
bottomFrame.pack()

equation = Label(bottomFrame, textvariable=test, font=("Arial", 70))
equation.pack(fill=X)

root.mainloop()

This is what I have, and the bottom how I want
But when I add the commented line it looks like this:
[It all breaks - Removed]
How can I get 3 equal size boxes at the top with labels in them?!
EDIT:
I must have just been too tired and stupid to think about this and got caught up in the fact the boxes "HAD" to be the same size. After a few minutes of code changes from the original above, I ended up with:
#!/usr/bin/python

from tkinter import *
from tkinter import ttk

root = Tk()
root.title("Learning Number Bonds!")

test = StringVar(value="XX + XX = XXX")
score = StringVar(value=999)
question = StringVar(value="10/10")
time = StringVar(value="10")

w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))

topFrame = Frame(root, bg="red", width=w, height=h/4)

##Score
scoreTextLabel = Label(topFrame, text="Score: ", font=("Arial", 30))
scoreTextLabel.pack(side=LEFT)

Label2 = Label(topFrame, textvariable=score, font=("Arial", 30))
Label2.pack(side=LEFT, padx=(0,50))

##Question
qTextLabel = Label(topFrame, text="Question: ", font=("Arial", 30))
qTextLabel.pack(side=LEFT)

TextLabel2 = Label(topFrame, textvariable=question, font=("Arial", 30))
TextLabel2.pack(side=LEFT, padx=(0,50))

##Time
tTextLabel = Label(topFrame, text="Time: ", font=("Arial", 30))
tTextLabel.pack(side=LEFT)

TextLabel3 = Label(topFrame, textvariable=time, font=("Arial", 30))
TextLabel3.pack(side=LEFT, padx=(0,50))

topFrame.pack(pady=(0,120))

bottomFrame = Frame(root, bg="blue", width=w, height= h-(h/4))
bottomFrame.pack()

equation = Label(bottomFrame, textvariable=test, font=("Arial", 70))
equation.pack(fill=X)

root.mainloop()

Which looks like this
Thanks for all the help!

A: This shows how to configure the top row so it shows, and uses sticky to stretch the frame so it occupies the entire space, and uses a set width for the Label as well.  You might also want to increase the font size of the label if you want the type to be larger.
root = Tk()
root.title("Learning Number Bonds!")

test = StringVar(value="XX + XX = XXX")
score = StringVar(value="0")
question = StringVar(value="7/10")
time = StringVar(value="8s")

w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))

topFrame = Frame(root, bg="red", width=w, height=h/4)

## put an empty row on top
topFrame.rowconfigure(0, weight=1, minsize=100)
Label(topFrame, text="test", bg="lightblue", width=50).grid(row=1,     column=1)
topFrame.grid(sticky="nsew")

bottomFrame = Frame(root, bg="blue", width=w, height= h-(h/4))
bottomFrame.grid(row=1)

equation = Label(bottomFrame, textvariable=test, font=("Arial", 70))
equation.pack(fill=X)

root.mainloop()


text:
Q: Get lowermost level of php array I have this array from prestashop:
[11]=>
[id_category] => 11
[children] =>
    [12]=>
        [id_category] => 12
        [children] =>
            [13]=>
                [id_category] => 14

I want get last level of this array that is the 13 array. For get this array I use Category::getNestedCategories.

A: Try the following:
$tree = [
    'id_category' => 11,
    'children' => [
        12 => [
            'id_category' => 12,
            'children' => [
                13 => [
                    'id_category' => 13,
                    'children' => [
                        14 => [
                            'id_category' => 14
                        ]
                    ]
                ],
                15 => [
                    'id_category' => 15
                ]
            ]
        ]
    ]
];

function findMaxDepth(array $data): int
{
    $maxDepth = 0;
    if (isset($data['children'])) {
        // if there'are children of the node collect maxs on this level
        foreach ($data['children'] as $child) {
            // go on next level
            $depth = findMaxDepth($child);
            if ($maxDepth < $depth) {
                $maxDepth = $depth;
            }
        }
    }
    return $maxDepth + 1;
}

Now you can use it:
$max = findMaxDepth($tree);

Result will be 4

A: Try the below function:-
function findLowestChild($arr, $level = 0, $lowestArr = ['level'=>0, 'value'=> null]){

    if(isset($arr['children']) && is_array($arr['children'])) {
        $level++;
        foreach($arr['children'] as $childArr) {
            $lowestArr = findLowestChild($childArr, $level, $lowestArr);
        }
    } else {
        if($lowestArr['level'] < $level) {
            $lowestArr['level'] = $level;
            $lowestArr['value'] = $arr;
        }
    }
    return $lowestArr;
}

Call it like findLowestChild($yourArray);
It will give you level value as well as the lowest value array.


text:
Q: Guidance needs to setup datalake I need some guidance in setting up datalake:

*

*We are pulling data from source (rest api) which returns JSON file. Sample structure given below.

{
    "version": "3.0",
    "name": "application_name",
    ...
    "request":
    {
        "startdate": "" ,
        "enddate": "",
        "records": 1000
        ...
    }
    "ranking":
    {
        "90":
        {
            "name": "somename",
            "class": "someclass"
            ..
        },
        "98":
        {
            "name": "somename",
            "class": "someclass"
            ..
        }
        "86":
        {
            "name": "somename",
            "class": "someclass"
            ..
        }
    }
}

*We are planning to store this information in datalake and hence I had following questions:

A. We are planning to dump data under directory [YEAR] - [MONTH] - [FILE_.json]. What is the advantage in splitting the directory by [Year] and [Month] in comparion to storing [FILE_.json] in root directory?

B. If we are extracting data multiple times (say every hour), then shall I overwrite [FILE_.json] or appending the file is better?

C. Is it advisable to store data as it is from source or better to store required data. In this case data under "ranking" attribute.

D. Consider I notice that data for last 10 days hasn't been extracted. In this situation, if I extract data for last 10 days, it will store all the data in a single file [FILE_.json]. Is it good way of storing data? For getting data from source, I have to pass startdata and enddate. It would be easier to get all 10 days data in a single call rather than making 10 different calls.

E. Is it advisable to add additional attributes to JSON file like following:
- ingestdt
- tags??

F. In future, if we are extracting data from another source, should I combine data and dump it in single json or should I have different JSON file. JSON structure between different sources will be different? Which method would be easier for downstream consumption?

I will be grateful if someone can please guide us in right direction. Any inputs will be helpful.
Thank you

A: Below are the answers to all your questions.
A. Advantage of splitting or filtering the data on [YEAR] and [MONTH] will help you to manage it. You will be able to identify the data based on per month, date, hours for future reference. If you have loaded all the data in a single file, it will be difficult to process further. Therefore, sorting the data is the recommended approach in any given case.
B. Overwriting the file or appending it totally depends on your use case. If your application may need previous data in future, it is better to append. Or, if the previous data is useless and won't be required in future, then simply overwrite it and save your storage memory.
C. It is always advisable to store only required data. Storing unrequired data will use unnecessary storage. Clean your data using Azure Data Factory data flow and store the output in data lake.
D. Technically you should manage the same hierarchy as mentioned in answer A to manage data properly. Split your data per day basis for easy processing.
E. This is not mandatory but you can if want to. As you are already splitting it on per day basis, no extra tags required.
F. When extracting data from different source, always keep it in separate JSON file so that it would be easy to identify and there will be no confusion. Create a separate folder structure and store data there.


text:
Q: Are the relations in fixed, random and mixed effect models and multilevel models causal? In fixed, random and mixed effect models, and multilevel models, the response random variable is represented as a function of some explanatory variables and random errors. I was wondering if the relations implied by them are considered causal, and therefore used in causal inference? Thanks!

A: Whether a coefficient from a model has a causal interpretation mostly depends on the other variables included or the way that unobserved but relevant variables are controlled for. For example, in an earnings regression of the type
$$\ln(y_{i}) = \alpha + \delta S_{i} + \gamma A_{i} + X'\beta + \epsilon$$
where the dependent variable is log earnings, $S_{i}$ is years of education, $A_{i}$ is ability and $X$ are other relevant variables that affect wages like parental background, age, gender, etc.
Assume $A_{i}$ and $S_{i}$ are correlated and that there are no other endogeneity issues or measurement error. If you can observe $S_{i}$, $A_{i}$ and $X$, then the coefficient $\delta$ has a causal interpretation, i.e. it is the causal effect of an additional year of education on earnings - holding all else constant. This ceteris paribus assumption is what makes causality.
To extend this example to your fixed effects model, if you have panel data and you don't observe $A_{i}$, you can still consistently estimate $\delta$ using fixed effects. Suppose $S_{i}$ varies over time and $A_{i}$ does not vary over time, then
$$\ln(y_{i}) = \eta + \delta S_{i} + X'\beta + \epsilon$$
the absorbing variable $\eta = \alpha + A_{i} + G_{i}$ includes all observed and unobserved variables that do not vary over time, like the intercept or $G_{i} =$ gender, place of birth, etc. So it pulls $A_{i}$ out of the error and hence removes the endogeneity problem (remember $A_{i}$ and $S_{i}$ are correlated, so if $A_{i}$ is in the error, $S_{i}$ will be correlated with the error).
The problem is that $A_{i}$ is likely not to be fixed over time as for instance mental capabilities and productivity diminish with old age.
In theory, I could go on providing examples for each type of your models but I guess you get the idea. Whether or not you estimate a causal effect depends on the included (and omitted!) variables AND on the assumptions of the model. So see what kind of data you have at hand, what you can control for in terms of relevant variables for the relationship you are after (perhaps you don't even have an endogeneity problem), and what assumptions are the most realistic for your analysis to be credible. If you want to dig a little deeper into the topic of causal effects estimation, Mostly Harmless Econometrics by Angrist and Pischke is an excellent book. Otherwise you will find plenty of lecture notes online.


text:
Q: Let N be a four digit number, and N' be N with its digits reversed. Prove that N-N' is divisble by 9. Prove that N+N' is divisble by 11. Let $N$ be a four digit number, and $N'$ be $N$ with its digits reversed. Prove that  $N-N'$ is divisible by $9$. Prove that $N+N'$ is divisible by $11$.
I let $N=abcd$ and $N'=dcba$
but I dont see how I can proceed to show that either the sum or difference is divisble by 11 or 9.
Any ideas on how to start this problem?

A: $$\begin{align}
N &= abcd = 1000a + 100b + 10c + d\\
N' &= dcba = 1000d + 100c + 10b + a\\
N - N' &= 999a + 90b - 90c -999d\\
N + N' &= 1001a + 110b + 110c + 1001d
\end{align}$$

A: Hint: Analyze the numbers $N$ and $N'$ $\mod 9$ and $\mod 11$. Maybe write them as
$$ N= 1000a+100b+10c+d$$ and
$$ N'= 1000d+100c+10b+a$$
If you calculate $N+N' \mod 11$ or $N-N' \mod 9$ this will give you the answer

A: The trick is to look write your number base 10, then use modular arithmetic to make life easy. For example, write $ N = a \cdot 10^3 + b \cdot 10^2 + c \cdot 10 + d $. 10 is congruent to 1 modulo 9, so $$ N \equiv a (1)^3 + b(1)^2 + c(1) + d \equiv a + b + c + d \mod 9 $$
and similarly $N' \equiv d + c + b + a \mod 9$.  Then $N - N' \equiv 0 \mod 9$, which just means that 9 divides $N-N'$.
To show that their sum is divisible by 11, do the same thing but look at the sum modulo 11, noting that $10 \equiv -1 \mod 11$.


text:
Q: How to upload Java archive (.WAR) to Windows Server on Plesk? I am able to create a .WAR archive of my Java project from Eclipse. This is what I tried:
Plesk Home Page -> Domains -> example.com -> Java Applications -> Install Java Application
But when I click The Install Java Application button it shows this warning:

Please help me, anything will be appreciated...

A: That means that while Tomcat feature is available for your subscription, the current limit for Java application is 'zero'. Contact your server provider to sort it out.
If you are a server owner, login into Plesk and check the following:

*

*Plesk license allows creating resources of this type (Tools & Settings > License Management).

*Subcription service plan has enough resources (Subscriptions > example.com > Service plan).

*If the subscription is locked check the customized resources (Subscriptions > example.com > Customize).

If the subscription assigned to the customer created by reseller, then verify reseller's resources availability:

*

*Reseller' service plan has not enough resources (Service Plans > Reseller Plans).

*If the reseller' subscription is locked check the customized resources (Resellers > My reseller > Customize).
Locked state means locked for syncing, indicates that a subscription is excluded from syncing with the associated plans.

A subscription gets locked parameters of the subscription are changed without changing the associated service plan. Such locking secures the customization so that they are not overwritten the next time, when the plan parameters are changed and all its subscriptions are synced.
Unsynced state indicates that some services or resources offered with the associated plans cannot actually be provided with the subscription.


text:
Q: Cannot deserialize out of start_array token This is my method for POST test
public void createParagraph3() {
    RestAssured.baseURI = paragraphsURL;
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("featurePackage", Arrays.asList(new HashMap<String, String>() {{
            put("name", "Test");
            put("inputText", "test test");
    }}));
    map.put("features", Arrays.asList(new HashMap<String, Object>() {{
            put("featureType", "Feature");
            put("inUse", "true");
            put("name", "test xyxy");
    }}));
    map.put("type", Arrays.asList(new HashMap<String, String>() {{
        put("key", "int");
        put("name", "Introduction");
    }}));
    RequestSpecification request = RestAssured.given();
    request.header("Content-Type", "application/json");
    request.body(map).toString();
    Response response = request.post();
    int statusCode = response.getStatusCode();
    System.out.println("Response body: " + response.body().asString());
    System.out.println("Status code received: " + statusCode);
}

Below I have my request on basis I'm creating my test
{
  "featurePackage": {
    "features": [
      {
        "featureType": "string",
        "id": 0,
        "inUse": true,
        "name": "string"
      }
    ],
    "id": 0,
    "name": "string",
    "objectCount": 0
  },
  "features": [
    {
      "featureType": "string",
      "id": 0,
      "inUse": true,
      "name": "string"
    }
  ],
  "id": 0,
  "inputText": "string",
  "objectCount": 0,
  "outputHtmlText": "string",
  "sourceFileName": "string",
  "type": {
    "key": "string",
    "name": "string"
  }
}

What I am doing wrong? I still received 400 response "Cannot deserialize instance". Can someone help? I have incomplete request in my method?

A: EDIT 1:
The root cause is that map.toString() is not a valid JSON string.
There are two ways for you to solve this problem:

*

*use JSONObject instead of map, see this

*convert map to JSON object, see this

PS: A demo about map.toString()
Map<String, Integer> map = new HashMap<>();
map.put("apple",  1);
map.put("banana", 2);

System.out.println(map.toString());
// get: {apple=1, banana=2} is NOT a valid JSON String
// but, {"apple":1,"banana":2} is a valid JSON String

EDIT 2:
Since the owner of question added some comments, I have to add the following answer.
Pom.xml
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.10.0</version>
</dependency>

Java code:
// your comment
Map<String, Object> titles = new HashMap<>();
titles.put("titles", Arrays.asList(new HashMap<String, Object>() {
    {
        put("id", "876");
        put("title", "test");
    }
}));
System.out.println(titles);

// my new answer
import com.fasterxml.jackson.databind.ObjectMapper;

ObjectMapper mapper = new ObjectMapper();
String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(titles);
System.out.println(json);


text:
Q: How do I delete one item from the list of 10 "recent documents" in LibreOffice Writer? How do I delete one item from the list of 10 "recent documents" in LibreOffice Writer?

A: It seems that there should be an easy, built-in way of doing this, but there's not (yet?). LibreOffice is now storing user settings and Recent Documents history in one file. On my system it is:
$HOME/.libreoffice/3/user/registrymodifications.xcu

It is an XML document, and extracting the history of just one document is not straight forward.
There was a history plug-in (forgot the name) that used to work, but it no longer works for me. I created a script/one-liner to delete the entire recent documents history. It searches for and removes tags of the form: <item ...HistoryInfo> ... </item>
perl -i -pe 's#<item[^>]+?HistoryInfo.+?</item>##g' $HOME/.libreoffice/3/user/registrymodifications.xcu

The usual disclaimers apply:

*

*always back up the file first

*understand a script before you execute it

*use at your own risk

A: It turns out that the Start Center can do this out of the box.
You can see the Start Center when only one of the applications is running and no file is open. You may also launch it by running libreoffice in a terminal instead of one particular application (such as LibreOffice Calc or LibreOffice Writer).
Hovering over the thumbnails presents an "X" in the top right corner that can be used to delete the item.

A: This is the one for LibreOffice 4.0x in Ubuntu 12.04 LTS:
perl -i -pe 's#<item[^>]+?HistoryInfo.+?</item>##g' $HOME/.config/libreoffice/4/user/registrymodifications.xcu

It works for me, but as stated before: use at your own risk.


text:
Q: Aggregate difference between DateTime fields in Django I have a table containing a series of entries which relate to time periods (specifically, time worked for a client):
task_time:
id     |    start_time    |    end_time       |    client (fk)
1        08/12/2011 14:48   08/12/2011 14:50     2

I am trying to aggregate all the time worked for a given client, from my Django app:
time_worked_aggregate = models.TaskTime.objects.\
                        filter(client = some_client_id).\
                        extra(select = {'elapsed': 'SUM(task_time.end_time - task_time.start_time)'}).\
                        values('elapsed')

if len(time_worked_aggregate) > 0:
    time_worked = time_worked_aggregate[0]['elapsed'].total_seconds()
else:
    time_worked = 0

This seems inelegant, but it does work. Or at least so I thought: it turns out that it works fine on a PostgreSQL database, but when I move over to SQLite, everything dies.
A bit of digging suggests that the reason for this is that DateTimes aren't first-class data in SQLite. The following raw SQLite query will do my job:
SELECT SUM(strftime('%s', end_time) - strftime('%s', start_time)) FROM task_time WHERE ...;

My question is as follows:

*

*The Python sample above seems roundabout. Can we do this more elegantly?

*More importantly at this stage, can we do it in a way that will work on both Postgres and SQLite? Ideally, I'd like not to be writing raw SQL queries and switching on the database backend that happens to be in place; in general, Django is extremely good at protecting us from this. Does Django have a reasonable abstraction for this operation? If not, what's a sensible way for me to do a conditional switch on the backend?

I should mention for context that the dataset is many thousands of entries; the following is not really practical:
sum([task_time.end_date - task_time.start_date for task_time in models.TaskTime.objects.filter(...)])

A: Almost the same solution as @andri proposed. In the final result you will get the same data.
ExpressionWrapper - New in Django 1.8.
from datetime import timedelta
from django.db.models import ExpressionWrapper, F, fields
from app.models import MyModel

duration = ExpressionWrapper(F('closed_at') - F('opened_at'), output_field=fields.DurationField())
objects = MyModel.objects.closed().annotate(duration=duration).filter(duration__gt=timedelta(seconds=2))

for obj in objects:
    print obj.id, obj.duration, obj.duration.seconds

# sample output
# 807 0:00:57.114017 57
# 800 0:01:23.879478 83
# 804 3:40:06.797188 13206
# 801 0:02:06.786300 126

A: I think since Django 1.8 we can do better:
I would like just to draw the part with annotation, the further part with aggregation should be straightforward:
from django.db.models import F, Func
SomeModel.objects.annotate(
    duration = Func(F('end_date'), F('start_date'), function='age')
)

[more about postgres age function here: http://www.postgresql.org/docs/8.4/static/functions-datetime.html ]
each instance of SomeModel will be anotated with duration field containg time difference, which in python will be a datetime.timedelta() object [more about datetime timedelta here: https://docs.python.org/2/library/datetime.html#timedelta-objects ]

A: I will do it step by step:

*

*first step:annotate the timedelta

*group by and sum timedelta

the code like this:
from django.db.models import Count, Sum, F

times_obj_list = models.TaskTime.objects.annotate(times=F("end_time")-F("start_time"))

groupby_obj_list = times_obj_list.values("client").annotate(cnt=Count("id"),seconds=Sum(times)).order_by()

A: Django currently only supports aggregates for Min, Max, Avg and Count, so using raw SQL is the only way to achieve what you want. When you use raw SQL, database-independence is out the window, so unfortunately, you're out of luck. You'll have to just detect the database and alter the SQL appropriately.


text:
Q: modify text file with tkinter python3 How can i modify text (Add or delete) file which i opened with Tkinter?
For example when i open some file with notebad i can easily modify text.
I cant figure out how can i do it in tkinter.
There is my code:
from tkinter import *
from tkinter import filedialog
import re

class Window(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master

        self.master.title("JoNotepad")
        self.pack(fill=BOTH, expand=1)

        menu = Menu(top)
        top.config(menu=menu)
        self.file_menu = Menu(menu)
        menu.add_cascade(label="File", menu=self.file_menu)
        self.file_menu.add_command(label="New")
        self.file_menu.add_command(label="Open",      command=self.open_file_function)
        self.file_menu.add_command(label="Save")
        self.file_menu.add_separator()
        self.file_menu.add_command(label="Exit")

        self.listNodes = Listbox(top, height=200, width=200)
        self.listNodes.pack(side=LEFT, fill=Y, expand=True)

        self.scrollbar = Scrollbar(top, orient="vertical")
        self.scrollbar.config(command=self.listNodes.yview)
        self.scrollbar.pack(side=RIGHT, fill=Y, expand=True)

        self.listNodes.config(yscrollcommand=self.scrollbar.set)

    def open_file_function(self):

        self.file_save = filedialog.askopenfilename(initialdir = "/", title = "Select file", filetypes = (("txt files", "*.txt"), ("All files", "*.*")))
        with open(self.file_save) as file:
            for i in file:
                self.listNodes.insert(END, i)

top = Tk()
top.geometry("1000x1000")
ap = Window(top)

top.mainloop()

A: You should use the tkinter Text widget instead of the Listbox. The Text widget allows you to perform want you want to do (including add text, delete text, select text, etc).
Here is your code, using the Text widget.
from tkinter import *
from tkinter import filedialog
import re

class Window(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master

        self.master.title("JoNotepad")
        self.pack(fill=BOTH, expand=1)

        menu = Menu(top)
        top.config(menu=menu)
        self.file_menu = Menu(menu)
        menu.add_cascade(label="File", menu=self.file_menu)
        self.file_menu.add_command(label="New")
        self.file_menu.add_command(label="Open",      command=self.open_file_function)
        self.file_menu.add_command(label="Save")
        self.file_menu.add_separator()
        self.file_menu.add_command(label="Exit")

        self.text = Text(top, height=200, width=200) #Use Text widget insted of Listbox
        self.text.pack(side=LEFT, fill=Y, expand=True)

        self.scrollbar = Scrollbar(top, orient="vertical")
        self.scrollbar.config(command=self.text.yview)
        self.scrollbar.pack(side=RIGHT, fill=Y, expand=True)

        # change all occurances of self.listNodes to self.text
        self.text.config(yscrollcommand=self.scrollbar.set)

    def open_file_function(self):

        self.file_save = filedialog.askopenfilename(initialdir = "/", title = "Select file", filetypes = (("txt files", "*.txt"), ("All files", "*.*")))
        with open(self.file_save) as file:
            for i in file:
                self.text.insert(END, i)

top = Tk()
top.geometry("1000x1000")
ap = Window(top)

top.mainloop()


text:
Q: replace values in a list of matrices from an external data.frame I have a list of matrices (list1) and a data.frame (df1) and I would like to replace the values (characters) of columns (starting in the third column) in each matrix with the numeric values that match the same character in the data.frame
The code that I am using is the following:
func <- function(m) {
df[,3:dim(m)[2]] <- pvals[match(as.character(unlist(m[,3:dim(m)[2]])), as.character(df1[[1]])), 2]
df
}
list.new <- lapply(list1, func)

My real data is comprised of a data.frame with 17,000 rows and a list of matrices with different number of rows (from 6 to 300) and the length of the list is 2508
Here is an example dput how looks my data
Thanks a lot
dput(df1)
structure(list(V1 = structure(1:26, .Label = c("A", "B", "C",
"D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"), class = "factor"),
V2 = c(-1.05472743912239, -0.465387694876923, -1.50964262537451,
0.487940146424352, -0.00535613573109694, -2.55414346097441,
1.15509940021931, 1.64866342884192, -0.020679542693602, -0.975466676313729,
1.44489084009727, 0.34865766217741, -0.164166594564227, 0.2334524300922,
-3.00151476863052, -0.162648518811422, -0.562118292072104,
0.530959584228129, -0.696269913233278, 0.510942754508697,
0.313765084303269, -0.572585873036666, -1.33022085052541,
0.983493004888859, 0.135722232469565, 0.857043820782375)), .Names = c("V1",
"V2"), row.names = c(NA, -26L), class = "data.frame")

dput(list1)
list(structure(c("J", "E", "I", "V", "R", "W", "6", "5", "3", "4", "2", "1", "Q", "C", "F", "W",
"I", "S", "L", "W", "T", "N", "M", "H", "I", "L", "B", "Q", "T", "X", "I", "X", "R", "V", "H",
"S", "M", "I", "H", "L", "W", "B", "P", "G", "N", "L", "I", "Q", "U", "Y", "F", "D", "N", "T",
"E", "R", "X", "M", "F", "T", "X", "R", "S", "W", "N", "I", "J", "N", "L", "V", "C", "B"),
.Dim = c(6L, 12L), .Dimnames = list(NULL, c("Name", "bd", "P1", "P2", "P3", "P4", "P5", "P6",
"P7", "P8", "P9", "P10"))), structure(c("Z", "K", "F", "H", "L", "O", "N", "S", "W", "V", "J",
"A", "G", "I", "C", "E", " 7", "14", " 9", " 8", " 3", " 1", "13", "12", "10", "11", " 2", " 5",
"15", " 4", "16", " 6", "M", "R", "S", "O", "K", "W", "B", "D", "C", "J", "A", "H", "U", "Y",
"T", "P", "Z", "U", "O", "C", "J", "Q", "E", "L", "X", "R", "G", "B", "M", "F", "T", "W", "D",
"P", "Z", "M", "H", "W", "X", "U", "K", "V", "S", "C", "L", "I", "B", "N", "P", "S", "R", "I",
"F", "G", "W", "D", "A", "V", "L", "U", "C", "X", "T", "E", "Y", "V", "X", "H", "I", "N", "K",
"M", "D", "C", "Z", "L", "W", "F", "B", "Q", "E", "F", "A", "C", "G", "L", "B", "M", "X", "Q",
"Y", "S", "W", "P", "K", "R", "Z", "P", "R", "G", "W", "S", "J", "E", "A", "F", "K", "U", "N",
"O", "D", "L", "L", "A", "W", "F", "V", "G", "M", "U", "H", "O", "J", "K", "T", "C", "S", "D",
"Z", "X", "L", "V", "R", "P", "I", "H", "E", "W", "K", "T", "U", "S", "J", "D", "Q", "V", "J",
"Z", "K", "C", "W", "P", "D", "I", "B", "O", "S", "A", "G", "U"), .Dim = c(16L, 12L), .Dimnames
= list(NULL, c("Name", "bd", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10"))),
structure(c("A", "V", "I", "C", "Z", "H", "M", "Q", "R", "S", "X", "E", "K", "T", "W", "U", "J",
"G", "L", "D", "P", "B", "O", "F", "N", "Y", "12", "14", " 8", " 2", "18", "21", "10", "19",
"25", "26", " 5", "11", " 9", " 1", "23", " 3", "17", "24", " 4", "22", "16", " 7", "20", "13",
" 6", "15", "O", "Q", "W", "N", "F", "J", "K", "T", "A", "U", "L", "Z", "R", "P", "M", "Y", "B",
"S", "V", "C", "G", "X", "I", "E", "D", "H", "X", "N", "H", "Y", "U", "Q", "B", "O", "S", "E",
"J", "L", "F", "A", "M", "P", "Z", "G", "V", "K", "W", "C","R", "I", "T", "D", "G", "C", "Y",
"K", "N", "T", "Z", "D", "A", "X", "Q", "J", "V", "W", "I", "U", "R", "F", "O", "S", "L", "P",
"B", "H", "E", "M", "T", "I", "O", "W", "Q", "M", "X", "G", "U", "S", "Z", "K", "V", "R", "L",
"D", "H", "Y", "J", "A", "B", "F", "P", "C", "N", "E", "X", "Z", "E", "G", "F", "S", "Y", "L",
"W", "O", "T", "K", "C", "I", "U", "Q", "N", "A", "D", "R", "P", "M", "V", "B", "J", "H", "R",
"B","C", "Z", "H", "J", "V", "K", "M", "F", "S", "U", "N", "A", "L", "W", "D", "Q", "G", "E",
"T",   "Y", "I", "O", "X", "P", "J", "N", "L", "R", "G", "Q", "I", "A", "D", "E", "C", "O", "F",
"Z", "Y", "X", "M", "V", "T", "W", "K", "H", "U", "P", "B", "S", "T", "D", "R", "J", "M", "P",
"Y", "Q", "G", "B", "C", "S", "V", "N", "K", "F", "I", "U", "H", "X", "A", "Z", "L", "W", "O",
"E", "Q", "Y", "L", "J", "I", "N", "F", "X", "W", "P", "G", "D", "A", "B", "V", "S", "K", "U",
"T", "H", "R", "E", "Z", "O", "M", "C", "H", "B", "Q", "V", "S", "Z", "L", "I", "A", "K", "J",
"C", "U", "X", "W", "M", "O", "E", "G", "T", "P", "D", "F", "N", "Y", "R"), .Dim = c(26L, 12L),
.Dimnames = list(NULL, c("Name", "bd", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9",
"P10"))))

A: Use merge and loop using lapply:
lapply(list1,merge,df1,by.x=3,by.y=1)


text:
Q: How to use a method of an object stored in a TList? My question is pretty simple. I have a TList (called queue) containing objects of class CNotif and want to use the method is_alive on those objects.
The problem is, when I use queue.Items[0].is_alive(), I get an error message saying Error: Illegal qualifier.
I'm also confused with the way I can instantiate objects in this TList (and how the way the compiler "knows" that the objects stored are of this type ...)
What I do now is: queue.Add(CNotif.create(timer, title, text, badge)) but I don't think it's supposed to be done that way.
Thank you in advance !

A: Unless you're stuck with an old Delphi version, you should look into generics.
In the generics.collection unit there is a TList<T> class that you could use here.
Queue:TList<CNotify>;

...
Begin
  Queue := TList<CNotify>.Create; // remember to clean it up
  Queue.Add(CNotify.Create(...));
  Queue.Add(CNotify.Create(...));

  If Queue[0].isAlive then
    Beep;
End;

I haven't used fpc and lazarus for a while, but in Delphi this is definitely the way to do this. Lists of untyped pointers and type-casts all over the place can become a nightmare to maintain.

A:
The problem is, when I use queue.Items[0].is_alive(), I get an error message saying Error: Illegal qualifier.

That's because the compiler has no idea what queue.items[0] is other than a generic pointer (see below).

What I do now is: queue.Add(CNotif.create(timer, title, text, badge)) but I don't think it's supposed to be done that way.

This is exactly the way you need to do it. CNotif.Create constructs a new object, and that object descends from TObject.
It compiles fine because your queue.Add call is expecting a pointer, and a Delphi/FreePascal variable containing an object instance is actually a pointer. (Both languages hide the need to dereference using MyObj^ for us.)
To use something in queue.Items, you need to tell the compiler what's in there other than a generic pointer (which of course doesn't have an is_alive method). You do that by typecasting:
CNotif(queue.Items[0]).is_alive

Note: There's a shorter way to use the TList.Items; Items is declared as the default property for the TList, so you can omit it:
queue[0]

is the same as
queue.Items[0]

and is much easier to type.


text: Q: In django application dynamic images are missing after restarting server In my Django app I create a bunch of models at runtime dynamically. The models are created fine and they are registered properly. However, when I restart the server that my app is running on, the  images are missing but the text are displaying only images are missing.


text:
Q: Openshift Prestashop 1.5.6 Performance Tuning In the prestashop performance page, it offers caching with APC, memcached, File System, and XCache.  There's a warning about making sure the infrastructure contains one front-end server.  If not sure, ask your hosting company.  What's available and best here?
I'm currently using the free 3 gear set up. 1 small gear with PHP 5.4 and scaling turned on (minimum 1, maximum all available), 1 small gear for mysql 5.5.  the HA Proxy shows one of my gears as active/down (red) with 0 bytes of anything.  I'm assuming because I don't have the High Availability turned on correctly.  I'm getting page load times of 1.5 to 3 seconds on average.  I know the small gear is low cpu, but is that a normal response time?  How can I tune this to sub 1 with what I have?  I'd like to see the performance capabilities and scaling abilities before I kick over a CC to grab bigger gears and more of them.
Speaking of scaling I see this The code in the git repository is copied to each new gear, but the data directory begins empty. I just recently made some post_deploy hooks to symlink an images directory so that my git updates from my local machine didn't destroy custom uploads.  Am I going to have to switch to some kind of CDN? I believe I saw an option to set CDN servers in the application.
Thanks in advance,
Alan

A: Prestashop is probably a pretty beefy application to run on a small gear, even with moving the database to it's own gear.  Your web gear would have to receive enough traffic to scale up to another web gear, but as long as you are just getting a few requests to it, it might respond slowly and not scale up.  For a few cents an hour, it might be worth spinning up a medium/large gear and checking it's performance.
As for the data directory symlink.  On a scaled application, anything you upload into your OPENSHIFT_DATA_DIR will not be synced across gears that are spun up.  You might want to consider finding some kind of Amazon S3 plugin or similar.


text:
Q: Set global handling for PHP scripts in NGINX + PHP-FPM I have to define fastcgi_pass for every virtual host. How do I define it global-wise?
server {
    listen       80;
    server_name  www.domain.tld;

    location / {
        root   /home/user/www.domain.tld;
        index  index.html index.php;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/user/domain.tld$fastcgi_script_name;
        include        fastcgi_params;
    }

}

A: Make a file that you can include wherever you need it. For instance:
cat > /etc/nginx/php-fpm <<EOF
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;
EOF

Then modify your location to include php-fpm; and fix the root directive (it should appear under server, not under location /; this is a common nginx misconfiguration).


text:
Q: How to check if a given ip address is reachable in C program I need a C program that will check whether a user given ip address(both ipv4 and ipv6) is reachable or not. I do not know the port no. So I cant connect and check. The functionality is more or less like ping. Except I don't want to use ping because of the overhead involved.

A: You need to create a raw socket, then construct and send an ICMP packet to your destination.
http://courses.cs.vt.edu/~cs4254/fall04/slides/raw_6.pdf

A: Having an host reachable doesn't mean you will be able to get service from it. The best would be to try to connect to the correct port number. What are you trying to achieve exactly ?
Besides, although ICMP is the smart way to doing it, it might not work if the host has a firewall disabling ICMP. In that case you won't get any response.


text:
Q: How to trigger this event? I have a table with 3 x 3 cells. Each cell contains a button in 1-9, when clicking on any button, the value will be appended to an input textbox.
I tried to trigger the onmouseout event in the table but that did not work. I also tried to add a div outside the table, to capture the onmouseout event.
How can I use JavaScript to trigger whether the client cursor is still over the table?
What I want is after the user clicks something in the buttons and the mouse leaves the table, I need to validate what the client clicked.

A: If you set the OnMouseout event on the table it will be triggered when you move the cursor over an object within the table since the cursor is no longer over the table directly.
I'm not sure what you want to do here. Do you want to raise an event when you click a button or do you want to raise an event when the cursor moves outside the table?
Edit:
The following code will raise an event every time a button is clicked.
The myClickEvent function will know which button was clicked:

        <input type="button" value="1" onClick="myClickEvent(this);"></input>
        <input type="button" value="2" onClick="myClickEvent(this);"></input>
        <input type="button" value="3" onClick="myClickEvent(this);"></input>

        <input type="button" value="4" onClick="myClickEvent(this);"></input>
        <input type="button" value="5" onClick="myClickEvent(this);"></input>
        <input type="button" value="6" onClick="myClickEvent(this);"></input>

        <input type="button" value="7" onClick="myClickEvent(this);"></input>
        <input type="button" value="8" onClick="myClickEvent(this);"></input>
        <input type="button" value="9" onClick="myClickEvent(this);"></input>

    <input type="text" id="myTextBox"></input>

A: try to add onmouseout event for the control that you want to validate and also you can use hover css style to solve that.


text:
Q: Can't save checkbox value in meta with wp insert post? I am trying to add checkbox value through add_post_meta but getting no luck..!
It is saved in database...but when I open the post in wordpress the checkbox isn't checked..!
So please take a look over my code and let me know if I am doing anything wrong :
require_once("../rabotavbaku/wp-load.php");
// Create post object
$my_post = array(
  'post_title'    => $job_title,
  'post_content'  => "İş barədə məlumat :
".$job_description."
Namizədə tələblər :
".$requirements,
  'post_type'     => 'job_listing',
  'post_status'   => 'publish',
  'post_author'   => 0,
);

// Insert the post into the database
$post_id = wp_insert_post( $my_post );

add_post_meta($post_id, '_company_name', $company_name, true);
add_post_meta($post_id, '_application', $email, true);
add_post_meta($post_id, '_job_location', 'Baku', true);
add_post_meta($post_id, '_job_expires', $expire_date, true);
// This one is that checkbox meta but it isn't working
add_post_meta($post_id, 'tax_input[job_listing_type][]', 2,true);

A: Try this Please look at this image for checkbox cheked. for example

<input type="checkbox" value="1" name="checkInt[]">Economics

<input type="checkbox" value="3" name="checkInt[]">Science

require_once("../rabotavbaku/wp-load.php");
    // get values for check boxes
    $check = $_REQUEST['checkInt'];
    $q1=implode(',', $check);

    // Create post object
    $my_post = array(
      'post_title'    => $job_title,
      'post_content'  => "İş barədə məlumat :
".$job_description."
Namizədə tələblər :
".$requirements,
      'post_type'     => 'job_listing',
      'post_status'   => 'publish',
      'post_author'   => 0,
    );

    // Insert the post into the database
    $post_id = wp_insert_post( $my_post );

    add_post_meta($post_id, '_company_name', $company_name, true);
    add_post_meta($post_id, '_application', $email, true);
    add_post_meta($post_id, '_job_location', 'Baku', true);
    add_post_meta($post_id, '_job_expires', $expire_date, true);
    // This one is that checkbox meta but it isn't working
    add_post_meta($post_id, '_checked',$q1);


text:
Q: How to wait for a duration before a sequence is run? I'm making a game with SpriteKit, and when it starts, I have nodes that spawn and fall from the top of the screen:
let wait = SKAction.waitForDuration(0.2, withRange: 0.19)
let spawn = SKAction.runBlock {
    self.addTears()
}
let sequence = SKAction.sequence([wait, spawn])
self.runAction(SKAction.repeatActionForever(sequence))

Before these nodes spawn, I want to wait for a duration of 1 second, but only when the game starts. I tried to add a waitForDuration before I run the sequence but it didn't work.

A: Try:
let otherWait = SKAction.waitForDuration(1)
let otherSequence = SKAction.sequence([otherWait, SKAction.repeatActionForever(sequence)])
runAction(otherSequence)


text:
Q: C- error expected identifier or '(' before '.' token I'm working on a gps project using gpx files, the code is in c and i have a struct called Splitdata:
// Node Structure for storing Splits Data
typedef struct SplitData {
    double selevation[100];
    double pace[100];
    int splitnumber[100];
    int mins[100];
    int secs[100];
}data;

i then try to reference that struct in this function:
double calculate_tot_dist(struct node *lh){
    double lat1 = 0, lon1 = 0;
    double pathLen = 0;
    struct node *ptr = lh;
    double averagePace = 0;
    double elevationchange = 0;
    int kilocounter = 1;
    int i =0;

    struct timeStr tm1,tm2;

    strcpy(startTimeStr, lh->timeString);

    while(ptr != NULL){
        if (lat1 == 0){
            // First node
            lat1 = ptr->lat;
            lon1 = ptr->lon;
            elevationchange = ptr->elevation;
             ptr = ptr->next;

        }else
        {
            pathLen += haversine_m(lat1, lon1, ptr->lat, ptr->lon);

            if (((int)pathLen / 1000) > kilocounter)
             {
             // printf("%d", split->splitnumber[i]);
            data.splitnumber[i] = kilocounter;
            data.selevation[i] = ptr->elevation;
            kilocounter++;
            i++;
              }
            lat1 = ptr->lat;
            lon1 = ptr->lon;
            elevationchange = ptr->elevation;
            ptr = ptr->next;
        }

    }

When i attempt to compile the code i get an error saying:
C- error expected identifier or '(' before '.' token
the error is being reported for lines:
data.splitnumber[i] = kilocounter;
 data.selevation[i] = ptr->elevation;

Can anyone see why this would be the case?
thanks

A: in this case 'data' is not a variable but a type SplitData (for explanation refer to http://en.wikipedia.org/wiki/Typedef). If you want 'data' to be a variable then you could do following modification:
// Node Structure for storing Splits Data
typedef struct SplitData {
    double selevation[100];
    double pace[100];
    int splitnumber[100];
    int mins[100];
    int secs[100];
};

SplitData data;

or define another variable called data in the scope of the calculate_tot_dist() function
(for reference I made your code compile here https://coderpad.io/968894)


text:
Q: What is the shortest path in a graph that consists of exactly one vertex? I tried to find the answer to this question but either it makes no sense asking about paths in a one-vertex graph or I misinterpreted the found results so far.
I assume it would be the vertex itself but any clarification would be welcome.

A: You'll need to be more specific about what you mean by the shortest path to make this a meaningful statement (e.g. are you looking for the shortest path between any pair of vertices in the graph?).
The shortest path in any graph is either the empty path or a path consisting of a single vertex or a single edge (depending on your definition of path, in particular whether it can be empty or whether it can contain no edges). Also, if you are just looking for any "shortest path" in a graph, then the shortest path in any graph is either the empty path/the path on a single vertex/edge (again depending on your definition of a path).
In general there won't be much literature on this since it's not likely considered interesting or useful information. In other words, it is considered too obvious that the shortest path oin a graph with a single vertex is the empty path/the path consisting of only that vertex. Formally, it is trivial information.


text:
Q: Cannot update to Angular2 RC @angular@2.0.0-rc.1 I am getting the following error when I am trying to upgrade angular2 to RC. JWT is having dependencies on RC, so I had to update to @angular
M:\workspace\Angular2StartKit>npm install
npm ERR! addLocal Could not install M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\manish\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.2
npm ERR! npm  v3.9.5
npm ERR! path M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1'
npm ERR! enoent ENOENT: no such file or directory, open 'M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! M:\workspace\Angular2StartKit\npm-debug.log

package.json
"dependencies": {
    "angular2": "2.0.0-beta.1",
    "angular2-jwt": "^0.1.12",
    "body-parser": "~1.13.2",
    "cors": "^2.7.1",
    "es6-promise": "3.0.2",
    "es6-shim": "0.33.3",
    "express": "4.13.3",
    "express-jwt": "^3.4.0",
    "gulp-concat": "2.6.0",
    "material-design-lite": "^1.1.3",
    "mongodb": "^2.1.16",
    "mongoose": "^4.4.12",
    "promise": "^7.1.1",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "systemjs": "0.19.16",
    "zone.js": "0.5.10"
    }`

A: In Angular2 RC1, there are a set of sub packages you need to specify in your package.json file not a big package like with Beta versions:
{
  (...)
  "dependencies": {
    "@angular/common": "2.0.0-rc.1",
    "@angular/compiler": "2.0.0-rc.1",
    "@angular/core": "2.0.0-rc.1",
    "@angular/http": "2.0.0-rc.1",
    "@angular/platform-browser": "2.0.0-rc.1",
    "@angular/platform-browser-dynamic": "2.0.0-rc.1",
    "@angular/router": "2.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.1",
    "@angular/upgrade": "2.0.0-rc.1",
    (...)
  }
}


text:
Q: Unable to pass a foreignkey field to frontend Good morning colleagues. I have a react app with a database with foreignkey fields. I have been able to successfully call the fields without foreignkey data but unable to call the foreignkey fields. My database for example has student table which has a foreignkey reference to stream table. How do I get the stream.name on the frontend. I tried {student.stream.name } but did not work.

                        Adm No
                        Name
                        Stream

                    {students.map(student => (

                            {student.student_id}
                            {student.stream.name}
                            Edit

                    ))}

const [students, setStudents] = useState([]);
const getStudents = async () => {

        const student_data = await fetch("http://127.0.0.1:5000/students");
        const Students = await student_data.json();
        setStudents(Students)

useEffect(() => {
    document.title = "LLR | Students";
    getStudents();
}, [])
}


text:
Q: Send Parcelable object to another activity I got 3 classes. Series, Season and Episodes.
The Series class got a list of Season objects and the Season class got a list of Episode objects.
I want to send the Series object to the other activity like this.
Intent intent = new Intent(context, OtherActivity.class);
intent.putExtra("series", (Parcelable)seriesObject);

But I get a NullPointerException.
Here are the classes that implements Parcelable.
Series class:
public class Series implements Parcelable {

private int seasonCount;
public ArrayList<Season>seasons;
private String seriesName;
private int lastSeenSeason = 0;
private int lastSeenEpisode = 0;

public int describeContents() {
    return 0;
}

public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(seasonCount);
    dest.writeTypedList(seasons);
    dest.writeString(seriesName);
    dest.writeInt(lastSeenSeason);
    dest.writeInt(lastSeenEpisode);
}

private Series(Parcel in){
    seasonCount = in.readInt();
    in.readTypedList(seasons, Season.CREATOR);
    seriesName = in.readString();
    lastSeenSeason = in.readInt();
    lastSeenEpisode = in.readInt();
}

public static final Parcelable.Creator<Series> CREATOR = new Parcelable.Creator<Series>() {
    public Series createFromParcel(Parcel in) {
        return new Series(in);
    }
    public Series[] newArray(int size) {
        return new Series[size];
    }
};

Season class:
public class Season implements Parcelable{

private int seasonNo;
private int episodeCount;
public ArrayList<Episode> episodes;

public int describeContents() {
    return 0;
}

public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(seasonNo);
    dest.writeInt(episodeCount);
    dest.writeTypedList(episodes);
}

private Season(Parcel in){
    this.seasonNo = in.readInt();
    episodeCount = in.readInt();
    in.readTypedList(episodes, Episode.CREATOR);
}

public static final Parcelable.Creator<Season> CREATOR = new Parcelable.Creator<Season>() {
    public Season createFromParcel(Parcel in) {
        return new Season(in);
    }
    public Season[] newArray(int size) {
        return new Season[size];
    }
};

and the Episode class:
public class Episode implements Parcelable{

private int episodeNo;
private boolean episodeSeen;

public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(episodeNo);
    dest.writeByte((byte) (episodeSeen ? 1 : 0));
}

private Episode(Parcel in){
    episodeNo = in.readInt();
    episodeSeen = in.readByte() != 0;
}

public static final Parcelable.Creator<Episode> CREATOR = new Parcelable.Creator<Episode>() {
    public Episode createFromParcel(Parcel in) {
        return new Episode(in);
    }
    public Episode[] newArray(int size) {
        return new Episode[size];
    }
};

A: You should initialize your arrays:
public ArrayList<Episode> episodes = new ArrayList<Episode>();
public ArrayList<Season> seasons = new ArrayList<Season>();

otherwise readTypedList will fail.


text:
Q: go language web framework design thread wise What is the threading design of GO net/http library?
I heard this talk a few days ago and I was really curious about how GO developers implemented their web framework design, thread wise.
I know node.js uses 1 Computational thread reading events and a pool of I/O threads. ASP.NET uses a thread per call... how does GO handle the C10K problem?

A: The net/http server uses one goroutine per connection as stated in the documentation.


text:
Q: Creating Extension method to include subquery I am having trouble creating an extension method for an IQueryable that will include the translation for a specified column in a Linq Query.
Suppose i have the query below.
I would like to call a method IncludeTranslation on the CFG_Article IQueryable specifying the column i want to get the translation for.
Could someone help me in the right direction.
var translations =
    from t in UoW.CFG_TRANSLATION.GetAll()
    select t;

var result = (
    from a in UoW.CFG_ARTICLE.GetAll()
    select new
    {
        a,
        translation = translations
            .Where(t=> t.TR_TEXT == a.AR_NAME).FirstOrDefault()
    });

All i have come up so far is the code below but this does not compile.
public static IQueryable IncludeTranslation<T>(
        this IQueryable<T> query,
        Expression<Func<t, bool>> fieldToTranslate)
{
    // this will get an IQueryable of CFG_TRANSLATION
    var translations = GetTranslations();

    var result = (
        from q in query
        select new
        {
            q,
            translation = translations
                .Where(t=> t.TR_TEXT == fieldToTranslate)
                .FirstOrDefault()
        });
    // even better is to return all fields from query
    // + the TR_TRANSLATION field from the translations table

    return result;
}

A: Try this (I'm having to guess class names are CFG_ARTICLE & CFG_TRANSLATION - replace as required)
public static IQueryable IncludeTranslation(
            this IQueryable<CGF_ARTICLE> query,
            Func<CFG_ARTICLE, CFG_TRANSLATION, bool> fieldToTranslate)
{
    var translations = GetTranslations();

    var result =
        from a in query
        select new
        {
            a,
            translation = translations
                .Where(t => fieldToTranslate(a, t))
                .FirstOrDefault()
        };

    return result;
}

calling like this
var result = query.IncludeTranslation(
    (article, translation) => article.TR_TEXT == translation.AR_NAME);

A: I found an other way of returning the same result using a Generic Way.

    public static IQueryable IncludeTranslation<S>(this IQueryable<S> source, Expression<Func<S, string>> keyField)
        where S : class
    {
        IQueryable<CFG_TRANSLATION> translations = GetTranslations();
        var trans = source.GroupJoin(translations, keyField, t => t.TR_TEXT, (s, t) => new { Source = s, Translations = t });
        var result = trans.Select(t => new {
            Source = t.Source,
            Translation = t.Translations
                            .FirstOrDefault()
        });
        return result;
    }

Maybe someone can use this as a sollution
this can be called as follow

var Result = QueryableTable.IncludeTranslation(t => t.FieldToTranslate);


text:
Q: Converting midnight in to a date time format in R I have a very specific problem. I have been trying to convert a date time character into a date time format in R. Example: "2017-05-21 00:00:00".
Whenever I try to convert it using strptime and as.POSIXct to a date time format it gives me "2017-05-21".
Thanks for any help

A: As @ngm says, this is only a formatting choice on the part of R. You can check to make sure it's actually midnight.  Datetimes are stored as seconds past the epoch, and can actually be used in arithmetic.
t1 <- as.POSIXct("2017-05-21 00:00:00")
t1
# [1] "2017-05-21 EDT"

as.integer(t1)
# [1] 1495339200

So your time is 1,495,339,200 seconds after the epoch. Now we can look at midnight plus one second.
t2 <- as.POSIXct("2017-05-21 00:00:01")
t2
# [1] "2017-05-21 00:00:01 EDT"

as.integer(t2)
# [1] 1495339201

Which is one second higher than t1. So t1 is, in fact, midnight.


text:
Q: Transferring HTML documents with JSON responses. Rails recently i`ve faced a problem parsing JSON responses, that contains html injections.
 [{"Date":"\/Date(1316445326553+0400)\/",
 "Dishes":null,"Id":103,"Name":"Menutka уже с Вами!",
 "PictureId":130144,
 "TextHtml":"<!DOCTYPE html PUBLIC '-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN' 'http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd'>\u000a<html xmlns='http:\/\/www.w3.org\/1999\/xhtml'>\u000a<head>\u000a... etc",
 "Type":1,"UserId":1,"UserName":"Администратор"}]

and tried to do JSON.parse response.body where response body is my JSON. It silenly obeys, but returns empty collection. I tried to validate this json on this site and it says "It s valid"
So i`m a bit confused about whats gone wrong.
PS this is my parse method:
   def self.get(uri)
raw_url = BASE_URL+uri
url = "#{BASE_URL}"+CGI::escape(uri)
f = File.open('response.log', 'a')
start = Time.new
f.print "#{start.to_s}\t#{uri}"
resp = Net::HTTP.get_response(URI.parse(url))
stop = Time.new
f.puts "\t\t#{stop-start} seconds"
f.close
data = resp.body
begin
  if data.blank? or data.include?('<html')
    return {}
  end
  object = JSON.parse(data)
rescue JSON::ParserError
  raise Exceptions::NothingReturned, "GET Error on #{raw_url}"
end
end

A: i'm not quite sure if it's that simple, but you're deliberately returning {} if your JSON contains a <html tag? what behavior do you want?
if you want to distinguish between html and json responses, just use the Content-Type response header