text:
Q: SQL lower() on one side of WHERE statement works for part of result but not all? I will happily take an edit on the title - I have no clue what to call this. Basically, I'm looking for an explanation to something I just came across in my work environment.
Consider the user with the user name Test User randomlyGeneratedString (this is a test-generated user). This user sold a product called TEST PRODUCT (DO NOT BUY).
For work, I had to create a search on the user name that included using "lower()" on a join. In my naivety, this is what I came up with:
WHERE....
AND (...
   OR products.product_name LIKE %$search_terms%
   OR users.display_name LIKE lower(%$search_terms%)
)

(obviously, terms was cleaned up before hitting the database - I'm just trying to lay out the example)
This created some other fun things that I'm not going to get into for the sake of this question (like the conflict between TEST in both the product and the user name, and the fact that a second lower() is needed around the column).
Here is what I'm trying to understand.

*

*TEST, test, and Test obviosly all returned Product Name results.

*User, user, and User returned NOTHING.

*randomlyGeneratedString, randomlyGeneratedStrinG returned the CORRECT RESULTS

My boss said that it shouldn't return ANY results (with the exception of the product names issue) because the users table requires the lower search to match case. However, neither of us can figure out why a partial search on only the randomly generated string returned correct results while a partial search on the middle of the name returned absolutely nothing.
EDIT - CLARIFICATION 1: users.display_name is a binary, nullable, varchar column. products.product_name is also a varchar but neither binary nor nullable.
EDIT - CLARIFICATION 2: To answer a provided below question - the reason we are using a LIKE search on a case sensitive table is because its an old old table that may or may not have been designed properly to begin with, and the search had to accept partial matches. LIKE and LOWER() seems like the only answer to this.
Adding a note to say that yes, I understand that the LOWER() should have been on both sides of the LIKE, and it is now. The question is centered around the fact that it was on ONE SIDE and behaving in an unexpected manner (that got me in trouble for not properly testing, as what I tested was the part that was returning as expected).
Sample data that I was actually specifically working with...
Here is the list of possible user names to be returned:

*

*Test User ztr9ejsj6a

*Test User 2i0jltuwrl

*Test User csmr0e16ry

*Test User 57lhpp4bfi

*Test User 6pvz9w7m6z

Searching ztr9ejsj6a returns 1 result:

*

*Test User ztr9ejsj6a

Searching ztr9ejsj6A (note the last letter capitalized) returns 1 result:

*

*Test User ztr9ejsj6a

Searching 'User', 'user', and 'USER' returns 0 results
Searching any variation of TEST is irrelevant (products have TEST in their name and therefore are searched before the user name).

A: TD;DR

SQL lower() on one side of WHERE statement works for part of result but not all?

Yes, when one side is case sensitive/binary and there are values in the column with upper case characters in them. LOWER() will match the substring in lower case only.
Detailed
In MySQL there is no difference between the values tEsT and TeSt when you are using LIKE and both of the operands are case insensitive.
This is why you get results for the products.product_name LIKE %$search_terms% regardless of the character cases in the search term or in the stored values.
The string comparison becomes more strict when one of the operands are case sensitive or binary. To have a match all characters should be in the correct case.
users.display_name LIKE lower(%$search_terms%) This solves nothing, unless all the values are stored in lower case in the display_name column. (As the OP stated, the display_name column has a binary collation.) As a side effect, if you have a UNIQUE key on this column, the values tEsT and TeSt are treated as different values and you can store both of them.
To make the above condition work as expected, you have to convert both sides to the same case: lower(users.display_name) LIKE lower(%$search_terms%), or you can convert the collation of the column using the COLLATE keyword: users.display_name COLLATE utf8_general_ci = %$search_terms%
Please note that this may render two different values equal, (tEsT and TeSt will become equal). Also note, that using any functions/transformations on a column will prevent MySQL to use indexes on that column. This includes the COLLATE keyword.
Only one question left: Why do you store those values in a case sensitive (or binary) column and want to search using case insensitive comparison?
You can check the statements above using a batch like this:
SET
  @bin = 'tEsT' COLLATE utf8_bin,
  @ci = 'tEsT' COLLATE utf8_general_ci
;

SELECT
  @bin, LOWER(@bin),
  @bin LIKE '%TeSt%',              -- 0
  LOWER(@bin) LIKE '%TeSt%',       -- 0
  LOWER(@bin) LIKE LOWER('%TeSt%') -- 1
;

SELECT
  @ci, LOWER(@ci),
  @ci LIKE '%TeSt%',              -- 1
  LOWER(@ci) LIKE '%TeSt%',       -- 1
  LOWER(@ci) LIKE LOWER('%TeSt%') -- 1
;

Disclaimer
You mentioned, that randomlyGeneratedString, randomlyGeneratedStrinG returned the CORRECT RESULTS. The correct result is the users with randomlygeneratedstring in their user names at any position. Unfortunatelly you did not provide sample data what we can use to explain how string comparison works in MySQL.
Sample data
Here is the list of possible user names to be returned:
Test User ztr9ejsj6a
Test User 2i0jltuwrl
Test User csmr0e16ry
Test User 57lhpp4bfi
Test User 6pvz9w7m6z

Searching ztr9ejsj6a returns 1 result: Test User ztr9ejsj6a
  Searching ztr9ejsj6A (note the last letter capitalized) returns 1
  result: Test User ztr9ejsj6a.

In both cases, the search string will be converted to it's lower case variant, which is 'ztr9ejsj6a', which is available in the database as the part of one display name.

Searching 'User', 'user', and 'USER' returns 0 results

This is because, you have no values with lower case user in the display name.

Searching any variation of TEST is irrelevant (products have TEST in their name and therefore are searched before the user name).

This is not true, you will have no results from the user table, since you have no records with the lower case test in them.
Applying the LOWER() function on the column will render all values lower case and allows the results you may want.
Your test data is a bit wrong tho. For the random string you have only lower case values and the 'Test' and 'User' parts are always in the mentioned form. In short, your test data does not contain all possible variations and with this, you may miss to find some bugs in your logic. Consider to use this (or something like this):
Test User ztr9ejsj6a -- no match for 'user' nor for 'test'
Test user 2i0jltuwrl -- match for 'user', but not for 'test'
test user csmr0e16ry -- match for both 'test' and 'user'
test User 98sdvg09s8 -- match for 'test' but not for 'user'
Test User 57lhPP4bFi -- no match for '57lhpp4bfi'
Test User 6Pvtestm6Z -- match for 'test' due to the random text!

The right side of the table above stands for all mentioned values in all case combinations (since they will be converted to their lower case variants).
As you can see, when you transform your search string to lower case, you will include some of the records, and exclude others, since the comparison is done using a case sensitive method. To prevent this either apply the same transformations to both sides or force both sides into their case insensitive form.


text:
Q: Downloaded page size vs. browsed page size I am having some speed problems on my site, and I noticed that when I saved the web page on disk it is around 7 MB. However, the same big images seem to be scaled on web page.
So, basically the question is "Does the user browsing a web page download all resources of that page? Or do they resources get optimized and scaled first and then sent to the user?

A: Yes, they download it all by default (in some cases, 'smart' browsers shrink the data if the user enable 'data saving mode'). You need to generate thumbnails for your big images.
You can check your website optimization with PageSpeed

redpajama_set_name: RedPajamaStackExchange


text:
Q: batch: set variable and compare it with another Task: check a number of files and directories in directory under Windows OS. If the number is equal to some number, then return 0. If not, return 1 and exit with error.
In bash on Linux, it might look like this:
$ cat a.sh
#!/bin/bash
a=`ls -l | wc -l`
[[ $a -eq 5 ]] || { echo "$a NOT equal to 6"; exit 1; }
echo "$a equal to 6"

And:
$ ls -l | wc -l
6

And:
$ ./a.sh
6 NOT equal to 6

How I can do same for Windows?

A: @echo off
  setlocal
  set "number=6"
  dir /b|find /c /v ""|findstr /x /c:"%number%">nul && (echo equal to %number% & endlocal & exit /b 0)
  echo not equal to %number% & endlocal & exit /b 1


text:
Q: Is there a better way to structure Express (nodejs) application routes? I have my app.js where I have the server created and this is where I define the main routes. I only added parts of my code.
const app = express();

const user = require("./routes/user/user");

app.use("/user", user);

In the ./routes/user/user.js I am able to define the routes like this
const express = require("express");
const router = express.Router();

router.get("/profile", (req, res) => {
/*some more code*/
});

router.post("/register", (req, res) => {
/*some more code*/
});

router.get("/timeline", (req, res) => {
/*some more code*/
})

module.exports = router;

Right now ./routes/user/user.js is not messy, but when we add more routes it can get pretty ugly.
My goal would be to have ./routes/user/combineUserRoutes.js where I could combine multiple requests without defining them there.
These request files would be structured something like this:
./routes/user/auth/register.js
./routes/user/profile/profile.js
./routes/user/timeline/index.js


text:
Q: PHP array path from values Hello i have this array
$ar=array(
'cat','dog','turtle','eagle'
);

I want to generate another array with this result
$arFinal=array(
[cat,dog,turtle,eagle],
[cat,dog,turtle],
[cat,dog],
[cat],
[dog,turtle,eagle],
[dog,turtle],
[dog],
[turtle,eagle],
[turtle],
[eagle],
);

A: Top of the mornin' to you,my solution (from the comments on your question):
<?php
    $array = array('cat','dog','turtle','eagle');

    $result = array();
    for($i = 0; $i < count($array); $i++){
        for($l = $i; $l < count($array); $l++){
            $result[] = array_slice($array, $i, count($array)-$l);
        }
    }
?>

Output:
array(10) {
    array(4) { [0]=>  "cat" [1]=>  "dog" [2]=>  "turtle" [3]=>  "eagle" }
    array(3) { [0]=>  "cat" [1]=>  "dog" [2]=>  "turtle" }
    array(2) { [0]=>  "cat" [1]=>  "dog" }
    array(1) { [0]=>  "cat" }
    array(3) { [0]=>  "dog" [1]=>  "turtle" [2]=>  "eagle" }
    array(2) { [0]=>  "dog" [1]=>  "turtle" }
    array(1) { [0]=>  "dog" }
    array(2) { [0]=>  "turtle" [1]=>  "eagle" }
    array(1) { [0]=>  "turtle" }
    array(1) { [0]=>  "eagle" }
}

Sincerely,
Sam.


text:
Q: Segfault during custom collation creation sqlite using qt I'm trying to add a custom collating function into a qt project, using sqlite.
I'm getting a segfault that i don't understand, thus can't fix.
It comes from the following code, in the sqlite3_create_collation sql function.
bool create_collate(QSqlDatabase *db)
{
    QVariant v = db->driver()->handle();
    if (!v.isValid() || qstrcmp(v.typeName(), "sqlite3*") != 0)
        return -1;

    sqlite3* sql_db = *static_cast<sqlite3* const*>(v.data());
    if (!sql_db)
        return -1;

    sqlite3_initialize();
--> return sqlite3_create_collation(sql_db, "NOACCENTS", SQLITE_UTF8, NULL, &localeCompare); <--
}

The segv happens when reaching this particular function, on the highlighted line:
static HashElem *findElementWithHash(
  const Hash *pH,     /* The pH to be searched */
  const char *pKey,   /* The key we are searching for */
  unsigned int *pHash /* Write the hash value here */
){
  HashElem *elem;                /* Used to loop thru the element list */
  unsigned int count;            /* Number of elements left to test */
  unsigned int h;                /* The computed hash */
  static HashElem nullElement = { 0, 0, 0, 0 };

  if( pH->ht ){   /*OPTIMIZATION-IF-TRUE*/
    struct _ht *pEntry;
    h = strHash(pKey) % pH->htsize;
    pEntry = &pH->ht[h];
--> elem = pEntry->chain; <--
    count = pEntry->count;
  }else{
    h = 0;
    elem = pH->first;
    count = pH->count;
  }
  if( pHash ) *pHash = h;
  while( count-- ){
    assert( elem!=0 );
    if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
      return elem;
    }
    elem = elem->next;
  }
  return &nullElement;
}

The output of sqlite -version is 3.32.3, which is consistent with the version used by qt, also 3.32.3.
EDIT:
localeCompare :
int localeCompare(void *, int len1, const void *data1, int len2, const void* data2)
{
    auto qstr1 = QString::fromUtf8(reinterpret_cast<const char*>(data1), len1 * 4);
    auto qstr2 = QString::fromUtf8(reinterpret_cast<const char*>(data2), len2 * 4);

    int end = 0;
    while (qstr1[end] != '\0') {end++;}
    qstr1.truncate(end + 1);

    end = 0;
    while (qstr2[end] != '\0') {end++;}
    qstr2.truncate(end + 1);

    return QString::compare(BkString::removeAccents(qstr1), BkString::removeAccents(qstr2), Qt::CaseInsensitive);
}

Qt has been installed via the online installer.
The corresponding .pro:
QT += core sql quick qml
QT -= gui

TEMPLATE = lib
CONFIG += unversioned_libname unversioned_soname # do not generate the symbolic link.

!android {
    LIBS += -lsqlite3 -ldl
}
TARGET = bkdatabase-core

INCLUDEPATH += ./src

SOURCES += ...
HEADERS += ...

A minimal example would be:
#include <sqlite3.h>
#include <QSqlDatabase>

int main(void)
{
   QSqlDatabase db("QSQLITE");
   db.setDataBaseName("My_db");

   if (db.open())
      create_collate(&db);

   return 0;
}

A: If you have installed Qt using the online installer then it has been compiled not using the system sqlite so you have to download the sqlite amalgation (the version of sqlite depends on the version that was used to compile Qt which you can get using SELECT sqlite_version(), in Qt 5.15 you get 3.31.1 so you have to download https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip. You can also find out this information by checking the qt_attribution.json file in the source code.
├── 3rdParty
│   ├── sqlite
│   │   ├── shell.c
│   │   ├── sqlite3.c
│   │   ├── sqlite3ext.h
│   │   └── sqlite3.h
│   └── sqlite.pri
├── 64591348.pro
└── main.cpp

*.pro
QT -= gui
QT += sql
CONFIG += c++11 console
CONFIG -= app_bundle

SOURCES += main.cpp

include(3rdParty/sqlite.pri)

sqlite.pri
INCLUDEPATH += $$PWD/sqlite

SOURCES += $$PWD/sqlite/sqlite3.c
LIBS += -ldl

main.cpp
#include <QSqlDatabase>
#include <QSqlDriver>
#include <QSqlError>
#include <QSqlQuery>
#include <QVariant>
#include <QDebug>

#include <sqlite3.h>

int localeCompare(void *, int len1, const void *data1, int len2, const void* data2)
{
    auto qstr1 = QString::fromUtf8(reinterpret_cast<const char*>(data1), len1 * 4);
    auto qstr2 = QString::fromUtf8(reinterpret_cast<const char*>(data2), len2 * 4);

    int end = 0;
    while (qstr1[end] != '\0') {end++;}
    qstr1.truncate(end + 1);

    end = 0;
    while (qstr2[end] != '\0') {end++;}
    qstr2.truncate(end + 1);

    return QString::compare(qstr1, qstr2, Qt::CaseInsensitive);
}

bool create_collate(QSqlDatabase db)
{
    QVariant v = db.driver()->handle();
    if (!v.isValid() || qstrcmp(v.typeName(), "sqlite3*") != 0)
        return false;

    sqlite3* sql_db = *static_cast<sqlite3* const*>(v.data());
    if (!sql_db)
        return false;

    sqlite3_initialize();
    return sqlite3_create_collation(sql_db, "NOACCENTS", SQLITE_UTF8, NULL, &localeCompare) == SQLITE_OK;
}
int main(int argc, char *argv[])
{
    Q_UNUSED(argc)
    Q_UNUSED(argv)
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(":memory:");
    if(!db.open())
        return -1;
    QSqlQuery q;
    if(!q.exec("SELECT sqlite_version()")){
        qDebug() << q.lastError().text();
        return -1;
    }
    if(q.first()){
        qDebug() << q.value(0).toString();
    }
    if(!create_collate(db))
        return -1;
    if(!q.exec("CREATE TABLE test(x)")){
        qDebug() << q.lastError().text();
        return -1;
    }
    q.prepare("INSERT into test(x) values (?)");
    for(const QString & word: {"z", "a", "p"}){
        q.addBindValue(word);
        if(!q.exec()){
            qDebug() << q.lastError().text();
            return -1;
        }
    }
    if(!q.exec("SELECT x FROM test ORDER BY x COLLATE NOACCENTS")){
        qDebug() << q.lastError().text();
        return -1;
    }
    while (q.next()) {
        qDebug() << q.value(0).toString();
    }

    return 0;
}

Output:
"3.31.1"
"a"
"p"
"z"


text:
Q: How can I pass an array as parameter without using Brackets in Swift? I want to know how could I pass an array as parameter to function without using Brackets, like printin Swift. as you can see in down it can be 3 or 5 or 7 strings, it would work
print("1", "2", "3")

func customFunction(???) { }

A: you can achieve this via Variadic functions this allows you to input parameter as comma separated values. just put 3 dots at the the end of parameter type
func customFunction(values: String...) {
    for value in values {
        print(value)
    }
}

function call
customFunction(values: "1", "2", "3")


text:
Q: TSD error: self signed certificate in certificate chain I am following the Angular 2 quick start guide and I'm stuck right at the beginning of it.
My company is filtering our network connections and modifying SSL negociation. In a man in the middle style they assign a self signed certificate as the CA of the destination's certificate.
Therefore when I execute the second command
npm install -g tsd
tsd query angular2 --action install

I get this:
stream.js:75
      throw er; // Unhandled stream error in pipe.
            ^
Error: self signed certificate in certificate chain
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:908:38)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:163:7)
    at TLSSocket._finishInit (_tls_wrap.js:496:8)

Does anybody know a way of disabling the self signed certificate verification?

A: One little FYI first : if you just want to learn AngularJS, maybe it's not the best way to start with TypeScript. If it's the case for you, try the tutorial on angularjs.org, which use JavaScript and angular-seed.
Anyway, if you want to use tsd, you have to edit your tsdrc file (in your user's home directory), to set the proxy, and maybe, to turn of strictSSL. See https://github.com/DefinitelyTyped/tsd#tsdrc
Following this documentation, this is what you certainly need to add to your tsdrc file :
{
    "proxy": "http://proxy.example.com:88",
    "strictSSL" : false
}

Edit : I also don't think it's an npm problem. So please update your question.

A: For yarn a very similar error occurs:
error An unexpected error occurred:
"https://registry.yarnpkg.com/generator-jhipster: self signed
certificate in certificate chain".

after
export NODE_TLS_REJECT_UNAUTHORIZED=0

I get:
error An unexpected error occurred: "https://registry.yarnpkg.com/generator-jhipster: SSL Error: SELF_SIGNED_CERT_IN_CHAIN".

Finally the solution, with the below yarn is now happy to accept the man in the middle attack by my corporate proxy.
export NODE_TLS_REJECT_UNAUTHORIZED=0
yarn config set strict-ssl false --global


text:
Q: Repeatedly change background colour of picture onMouseOver I have a picture and wish its background to change and repeatedly take random colours sequencially from all over the spectrum till the user's mouse exits the picture. I guess the solution should use setInterval (see this) and the following shall help:
var red = Math.round(Math.random() * 255);
var green = Math.round(Math.random() * 255);
var blue = Math.round(Math.random() * 255);
var bg = "background-color: rgb(" + red + "," + green + "," + blue + ");";
x.style = bg;

Here is a fiddle trying to implement what I have in mind: The first smiley should change colour onMouseOver and return to normal onMouseOut.
Here is what I have in mind: I want to implement what FontAwesome.com do on their logo at their footer: it changes colours onmouseover and stops otherwise. But that's not a picture, it's a font(?). Instead, I have a logo that I made transparent, and I want to change the background dynamically so that it replicates the nice trick of Fontawesome. Any ideas?
* Updated *
I am posting a detailed solution to my question below based on the answers of the community. Looks like I followed Leo's way but Rakibul's solution worked well too.

A: I achieved what I want.
I wanted my logo to change colours "nicely" when a user's mouse hovers over it (like magic and similar to FontAwesome's logo at their footer).

.OAlogo {
  background-color: transparent;
  animation-play-state: paused;
}

.OAlogo:hover {
  animation: colorReplace 10s infinite;
  animation-timing-function: linear;
  animation-direction: alternate;
}

@keyframes colorReplace {
  0% {
    background-color: rgb(44, 132, 231);
  }
  10% {
    background-color: rgb(61, 192, 90);
  }
  20% {
    background-color: rgb(255, 211, 59);
  }
  30% {
    background-color: rgb(253, 136, 24);
  }
  40% {
    background-color: rgb(243, 129, 174);
  }
  50% {
    background-color: rgb(34, 138, 230);
  }
  60% {
    background-color: rgb(62, 192, 89);
  }
  70% {
    background-color: rgb(255, 211, 59);
  }
  80% {
    background-color: rgb(71, 193, 86);
  }
  90% {
    background-color: rgb(253, 126, 20);
  }
  100% {
    background-color: rgb(233, 109, 132);
  }
}

A: Use CSS animation to change colors and use the animation-play-state: pause on hover.

 .button {
    width:100px;
    height:20px;
    background-color: red;
    animation: colorReplace 5s infinite;
  }

  .button:hover {
    animation-play-state: paused;
  }

@keyframes colorReplace
{
  0%   {background-color:red;}
  30%  {background-color:green;}
  60%  {background-color:blue;}
  100%   {background-color:red;}
}
<input type="submit" value="submit" class="button" />

A: You have to declare setInterval() with your required time interval (In the example below 500 is set) for the color to be changed randomly on definite interval. And onmouseover is used to simply detect the hover on the image and then it sets the color randomly. Finally, when onmouseout is detected, the color changes to no-color.

var randomColor = function() {
  var r = Math.floor(Math.random() * 12);
  var g = Math.floor(Math.random() * 128);
  var b = Math.floor(Math.random() * 100);
  return "#" + r + g + b;
};

var colorChange;

document.getElementById("myImage").onmouseover = function() {
  colorChange = setInterval(function() {
    document.getElementById("myImage").style.backgroundColor = randomColor();
  }, 500);
};

document.getElementById("myImage").onmouseout = function() {
  this.style.backgroundColor = "";
  clearInterval(colorChange);
};

A: You can just use the setInterval function to run your code over and over. You also had some minor errors in your code which I have fixed. See your updated fiddle here: https://jsfiddle.net/zvebco3r/3/
You can change the interval time (currently 25ms) to your desired length.
HTML:

JS:
var img = document.getElementById('img');

img.onmouseover = function() {
    changeIt = setInterval(function(){
       var red = Math.floor(Math.random() * 255);
       var green = Math.floor(Math.random() * 255);
       var blue = Math.floor(Math.random() * 255);
       img.style.backgroundColor="rgb("+red+","+green+","+blue+")";
    },25);
}

img.onmouseout = function() {
    this.style.backgroundColor="transparent";
    clearInterval(changeIt);
}


text:
Q: Install Managed Package Into Sandbox Fails on All Lightning Component Bundles I have developed an app for the Salesforce platform and have successfully created a beta managed package ready for testing on one of our sandboxes. however when I try to install the package on the sandbox, it fails with a large number of errors detailing that every part of a lightning bundle does not exist. This same error happened when attempting to install a dependency app from the App Exchange directly into the sandbox, but I got around this by installing it into the Test Enterprise Org.
does anyone know why this happens when trying to install to a sandbox? How can I get around this problem with a beta managed package?
This is a portion of the 58 errors that I receive:
1.  No EVENT named markup://it4sxr:SourceAddedEvent found
SourceAddedEvent: No EVENT named markup://it4sxr:SourceAddedEvent found

2.  No CONTROLLER named js://it4sxr.SourceList found
SourceListController: No CONTROLLER named js://it4sxr.SourceList found

3.  No HELPER named js://it4sxr.SourceList found
SourceListHelper: No HELPER named js://it4sxr.SourceList found

4.  No STYLE named css://it4sxr.SourceList found
SourceList: No STYLE named css://it4sxr.SourceList found

5.  No COMPONENT named markup://it4sxr:SourceList found
SourceList: No COMPONENT named markup://it4sxr:SourceList found

6.  No CONTROLLER named js://it4sxr.ImportJobService found
ImportJobServiceController: No CONTROLLER named js://it4sxr.ImportJobService found

7.  No HELPER named js://it4sxr.ImportJobService found
JobServiceHelper: No HELPER named js://it4sxr.ImportJobService found

8.  No COMPONENT named markup://it4sxr:ImportJobService found
ImportJobService: No COMPONENT named markup://it4sxr:ImportJobService found

Thanks

A: Since it seems to be an internal Salesforce bug there isn't much you can do about it until they resolve it.
They are onto it:

Team is looking into it right now. W-5394323 for reference if you have a support case or talk to a support agent.
   - Farhan Tahir

Circumstantial evidence suggests Summer'17 Patch 19.0 could be responsible. So if you can avoid deploying to orgs with that patch version you can avoid the problem. YMMV.


text:
Q: How to save object to "resteasy" application scope without "spring" usage?
Do you know how to set object to resteasy framework without using spring.
For example I have service :
@Path("/customers")
public class CustomerResource {

   private MyDBconnection db = new MyDBconnection();

   ...

}

How can I save db connection object to application scope for all webservers ?

A: I wouldn't save one db connection to be shared amongst multiple physical servers. I'm not sure if that's what you're asking. I would recommend sharing the connection/pool on each server. The easiest thing you can do is a simple singleton. However, I would recommend you use Guice https://code.google.com/p/google-guice/ so that you can do something like this wherever you need it.
@Path("/customers")
public class CustomerResource {
   @Inject
   private Connection db;

   ...
}

and then you can define a guice module similar to this
public class DatabaseModule extends AbstractModule {
    @Override
    protected void configure() {
        ...
    }

    @Provides
    @Singleton
    Connection provideConnection() {
        MyDBConnection connection = new MyDBConnection("jdbc:mysql....");
        connection.setSomeCustomStuff(someCustomStuff);
        return connection;
    }
}

I know that currently, resteasy only supports Guice 2.0. If you can live with that cool, if not, I can help you get Guice 3.0 integrated with resteasy because I've done it myself and it's working well.


text:
Q: append int values in an emty array java I wrote a programm to print out all the prime number up to a limit. Then put those prime numbers into an ArrayList, convert this ArrayList into an array, finally print the numbers out with their index.
Note: I couldnt print out an ArrayList with a for loop, it's possible with an array only, hence the conversion.
My question is:
Is there anyway to do it without pushing the numbers into an ArrayList first, instead put them right away into an emty array of a length < given limit.
Thanks for you help!
was browsing SO in the last 2 days and couldnt find anything
import java.util.Scanner;
import java.util.ArrayList;

public class test {
public static void main(String[] args){

    //get input till which prime number to be printed
    System.out.print("Enter the number till which prime number to be printed: ");

    int limit = new Scanner(System.in).nextInt();

    System.out.print("\n");

    ArrayList<Integer> myArray = new ArrayList<Integer>();

    //printing primer numbers till the limit ( 1 to 10)
    System.out.println("Printing prime number from 1 to " + limit + "\n");

    for(int number=2; number <= limit; number++){
        if(isPrime.numberPrime(number)){
            myArray.add(number);
        }
    }

    System.out.println(myArray + "\n");

    //Convert ArrayList into an Array
    int[] newArray = new int[myArray.size()];

    for(int i = 0; i < myArray.size(); i++) {

            newArray[i] = myArray.get(i);

    }
    System.out.println("There were " + myArray.size() + " prime numbers");
    System.out.println("Index\tValue");

    for(int counter = 0; counter<newArray.length; counter++){
        System.out.println(counter+1 + "\t" + newArray[counter]);
    }

}

here is the result:
    Enter the number till which prime number to be printed: 10
Printing prime number from 1 to 10

[2, 3, 5, 7]

There were 4 prime numbers
Index   Value
1   2
2   3
3   5
4   7

A: No need to do this
//Convert ArrayList into an Array
int[] newArray = new int[myArray.size()];

for(int i = 0; i < myArray.size(); i++) {

        newArray[i] = myArray.get(i);

}
System.out.println("There were " + myArray.size() + " prime numbers");
System.out.println("Index\tValue");

for(int counter = 0; counter<newArray.length; counter++){
    System.out.println(counter+1 + "\t" + newArray[counter]);
}

In place of this, simply write
System.out.println("There were " + myArray.size() + " prime numbers");
System.out.println("Index\tValue");
for(int i=0;i<myArray.size();i++)
System.out.println(i+1 + "\t" + myArray.get(i));


text:
Q: How to rename a column in a spark scala dataframe after checking if it's present or not? I need to rename a column, "DOB" in my spark dataframe to "DateOfBirth" after checking if the column is available in the dataframe or not.
I am doing the below for renaming the column, but how do I insert the condition here
df.withColumnRenamed("DOB","DateOfBirth")

Could anyone please help on this.

A: You can just check if the column exists with the column() function and only rename the column in that case:
val renamed_df =
    if (df.columns.contains("DOB"))
        df.withColumnRenamed("DOB","DateOfBirth")
    else df


text:
Q: group by per day pyspark I have a PySpark DataFrame :
From id  To id Price  Date
a         b    20     30/05/2019
b         c    5      30/05/2019
c         a    20     30/05/2019
a         d    10     02/06/2019
d         c    5      02/06/2019

id  Name
a   Claudia
b   Manuella
c   remy
d   Paul

The output that i want is :
Date         Name   current balance
30/05/2019   Claudia       0
30/05/2019   Manuella      15
30/05/2019   Remy         -15
30/05/2019   Paul           0
02/06/2019   Claudia      -10
02/06/2019   Manuella      15
02/06/2019   Remy         -10
02/06/2019   Paul           5

I want to get  the current balance in each day for all users.
my idea is to  make a groupby per user and calculate the sum of the TO column minus the From column. But how to do it per day? especially it's cumulative and not per day?
Thank You

A: I took a bit of an effort to get the requirements right. Here's my version of the solution.
from pyspark.sql import Row
from pyspark.sql.types import *
from pyspark import SparkContext, SQLContext
import pyspark.sql.functions as F
from pyspark.sql import Window

sc = SparkContext('local')
sqlContext = SQLContext(sc)

data1 = [
        ("a","b",20,"30/05/2019"),
        ("b","c",5 ,"30/05/2019"),
        ("c","a",20,"30/05/2019"),
        ("a","d",10,"02/06/2019"),
        ("d","c",5 ,"02/06/2019"),
      ]

df1Columns = ["From_Id", "To_Id", "Price",  "Date"]
df1 = sqlContext.createDataFrame(data=data1, schema = df1Columns)
df1 = df1.withColumn("Date",F.to_date(F.to_timestamp("Date", 'dd/MM/yyyy')).alias('Date'))
print("Actual initial data")
df1.show(truncate=False)

data2 = [
        ("a","Claudia"),
        ("b","Manuella"),
        ("c","Remy"),
        ("d","Paul"),
      ]

df2Columns = ["id","Name"]
df2 = sqlContext.createDataFrame(data=data2, schema = df2Columns)

print("Actual initial data")
df2.show(truncate=False)

alldays_df = df1.select("Date").distinct().repartition(20)
allusers_df = df2.select("id").distinct().repartition(10)

crossjoin_df = alldays_df.crossJoin(allusers_df)
crossjoin_df = crossjoin_df.withColumn("initial", F.lit(0))
crossjoin_df = crossjoin_df.withColumnRenamed("id", "common_id").cache()
crossjoin_df.show(n=40, truncate=False)

from_sum_df = df1.groupby("Date", "From_Id").agg(F.sum("Price").alias("from_sum"))
from_sum_df = from_sum_df.withColumnRenamed("From_Id", "common_id")
from_sum_df.show(truncate=False)

from_sum_df = crossjoin_df.alias('cross').join(
    from_sum_df.alias('from'), ['Date', 'common_id'], how='outer'
).select('Date', 'common_id',
    F.coalesce('from.from_sum', 'cross.initial').alias('from_amount') ).cache()
from_sum_df.show(truncate=False)

to_sum_df = df1.groupby("Date", "To_Id").agg(F.sum("Price").alias("to_sum"))
to_sum_df = to_sum_df.withColumnRenamed("To_Id", "common_id")
to_sum_df.show(truncate=False)

to_sum_df = crossjoin_df.alias('cross').join(
    to_sum_df.alias('to'), ['Date', 'common_id'], how='outer'
).select('Date', 'common_id',
    F.coalesce('to.to_sum', 'cross.initial').alias('to_amount') ).cache()
to_sum_df.show(truncate=False)

joined_df = to_sum_df.join(from_sum_df, ["Date", "common_id"], how='inner')
joined_df.show(truncate=False)

balance_df = joined_df.withColumn("balance", F.col("to_amount") - F.col("from_amount"))
balance_df.show(truncate=False)

final_df = balance_df.join(df2, F.col("id") == F.col("common_id"))
final_df.show(truncate=False)

final_cum_sum = final_df.withColumn('cumsum_balance', F.sum('balance').over(Window.partitionBy('common_id').orderBy('Date').rowsBetween(-sys.maxsize, 0)))
final_cum_sum.show()

Following are all the outputs for your progressive understanding. I am not explaining the steps. You can figure them out.
Actual initial data
+-------+-----+-----+----------+
|From_Id|To_Id|Price|Date      |
+-------+-----+-----+----------+
|a      |b    |20   |2019-05-30|
|b      |c    |5    |2019-05-30|
|c      |a    |20   |2019-05-30|
|a      |d    |10   |2019-06-02|
|d      |c    |5    |2019-06-02|
+-------+-----+-----+----------+

Actual initial data
+---+--------+
|id |Name    |
+---+--------+
|a  |Claudia |
|b  |Manuella|
|c  |Remy    |
|d  |Paul    |
+---+--------+

+----------+---------+-------+
|Date      |common_id|initial|
+----------+---------+-------+
|2019-05-30|a        |0      |
|2019-05-30|d        |0      |
|2019-05-30|b        |0      |
|2019-05-30|c        |0      |
|2019-06-02|a        |0      |
|2019-06-02|d        |0      |
|2019-06-02|b        |0      |
|2019-06-02|c        |0      |
+----------+---------+-------+

+----------+---------+--------+
|Date      |common_id|from_sum|
+----------+---------+--------+
|2019-06-02|a        |10      |
|2019-05-30|a        |20      |
|2019-06-02|d        |5       |
|2019-05-30|c        |20      |
|2019-05-30|b        |5       |
+----------+---------+--------+

+----------+---------+-----------+
|Date      |common_id|from_amount|
+----------+---------+-----------+
|2019-06-02|a        |10         |
|2019-06-02|c        |0          |
|2019-05-30|a        |20         |
|2019-05-30|d        |0          |
|2019-06-02|b        |0          |
|2019-06-02|d        |5          |
|2019-05-30|c        |20         |
|2019-05-30|b        |5          |
+----------+---------+-----------+

+----------+---------+------+
|Date      |common_id|to_sum|
+----------+---------+------+
|2019-06-02|c        |5     |
|2019-05-30|a        |20    |
|2019-06-02|d        |10    |
|2019-05-30|c        |5     |
|2019-05-30|b        |20    |
+----------+---------+------+

+----------+---------+---------+
|Date      |common_id|to_amount|
+----------+---------+---------+
|2019-06-02|a        |0        |
|2019-06-02|c        |5        |
|2019-05-30|a        |20       |
|2019-05-30|d        |0        |
|2019-06-02|b        |0        |
|2019-06-02|d        |10       |
|2019-05-30|c        |5        |
|2019-05-30|b        |20       |
+----------+---------+---------+

+----------+---------+---------+-----------+
|Date      |common_id|to_amount|from_amount|
+----------+---------+---------+-----------+
|2019-06-02|a        |0        |10         |
|2019-06-02|c        |5        |0          |
|2019-05-30|a        |20       |20         |
|2019-05-30|d        |0        |0          |
|2019-06-02|b        |0        |0          |
|2019-06-02|d        |10       |5          |
|2019-05-30|c        |5        |20         |
|2019-05-30|b        |20       |5          |
+----------+---------+---------+-----------+

+----------+---------+---------+-----------+-------+
|Date      |common_id|to_amount|from_amount|balance|
+----------+---------+---------+-----------+-------+
|2019-06-02|a        |0        |10         |-10    |
|2019-06-02|c        |5        |0          |5      |
|2019-05-30|a        |20       |20         |0      |
|2019-05-30|d        |0        |0          |0      |
|2019-06-02|b        |0        |0          |0      |
|2019-06-02|d        |10       |5          |5      |
|2019-05-30|c        |5        |20         |-15    |
|2019-05-30|b        |20       |5          |15     |
+----------+---------+---------+-----------+-------+

+----------+---------+---------+-----------+-------+---+--------+
|Date      |common_id|to_amount|from_amount|balance|id |Name    |
+----------+---------+---------+-----------+-------+---+--------+
|2019-05-30|a        |20       |20         |0      |a  |Claudia |
|2019-06-02|a        |0        |10         |-10    |a  |Claudia |
|2019-05-30|b        |20       |5          |15     |b  |Manuella|
|2019-06-02|b        |0        |0          |0      |b  |Manuella|
|2019-05-30|c        |5        |20         |-15    |c  |Remy    |
|2019-06-02|c        |5        |0          |5      |c  |Remy    |
|2019-06-02|d        |10       |5          |5      |d  |Paul    |
|2019-05-30|d        |0        |0          |0      |d  |Paul    |
+----------+---------+---------+-----------+-------+---+--------+

+----------+---------+---------+-----------+-------+---+--------+--------------+
|      Date|common_id|to_amount|from_amount|balance| id|    Name|cumsum_balance|
+----------+---------+---------+-----------+-------+---+--------+--------------+
|2019-05-30|        d|        0|          0|      0|  d|    Paul|             0|
|2019-06-02|        d|       10|          5|      5|  d|    Paul|             5|
|2019-05-30|        c|        5|         20|    -15|  c|    Remy|           -15|
|2019-06-02|        c|        5|          0|      5|  c|    Remy|           -10|
|2019-05-30|        b|       20|          5|     15|  b|Manuella|            15|
|2019-06-02|        b|        0|          0|      0|  b|Manuella|            15|
|2019-05-30|        a|       20|         20|      0|  a| Claudia|             0|
|2019-06-02|        a|        0|         10|    -10|  a| Claudia|           -10|
+----------+---------+---------+-----------+-------+---+--------+--------------+


text:
Q: Can I have an HTML drag-and-drop input in Microsoft Edge? We are adapting our product to Microsoft Edge. We have an HTML drag-and-drop feature that works correctly in IE, Chrome, etc.
Using Microsoft Edge from Win10 Insider Preview Build 10162, the drop is forbidden. We also checked http://html5demos.com/dnd-upload doesn't work neither.
Has anyone solved this problem?

A: Microsoft implemented this feature in EdgeHTML 13, included in Windows 10 Build 10586 (November 2015).

Original answer:
The DragAndDropEntries is not supported in Microsoft Edge yet.  See this link for more detail
It says:

Allows dragging and dropping entire folders using HTML5 Drag and Drop. Extends the DataTransferItem with a method to get a FileEntry/DirectoryEntry.
  Roadmap Priority: Low — We are still evaluating this technology. There may be significant spec stabilization, foundational work, or additional community input required before we can begin development."

However, feel free to request for this feature at
https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer

A: I just tried it the demo on Microsoft Edge and it worked fine for me.


text:
Q: javascript - showModalDialog not returning value in Chrome I made a small calendar popup in Javascript. Very simple, using the Calendar control from ASP.NET. I call the popup window with showModalDialog. In the modal window, changing the current month of the calendar causes problems because of the postback, and I found in several places that the solution is to put:
<base target="_self"/>

in the head part of the aspx file. Everything works great... except for one thing, and only in Google Chrome. To get back the selected date, I set the returnValue of the popup to the date selected in the calendar. In IE and Firefox, it always works. In Chrome, however, it works only if I don't change the current month in the calendar. As soon as I change it, the return value is not passed back to the caller of showModalDialog. It is as if the modal window is not the original one anymore; the return value is undefined.
Has anyone experienced that behavior and have a suggestion to make it work? I tried using dialogArguments to keep trace of the caller window but it gets passed only to the first modal window (it is lost after changing the current month).
The code in the calling procedure:
var d = window.showModalDialog(...)

The code in the modal window:
window.returnValue = selectedDate;
self.close();

As I said to Teemu, selectedDate and window.returnValue are both always correct. However, in the case of Google Chrome (after a month change in the calendar), returnValue is not passed back by showModalDialog and d is undefined.

A: In order to keep using showModalDialog in my page, I had to come up with my own workaround for the bug. So, here it is...
In Google Chrome, after a postback, showModalDialog always returns undefined. However, the window.opener property in the modal dialog points to the caller window, even after postbacks. So, I thought about putting the result of the dialog in the returnValue property of that caller window. And it works.
In the caller window:
var prevReturnValue = window.returnValue; // Save the current returnValue
window.returnValue = undefined;
var dlgReturnValue = window.showModalDialog(...);
if (dlgReturnValue == undefined) // We don't know here if undefined is the real result...
{
    // So we take no chance, in case this is the Google Chrome bug
    dlgReturnValue = window.returnValue;
}
window.returnValue = prevReturnValue; // Restore the original returnValue

At this point, use dlgReturnValue for further processing

In the modal dialog window:
if (window.opener)
{
    window.opener.returnValue = dateValue;
}
window.returnValue = dateValue;
self.close();

A: I had this same error, what i found in some forum is that if you put your controls in a updatePanel and ContentTemplate it will work:
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
           </ContentTemplate>
 </asp:UpdatePanel>


text:
Q: Migrating a classic ASP's SQL Server database from a server 2003 to a 2008r2 server I have a situation where a classic ASP's SQL Server database has been moved from a server 2003 to a 2008r2. The classic asp application stills resides on a server 2003.
Now because I have never done a migrating the only thing I thought I needed to change is the SQL Server named IP address in the application's IIS deployed ini file. Currently I am using anonymous authentication and the default application pool. The application render's to the browser fine. The problem is the application is not pulling any data for the database.
It seems that I have missed something in the configuration process. Has someone done this type of migration and if so provide me a list of thing that they have done to configure the application correct and other settings for the migration?
Thanks,
Steve Holdorf

A: This is not an asp but a database authentication.
It sounds like you used Windows authentication to connect from asp to the old server. Windows authentication means that asp uses IIS user identity to connect to the database and in your ini-file (or asp files) you do not provide any user/password to connect to sql.
If you want to keep this type of authentication for the new database, then you would need to configure user on the new Sql Server. Look at the old server, you should find the user named similar to domainName\WebServerMachineName$. You would need to create the same user on the new Sql Server and grant the same rights as on the old database. Read more https://msdn.microsoft.com/en-us/library/ff647396.aspx
If this is not an issue, then you should find what is the error message when application is not pulling any data for the database.


text:
Q: How to pass php object or array to Vue prop (Not Blade)? This Not Blade, it's just a regular php file containing the inline-template of my vue component, so I have no access to the typical laravel/blade {!! !!} shorthand.
This is an old Codeigniter project I'm migrating to Vue for the frontend and their way to bring data to their plain js script contained on php files was like:
var a = <?= json_encode($frontLanguage) ?>;
console.log(a);

which ouputted:

I tried something similar with Vue like
<vue-component a-string="<?='something string'?>" :language='<?=json_encode($frontLanguage)?>' inline-template>

a-string just works as it's just a string, but :language breaks the entire component, tried without json_encode, tried using double and single quotes, with and without colon, etc with no avail.
In the object I see html characters so that may be the reason? I'm not entirely sure
What would be the proper way of bringing this object for Vue to use as a prop?
Thanks in advance

A: Just to give you a full answer here: The reason, why there is a problem is, that either you need to use " or ' for your html attribute. This leads to the problem, that you might have both of them inside your json output.
To avoid that, you need to encode html entities inside your json string like
<vue-component :language="<?php htmlentities(json_encode($frontLanguage), ENT_QUOTES) ?>" />


text:
Q: Why other devices cannot add my pass I created a pass. I can add it to my passbook by email or app or web server. When I send it to others to test, they can open it on Mail.app and see a pass, but when they click add button, nothing adds to passbook. Why is it so ?

A: The issue is because your webServiceURL is HTTP, not HTTPS.
"webServiceURL" : "http://192.168.1.202:8888/passesWebserver/"

The pass will load on your device because you have enabled "Allow HTTP Services" in the PassKit Testing section of the Developer menu in your device's settings.
For non-development devices (or development devices that don't have this option set), the webServiceURL has to be HTTPS.
To fix this, either change your webServiceURL to https://192.168.1.202:8888/passesWebserver/, or ask the people who you are sending the pass to, to Allow HTTP Services (note, they will require development devices to be able to do so).
Also note that if you change to https, your webServiceURL will probably not work because your MAMP server is not configured for SSL on port 8888.


text:
Q: In the URL orgId, UserId, and User are not appearing in R12 In the R12.2.6 Oracle iProcurement screen I added one link like Catalog --

it's defined on the $OA_HTML/US/POPNEWS.htm page

like  catalog
When I click the link in the URL it is like:

http://isyg011.8000//OA_HTML/jsp/por/cat.jsp?responsibilityId=5014

but the same set up is done in 11i, but we could get:

http://eol1a.8100//OA_HTML/jsp/por/cat.jsp
  user=B&userId=1122&orgId=123&responsibilityId=5020

What is missing in R12?

A: Assigned Responsibilities are not visible to User
Following shortcut solution worked many times in 11i and R12 as well

*

*Run the following requests in the order below:
a. "Create FND_RESP WF Roles"
b. "Sync responsibility role data into the WF table.(obsolete in R12)"
c. "Synchronize WF LOCAL tables"
d. "Workflow Directory Services User/Role Validation"

*End date and associated userid, un-end date it, and change the password.

*Retest the issue.

There is an exhaustive troubleshooting steps for this issue, but above solution has worked in most of the cases for me, except very few, where I had to walk that extra mile.
Make sure Workflow Background Process is properly Scheduled. Follow this for best practice on this:
http://mkkoracleapps.blogspot.com/2012/12/workflow-related-scheduled-concurrent.html


text:
Q: block display of drawer and main content in paper-drawer-panel For the code below, I am expecting the drawer and main toolbars to be aligned horizontally. The are aligned vertically instead! Please help me sort this out.

<!DOCTYPE html>

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <base href="https://polygit.org/components/">

  <link ref="import" href="polymer/polymer.html" />
  <link ref="import" href="paper-drawer-panel/paper-drawer-panel.html" />
  <link rel="import" href="paper-scroll-header-panel/paper-scroll-header-panel.html" />
  <link rel="import" href="paper-toolbar/paper-toolbar.html" />
  <link rel="import" href="paper-icon-button/paper-icon-button.html" />
  <link rel="import" href="iron-icons/iron-icons.html" />
  <link rel="import" href="iron-icon/iron-icon.html" />
  <link rel="import" href="paper-styles/paper-styles.html" />

  <paper-drawer-panel>

    <paper-header-panel drawer>
      <paper-toolbar>
        My drawer
      </paper-toolbar>
    </paper-header-panel>

    <paper-header-panel main>
      <paper-toolbar>
        <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
        My content
      </paper-toolbar>
    </paper-header-panel>

  </paper-drawer-panel>

rendered html with toolbars aligned vertically

A: The problem is using ref instead of rel for polymer and paper-drawer-panel. Polymer is still getting imported as it is dependency in other modules, but drawer-panel is not imported as all

<!DOCTYPE html>

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <base href="https://polygit.org/components/">

  <link rel="import" href="polymer/polymer.html" />
  <link rel="import" href="paper-drawer-panel/paper-drawer-panel.html" />
  <link rel="import" href="paper-scroll-header-panel/paper-scroll-header-panel.html" />
  <link rel="import" href="paper-toolbar/paper-toolbar.html" />
  <link rel="import" href="paper-icon-button/paper-icon-button.html" />
  <link rel="import" href="iron-icons/iron-icons.html" />
  <link rel="import" href="iron-icon/iron-icon.html" />
  <link rel="import" href="paper-styles/paper-styles.html" />

  <paper-drawer-panel>

    <paper-header-panel drawer>
      <paper-toolbar>
        My drawer
      </paper-toolbar>
    </paper-header-panel>

    <paper-header-panel main>
      <paper-toolbar>
        <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
        My content
      </paper-toolbar>
    </paper-header-panel>

  </paper-drawer-panel>


text:
Q: multi threading inside threads in c program I am debugging a c code which creates 3 threads.These 3 threads wait(using pthread_cond_wait) and when my program signals them(using pthread_cond_signal) they create 4 threads each. Now when these 4 threads starts running, a segmentation fault occurs.
my gdb output:
[New Thread 0x7fffd57fa700 (LWP 707)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd77fe700 (LWP 701)]
0x00007ffff79b591f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

(gdb) info threads
  Id   Target Id         Frame

  18   Thread 0x7fffd57fa700 (LWP 707) "scan_mt_skip_de" 0x00007ffff79b80db in __lll_lock_wait_private () from /usr/lib/libpthread.so.0

  17   Thread 0x7fffd5ffb700 (LWP 704) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  16   Thread 0x7fffd67fc700 (LWP 703) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  15   Thread 0x7fffd6ffd700 (LWP 702) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

* 14   Thread 0x7fffd77fe700 (LWP 701) "scan_mt_skip_de" 0x00007ffff79b591f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  13   Thread 0x7fffd7fff700 (LWP 578) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  12   Thread 0x7fffe0e6f700 (LWP 577) "scan_mt_skip_de" 0x00007ffff62aed37 in mprotect () from /usr/lib/libc.so.6

  11   Thread 0x7fffe1b21700 (LWP 576) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  10   Thread 0x7fffe2c84700 (LWP 574) "scan_mt_skip_de" 0x00007ffff79b83ed in read () from /usr/lib/libpthread.so.0

  9    Thread 0x7ffff157b700 (LWP 32268) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  8    Thread 0x7ffff1d7c700 (LWP 32265) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  7    Thread 0x7ffff257d700 (LWP 32244) "scan_mt_skip_de" 0x00007ffff62a9fad in poll () from /usr/lib/libc.so.6

  6    Thread 0x7ffff2d7e700 (LWP 32233) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  5    Thread 0x7ffff357f700 (LWP 32231) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  4    Thread 0x7ffff41c3700 (LWP 32229) "scan_mt_skip_de" 0x00007ffff62a9fad in poll () from /usr/lib/libc.so.6

  3    Thread 0x7ffff49c4700 (LWP 32228) "scan_mt_skip_de" 0x00007ffff79b5954 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  2    Thread 0x7ffff51e6700 (LWP 32227) "scan_mt_skip_de" 0x00007ffff79b5d01 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

  1    Thread 0x7ffff7fe1780 (LWP 32223) "scan_mt_skip_de" 0x00007ffff62f9833 in __memcpy_ssse3 () from /usr/lib/libc.so.6

(gdb) bt

0  0x00007ffff79b591f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0

1  0x000000000040385d in myDmtxDecodeThread ()

2  0x00007ffff79b1e0f in start_thread () from /usr/lib/libpthread.so.0

3  0x00007ffff62b2efd in clone () from /usr/lib/libc.so.6

In my code, when I create 3 threads, I lock a mutex variable and then wait. But in each 4 threads, I just use a mutex variable and wait on it.
Part of the code:
in 3 threads:
{
    pthread_mutex_lock(tdata-> wait_mutex);
    pthread_cond_wait(tdata-> wait_cv, tdata-> wait_mutex);
}

in 4 threads:
{
    pthread_cond_wait(thdata->wait_cv_th,thdata->wait_mutex_th);
}

A:
But, in each 4 threads, I just use a mutex variable and wait on it.

Well, this is wrong. You must lock the mutex before waiting (which will release lock while waiting on conditional, then acquire it again before returning from wait, blocking if it is locked by somebody else). And, since pthread_cond_wait() returns with mutex locked, you must also unlock it.


text:
Q: Android remove onInterceptTouchEvent when tapping Hello right now I'm developing a custom view where there'll be 2 listview that the header can be stacked each other like this picture :

               ||
               ||
               \/

I already succeed to create this view, by overriding overscrolled and intercept all touch and playing with the margin of the header contents. but the problem now is because I intercept all touch now I can't tap the content of the listview, I know the flow of the touch is from ACTION_DOWN -> ACTION_MOVE -> ACTION_UP, and then when I dispatch the event to the child the tap is working but the scroll isn't working at all.
So for now the flow for my view is like this onInterceptTouchEvent -> onTouch -> gestureListener (or with overscroll)
this is some part of my code
@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
    onTouchEvent(ev);
    return true;
}

@Override
    public boolean onTouch(View v, MotionEvent event) {
        topListViewHeight = lvFirstListView.getTotalHeight() - rlFirstHeader.getHeight();
        if(isBottomScrollable) {
            listGestureDetector.onTouchEvent(event);
            lvSecondListView.dispatchTouchEvent(event);
        } else {
            gestureDetector.onTouchEvent(event);
        }
        return true;
    }

Is there anybody here have an idea about this? Any suggestion is very appreciated and if you need more question about this question please ask me.
Thanks before


text:
Q: No Input File Specified with Nested Docroot I have the following nginx config for 2 different domains:
server {
    listen 80;

    root /srv/users/serverpilot/apps/myapp/public;
    index index.php index.html index.htm;

    server_name domain.com www.domain.com;

    location / {
            try_files $uri $uri/ @route;
    }

    location @route {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

I'm on a DigitalOcean Ubuntu 14.04 x64 droplet using ServerPilot as my control panel.
The default docroot for ServerPilot apps is:
/srv/users/serverpilot/apps/APPNAME/public

On one domain, where I'm using the default docroot, this nginx config works fine, but on the other app, my actual document root is:
/srv/users/serverpilot/apps/myapp/public/public

On this I've changed the root directive as appropriate, but all I get is the No input file specified. error.
I've checked permissions, checked my pool permission, and checked that the file exists.
Any ideas or help would be appreciated.
UPDATE
Changed the config to this:
server {
    listen 80;

    root /srv/users/serverpilot/apps/myapp/public;
    index index.php index.html index.htm;

    server_name my.domain.com;

    location / {
        rewrite ^/$ /public/ break;
        rewrite ^(.*)$ /public/$1 break;
    }

    location ~ .*\.(ico|gif|jpg|jpeg|png) { }

    location /public {
        rewrite ^/(.*)/$ /$1 redirect;
        if (!-e $request_filename){
            rewrite ^/([^?]*) /index.php?_route_=$1 break;
        }
    }

    location ~ \.php$ {
            try_files $uri $uri/ /index.php =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}

And now I'm getting my index.php as expected, but no css, js, or images, and clicking links takes me to a 404.
So I'm getting close but still missing something.
UPDATE
From error log I can see why routes are failing. Routes are being requested with an additional trailing slash here:
2015/04/29 11:16:06 [error] 9796#0: *7 open()
"/srv/users/serverpilot/apps/myapp/public/public//common/css&css=50d5d2cdd10873f535b8f87c3c65e908"
failed (2: No such file or directory), client: 127.0.0.1,
server: my.domain.com, request: "GET /common/css&css=50d5d2cdd10873f535b8f87c3c65e908 HTTP/1.1",
host: "my.domain.com",
referrer: "http://my.domain.com/"

And for images, they aren't being routed through the public/ directory:
2015/04/29 11:16:06 [error] 9796#0:
*11 open() "/srv/users/serverpilot/apps/myapp/public/image/cache/data/blog/post/landscape-b-40x30h.jpg"
failed (2: No such file or directory), client: 127.0.0.1,
server: my.domain.com, request: "GET /image/cache/data/blog/post/landscape-b-40x30h.jpg HTTP/1.1",
host: "my.domain.com", referrer: "http://my.domain.com/"

UPDATE:
After tons of research and looking at other server blocks for different apps I've come up with this, but it's still missing something.
upstream backend {
    server unix:/srv/users/serverpilot/run/myapp.php-fpm.sock;
}

server {
    listen 80;

    root /srv/users/serverpilot/apps/myapp/public;
    index index.php index.html index.htm;

    server_name my.domain.com;

    access_log /srv/users/serverpilot/log/myapp/myapp_nginx.access.log;
    error_log  /srv/users/serverpilot/log/myapp/myapp_nginx.error.log;

    location /public {
        try_files $uri $uri/ /public/index.php?_route_=$args;
    }

    location / {
        rewrite ^(.*)$ /public/$1;
    }

    location ~ \.php$ {
        include fastcgi.conf;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_pass backend;
    }
}

The only problem left is that every php page returns the home page.
Links work in that clicking them changes the dom history, but the same page loads for each request.

A: upstream myapp {
    server unix:/srv/users/serverpilot/run/myapp.php-fpm.sock;
}

server {
    listen 80;
    server_name my.domain.com;

    root /srv/users/serverpilot/apps/myapp/public;
    index index.php index.html index.htm;

    access_log /srv/users/serverpilot/log/myapp/myapp_nginx.access.log;
    error_log  /srv/users/serverpilot/log/myapp/myapp_nginx.error.log;

    location /asset {
        rewrite ^/asset/(.*)$ /public/asset/$1 break;
    }

    location /image {
        rewrite ^/image/(.*)$ /public/image/$1 break;
    }

    location / {
        try_files $uri $uri/ @front;
    }

    location @front {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

    location ~ \.php$ {
        include fastcgi.conf;
        fastcgi_pass myapp;
    }
}

Thanks for nothing.


text:
Q: SASS/SCSS sourcemap on sharepoint framework webpack Is there any way load the sass/scss file as the sourceMap in dev mode? I understand that sharepoint framework is using webpack which transpiles all sass/scss files into css then render it within the <style> element. However it becomes a bit painful if the project gets bigger and when I will need to locate a certain rule.
I have had a look around on some articles:
https://ihaveabackup.net/article/sass-with-sourcemaps-webpack-and-live-reload
And tried to apply the suggested changes as follows, but it still referencing the css to  instead of the scss file.
build.configureWebpack.mergeConfig({
  additionalConfiguration: (generatedConfiguration) => {
    generatedConfiguration.module.loaders.push(
        [{
          test: /\.scss$/,
          loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
        }]
    );
    return generatedConfiguration;
  }
});


text:
Q: Gridpanel lost filter while paging I have a jsonStore bound to gridpanel with paging toolbar and some custom filter. But everytime when I use paging all filtersettings get lost. How can I keep them?

A: You have to apply them to the Store along with the paging params. Otherwise the store doesn't know about these params and they get lost.


text:
Q: Marker out of canvas TomTom You can have a look at this IMG to understand quickly the issue:
Example IMG
This appens when you drag with mouse on the map. Thanks

A: You should probably add style to the marker:
#marker {
    position: absolute;
    top: 0;
    left: 0;
    background-image: your-marker-icon-here.svg;
    background-size: cover;
    width: 50px;
    height: 50px;
}

A: I found an answer:
Don't forget to import style.css.
In react it's import '@tomtom-international/web-sdk-maps/dist/maps.css'
More information here: https://developer.tomtom.com/maps-sdk-web-js/documentation


text:
Q: Printing object gives different value than printing a property of that object I've got a strange situation in my typescript file where these two console.info calls show separate values for overage:
this.rows[index].overage = 17;
console.info(this.rows[index].overage);
console.info(this.rows[index]);

The first printout shows the expected value of 17.  The second, where the whole object is displayed, show the old value of 90 for overage.  How is that possible?
Rows is defined like so:
rows: UsageDisplayData[];

export interface UsageDisplayData {
    id: number;
    overage: number;
    // A bunch of other properties
}

A: It's hard to say without an MVCE exactly what is happening, but the expanded view in the dev console is usually a "live" view and thus will show whatever the latest value is. Example:
let obj = { m: 17 };
console.info(obj.m);
console.info(obj);
obj.m = 90;


text:
Q: Wordpress search failed on special characters due to improper decode I am implementing the Wordpress search functionality.
When I search for text "Division's" (which is a text in one of the posts),
It returns "No results found"
Now to investigate further, I checked the core file:
wp-includes/query.php => function parse_search()
And found that the $term is received encoded as : Division\xe2\x80\x99s
Now this term is not decoded properly. And the final SQL statement formed is :
(((test_posts.post_title LIKE '%Division\xe2\x80\x99s%') OR (test_posts.post_content LIKE '%Division\xe2\x80\x99s%')))
So, I want to decode the special characters to succesfully search terms with special characters too.
Decoding methods like :

*

*$string = urldecode($string);

*$string = html_entity_decode($string);

*$string = rawurldecode ($string);

*$string = base64_decode($string);

*$string = utf8_decode($string);

Did not work.
Is there any plugin/hook/method that can help?
Example Provided:
Simple searchform.php file here:
if (!defined('ABSPATH')) exit(0);

global $wp_query;

$search_query = get_search_query();
$error = get_query_var('error'); ?>

<form role="search" method="get" class="search-form form-inline" action="<?php echo esc_url(home_url('/')); ?>">
    <input id="mod-search-searchword" type="search" size="30" class="inputbox search-query search-field" placeholder="search products, content" value="<?php echo !empty($search_query) && empty($error) ? $search_query : ''; ?>" name="s" title="Search for:" />
    <input type="submit" class="button btn btn-primary" value="Search" />
</form>

Now if I type in characters like () they get urlencoded, and that same urlencoded string not populates into the text field with the percentages, etc.
If I do this:
$search_query = !empty($search_query) ? trim(sanitize_text_field(urldecode($search_query))) : '';

There is still a problem, but no longer a problem with the text input not having correct string, the problem becomes that there are no search results now.
How to fix this issue with Wordpress Search?
wp-config.php contains the following:
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

header.php contains the following:
<!DOCTYPE html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes"/>
        <meta name="HandheldFriendly" content="true" />
        <meta name="apple-mobile-web-app-capable" content="YES" />
        <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" type="image/vnd.microsoft.icon" />
        <title><?php wp_title(' - ', true, 'right'); ?></title>
        <?php wp_head(); ?>
    </head>

I have the following in my functions.php file:
function livchem_searchfilter($query) {

    global $search_query;

    if ($query->is_search && !is_admin()) {

        // check if length of query > 3 but < 200
        $search_query = trim(get_search_query());
        $search_length = strlen($search_query);

        if ($search_length < 3 || $search_length > 200)
        {
            $query->set('error', 'Search term must be a minimum of 3 characters and a maximum of 200 characters.');
            return $query;
        }
        else
        {
            $query->set('post_type', array('post', 'page', 'product'));
            $query->set('posts_per_page', 20);
        }
    }

    return $query;
}

add_filter('pre_get_posts','livchem_searchfilter');

So, I do have UTF-8 encoding as my charset afaik.  What is the problem, why is my search for: copper(i)/(ii) returning ?s=copper%2528i%2529%252F%2528ii%2529 in the URL?  And I should have 2 results found for this, but I get 0 results found.  Why?
And if I change the url to this:  ?s=copper(i)/(ii) I see my 2 results.  But why can't I get my results, and/or the url to be like this?  I could honestly care less on what the url structure is, but I do want my 2 results to be found when I type in:  copper(i)/(ii) into the search form, but currently it is not finding any results.

A: Ok, so you do have to decode the search query and here's how I have it working and works like a charm now!  This now returns the search results, but keeps the url encoded so no problems anywhere here.
function livchem_search_filter($s) {
    return urldecode($s);
}

add_filter('get_search_query', 'livchem_search_filter');
add_filter('the_search_query', 'livchem_search_filter');

function livchem_query_vars_search_filter($query)
{
    if ($query->is_search && !is_admin()) {
        $query->query_vars['s'] = urldecode($query->query_vars['s']);
    }

    return $query;
}
add_action('parse_query', 'livchem_query_vars_search_filter');

As a plus this also works well for path related searches now, so if I added the following to my .htaccess:
RewriteCond %{QUERY_STRING} s=(.*)
RewriteRule ^$ /search/%1? [R,L]

Searches would be structured like so:  /search/searchterm
And the query with special characters also now works.  what a pain in the neck this was to get working properly, for something that is part of the CMS.


text:
Q: x-editable refresh loading the data-source? <a class="javascript-file-set editable editable-click" data-name="jsFileId_<?=$i?>" data-value="0" data-pk="" data-source="/asset/getClientScriptAssets" data-type="select" href="#">Not Specified

I've integrated an uploader button with the x-editable popover, thus when the user uploads files they get appended to the list generated from the data source.
Unfortunately when calling the display callback the new <option> elements in the <select> list do not show up in the sourceData argument. A simple solution would be to simply reload the data source. How to do this without creating a new x-editable object? Thanks!

A: Looks like my solution is the sourceCache option.
Don't know how I missed it. You guys woulda had an easy 50 reputation, tisk.


text:
Q: Set name of PortType for Axis2 Web Service I'm creating an Axis2 Web Service with Eclipse and the WSO2 Development Tools. I export the Web Service as an ".aar" file, and that install it in WSO2 Application Server.
The WSDL is automatically generated and the name of the Porttype is always [ServiceName]PortType.
Is there a way to change the PortType while developing the WS to a custom name, or after I have deployed it? I know that I can set the PortType of a Jax-WS WebService with some parameters, but Jax-WS are not well suitable for my use case.
Thanks for your answers.

A: Yes.
It is possible to override the default port type naming convention by associating a WSDL file with your custom port names.

*

*Implement your Axis2 Service with Developer Studio.

*Once you are done with service implementation, right click on the Axis2 Service Project and select "Generate WSDL".
Then it will generate the WSDL file in the src/main/resources folder.

*Then you need to move (cut and paste) that generated WSDL file to the src/main/resoures/META-INF folder where your services.xml file exists.

*Then you can modify and update the portType elements of the WSDL file.

*Once you are done with the modification to the WSDL file, you need to open the services.xml file in the src/main/resoures/META-INF location and update the services.xml file with following parameter.

<service ...>
    <parameter name="useOriginalwsdl">true</parameter>
    .
    .
    .
</service>

Now you can export the service as an Axis2 Archive (aar file) using Developer Studio and deploy the generated Axis2 Service in the WSO2 App Server or any other suitable/compatible Web Service container.
Hope this helps!!
Thanks and Regards,
Harshana


text:
Q: Magazine/Journal Class Structure and/or Design pattern I have an xml document that holds all of our alumni magazines.
<Magazine>
  <Volumes>
    <Volume>
      <Issues>
        <Issue>
          <Sections>

              <Articles>

                  <Images>
                    <Image>
                    </Image>
                    ...
                  </Images>

                ...
              </Articles>

            ...
          </Sections>
        </Issue>
        ...
      </Issues>
    </Volume>
    ...
  </Volumes>
</Magazine>

I created a class for: Volume, Issue, Section, Article, and Image.
My question is:
Should I create a hierarchy of super- and sub-classes?
i.e. -- Image inherits Article inherits Section inherits Issue inherits Volume
Or
Do I leave them separate and use Generic Collections as properties of the parent class?
i.e. -- Volume.Issues, Issue.Sections, Section.Articles, Article.Images
Or
Something else that I am completely unaware of?

What are the pros/cons/deficiencies of these choices?
EDIT:
If I'm using an Issue object, I also need to know the Volume number and Volume Year, as well as the Article Titles in each Section.

A: You can use inheritance if all classes has common properties/methods if not the inheritance will be meaningless.
You can use Linq To XML to get all data you need from your xml document without mapping it to classes, or use Linq to Object after mapping

A: Inheritance sounds completely wrong for your case. It should only be used when there is a natural hierarchical relationship present between your domain classes. A classical example would be to have
-Employee
--Contractor
--Permanent

They will still all need names, addresses and similar methods like: hire(), fire(), pay().
In your case there is no relationship to inherit, and it's a classical example of why you should favour composition over inheritance.
A image is NOT an article, but an article HAS an image. This could be applied to your entire structure.
It's all about the 'has a' instead of 'is a'.

A: Exact answer is only when you will know how do you planning to use this data in your application, how data will be stored, how to be displayed etc.
Usually, article is a useful start-point class (similar to blog post etc.). You do not need Article inside Magazine (rather MagazineIssue)
    //search all articles in some Magazine issue
    public IList
 GetArticles(long ISBN, string issueNumber)
    {
        //implementation
    }

In some cases you also do not need Section class.
public class Article
{
    //can be immutable
    public MagazineIssueView Issue { get; set; }

    public string Author { get; set; }

    public IList
 Sections { get; set; }

    public IList<Image> GetAllArticleImages()
    {
        return Sections
            .SelectMany
(s => s.SectionContent)
            .Where(c => c is Image)
            .Cast<Image>()
            .ToList();
    }
}

public class MagazineIssueView
{
    public long ISBN { get; set; }

    //if you have internal Magazines list, it can be also internal MagazineId
    public string MagazineName { get; set; }

    public DateTime IssueDate { get; set; }

    public string IssueNumber { get; set; }
}

public class Section
{
    public string SectionTitle { get; set; }
    public int Order { get; set; }

    public IList<ContentBlock> SectionContent { get; set; }
}

public abstract class ContentBlock
{
}

public class Image: ContentBlock
{
}

public class Paragraph: ContentBlock
{
}


text:
Q: Remove Sink in Effect in Tabbar(Iphone Development) Is it possible to remove the sink-in effect in Tab-Bar?
I mean the button will be selected without a sink-in effect.

A: You can. To do so, subclass the UITabBarItem class and override the appropriate methods. See this answer for more.


text:
Q: Where would I find the payload with a Wix webhook? I have a couple Wix webhooks pointed to a couple routes on my server. The webhook is in fact hitting my routes, but I'm not seeing the payload anywhere. The documentation says it's in the form of a JWT sent in the body of the request. The body is empty though. Am I missing something?
Here is my route receiving the request:
router.post("/app-installed", (req, res) => {
  console.log("req.body: ", req.body);
  console.log("headers", req.headers);
  res.sendStatus(200);
});


text:
Q: How to avoid repatation of code in JQuery? Using JQuery is there away to shorten this code instead of repeating it for each new control?
//input control_1
    $("#control_1").click(function() {
            $("#control_1").addClass("CellInput");
            $("#control_1").removeClass("CellInput_");
        });

        $("#control_1").focusout(function() {
            $("#control_1").removeClass("CellInput");
            $("#control_1").addClass("CellInput_");
        });

//input control_2
    $("#control_2").click(function() {
            $("#control_2").addClass("CellInput");
            $("#control_2").removeClass("CellInput_");
        });

        $("#control_2").focusout(function() {
            $("#control_2").removeClass("CellInput");
            $("#control_2").addClass("CellInput_");
        });

//input control_3
    $("#control_3").click(function() {
            $("#control_3").addClass("CellInput");
            $("#control_3").removeClass("CellInput_");
        });

        $("#control_3").focusout(function() {
            $("#control_3").removeClass("CellInput");
            $("#control_3").addClass("CellInput_");
        });

I've tried to shorten it like below, but still not working or maybe I missed something..
$("#control_1 #control_2 #control_3").click(function() {
        $(this).addClass("CellInput");
        $(this).removeClass("CellInput_");
    });

    $("#control_1 #control_2 #control_3").focusout(function() {
        $(this).removeClass("CellInput");
        $(this).addClass("CellInput_");
    });

A: You'll want
$("#control_1,#control_2,#control_3")

since $("#control_1 #control_2 #control_3") would match a control_3 element within a control_2 element within a control_1 element.

A: $("#control_1, #control_2, #control_3").click(function() {
  $(this).toggleClass("CellInput");
});

$("#control_1, #control_2, #control_3").focusout(function() {
    $(this).toggleClass("CellInput");
});

A: Regarding AKX answer you can even make it shorter if there are more than 3 elements:
$('[id^=control_]').click({
//blah
})

this selects all elements which their ID starts with control_


text:
Q: Checkbox in gridview control I am using gridview to display labels, checkboxes, dropdown lists and textboxes
(see image)
i would like that some fields are hidden when the checkbox is unchecked and as soon as i check it, those hidden fields appear.(the fields to be hidden are the reason and the comments)
normally i assume i would use selectedindexchanged but since this is in a gridview i am not sure what i should do

Thanks

A: Make use of OnCheckedChanged of check box
protected void chkbox_OnCheckedChanged(object sender, EventArgs e)
{
      int selRowIndex = ((GridViewRow)(((CheckBox)sender).Parent.Parent)).RowIndex;
      CheckBox cb = (CheckBox)gridView.Rows[selRowIndex].FindControl("chkbox");

      if (cb.Checked)
      {
             // Find other control using FindControl and check the
      }
}


text:
Q: Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. ( Typescript ) Как правильно написать функцию getColors на Typescript ?

export interface Palette {
    100?: string
    200?: string
    300?: string
    400?: string
    500?: string
    600?: string
    700?: string
    800?: string
    900?: string
}

export interface Colors {
    white: string
    black: string
    text: Palette
}

export const colors: Colors = {
    white: '#fff',
    black: '#000',

    text: {
        100: '#f6f6f6',
        200: '#eeeeee',
        300: '#c8c8cc',
        400: '#b3b3bb',
        500: '#8d929a',
        600: '#8a8e94',
        700: '#6b6e74',
        800: '#525252',
        900: '#1a1a1a'
    }
}

type S =
    | 'text'
    | 'white'
    | 'black'

type E = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900

export const getColor = (type: S, number: E): string => {
    if (!number && (type === 'white' || type === 'black')) {
        return colors[type]
    }
    if (number && type) {
        return colors[type]
    }
    return ''
}


text:
Q: why does the font appear so differently? (in web and photoshop) i've actually never encounter this problem before. I usually start designing my layout in photoshop then transfer it to my page.
Somehow, lately i've been using georgia font alot, and i love it when the style is italic, but what comes out in photoshop does not reflect back in the webpage when i set it in css.

in the pic above, 1. is what i saw in photoshop and what i wanted, but 2. is what i got, no matter what i try changing, be it font-weight or font-size it remains as bold. I want it thinner, is there a way? I tried font-stretch too btw.

A: It's not the bold, it is a system font smoothing.
You are able to change (or disable as in your case) font smoothing in Photoshop, but you can't do it with CSS, unless you are using CSS3 and compatible browser.
Added: I wouldn't recommend you to even try to change the font smoothing. That's the user right - to have fonts rendered the way she likes.


text:
Q: Custom powershell cmdlets do not support multi-threading? In the code blocks below, I'm trying to run Get-MyCmdlet in 3 separate threads, each of which opens a google page if the Get-MyCmdlet did not give anything.
The Get-MyCmdlet is fairly simple, the only thing it does is WriteObject("hello world"); (defined in the c# code).
However the script always opens up a google page, unless I change the Get-MyCmdlet to Get-Host(which is a system default cmdlet).
Is it because the custom cmdlets are not supporting multi-threading? Any help will be greatly appreciated!
The cmdlet:
[Cmdlet(VerbsCommon.Get, "MyCmdlet ")]
public class GetMyCmdlet  : Cmdlet
{
    protected override void ProcessRecord()
    {
         WriteObject("hello world");
    }
}

the script:
$ScriptBlock = {

        $result = Get-MyCmdlet

        if (!$result) {[System.Diagnostics.Process]::Start("http://www.google.com")}

        $name = ($result | get-member)[-1].name
        $result = $result.$name
        return $result
}

....
$threads = 3
    for ($i = 0; $i -lt $threads) {

        $running = @($jobs | Where-Object {$_.State -match 'Running'})

        Write-Host $running.length
        if ($running.length -lt $threads) {

            $jobs += Start-job -ScriptBlock $ScriptBlock

            $i = $i + 1

        } else {
            get-job | receive-job
            $finished = @($jobs | Where-Object ($_.State -match 'Completed'))

            if ($finished) {
                $finished.getType()
                foreach($job in $finished) {
                    Receive-Job -keep $job | Out-File "Output$.txt"
                    $i = $i + 1
                    $finished.Remove($job)
                    Remove-Job -job $job
                }
            }
        }
    }

A: No custom cmdlets are not the problem. My guess is the problem is that calling Get-MyCmdlet fails with an error so $result is not set and thanks to your if the browser is started. If you would check the results of your jobs you would see an error message. You probably need to make sure the job initializes right so you can call your cmdlet. You could use the -InitializationScript parameter of Start-Job to import your module for the job. See here, here and here for more information.


text:
Q: jQuery file upload multiple instances error I've done file upload with jquery file upload plugin (https://github.com/blueimp/jQuery-File-Upload). But now, I'm don't know how to solve this problem: I have HTML code like this:
<form id="form-1"></form>
<input type="file" class="file-upload" id="file-1" name="file" form="form-1" />
<form id="form-2"></form>
<input type="file" class="file-upload" id="file-2" name="file" form="form-2" />

    $('input[type="file"][name="file"].file-upload').each(function(){
            var self = $(this);
            $(this).fileupload({
                url: window.fileUpload.uploadUrl,
                dataType: 'json',
                dropZone: self,
                fileInput: self
            });
});

But there is problem, when I drop file over first input, it upload file 2 times - for each input. And I don't know, how to solve this problem. Do you have any solution?
EDIT:
I find out, upload is done just once, but two times is called "fileuploaddone" event.
SOLVED:
jQuery file upload instance was initiated for two times over one file input.

A: This is because you don't import jquery min-js file and write your code properly under the <script type="text/javascript">your code here</script>