text:
Q: Existence of function [also asked here:http://mathoverflow.net/questions/122191/existence-of-a-function]
All arguments are in $\mathbb{R}^3$.
Suppose $n(x)$ is a smooth function where $\mathbf{supp}(n(x)-1)$ is a compact set $\Omega$. i.e. $n(x) = 1$ when $x$ is outside $\Omega$.
Assume there are some points $x_j\in\Omega$, where $j=1,2,\cdots.m$.
Consider Helmholtz equation
$\Delta u + k^2 n(x) u = 0$
And I want to know if there is a complex-valued function $u:\mathbb{R}^3\rightarrow\mathbb{C}$ satisfies the equation and also vanishes at $x_j$. i.e. $u(x_j) = 0$. [Certainly $u$ $\text{can have more zeros}$ than $x_j$]
Here you may try to give a method to construct $u$, or prove the existence.
And you may take $m=1$ here.
Thanks.

[UPDATE]. Here is a case that this function can exist with some freedom to choose the points.
If we assume the points are on $xy$ plane, i.e. with the corrdinate $(x,y,0)$ in $\mathbb{R}^3$, and $n=1$ as a constant.
Then for $x_j = (a_j,b_j,0)$ in $\mathbb{R}^3$,
we construct function
$\phi(x,y) = \prod_{i=1}^m(x+iy -a_j-ib_j)$
thus $\Delta \phi = 0$, since it is analytic.
My function $u(x,y,z) = \phi(x,y)e^{-ikz}$ satisfies that $u(x_j) = 0$, and satisfies Helmholtz equation.
What I am still thinking about is, can I choose the points randomly, or the points should satisfy some condition?

[UPDATE] For $n(x)$ is not a constant. I have found a way to construct the function for the case that $x_j$ sits on the $xy$ plane.
Take the form of solution as $u(x,y,z) = \phi(x,y)e^{-ik\rho(x,y,z)}$, then
$\rho:\mathbb{R}^3\rightarrow\mathbb{C}$ satisfies that
$\Delta \rho + 2\dfrac{\nabla\phi}{\phi}\cdot \nabla\rho + ik(n(x)-\nabla\rho\cdot\nabla\rho) = 0$
Here we cannot say the existence is assured by PDE theories, since $\dfrac{\nabla\phi}{\phi}$ is unbounded, we shall either have $\dfrac{\nabla\phi}{\phi}\cdot \nabla\rho=0$ or $\nabla\rho(x_j) =0$.
I have found a way to construct $\rho$ to saitisfy this, but I still want to know if there is a function such that can have zeros randomly. My example requires the points are  on the same plane.

[UPDATE] I have come up with an easier proof. We can prove the existence by induction. The only thing we have to ensure is the $\nabla u\neq\mathbf{0}$ in $\Omega$.

A: I have given a proof here. In the existence chapter.


text:
Q: Unable to build in AMD-GPU kernel module: This feature depends on another which has been configured as a module I am trying to build-in the AMD-GPU kernel module to my custom kernel. However, I am only able to build it as a module. When I press y in order to build it a text box appears that reads:
  This feature depends on another which has been configured as a module. As a result, this feature will be built as a module.
My question is, what kernel modules does the AMD-GPU module depend on so that I can build it into the kernel?
Apologies for my wording and formatting, and thanks for the help.

A: if you type modinfo amdgpu modinfo gives you all the info about the kernel object.
AMDGPU depends:  drm,drm_kms_helper,ttm,i2c-algo-bit

redpajama_set_name: RedPajamaStackExchange


text:
Q: What does "%Type" mean in Oracle sql? I'm getting my first experience with Oracle and TOAD (I know SSMS). I came across this "%Type" next to an input parameter in an update procedure and I have no idea what it is or what it means. I found links on Google related to "%Rowtype". Is the same thing or something entirely different?
If this is vague, I apologize. As always, thanks for the help.

A: Oracle (and PostgreSQL) have:

*

*%TYPE

*%ROWTYPE

%TYPE
%TYPE is used to declare variables with relation to the data type of a column in an existing table:
DECLARE v_id ORDERS.ORDER_ID%TYPE

The benefit here is that if the data type changes, the variable data type stays in sync.
Reference: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/fundamentals.htm#i6080
%ROWTYPE
This is used in cursors to declare a single variable to contain a single record from the resultset of a cursor or table without needing to specify individual variables (and their data types).  Ex:
DECLARE
  CURSOR c1 IS
     SELECT last_name, salary, hire_date, job_id
       FROM employees
      WHERE employee_id = 120;

  -- declare record variable that represents a row fetched from the employees table
  employee_rec c1%ROWTYPE;

BEGIN
 -- open the explicit cursor and use it to fetch data into employee_rec
 OPEN c1;
 FETCH c1 INTO employee_rec;
 DBMS_OUTPUT.PUT_LINE('Employee name: ' || employee_rec.last_name);
END;
/

A: Apart from the purpose pointed by OMG Ponies, %TYPE is also used for inheriting the same data type used by a previously declared variable.
The syntax is :
 DECLARE
            L_num NUMBER(5,2) NOT NULL default 3.21;
            L_num_Test L_num%TYPE := 1.123;

So there is no need to declare the data type for the second variable i.e L_num_Test.
Comment if anyone needs further clarification regarding this topic.
Reference: https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/fundamentals.htm#BEIIGBBF

A: %Type with its use :

*

*%Type datatype is use to define the variable as column name datatype for specified table.

*Lets take a small example of customer table where Customer_name datatype is varchar2(30). If you give the %type then the specified column or variable will take the datatype as varchar2(30).

*Low to define this? vCustomerName Customer.Customer_Name%TYPE; In the above define statement the datatype of Customer_Name will be assign to the variable named vCustomerName.
Real life example : If you want to create a simple PL SQL block to check the assignment for the datatype from direct table. PL SQL block :

A: some example
set serveroutput on
DECLARE
  var1  table_a.id%TYPE;
  var2  table_a.value%TYPE;
  var3_row table_a%ROWTYPE;
BEGIN
  SELECT id,value
    INTO var1, var2
    FROM table_a
  WHERE id= 8 AND ROWNUM<=1;

  SELECT id+100,value INTO var3_row from table_A where rownum=1;

  INSERT INTO table_a VALUES var3_row;

  dbms_output.put_line('this is a test');
  dbms_output.put_line(var1);
  dbms_output.put_line(var2);
  NULL;  -- do something useful here
EXCEPTION
  WHEN NO_DATA_FOUND THEN
    NULL;  -- do something appropriate here
  WHEN TOO_MANY_ROWS THEN
    NULL;  -- do something appropriate here
END;
/


text:
Q: Kotlin DSL scope control on external non-changeable classes (similar to @DslMarker) I have lots of external classes (generated externally; not under my control), which do not come with a builder and which are rather cumbersome to create. However using apply it is rather easy to build them, e.g.:
SomeOfTheObjects().apply {
  someProperty = SomeOtherComplexObject().apply {
    someOtherProperty = "..."
  }
}

Now I like the way it works with the receiver, but I would like to prevent that I can set someProperty within SomeOtherComplexObject. If the classes were under my control, it would suffice to put a @DslMarker on that class, but as they aren't, the only other way that came to my mind, was to use also instead without renaming the parameter, e.g.:
SomeOfTheObjects().also {
  it.someProperty = SomeOtherComplexObject().also {
    it.someOtherProperty = "..."
    //it.someProperty will not work if SomeOtherComplexObject has no such property
  }
}

While it works, it now has tons of it. in the code and I was wondering, whether it is possible to have some similar behaviour as with the @DslMarker in place.
What I tried is a mixture of the following:
@DslMarker
annotation class DemoMarker

@DemoMarker
inline fun <T> T.build(@DemoMarker builder : T.() -> Unit) = this.apply(builder)

"mixture", because I ended up putting the annotation everywhere, but this doesn't have any effect. If I put it on a class it works as expected. Did I miss something and it is actually possible somehow? Or does anyone have an appropriate workaround for this, besides using also?

A: For third party classes you can use the DslMarker annotation on receiver types as explained here.
@DslMarker
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
annotation class TestDsl

fun build1(builder: (@TestDsl DslReceiver1).() -> Unit) {}


text:
Q: "Could not find package with version stability=dev." Using Satis private repo I have a satis private repo set up on the url http://packages.ex/, which, when I visit it, lists two packages: example/admin and example/codebase
When I run composer create-project example/codebase new-site --repository-url=http://packages.ex stability=dev I get the error:
[InvalidArgumentException]
Could not find package example/codebase with version stability=dev.

The composer.json inside example/codebase looks like this:
{
    "name": "example/codebase",
    "description": "Example codebase.",
    "keywords": ["codebase", "example"],
    "homepage": "http://www.exampple.com",
    "version": "0.1",
    "repositories": [ { "type": "composer", "url": "http://packages.ex/" } ],
    "authors": [
        {
            "name": "Example",
            "email": "example@example.com"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "ext-mcrypt": "*",
        "laravel/framework": "4.1.*",
        "way/generators": "dev-master",
        "example/admin": "dev-master"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"
}

I don't know why composer can't find the package as when I visit the private repo in a browser it's there, and I'm specifying 'minimum-stability': 'dev' in composer.json.
Maybe I'm missing something or doing something wrong. Any ideas?
Is there any way to run a command line check to see if composer can access a particular package and what stabilities it has?

A: Looks like you have an error or typo in your repository-url parameter and composer try to find package on default packagist.org repo.


text:
Q: Is I-nex temp reading accurate I got I-nex and I was wondering if the cpu temperature is accurate. I have a fx-4150 and wanted to do a slight overclock. My computer is pretty much idle with only I-nex open. It says my cpu temp is about 2c. Is that ok and if I overclock is the temperature reading accurate? Also at the most it went to 10c, sometimes 5c.

A: It depends. If you have a water cooling setup such low temperatures are possible if you´re air cooling than your telemetric data is definitely incorrect. The best thing is to check your BIOS data: if it´s displaying +/- 10 °C you can go on. The measured temperature also depends on your sensor location. A thermometer inside the CPU can measure 60 °C while at the same time a thermometer at a different spot inside the CPU could only measure 30 °C.
For an AMD fx-4150 a temperature of 70 °C is definitely fine and for a short period of time it also can handle up to 95 °C but try to avoid very hight temperatures. Last but not least I highly recommend you to set up some kind of 'automatic emergency kill switch' inside your BIOS making it that if your CPU temperature reaches hight levels the BIOS automatically lowers the CPU frequency.


text:
Q: Using jQuery UI switchClass method to change class of 13 elements at once? I have 13 different elements with the following class on all of these elements defined candidate
Now I also have 13 different classes for these same elements defined as well, such as follows:
can1, can2, can3, can4, can5, can6, can7, can8, can9, can10, can11, can12, can13
I need to switch each elements class SIMULTANEOUSLY at the same time once every 5 seconds or so, but keep the candidate class defined on all of them, just need to change the can classes.  And I need to change the classes so that they decrement by 1 every 5 seconds, except when can1 is defined, it will switch to can13 instead.  So...
can1 becomes can13
can2 becomes can1
can3 becomes can2
and so on... all the way to can13 becomming can12
And during the class change, it needs to animate to that class as well, so I'm thinking I need switchClass to accomplish this.  But what's the BEST and most productive way to do this exactly?
Could grab all elements in 1 go using:
$(".candidate").switchClass(... code);
But I now I'm screwed with getting the old class and changing to the new class, so how would I do that?
Also, I have defined a data-class on each element with the actual NUMBER that represents the can class.  So, if that element has a class of can1, than data-class has a value of 1, if that element has a class of can2, than data-class on that element has a value of 2, and so on...
How can I use this to my advantage and decrement the can classes last number value every 5 seconds?  So I noticed that the switchClass method can have a queue option set to false which is probably something that I want, but again, how to use it for this purpose??  And am wanting something like 500 ms for the animation of switchClass
Do I have to do a .each() on this?

A: It would be better if the classes ranged from 0 to 12 instead of 1 to 13.  This way you can easily use modular arithmetic.  If they have to be 1 to 13, simply do the addition after computing the modulus, i.e., nextClassId = (currentClassId % 13) + 1; (but that seems more confusing to me).
setInterval(function() {
   $('.candidate').each(function() {
        var $this = $(this),
            currentClassId =  Number($this.data('class')),
            nextClassId = (currentClassId + 1) % 13;
        $this.switchClass('can' + currentClassId, 'can' + nextClassId);
        $this.data('class', nextClassId);
   });
}, 5000);

Working fiddle, http://jsfiddle.net/7dYXh/


text:
Q: My bot program accepts user input and then instead of replying, does nothing I created a bot and used a snippet of code I invented called "simplify" to dramatically shorten java commands.
Only problem is, the bot program I made with it doesn't work. It's supposed to search the user input for keywords and reply accordingly, but all it really does is accept user input and then turn off. What did I do wrong?
import java.util.*;
    public class bot{
        //"simplify" and "bot" created by @genisome, All rights reserved.
    System.out.println(in);

}

public static void print(String in){

System.out.println(in);

}

public static void print(double in){

System.out.println(in);

}

public static void print(long in){

System.out.println(in);

}

public static void print(boolean in){

System.out.println(in);

}

public static void print(float in){

System.out.println(in);

}

//scan below

public static void scan(int dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.nextInt();

}

public static void scan(String dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.next();

}

public static void scan(double dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.nextDouble();

}

public static void scan(float dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.nextFloat();

}

public static void scan(boolean dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.nextBoolean();

}

public static void random(int min, int max, int dumpinto){
    Random x = new Random();
    dumpinto = x.nextInt(max) + min;
}

public static void main (String[] x){
int score;
String[] badcomputerresponse = {"that sucks, sorry", "sorry about that", "bummer", "shit", "aw, damn"};
String[] goodcomputerresponse = {"awesome.", "me too", "great", "cool", "I'm not bad myself"};
String[] goodwords = {"good", "fine", "dandy", "awesome", "cool", "swell", "great", "amazing", "ok", "okay", "well", "happy", "thrilled"};
String[] badwords = {"shitty", "terrible", "sad", "bad", "crappy", "terrible", "sucky", "up shit creek", "pathetic", "miserable", "badly", "terribly", "miserably"};
String input = "";
print("Hey there, how are you doing?");
scan(input);
for (int counter = 0; counter < goodwords.length; counter++){
    if (input.contains(goodwords[counter])){
        if (input.contains("not")){
            sadanswer(badcomputerresponse);
        }
        else{
            happyanswer(goodcomputerresponse);
    }
}
}
for (int count2 = 0; count2 < badwords.length; count2++){
    if (input.contains(badwords[count2])){
        if (input.contains("not")){
            happyanswer(goodcomputerresponse);
        }
        else{
            sadanswer(badcomputerresponse);
    }
}
}
}
public static void sadanswer(String[] badcomputerresponse){
    int randomanswer = 0;
    random(0, badcomputerresponse.length, randomanswer);
    print(badcomputerresponse[randomanswer]);
}

public static void happyanswer(String[] goodcomputerresponse){
    int randomanswer = 0;
    random(0, goodcomputerresponse.length, randomanswer);
    print(goodcomputerresponse[randomanswer]);
}
}

edit: thank you people who gave me help instead of downvoting me.
To the people who downvoted me, you stink!

A: First you define a bunch of scan methods like this:
public static void scan(String dumpinto){

Scanner x = new Scanner(System.in);

dumpinto = x.next();

}

Then you call it like this:
String input = "";
print("Hey there, how are you doing?");
scan(input);

That function does not do what it looks like it does. String dumpinto is an input parameter to the method. You can't write output to it. Once the method is done executing, the value that you typed in is lost. After you call scan(input);, the input variable still contains "". (Print it out or use a debugger to verify.)
Your scan method needs to return a value. Better yet, get rid of those methods altogether and just use one Scanner object to get input from the user.


text:
Q: Nuget package updated in a referenced project but still shows the old one I have a project A in visual studio which references another project B in the same solution.
The project B has a nuget package reference of another project C. I make some changes to project C and rebuild a pre-release nuget version of C and update the nuget package reference in B project. The project B properly shows the updated nuget version.
But, the project B showing up under Project References in A still shows the old nuget package version. I deleted and re-added the project reference B but without any success.
What I need to do to have updated nuget package in the project B under A?

A:
When I update Project C from 2.0.0 into 3.0.0-beta1, Project A and Project B are all the same version.
So for your issue, please try to delete bin and obj folder of Project A and Project B.
Update
The issue is that Project A also has a nuget reference of previous Project C which leads it always shows the old version of Project C.


text:
Q: Passing extra values to intents via deeplinks in Android in order for myapp://wallet to point to WalletActivity I wrote the below code, and it worked:
    <activity
        android:name=".ui.WalletActivity"
        android:label="@string/title_activity_wallet"
        android:screenOrientation="portrait"
        android:theme="@style/MaterialThemeNoActionBar"
        android:launchMode="singleTop"
        android:exported="true">
        <intent-filter android:label="@string/title_activity_link_wallet" >
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="myapp"
                android:host="wallet" />
        </intent-filter>
    </activity>

I do a similar thing for UserProfileActivity but it crashes (obviously) inside the function onCreate in the line: String id = intent.getExtras().getString("id"); because I am not sending any value for id to that activity's intent.
So, is there a way for me to pass the id to the intent of the called activity in this case, which I would have done in normal cases using intent.putExtra("id", id); in the calling activity (where intent is of the called activity)

A: String id = intent.getExtras().getString("id") for the deeplink is wrong.
You can retrieve the Uri associated with the Intent using
Uri uri = getIntent().getData();

you can then using one of the getter available to retrieve your id, if you provide one. E.g. myapp://wallet/test?id=100
String id = data.getQueryParameter("id");

should give you 100


text:
Q: Metric spaces and ultrafilters Assume $X_n$ are proper metric spaces and $X$ is a compact metric space.
Fix an non-principal ultrafilter $\omega$ on $\mathbb{N}$.
Assume we have a metric space $\mathbb{X}$ such that:
(1) $\mathbb{X}=X\coprod X_1\coprod X_2\coprod...$
(2) For each $j=1,2,3,...$ the canonical injection $i_j:X_j\rightarrow \mathbb{X}$ is distance preserving.
(3) The canonical injection $i:X\rightarrow \mathbb{X}$ is distance preserving.
(4) Each $X_1,X_2,...$, is open in $\mathbb{X}$.
(5) For each $x\in \mathbb{X}$, $dist(x,X_n)\rightarrow dist(x,X)$.
Let $x_1,x_2,....$ where $x_n\in X_n$. Why does it follow that the $\omega-limit$ of that sequence exists and is in $X$?
Comments:

*

*Clearly $(x_n)_n$ is in $\mathbb{X}$.

*It is not true that for large enough $n$, $x_n\in X$ (by disjointness).

*In compact metric space, the $\omega$-limit for any sequence in $X$ exists and is unique.

*Proper metric spaces are complete.

A: This is not true.  For a counterexample, consider $X_n=\mathbb{R}\times\{1/n\}$ and $X=[0,1]\times\{0\}$.  Give $\mathbb{X}$ the following metric: the distance between two points is the shortest path between them where you are allowed to move horizontally in $\mathbb{R}^2$ and vertically only within $[0,1]\times\mathbb{R}$.  So restricted to $[0,1]\times\mathbb{R}$ this is the $\ell^1$ metric, but for instance $d((2,1),(2,1/2))=5/2$ since you have to first move from $(2,1)$ to $(1,1)$ and then down to $(1,1/2)$ and then back out to $(2,1/2)$.  This satisfies all your assumptions, but the sequence $x_n=(2,1/n)$ has no accumulation point in $\mathbb{X}$.
To make this true you need to strengthen (5) to say that $X_n$ converges to $X$ with respect to the Hausdorff metric of $\mathbb{X}$.  With that assumption, for each $n$ we can pick a point $y_n\in X$ such that $d(x_n,y_n)\leq d_H(X_n,X)\to 0$ as $n\to\infty$.  By compactness of $X$, $(y_n)$ converges to some $x\in X$ with respect to $\omega$, and then it follows that $(x_n)$ converges to $x$ with respect to $\omega$ as well.


text:
Q: Is it possible to use persistent connections in rclone? I am trying to use rclone to upload millions of small files to a storage provider. Using the default settings (--transfers 4) works fine, but it's a waste of the server bandwidth.
Each file is approx 1-2KB. My bandwidth is ~50MBps.
I tried using --transfers 1000, which got me the following error from the provider:

Their support suggested making persistent connections, but I could not find such an option in rclone.
I looked at the tpslimit option (setting it to 1.6), but that would effectively cap me
at max 100 files per minute. I want to cap my connections, not the files transferred.
Is this something I can accomplish either with an rclone option or with a system tweak?

A: Create a Dropbox remote in rclone, create your own Dropbox ID and use this:
rclone sync /path/to/your/local/folder YourDropboxRemote: --dropbox-batch-mode async --transfers 64 --checkers=64 --fast-list --size-only --tpslimit 12 --tpslimit-burst 12 -Pv


text:
Q: Adding action links when posting Facebook Photos It's easy to include action links to items posted to the feed using Facebook's Graph API using the "actions" object, which appear along side "Comment" and "Like" below the feed post. Like:
"actions": [{"name":"Vote!","link":"http://voting.com/123/vote"}]

But, is it possible to include the same action links when posting Photos so the link will show up next to Comment and Like below a photo? I've tried the obvious (i.e. including the actions object on a photo post, which doesn't work) but wondering if anyone's found a workaround for this.

A: You can only add Action Links to things published on the user's timeline / wall. You cannot add action links to Photos, Notes, Events, etc.
If you post a photo to the user's wall (using FB.ui), you can add an action link to it, but if the user views the photo from the Wall Photos album, the Action Link will be hidden.
If you see the screenshots in the documentation, you will see that all instances of Action Links are on the Timeline / Wall.


text:
Q: Series Of Sines. I want to ask:How $ \hat{f}(0) + \sum_{n=1}^{\infty}2i\hat{f}(n)\sin(n\Theta)$ is a series of sines?
How can I deal with $$\hat{f}(0)?$$
Do anyone have an idea?

A: If the function is odd, then after substituting with $n =0$ in$$\hat{f}(0) =\frac{1}{2\pi} \int_{-\pi}^{\pi} f(t) e^{-int}dt$$ we get an integration over an odd function in a symmetric interval, which equals 0.


text:
Q: CheckBox are not working in ListItem rendered with Flatlist I am using ListItems with checkbox. Every Item in the list contain the checkBox. I am not able to check or unCheck the checkbox and also not able to select all the checkbox in the listItems. I have made both functions with 'checkBoxTest()' and 'selectAll()' I think i am not using the setState correctly. Here is my code
import React, { Component } from 'react';
import { FlatList, StyleSheet, Text, View, Image, TouchableOpacity } from 'react-native';
import { ListItem, checkBox } from 'react-native-elements';

const list = [
  {
    name: 'PinkMan',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
    subtitle: 'Vice President'
  },
  {
    name: 'Mr White',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
    subtitle: 'Vice Chairman'
  },
]

export default class Members extends Component {
  constructor(props) {
    super(props);
    this.state = {
      checked: false,

    }
  }
  selectAll(){
    this.setState({checked: !this.state.checked})
  }

  checkBoxTest() {
    this.setState({checked: !this.state.checked})
  }

  keyExtractor = (item, index) => index.toString()
  renderItem = ({ item }) => (
    <ListItem
      title={item.name}
      subtitle={item.subtitle}
      leftAvatar={{
        source: item.avatar_url && { uri: item.avatar_url },
        title: item.name[0]
      }}
      checkBox={{
        checkedColor: '#744DD2',
        uncheckedColor: 'grey',
        onPress: this.checkBoxTest,
        checked: this.state.checked,
      }}
      bottomDivider
    />
  )

  render() {
    return(
      <>
        <View style={{ bottom: 60 }}>
          <FlatList
            keyExtractor={this.keyExtractor}
            data={list}
            renderItem={this.renderItem}
          />
        </View>
        <View>
          <TouchableOpacity onPress={this.selectAll} >
            <Text style={styles.textStyle}>Select All</Text>
          </TouchableOpacity>
        </View>
      </>
    );
  }
}

A: Try passing extraData={this.state} to your FlatList component.
https://facebook.github.io/react-native/docs/flatlist#extradata
Edit:
You might want to just pass extraData={this.state.checked} instead. Your FlatList should only re-render when the checked state changes. Pass other props as needed.

A: seems like you forgot to bind this.selectAll() and checkBoxTest()
If you wanna pass a function to onPress(), First you need to bind it in constructor.
this.selectAll = this.selectAll.bind(this);
this.checkBoxTest = this.checkBoxTest.bind(this);

Place these two statements in constructor.


text:
Q: Звук при падении игрока Нужно что бы звук воспроизводился при падении игрока. При использовании этого кода:
private void OnCollisionEnter(Collision collision)
{
    foreach (var contact in collision.contacts)
    {
        var normal = contact.normal;
        if (IsGround(normal))
        {
            _normal = normal;
            scoreJumps = 0;
            if (_rb.velocity.y > -1)
            {
                AudioFall.Play();

            }
            Debug.Log(_rb.velocity.y);
            break;
        }
    }
}

private bool IsGround(Vector3 normal)
{
    if (normal.x > 0.5) return false;
    if (normal.z > 0.5) return false;
    if (normal.y < 0.1) return false;

    return true;
}

звук падения воспроизводится когда игрок ходит по земле. Я понимаю что при передвижение по неровной поверхности игрок может незаметно подлетать и из-за этого if (IsGround(normal)) становится истиной, а _rb.velocity.y становится больше -1. Но как сделать так что бы на земле звук не воспроизводился. Заранее спасибо за помощь.

A: Флаги делать, конечно, не самая лучшая идея, но и так сойдет.
private bool _grounded;

private IEnumerator TryFall(float fallTime)
{
    var startVelocity = _rb.velocity.y;
    while (fallTime > 0)
    {
        if (_rb.velocity.y > startVelocity) yield break;

        fallTime -= Time.deltaTime;

        if (fallTime <= 0)
        {
            _grounded = false;
            Debug.Log("FallStarted");
            yield break;
        }

        startVelocity = _rb.velocity.y;

        yield return new WaitForSeconds(Time.deltaTime);
    }
}

private void OnCollisionEnter(Collision collision)
{
    foreach (var contact in collision.contacts)
    {
        var normal = contact.normal;
        if (IsGround(normal))
        {
            _normal = normal;

            if (_grounded == false)
            {
                Debug.Log("Fall"); //Проиграть звук
                _grounded = true;
            }
            break;
        }
    }
}

private void OnCollisionExit(Collision collision)
{
    if (_grounded)
    {
        StartCoroutine(TryFall(1f)); // вместо 1f время, через которое должно начаться падение
    }
}

Для того, чтобы звук воспроизводился, достаточно изменить только OnCollisionEnter, но если нужно, чтобы персонаж считался падающим через какое-то время после начала падения, то OnCollisionExit тоже пригодится.
В OnCollisionEnter просто меняется флаг _grounded на true, соответственно в методе прыжка, если он есть, _grounded нужно менять на false, в этом и заключается проблема флагов.
При выходе из коллизии запускается корутина, которая ставит флаг _grounded в false, если пройдет определенное время fallTime (в секундах) после падения. Если это время не пройдет или скорость не станет ниже, то корутина отключится (надеюсь). Вообще, корутину желательно кэшировать, чтобы не запускать новую, если уже одна запущена.


text:
Q: mac os java connect to network drive I am currently using Mac Yosemite. I have to copy files from one folder to another folder on network drive. The code works fine in Windows 7, but the same code does not work in Mac. The files are on Windows Server.
So, with a bit of research online, I found that we can use Apache Commons VFS, FileManagerSystem to access network files / folders.
Is there anyone who can share code to that?
public class CopyFiles {

public static void main (String[] args){

    File source = new File ("smb://abcserver/TestFolder1/TestFile.xlsx");
    File dest = new File ("smb://abcserver/TestFolder2/TestFile_Mac.xlsx");

    try
    {
        FileUtils.copyFile(source, dest);
        System.out.println("File Copied");
    }
    catch(IOException ie)
    {
     ie.printStackTrace();
    }
  }
}


text:
Q: How i can make pattern in input type="tel" start with only "05"? Hi everyone as I said in the title How I can make pattern start with only "05", I want it to accept 05[any 8 number you can think of it]
I tried several ways but none of them work with me like
pattern=/ (05) \ d {9}/
pattern="[05]{1} [0-9]{9}"/
pattern="[05]{10}"/ (this one work but only with Any combination that contains 0 and 5)
pattern=/ (0) \/ (5) \ {8} /

A: Use start and end of string symbols, use {8}, not {9}:
pattern='/^05\d{8}$/'

Examples

I think your tries mostly does not work because you have whitespaces inside patter:
/ (05) \ d {9}/ - space, sequence 05, space, escaped literal space 9 times
pattern="[05]{1} [0-9]{9}"/ - no even valid HTML as / is outside quotes and does not have start/end delimiters
[05]{10} - any sequence of 0 or 5, 10 times. E.g. 0000000000
(0) / (5) \ {8} - space, 0, space, backslash, space, 5, escaped space 8 times


text:
Q: can TTURLMap from three20 map to a xib-file? ive made an app for the iphone and wanted to make it work on an ipad too.
for the navigation i used three20. all the views are viewcontrollers with xib´s.
for later developement, i just wanted to make the xibs in the bigger format as new skin and let the background-programm the same, so that in the end each viewcontroller would have 2 xib´s as skins.
so, three20´s URLMap can link to class-files. but how can i link to a xib ?
i wanted in the appdelegate to make the URLMap depending on the device, so that the programm it self can stay as is with its URL-Calls.

A: ok, now i used to overwrite the initWithNibName in combination with [UIDevice currentDevice].model to let the viewcontroller check, on which device he loads


text:
Q: How to use Playwright to interact with Metamask? I'd like to automate interactions with Metamask using Playwright and Python, but I don't understand exactly how the extension is controlled. When I open the browser the extension may or may not be configured. Each time the extension is requested, it opens a new page in the handler array.
How do I master the extension, load correctly, configure networks, open at the right time, know which handler is correct, approve or reject transactions and everything else?
Any full tutorial? Course? Book?

A: You can not interact with extensions in playwright. You could script windows tasks like clicking, waiting, pressing keys etc and run it with headfull browser mode.

A: You could use the dAppwright library, I leave you a small example of use:
# global-setup.ts

import dappwright, { MetaMaskWallet } from "@tenkeylabs/dappwright";
import playwright from 'playwright';

async function globalSetup(config: FullConfig) {
  const [metamask, page, context] = await dappwright.bootstrap("", {
    wallet: "metamask",
    version: MetaMaskWallet.recommendedVersion,
  });

  // Add Hardhet network
  await metamask.addNetwork({
    networkName: "Hardhat",
    rpc: "http://127.0.0.1:8545/",
    chainId: 31337,
    symbol: "ETH",
  });

  // Add an extra account
  await metamask.createAccount();

  await context.close();
}

export default globalSetup;

# example.spec.ts

export const test = base.extend<{
  context: BrowserContext;
  metamask: Dappwright;
}>({
  context: async ({}, use) => {
    // Launch context with the same session from global-setup
    const context: BrowserContext = await dappwright.launch("", {
      metamaskVersion: MetaMaskWallet.recommendedVersion,
    });

    // Unlock the wallet
    await metamask.unlock();

    await use(context);
    await context.close();
  },
  metamask: async ({ context }, use) => {
    const metamask = await dappwright.getWallet("metamask", context);

    await use(metamask);
  },
});

test.describe.configure({ mode: "serial" }); // Avoid colliding browser sessions
test("can connect to an application", async ({ page, metamask }) => {
  // Click a connect wallet button
  await page.locator("text=MetaMask").click();

  // Approve the connection when MetaMask pops up
  await metamask.approve();

  // Wait for the dapp to redirect
  await page.waitForUrl("http://localhost:3000/dashboard");
})

A: I have following problem with dAppwright:
ReferenceError: dappwright is not defined

   at my-test.js:9

   7 |      context: async ({}, use) => {
   8 |              // Launch context with the same session from global-setup
>  9 |              const context = await dappwright.launch('', {
     |                              ^
  10 |                      metamaskVersion: MetaMaskWallet.recommendedVersion,
  11 |              });
  12 |              // Unlock the wallet

Do you have some ideas what I should put there?


text:
Q: Detect operator support with decltype/SFINAE A (somewhat) outdated article explores ways to use decltype along with SFINAE to detect if a type supports certain operators, such as == or <.
Here's example code to detect if a class supports the < operator:
template <class T>
struct supports_less_than
{
    static auto less_than_test(const T* t) -> decltype(*t < *t, char(0))
    { }

    static std::array<char, 2> less_than_test(...) { }

    static const bool value = (sizeof(less_than_test((T*)0)) == 1);
};

int main()
{
    std::cout << std::boolalpha << supports_less_than<std::string>::value << endl;
}

This outputs true, since of course std::string supports the < operator.  However, if I try to use it with a class that doesn't support the < operator, I get a compiler error:
error: no match for 'operator<' in '* t < * t'

So SFINAE is not working here.  I tried this on GCC 4.4 and GCC 4.6, and both exhibited the same behavior.  So, is it possible to use SFINAE in this manner to detect whether a type supports certain expressions?

A: You need to make your less_than_test function a template, since SFINAE stands for Substitution Failure Is Not An Error and there's no template function that can fail selection in your code.
template <class T>
struct supports_less_than
{
    template <class U>
    static auto less_than_test(const U* u) -> decltype(*u < *u, char(0))
    { }

    static std::array<char, 2> less_than_test(...) { }

    static const bool value = (sizeof(less_than_test((T*)0)) == 1);
};

int main()
{
    std::cout << std::boolalpha << supports_less_than<std::string>::value << endl;
}

A: This is C++0x, we don't need sizeof-based tricks any more... ;-]
#include <type_traits>
#include <utility>

namespace supports
{
    namespace details
    {
        struct return_t { };
    }

    template<typename T>
    details::return_t operator <(T const&, T const&);

    template<typename T>
    struct less_than : std::integral_constant<
        bool,
        !std::is_same<
            decltype(std::declval<T const&>() < std::declval<T const&>()),
            details::return_t
        >::value
    > { };
}

(This is based on iammilind's answer, but doesn't require that T's operator< return-type be a different size than long long and doesn't require that T be default-constructable.)

A: Below simple code satisfies your requirement (if you don't want compile error):
namespace supports {
  template<typename T>  // used if T doesn't have "operator <" associated
  const long long operator < (const T&, const T&);

  template <class T>
  struct less_than {
    T t;
    static const bool value = (sizeof(t < t) != sizeof(long long));
  };
}

Usage:
supports::less_than<std::string>::value ====> true;  // ok
supports::less_than<Other>::value ====> false;  // ok: no error

[Note: If you want compile error for classes not having operator < than it's very easy to generate with very few lines of code.]

A: In C++11 the shortest most general solution I found was this one:
#include <type_traits>

template<class T, class = decltype(std::declval<T>() < std::declval<T>() )>
std::true_type  supports_less_than_test(const T&);
std::false_type supports_less_than_test(...);

template<class T> using supports_less_than = decltype(supports_less_than_test(std::declval<T>()));

#include<iostream>
struct random_type{};
int main(){
    std::cout << supports_less_than<double>::value << std::endl; // prints '1'
    std::cout << supports_less_than<int>::value << std::endl; // prints '1'
    std::cout << supports_less_than<random_type>::value << std::endl; // prints '0'
}

Works with g++ 4.8.1 and clang++ 3.3

A more general solution for arbitrary operators (UPDATE 2014)
There is a more general solution that exploits the fact that all built-in operators are also accessible (and posibly specialized) through STD operator wrappers, such as std::less (binary) or std::negate (unary).
template<class F, class... T, typename = decltype(std::declval<F>()(std::declval<T>()...))>
std::true_type  supports_test(const F&, const T&...);
std::false_type supports_test(...);

template<class> struct supports;
template<class F, class... T> struct supports<F(T...)>
: decltype(supports_test(std::declval<F>(), std::declval<T>()...)){};

This can be used in a quite general way, especially in C++14, where type deduction is delayed to the operator wrapper call ("transparent operators").
For binary operators it can be used as:
#include<iostream>
struct random_type{};
int main(){
    std::cout << supports<std::less<>(double, double)>::value << std::endl; // '1'
    std::cout << supports<std::less<>(int, int)>::value << std::endl; // '1'
    std::cout << supports<std::less<>(random_type, random_type)>::value << std::endl; // '0'
}

For unary operators:
#include<iostream>
struct random_type{};
int main(){
    std::cout << supports<std::negate<>(double)>::value << std::endl; // '1'
    std::cout << supports<std::negate<>(int)>::value << std::endl; // '1'
    std::cout << supports<std::negate<>(random_type)>::value << std::endl; // '0'
}

(With the C++11 standard library is a bit more complicated because there is no failure on instatiating decltype(std::less<random_type>()(...)) even if there is no operation defined for random_type, one can implement manually transparent operators in C++11, that are standard in C++14)
The syntax is quite smooth. I hope something like this is adopted in the standard.

Two extensions:
1) It works to detect raw-function applications:
struct random_type{};
random_type fun(random_type x){return x;}
int main(){
    std::cout << supports<decltype(&fun)(double)>::value << std::endl; // '0'
    std::cout << supports<decltype(&fun)(int)>::value << std::endl; // '0'
    std::cout << supports<decltype(&fun)(random_type)>::value << std::endl; // '1'
}

2) It can additionally detect if the result is convertible/comparable to a certain type, in this case double < double is supported but a compile-time false will be returned because the result is not the specified one.
std::cout << supports<std::equal_to<>(std::result_of<std::less<>(double, double)>::type, random_type)>::value << std::endl; // '0'

Note: I just tried to compile the code with C++14 in http://melpon.org/wandbox/ and it didn't work. I think there is a problem with transparent operators (like std::less<>) in that implementation (clang++ 3.5 c++14), since when I implement my own less<> with automatic deduction it works well.

A: @xDD is indeed correct, though his example is slightly erroneous.
This compiles on ideone:
#include <array>
#include <iostream>

struct Support {}; bool operator<(Support,Support) { return false; }
struct DoesNotSupport{};

template <class T>
struct supports_less_than
{
  template <typename U>
  static auto less_than_test(const U* u) -> decltype(*u < *u, char(0))
  { }

  static std::array<char, 2> less_than_test(...) { }

  static const bool value = (sizeof(less_than_test((T*)0)) == 1);
};

int main()
{
  std::cout << std::boolalpha << supports_less_than<Support>::value << std::endl;
  std::cout << std::boolalpha <<
     supports_less_than<DoesNotSupport>::value << std::endl;
}

And results in:
true
false

See it here in action.
The point is that SFINAE only applies to template functions.


text:
Q: JMS messaging in Wildfly standalone mode I am using 2 Wildfly 11 server instances in standalone mode started with standalone-full-ha.xml.
Now i would like to send JMS Messages between those two by implementing a Sender and a Receiver that uses the same topic like this:
Receiver:
@Named
@MessageDriven(
   name="TaskJmsMsgReceiver",
   activationConfig={
     @javax.ejb.ActivationConfigProperty(propertyName="destinationLookup", propertyValue="topic/Blubb"),
     @javax.ejb.ActivationConfigProperty(propertyName="destinationType",   propertyValue="javax.jms.Topic"),
     @javax.ejb.ActivationConfigProperty(propertyName="acknowledgeMode",   propertyValue="Auto-acknowledge")
})
public class TaskJmsMsgReceiver implements MessageListener {

    @Inject
    private TaskWebSocketChannel webSocketChannel;

    @Override
    public void onMessage(Message rcvMessage) {
        TextMessage msg = null;
        try {
            if (rcvMessage instanceof TextMessage) {
                msg = (TextMessage) rcvMessage;
                String jmsMessageText = msg.getText();
                log.info("Received JMS Message: " + jmsMessageText);
                String socketChannelEmpfaenger = jmsMessageText;
                webSocketChannel.send(socketChannelEmpfaenger);
            }
        } catch (JMSException e) {
        ...
        }
    }

}

Sender:
@JMSDestinationDefinitions({
@javax.jms.JMSDestinationDefinition(
    name = "java:/jms/topic/Blubb",
    interfaceName = "javax.jms.Topic",
    destinationName = "Blubb")
})
@Stateless
@Dependent
public class TaskJmsMsgSender {

    @Resource(lookup = "java:/jms/topic/Blubb")
    private Topic topic;

    @Inject
    private JMSContext context;

    public void send(String text) {
        log.info("Send JMS Message: " + text);
        context.createProducer().send(topic, text);
    }

}

Now, obviously I need to configure the Wildfly instances to work together with the same JMS topic.
Can someone pls point me in the right direction how to configure this?
Thanx a lot.

A: By default the standalone-full-ha.xml enables clustering for the embedded instance of Apache ActiveMQ Artemis. Therefore, if the producer is sending to one server and the consumer is running on the other server the message should flow between the servers so that the consumer will automatically receive the sent message even though they are operating on different servers.

A: i am using wildfly server and JMS client and its working fine. try this code it will help ful to you,
standalone.xml
 <mdb>
                <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>

 <subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
            <server name="default">
                <security-setting name="#">
                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
                </security-setting>
                <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
                <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
                <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
                    <param name="batch-delay" value="50"/>
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-connector>
                <http-acceptor name="http-acceptor" http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput" http-listener="default">
                    <param name="batch-delay" value="50"/>
                    <param name="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-acceptor>
                <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="DeckQueue" entries="java:/jboss/exported/jms/queue/DeckQueue"/>
                <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
                <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
                <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
            </server>

java constant
public static final String DESTINATION = "destination";
    public static final String DESTINATION_VALUE = "java:/jboss/exported/jms/queue/DeckQueue";
    public static final String DESTINATION_TYPE = "destinationType";
    public static final String DESTINATION_TYPE_VALUE = "javax.jms.Queue";
public static final String QUEUE_LOOKUP = "java:/jboss/exported/jms/queue/DeckQueue";
    public static final String CONNECTION_FACTORY = "java:jboss/DefaultJMSConnectionFactory";//

 public static boolean sendJmsMessage(Serializable obj) {
        QueueConnection connection = null;
        QueueSession session = null;

        try {
            connection = JmsConnectionFactory.getFactory().createQueueConnection();
            session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            Queue queue = (Queue) JmsConnectionFactory.getContext().lookup(Constants.QUEUE_LOOKUP);
            QueueSender sender = session.createSender(queue);

            ObjectMessage objMsg = session.createObjectMessage();
            objMsg.setObject(obj);

            logger.log(Level.INFO, "Sending message : {0}", obj);

            sender.send(objMsg);

@MessageDriven(activationConfig = {
            @ActivationConfigProperty(
            propertyName = DESTINATION_TYPE, propertyValue = DESTINATION_TYPE_VALUE),
    @ActivationConfigProperty(
                    propertyName = DESTINATION, propertyValue = DESTINATION_VALUE)})
public class JmsMessageBean implements MessageListener {


text:
Q: Oldstyle numbers in body text computer modern Is there any way to make all numbers written outside of math mode be rendered oldstyle while still using the Computer Modern font? I'm pretty partial to both, and also to not writing \oldstylenum every time I want one.
Using Latex, by the way.

A: You could load the cfr-lm package, i.e., write \usepackage{cfr-lm} in the preamble. If the package is loaded in this way, old-style numerals will be used in text mode and lining numerals will be used in math mode. Latin Modern is a clone of Computer Modern; the basic glyphs (those in the ASCII set) are essentially indistinguishable from Computer Modern; you'll notice big improvements in some glyphs with accents and diacritics when using Latin Modern.
To get lining numbers, use either math mode or the package's \textl macro.

\documentclass{article}
\usepackage{cfr-lm}
\begin{document}
\obeylines % just for this example
\textl{0123456789}
$0123456789$
0123456789
\textbf{0123456789}
\textit{0123456789}
\textbf{\textit{0123456789}}
\textsf{0123456789}
\texttt{0123456789}
\end{document}


text:
Q: Configuring MySQL with ASP.NET MVC 4 Application I am new to ASP.NET and I am using this tutorial http://www.codeproject.com/Articles/470107/ASP-NET-MVC-Part-Introduction to learn some basics.
I have created a project using Visual Studio 2012. I then try to run the program in debug mode for the first time. I then get an error that I have encountered in winforms, i.e Could not load file or assembly 'MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies.
I have made sure that MySql.Web are added in references.
I have also added this to the Web.config
 <system.data>
    <DbProviderFactories>
      <clear />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

As I'm new to ASP.NET, I have noticed that creating the project added a connection string that I did not specify in the Web.config.
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-SoundSource-20140312214649;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-SoundSource-20140312214649.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

What do I need to do in order to view the home page on my browser correctly?

A: I recommend installing MySQL Installer, which includes MySQL Connector for .NET and MySQL for Visual Studio among other things. The Connector gives you the required assemblies to use with ADO.NET. With the Visual Studio plugin you can use Server Explorer to connect to MySQL server (and easily get the connection string). It also gives you Entity Framework designer support for MySQL.
When you add references to MySQL connector for .NET there are several assemblies you need to reference. Also there are several versions of each assembly - you need to reference correct ones. Look into that, it should help you with your problem.


text:
Q: Таблица Unicode или ASCII Вот есть код подскажите в какой таблице он написан? Мне нужно узнать какое там слово за шифрованно. Какую можно использовать программу для расшифровки символов?25F57E2C07D53983F0F205D72997E779EA6890726D147B23736D3A49772D5657
A: Вообще-то это больше напоминает md5 хэш-сумму... Погуглите на тему "расшифровка хэш-сумм".


text:
Q: I need a faster way with logging function to parse this special type of data in CSV file I have a file with below data format
<aqr>a=769 b="United States" c=02/04/2019 d=01:03:23
<aqr>a=798 b="India" c=02/04/2019 d=01:03:23 e="Non existent"

So basically all the lines have multiple columns but the columns are not fixed and no header is there. So need to create column header from the data itself. Like for the example above a,b,c,d and e will be column header.
I have made a code which does the job but I am looking for a more faster way and with logging facility.
By far my logic is to remove unwanted data at the beginning, then get the data in a dictionary and turn it into a dataframe.
result = defaultdict(list)
with open('testfiles/test.csv', 'r') as file:
    pardic = { }
    new_list = []
    final_list = []
    for line in file.read().splitlines():
        rule0 = line.strip("<aqr>")
        rule0 = '~'.join(shlex.split(rule0))
        y = rule0.split('~')
        for word in y:
            x = word.split('=')
            result[x[0]].append(x[1])
data = pd.DataFrame.from_dict(result, orient='index')
data = data.T

The result is fine. I just need a faster solution to this.


text:
Q: prefill Marketo fields on Submit On submit of Marketo form it does some processing and returns back to the same page.
My requirement
I would like to have all the Marketo fields populated with the just entered data (data entered before clicking Submit button)for all the Marketo fields.
What I have tried
I have used the below code, that's given in http://developers.marketo.com/blog/external-page-prefill/
<script>
MktoForms2.whenReady( function(form) {
    //set the first result as local variable
    var mktoLeadFields = mktoLead.result[0];
    //map your results from REST call to the corresponding field name on the form
    var prefillFields = {
            "Email" : mktoLeadFields.email,
            "FirstName" : mktoLeadFields.firstName,
            "LastName" : mktoLeadFields.lastName,
            "Company" : mktoLeadFields.company
            };
    //pass our prefillFields objects into the form.vals method to fill our fields
    form.vals(prefillFields);
    }
    );
</script>

But when the form submits and loads\returns back its not populated with previos entered data

A: I checked the declared variable - here its

var mktoLeadFields

(given in Q)  and made a logic that assigned the pre-enetered value to that var and then when set the form values with
form.vals(prefillFields);

it worked.


text:
Q: mmenu - Possible to show selected child instead of direct parent? I have mmenujs running on a project to handle the navigation. It works perfectly, but I wish the menu title would display the current page you are visiting.
Example:
Home

*

*about

*

*test1

*test2

*test3

*contact

Let's say this is the menu. We have an about section which have 3 menu items, test1, 2 and 3.
If i would click and navigate to test2, the menu title would show the parent about next time I open the menu.
Is there a way to control this, so the current child you are navigated to is what's being showed as the title.
I would also like the functionality of the < button to work as expected.
I hope this is clear enough, but can absolutly provide more information e.g. screenshots if needed.
I read the documentation and found this:
navbar
{
titleLink: "anchor"
}
Tried it, but it did not work and is probably not what I'm looking for anyways.


text:
Q: App doesn't remember that user is signed in I currently managed to finish my web app and I tried to make it so that the user doesn't have to log in every time he/she accesses the app. This works in debugging mode but as soon as I deploy it on the actual web using firebase, every time you refresh the app it asks you to log in again. I've trying doing it using a Future builder and even check the current user. Everything works in debugging but on the real website that doesn't work.
Code:
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        theme: ThemeData.dark(),
        scrollBehavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
          PointerDeviceKind.mouse,
          PointerDeviceKind.touch,
        }),
        home: FirebaseAuth.instance.currentUser != null ? Homepage() : Login());
  }
}

A: Firebase automatically persists the user credentials in local storage, and restores them when the page reloads. This requires it to call to the server, to check amongst others whether the account has been disabled.
While this call to the server is going on currentUser is null, which is why your code sends the user to the login page when it loads. When the call from the server completes/returns, Firebase updates the currentUser, but at this point your rendering code is not retriggered.

What you'll want to do is listen the authStateChanges() stream as shown in the documentation on authentication state. By putting this in a StreamBuilder, your UI will respond to the changes in authentication state. For some examples of this, see How to manage Firebase Authentication state in Flutter?

With this approach, the UI may briefly show the login page (during the call to the server) and then show the correct page once the state has been restored. If you want to prevent this brief flash, you what androloper did in their answer. Just make sure to do it in addition to listening to authStateChanges, as only checking the local state would mean you're missing cases where the server rejects the stored credentials.

A: I have faced with this problem. I havent used google firebase but it is about checking token. Maybe this one helps you to handle it.
Firstly, you should create future, such as:
Future<bool> autoLogin() async {
  SharedPreferences prefs = await SharedPreferences.getInstance();
  bool accessToken = prefs.containsKey('accessToken');
  return accessToken;
}

then you call it like this:
home: FutureBuilder<bool>(
          future: autoLogin(),
          builder: (context, snapshot){
            if(snapshot.data == null){
              return SplashScreen();
            }else {
              return snapshot.data == true ? WantedToGoScreen() : LoginScreen();
            }
          },
        ),

A: Just Use Shared Preference for store any value which identify that State...
Then remove the Preference key at the time of logout...
So when the app start check that store value is exist.. IF exist then its logged  otherwise Logged out...


text:
Q: In below code which is compared in Arrays?(length/type) JAVASCRIPT let numbers = new Array(1,2,3);
let numbers2 = new Array(1,2,3);
let alphabet = new Array("a","b","c");
let secondSet = new Array("a","b","c");
console.log(typeof(numbers))
console.log(typeof(secondSet))
console.log(numbers === numbers2);
console.log(numbers === alphabet);
console.log(secondSet == alphabet);```

can it is true in any case? how it is compared??*

A: Comparing arrays can be done by (suggested in the comments) converting the array (object) to a string, using JSON.stringify() and comparing the two strings:

let numbers = new Array(1,2,3);
let numbers2 = new Array(1,2,3);

console.log(JSON.stringify(numbers) === JSON.stringify(numbers2));

Or you could loop through the elements of the array using Array.prototype.every() for example in this way:

let numbers = new Array(1,2,3);
let numbers2 = new Array(1,2,3);

const isequal = numbers.length === numbers2.length && numbers.every((value, i) => value === numbers2[i]);
console.log(isequal);

In most cases, the first option will do the job.


text:
Q: How to autoscroll to the end of RichEdit? I never needed to use the TRichEdit before, always used TMemo.
I'd like RichEdit autoscrolling to the end when I add text like TMemo. See how it looks after you add some data:

As you can see, the scroll bar remains at the top, but I'd like it stayed at the bottom as I added text.
I've 'googled' for solutions but I couldn't find a good and reliable one.

A: Try this code
RichEdit1.SetFocus;
RichEdit1.SelStart := RichEdit1.GetTextLen;
RichEdit1.Perform(EM_SCROLLCARET, 0, 0);

A: Here is much easier and fast solution:
In OnChange event handler just:
SendMessage(RichEdit1.handle, WM_VSCROLL, SB_BOTTOM, 0);
Original answer from: https://www.experts-exchange.com/questions/21002277/Richedit-autoscrolling.html

A: In short, you need to place the cursor at the end, or send code to scroll down.
Have you tried
Richedit1.SelStart :=RichEdit1.GetTextLength();
SendMessage(RichEdit1.handle, EM_SCROLLCARET,0,0);


text:
Q: Lombok - expose @EmbeddedId fields to @SuperBuilder is there a way to expose properties defined in @EmbeddedId to @SuperBuilder?
// Composite id class
@Data
@Builder(builderMethodName = "having")
@NoArgsConstructor
@AllArgsConstructor
@Embeddable
public class TheId {
    @Column(name = "name", insertable = false)
    private String name;

    @Column(name = "description", insertable = false)
    private String description;
}

// Base entity class
@SuperBuilder
@Getter
@Immutable
@MappedSuperclass
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity implements Serializable {
    @Delegate
    @EmbeddedId
    private TheId id;

    @Column(name = "long_description", insertable = false)
    private String longDescription;
}

// Concreate entity over database view
@Entity
@Table(name = "view_number_1")
@Getter
@Setter
@Immutable
@AllArgsConstructor(staticName = "of")
@SuperBuilder(builderMethodName = "having")
public class ConcreteEntity1 extends BaseEntity {}

I'd like to be able to write code like that:
ConcreateEntity1.having()
    .name("the name")
    .description("something")
    .longDescription("akjsbdkasbd")
    .build();

instead of
ConcreateEntity1.having()
    .id(TheId.having()
        .name("the name")
        .description("something")
        .build())
    .longDescription("akjsbdkasbd")
    .build();

Reason behinds whole concept:
same-named columns are present across several views so it's kind of logical to have one base class for them all. Although entities themselves are immutable (db view based) I'd like using builder in tests that's why I'd like to have them as above.

A: There is no automatic way to insert delegates into a @(Super)Builder.
However, if your delegatee class (TheId in this case) does not contain too many fields, you can manually add the corresponding setter methods to the builder class. Just add the correct builder class header, put your code in it, and Lombok will add all the remaining code that you do not manually write.
Admittedly, it's a bit tricky. The code @SuperBuilder generates is quite complex, and you do not want to add too much manual stuff, because you want to keep the advantages of Lombok: If you change something in your annotated class, you wouldn't want to rewrite all your manual methods. So this solution tries to keep most of the automation at the cost of a little bit of performance/memory waste.
@SuperBuilder(builderMethodName = "having")
public class BaseEntity {
    @Delegate
    private TheId id;

    private String longDescription;

    public static abstract class BaseEntityBuilder<C extends BaseEntity, B extends BaseEntityBuilder<C, B>> {
        private TheId.TheIdBuilder theIdBuilder = TheId.having();

        // Manually implement all delegations.
        public B name(String name) {
            theIdBuilder.name(name);
            // Instantiating every time you call the setter is not optimal,
            // but better than manually writing the constructor.
            id = theIdBuilder.build();
            return self();
        }
        public B description(String description) {
            theIdBuilder.description(description);
            id = theIdBuilder.build();
            return self();
        }

        // Make this method invisible.
        @SuppressWarnings("unused")
        private B id() {
            return self();
        }
    }
}

Is it worth it? That's a matter of taste and how much it improves the applicability/usability/readability of the builder in your case.

A: Since you have used @Delegate annotation in id then you should be able to set/get TheId fields directly from BaseEntity Class.
You can read more about it at Project Lombok.


text:
Q: questions related to Azure Active Directory v2.0 and the OpenID Connect protocol working on project that need this, reading https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc
and do have a couple of questions:
1) as for single sign-out feature as mentioned in the link above,
do you mean if like user A has 100 web applications logged in,
if what he did is: register LogoutUrl and implement "session clear" for LogoutUrl in 20 of these 100 web applications,
then when logout, these 20 applications signed out automatically, while the other 80 applications still sign-in?
2) for {tenant} required to access like /authorize, /token endpoint in the link above, do you mean all users can just use 'common',
or they have to specify as their own {tenant} value from AAD?
I tried to use 'common' which seems works,
but after I switch to use my own {tenant} found in AAD portal, seems it got redirected to another strange web page and not working?
so want to know what is the actual difference of 'common' v.s. user-specific {tenant}?
thanks a lot!

A: For question1:
When the user A register LogoutUrl and implement "session clear" for LogoutUrl in 20 of these 100 web applications, there will only 20 applications signed out if you sign them out. And if only one of these register LogoutUrl apps is signed out, it cannot sign others register LououtUrl apps out automatically.
For question2:
When 'common' or'tenant' is used needs to consider with your application(to access). 'common' is used when you configure the multi-tenant application. By this, it will allow other tenants user access your multi-tenant application. When you set your application as the single tenant application, 'tenant' will only allow the own users to access the application. For the details about the single tenant or multi-tenant app, please read here.

A: @SunnySun
thanks a lot for the reply. for question1, still confused about your answer.
another example for this:
Suppose this is what user A has done:
1) registered LogoutUrl
2) implemented web applications App1, App2, App3, App4
3) in web application App1 and App2: implemented LogoutUrl with "session clear"
while in App3, App4: no implementation for LogoutUrl at all
4) now user has signed in all these four applications App1-4
case#1: user signed out from App1
so what will happen?
will user be signed out from App1, App2, App3, App4?
Or user will just be signed out from App1 and App2, while still remain signed in for App3, App4?
case#2: user signed out from App3
What will happen now?
will user be signed out from App1, App2, App3, App4?
Or user will just be signed out from App1 and App2, while still remain signed in for App3, App4?
Or user still remain signed in for App1, App2, and App4?


text:
Q: In ColdFusion what do single and double quotes around attribute values do? For example what do the "" around  #Trim(FORM.fromfirstname)# do? I'm adding <cfqueryparam...> tags and am wondering if the quotes are still required?
<CFQUERY NAME="account" DATASOURCE="#APPLICATION.centralDSN#">
    SELECT *
    FROM users
    WHERE (firstname =<CFQUERYPARAM VALUE="#Trim(FORM.fromfirstname)#">)
        AND (lastname = <CFQUERYPARAM VALUE="#Trim(FORM.fromlastname)#">)
        AND (email = '#Trim(FORM.fromemail)#')
</CFQUERY>

Here's one that doesn't use quotes for the WHERE clause:
<CFIF getUser.RecordCount>
    <CFQUERY NAME="cUser" DATASOURCE="#APPLICATION.centralDSN#">
        UPDATE users
            SET mailing_list = <CFIF IsDefined("FORM.mailing_list")>#FORM.mailing_list#<CFELSE>0</CFIF>
        WHERE user_id = #getUser.user_id#
    </CFQUERY>
</cfif>

EDIT: if they don't do anything there's no harm in keeping them, correct? In another file I found examples like
    to="#ListFirst(EnglishEmailList)#"
    cc="#ListRest(EnglishEmailList)#"

So if they are already there I'll leave them?

A: If you're using <cfqueryparam> then you never need to use quotes.
if you're comparing a string in SQL (and not using <cfqueryparam>)  then you need to use quotes. If you're comparing to a number (and not using <cfqueryparam>) then you don't need quotes.

A: The quotes are still required for strings if you're not using a queryparam tag and you should use queryparams for any variables in queries whenever it's possible.
Not using that feature would create a possible attack point for SQL injection and is almost an invitation for abuse.

A: I know it's tedious, but if you clean up your variables BEFORE you insert them into an SQL statement it's easier to understand and read.
Here's how I would write this:
// manipulate and rescope variables as required here
// no quotes or pound signs necessary when when not outputting
<cfset VARIABLES.FirstName = Trim(FORM.fromfirstname)>
<cfset VARIABLES.LastName  = Trim(FORM.fromlastname)>
<cfset VARIABLES.Email     = Trim(FORM.fromemail)>

// stop sql inject ~ use cfqueryparam
// simplifying your sql statement will make it much easier to diagnose problems
<CFQUERY NAME="account" DATASOURCE="#APPLICATION.centralDSN#">
    SELECT *
    FROM users
    WHERE  firstname = <CFQUERYPARAM cfqltype='cf_sql_varchar' VALUE="#VARIABLES.FirstName#">
        AND lastname = <CFQUERYPARAM cfqltype='cf_sql_varchar' VALUE="#VARIABLES.LastName#">
        AND email    = <CFQUERYPARAM cfqltype='cf_sql_varchar' VALUE="#VARIABLES.Email#">
</CFQUERY>

In the following SQL statement's WHERE clause, you are outputting an integer, so no quotes are necessary.
    WHERE user_id = #getUser.user_id#

Of course, it would be easy to screw up your database. Use cfqueryparam and save your job...
    WHERE user_id = <CFQUERYPARAM  cfqltype='cf_sql_integer'  VALUE="#VARIABLES.user_id#">

Instead of doing your IF/ELSE login inside your SQL statement, do it before, like this:
<cfif isDefined("FORM.mailing_list")>
  <cfset VARIABLES.mailing_list = trim(FORM.mailing_list)>
<cfelse>
  <cfset VARIABLES.mailing_list = 0>
</cfif>

UPDATE users
SET mailing_list = <cfqueryparam cfsqltype="cf_sql_varchar" value="#VARIABLES.mailing_list#">
WHERE user_id = #getUser.user_id#

A: SQL needs quotes for strings.
Quotes are part of standard SQL syntax to indicate a string (as indeed they are in almost every language).
If it didn't have quotes then SQL parser would have no idea where the string ended and the SQL continued.
Quotes are not necessary for numbers - where there is no ambiguity about where the value ends.
Remember also that the #hashes# are nothing to do with SQL - they are entirely on the CFML side. When running the cfquery tag, CF evaluates the body (including any hash expressions it contains) to create an SQL string, which is then passed to the database, (along with additional settings/parameters/etc). The SQL server has no knowledge of what parts of that string was hard-coded and what parts might have been evaluated from hashes.

cfqueryparam doesn't need quotes.
When you're fixing the queries to use cfqueryparam, you are creating parameters, and the tag handles everything necessary to indicate strings/etc to the SQL database. (You never need to wrap the cfqueryparam tag itself in quotes.)
Within the cfqueryparam tag, it makes zero difference whether or not you use quotes for the attributes - these three all produce the same result:
<cfqueryparam value="#var#" />
<cfqueryparam value='#var#' />
<cfqueryparam value=#var# />


text:
Q: Double integral bounded by square I have this double integral and I am not sure how to use the bound region to generate my limit  bounds..
the double integral is y-2x^2 dA      and it is bounded by |x| + |y| = 1
What do I do to start integrating this and how would I get the bound values from this? I am stuck on every part of this from integrating to coming up with the bounds.

A: It will help to draw a picture of your domain. In this case you can choose to integrate over $y$ first, and then (as you will be able to see from a plot), $y$ ranges from 0 to $|x|-1$. You can then split up your integral into 2 domains in x, $(-1,0)$, and $(0,1)$, You then get:
$\int_{-1}^0 \int_0^{x+1} f(x,y) dy dx$ on $(-1,0)$,
$\int_0^1 \int_0^{1-x} f(x,y) dy dx$ on $(0,1)$,
where $f(x,y) = y-2x^2$ and $dy dx$ means you integrate over y first, then x.The idea here is that you integrate up to one variable to get your function in terms of one variable then you have an absolute integral.


text:
Q: Change space between bars in ggplot I would like to set up proper spaces between bars in my ggplot.
That's how it looks like:

That's data:
> dput(tbl_all_ribosomes_abundance_overlap_dat)
structure(list(Ribosome = c("Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol", "Plastid",
"Plastid", "Cytosol", "Cytosol", "Plastid", "Plastid", "Cytosol",
"Cytosol", "Plastid", "Plastid", "Cytosol", "Cytosol"), Size_ranges = c(10L,
10L, 10L, 10L, 34L, 34L, 34L, 34L, 59L, 59L, 59L, 59L, 84L, 84L,
84L, 84L, 110L, 110L, 110L, 110L, 134L, 134L, 134L, 134L, 165L,
165L, 165L, 165L, 199L, 199L, 199L, 199L, 234L, 234L, 234L, 234L,
257L, 257L, 257L, 257L, 362L, 362L, 362L, 362L, 433L, 433L, 433L,
433L, 506L, 506L, 506L, 506L, 581L, 581L, 581L, 581L, 652L, 652L,
652L, 652L, 733L, 733L, 733L, 733L, 818L, 818L, 818L, 818L, 896L,
896L, 896L, 896L, 972L, 972L, 972L, 972L, 1039L, 1039L, 1039L,
1039L), Abundance = c(15236000, 36722900, 8953800, 8975200, 45971100,
99067800, 20305100, 26360500, 91416000, 219396000, 71722610,
84034100, 230630600, 254380400, 52402800, 50422300, 354388700,
437609200, 72343800, 86587600, 462991400, 497156100, 51817210,
65168400, 235045400, 290932300, 41362400, 50220300, 168440600,
196797700, 107294900, 158465800, 362305500, 375372400, 158236400,
209906300, 1367158670, 1122186600, 203436000, 203426900, 978435120,
983735500, 373804400, 362937700, 2104276960, 2220253960, 394261700,
410656800, 1267607300, 1323143500, 285954000, 276834600, 1080187900,
1410693500, 1261120700, 1299253600, 840738200, 1226346700, 1591379300,
1829220400, 1139340100, 1758611700, 2003838200, 2346221200, 2425368000,
3150723500, 2658315400, 3184999800, 3141234200, 4124976700, 3484620300,
4111995200, 2880830100, 4403308600, 4233078100, 4960194500, 2923459800,
4360192600, 5238580300, 5494148500), Time = structure(c(1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("EOD",
"EON"), class = "factor")), .Names = c("Ribosome", "Size_ranges",
"Abundance", "Time"), row.names = c(NA, -80L), class = "data.frame")

That's the code which I use for plotting:
ggplot(data=tbl_all_ribosomes_abundance_overlap_dat, mapping=aes(x=Size_ranges, y=Abundance, fill=Time)) +
  geom_bar(stat="identity", position="dodge", width = 25) +
  scale_x_continuous(limits = c(0, 1000),
                     breaks = c(0, 100, 250, 500, 750, 1000)) +
  scale_fill_manual("legend", values = c("EOD" = "gold1", "EON" = "gray")) +
  facet_grid(Ribosome~.)

As you see on the left side of the graph it does look messy because space between bars do not exist. Space between bars on the right side is, from the other hand, too big. Do you have any idea how I can improve this graph by increasing and decreasing spaces in specific places ?
Suggestions regarding setting up different scale for y axis to make it more clear (left side) are more than welcome.

A: You could make the x-variable discrete instead of continuous. You consider the values as categorical instead of numeric. This would make an evenly spaced bar for each of the values.
library(dplyr)
tbl_all_ribosomes_abundance_overlap_dat %>%
  mutate(Size_ranges = factor(Size_ranges)) %>%
  ggplot(aes(x=Size_ranges, y=Abundance, fill=Time)) +
  geom_bar(stat="identity", position = "dodge") +
  scale_fill_manual("legend", values = c("EOD" = "gold1", "EON" = "gray")) +
  facet_grid(Ribosome~.) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))


text:
Q: add a  before 5th
* and add another  after the last
* from a list? how can i make it possible say i have a unordered list of 17 items. so now i want to add a div tag just before the the 5th item and the closing div will go after the last item of the list. the result will look some thing like this.

and i cann't hard code this because this list will be generated by a php function. is there any way to do it? thank you
added: i am trying to hide those items that are in the div. and there will be another button somewhere so that when you click those items will show up.

A: It looks like you're trying to associate some common functionality (or perhaps styling?) with all-but-the-first-4-items in that
. Perhaps you could use a class attribute or something instead?
I don't know exactly what you're trying to achieve, but something like this might help:
var ul = //...
var items = ul.getElementsByTagName("li");
for (var i = 4; i < items.length; i++) {
    // do whatever you need to do here, e.g.:
    items[i].className += " foo";
}

The above snippet iterates over all but the first 4 elements of the list. (If you gave the
 an ID, you could use document.getElementById() to find it).
Edit:
OK, I see that you want to be able to toggle the visibility of these items. I would suggest that instead of surrounding the items in a
, use the technique described in my answer to first hide the list items, then do something similar when the button is clicked.
I'd probably put the item-finding logic in a function:
function getListItemsOfInterest() {
    var ul = //...
    var allItems = ul.getElementsByTagName("li");
    var items = [];
    for (var i = 4; i < allItems.length; i++) {
        items.push(allItems[i]);
    }
    return items;
}

then just iterate over the returned array to do the show/hide logic.
Predictably, I will also recommend you look into jQuery (don't know if you are able to use it or not). It tends to make this sort of thing a lot easier. For instance, you could achieve all of the above with something like the following:
$("ul>li:gt(3)").show();

A: While what you're trying to do is wrong in itself, I'm just answering the question here. Use this (it's pretty self-explanatory):
function insertDiv(){
    var d = document.createElement('div'), i=2, e = document.getElementsByTagName('li')[i];
    while(e){
        d.appendChild(e.cloneNode(true));
        e.parentNode.removeChild(e);
        e = document.getElementsByTagName('li')[i];
    }
document.getElementsByTagName('ul')[0].appendChild(d);
}

Where i is the tag number you want to start from. Reason why this isn't a for loop is because every time you remove an element, the length decreases. If the ul isn't the only one, give it an ID and use document.getElementById() instead.


text:
Q: How to disable Google Map MouseOver I am making an aspx page to track vehicles. The only thing I am sticking with is that I don't know how to remove tooltip text from google markers.
The data is displaying correctly.

In the image above, (1) is being shown when I am taking my cursor on marker image and (2) is coming when I am clicking on the marker.
I want to hide (1). How to do that?
I am using the following code:
function initMap() {
        var image = '../images/FireTruck.png';
        var markers = JSON.parse('<%=ConvertDataTabletoString() %>');
        var mapOptions = {
            center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
            zoom: 8,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var infoWindow = new google.maps.InfoWindow();
        var map = new google.maps.Map(document.getElementById("map"), mapOptions);
        for (i = 0; i < markers.length; i++) {
            var data = markers[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);
            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data.title,
                icon: image
            });
            (function (marker, data) {
                google.maps.event.addListener(marker, "click", function (e) {
                    infoWindow.setContent(data.title);
                    infoWindow.open(map, marker);
                });
            })(marker, data);
        }
    }

A: Don't set the title property of the marker (that is what sets the tooltip).
var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: data.title,  // <<<<<<<<<<<<<<<<<< REMOVE THIS
    icon: image
});


text:
Q: Pass a table method to addLink method of a QueryBuildDataSorce object Is there any way to pass a table method instead of fieldid to addLink method of a QueryBuildDataSource object?
I have this code:
qbdsLedgerTrans.addLink(
        FieldNum(LedgerTable, AccountNum), // Here i need to pass a conditional value of a LedgerTable method instead of a field
        FieldNum(LedgerTrans, AccountNum)
    );

A: I think no because the query API is tightly bound to tables in SQLServer and tables does not contain any method in SQLServer.
The #addLink will be used to generate query join statement so there must use data present inside the database and method are not in the database but in the aod files.
Depending on what you want to do you can have a method to encapsulate your logic and return the corrected fieldId.

A: The first argument to the addLink method must be an field of the prior joined table, in this case LedgerTable. It may be returned by a function, but I doubt it will solve your hidden (unstated) problem.
The second argument to the addLink method must be an field of the current datasource table.
In other scenarios (form delayed joins) you could use the addDynalink method instead.


text:
Q: SDI 12 interface I have a sensor that use SDI-12 communication. I want to connect it to a a µC. I'm looking for something like RS232 <-> SDI-12. Or USB <-> SDI-12 the only schematics I've found use buffer.
Do you have an idea about the interface / driver?
Thank you.


text:
Q: How to use array in javascript and print it out on webpage I am doing my assignment but I haven't used javascript on HTML before.
This is my HTML file(list.html).

HTML Lists

Fruit

Directories

and this is my javascript file(list.js).
const fruits = ['Apples', 'Oranges', 'Pears', 'Grapes', 'Pineapples', 'Mangos'];
/* I wrote this part (var i = 0; i < 6; i ++)
console.log fruits(i);*/
const directory = [
  { type: 'file', name: 'file1.txt' },
  { type: 'file', name: 'file2.txt' },
  {
    type: 'directory',
    name: 'HTML Files',
    files: [
      { type: 'file', name: 'file1.html' },
      { type: 'file', name: 'file2.html' }
    ]
  },
  { type: 'file', name: 'file3.txt' },
  {
    type: 'directory',
    name: 'JavaScript Files',
    files: [
      { type: 'file', name: 'file1.js' },
      { type: 'file', name: 'file2.js' },
      { type: 'file', name: 'file3.js' }
    ]
  }
];

I have to print out fruits array, but I don't know how to make it print out on the webpage. I can only check it on dev tool.

A: This code dynamically adds fruits list into your html code.

const fruits = ["Apples", "Oranges", "Pears", "Grapes", "Pineapples", "Mangos"];

let liList = "";
fruits.forEach(item => {
    liList = liList + `<li>${item}</li>`;
});

document.querySelector("#insertFruits").innerHTML = liList;

HTML Lists

Fruit

Directories

A: For rendering array of items first we have to get body to our script, because we are going to attach list to body.
const body = document.querySelector("body");
Then we are looping array and creating div tag,
const div = document.createElement("div"); (btw it can be any tag)
And we give a value to div
div.innerText = fruit
And in the end attach div to body
const body = document.querySelector("body");
          fruits.forEach((fruit) => {
            const div = document.createElement("div");
            div.innerText = fruit;
            body.appendChild(div);
          });

A: You can print array in your javascript file by adding below line just after 'const fruits' declaration :
document.getElementById("fruitList").innerHTML=fruits;
So, if you want to print the fruits array just below the text 'Fruit', then add a 'div' element within your 'fruit' 'div' with id 'fruitList' as shown below, so it will print the array below it:

Fruit


text:
Q: How do I print my dictionary keys without printing the key 'None'? I have created a dictionary containing majors and corresponding average salaries. I used a for loop to print the keys of the dictionary (being the majors) for a user to pick from. When I run the for loop at the end of the print statements, I keep getting the key None even when specifying to not print None using an if statement.
Here is the dictionary I defined:
majors = {
    'Management Information Systems': 84219,
    'Business': 50670,
    'Ecology': 58756,
    'Psychology': 40858,
    'Sociology' : 58678,
}

And here is the for loop I used to print the keys:
def printMajors():
    for key in majors.keys():
        if key is not None:
            print(key)

I also tried deleting the keys with the value None using the following (defined before the print statement):
  for key, value in majors.copy().items():
      if value is None:
          del majors[key]

Output:
Management Information Systems
Business
Ecology
Psychology
Sociology
None // this is unexpected and what I am having trouble with removing

Any help would be much appreciated!

A: I think you call printMajors() like below:
print(printMajors())

This returns None because your function doesn't return anything (no return statement). The function contains print() inside so there is no need for print() outside anymore.
solution:
printMajors()

A: majors = {
  'Management Information Systems': 84219,
  'Business': 50670,
  'Ecology': 58756,
  'Psychology': 40858,
  'Sociology' : 58678,
}

for i,j in majors.items():
    print(i)


text:
Q: Is there any ways to stop showing component variable from chrome developer tool In my project, I have scenario like before hitting service I need to one Boolean variable. functionality working fine. But in the developer tool i can change the variable value to true by putting the break point before the if condition.
steps:

*

*Put the break point before the If condition.

*Can change the value of Boolean (userDetailsFlag) variable to true from scope section then release the break point
component.ts

    this.userDetailsFlag = false
    this.showSpinnerFlag = true;
    if (!this.userDetailsFlag) {
      this.showSpinnerFlag = false;
      this.toastr.error('Please check the user details');
      return false;
    }
this.serviceRequestService.saveRequestDetails(this.serviceRequest)
.subscribe(data => {
    }, (err) => {
     });

Can we prevent showing scope variables from browser developer tool

A: Using that developer tool, using that breakpoint, customising values in the mid of an execution - All these are for the developer's benefit to understand and debug your code better...
If you do not want your end user to do these hijacks, build the application in prod mode, enable code bundles optimization plugins, code uglify plugins, disable source maps, enableProdMode().... That will give your end users a tough time to even put a breakpoint...
But again, it is for prod mode for end users, for developer mode, you may use those breakpoints and value changes frequently...


text:
Q: Win32 PrintDlg, PrintDlgEx, Crashing and quirkiness I'm tasked with solving the following issue:  My application crashes when running on a 64 bit machine when the PrintDlg() function is called.
After digging and hair pulling, I've decided the best solution is to replace the original calls of PrintDlg() with its bigger brother, PrintDlgEx().
Doing so fixes one problem (it no longer crashes!), but causes another.  When I execute the code, it is not showing the print dialog, just returning a success code, and giving me all of the information for my default printer.  I need this function to show the standard "print setup" window, I don't know how the heck to make it happen.  Shown below are the sample values I'm trying to use to get my dialog to show.
Any thoughts?  Thanks in advance.
//  Initialize the PRINTDLGEX structure.
pd2.lStructSize = sizeof(PRINTDLGEX);
pd2.hwndOwner = wnddata->wnd.hnd;
pd2.hDevMode = NULL;
pd2.hDevNames = NULL;
pd2.hDC = NULL;
pd2.Flags = PD_RETURNDC | PD_COLLATE;
pd2.Flags2 = 0;
pd2.ExclusionFlags = 0;
pd2.nPageRanges = 0;
pd2.nMaxPageRanges = 10;
pd2.lpPageRanges = NULL;
pd2.nMinPage = 1;
pd2.nMaxPage = 1000;
pd2.nCopies = 1;
pd2.hInstance = 0;
pd2.lpPrintTemplateName = NULL;
pd2.lpCallback = NULL;
pd2.nPropertyPages = 0;
pd2.lphPropertyPages = NULL;
pd2.nStartPage = START_PAGE_GENERAL;
pd2.dwResultAction = 0;
pdrc = PrintDlgEx  (&pd2);

A: You are most likely getting a return code of E_INVALIDARG, due to failure to read the fine print on the PRINTDLGEX structure. Specifically, it says "If the PD_NOPAGENUMS flag is not specified, lpPageRanges must be non-NULL."
The underlying problem with PrintDlg / PrintDlgEx is due to a missing attribute on your WinMain. You need to tag WinMain as [STAThreadAttribute] to indicate that your COM threading model is single-threaded apartment. Other threading models MAY work, but I can't say for sure.


text:
Q: Getting "Queue objects should only be shared between processes through inheritance" but I'm not using a Queue I am trying to use a ProcessPoolExecutor, but I am getting the error "Queue objects should only be shared between processes through inheritance", but I am not using a Queue (at least not explicitly). I can't find anything that explains what I am doing wrong.
Here is some code that demonstrates the issue (not my actual code):
from concurrent.futures import ProcessPoolExecutor, as_completed

class WhyDoesntThisWork:

    def __init__(self):
        self.executor = ProcessPoolExecutor(4)

    def execute_something(self, starting_letter):
        futures = [self.executor.submit(self.something, starting_letter, d) for d in range(4)]
        letter = None
        for future in as_completed(futures):
            letter = future.result()
        print(letter)

    def something(self, letter, d):
        # do something pointless for the example
        for x in range(d):
            letter = chr(ord(letter) + 1)

if __name__ == '__main__':
    WhyDoesntThisWork(). execute_something('A')

El Ruso has pointed out that making something() a staticmethod or classmethod makes the error go away. Unfortunately, my actual code needs to call other methods using self.

A: Can be solved without using static approach.
When using process, each process runs in an independent memory space. That's unlike when using thread, when different threads are running under the same process, using the same memory space. Thus the error doesn't occur when you use
ThreadPoolExecutor but occurs in ProcessPoolExecutor.
So when the function of the class instance is delivered into separate sub-processes, the multiprocessing mechanism pickles the function so that the function can be passed into the sub-process as an independent instance. And when the sub-process joined, the class is updated by the function instance delivered back as unpicked one.
To make it work, just add __getstate__() and __setstate__() functions to the class to guide the class how to pickle and unpickle the function. In pickling, the unnecessary fields can be excluded as shown in del self_dict['executor'].
import multiprocessing
import time
from concurrent.futures import ProcessPoolExecutor, as_completed

class GuessItWorksNow():

    def __init__(self):
        self.executor = ProcessPoolExecutor(4)

    def __getstate__(self):
        state = self.__dict__.copy()
        del state['executor']
        return state

    def __setstate__(self, state):
        self.__dict__.update(state)

    def something(self, letter, d):
        # do something pointless for the example
        p = multiprocessing.current_process()
        time.sleep(1)
        for x in range(d):
            letter = chr(ord(letter) + 1)
        return (f'[{p.pid}] ({p.name}) ({letter})')

    def execute_something(self, starting_letter):
        futures = [self.executor.submit(self.something, starting_letter, d) for d in range(10)]
        for future in as_completed(futures):
            print(future.result())

if __name__ == '__main__':
    obj = GuessItWorksNow()
    obj.execute_something('A')

A: try this code for something
@staticmethod
def something(letter, d):
    # do something pointless for the example
    for x in range(d):
        letter = chr(ord(letter) + 1)

or refactor to:
from concurrent.futures import ProcessPoolExecutor, as_completed

class WhyDoesntThisWork:
    def something(self, letter, d):
        # do something pointless for the example
        for x in range(d):
            letter = chr(ord(letter) + 1)
        return letter

if __name__ == '__main__':
    executor = ProcessPoolExecutor(4)
    letter = 'A'
    obj = WhyDoesntThisWork()
    futures = [executor.submit(obj.something, letter, d) for d in range(4)]
    for future in as_completed(futures):
        print(future.result())


text:
Q: Signing into Backand Using BackAnd SDK Attempting to sign in (and enter a session) using user credentials in an Angular app using the Backand SDK.  From the Backand docs I am attempting to sign in using the Backand.signin() method (from my local) which looks to be initially sending an OPTIONS http request to the API which unfortunately is causing this cross origin error:

XMLHttpRequest cannot load https://api.backand.com/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:xxxx' is therefore not allowed access. The response had HTTP status code 400.

The exact response from the endpoint is: {"error":"unsupported_grant_type"}
I've combed through the documentation extensively but can't find anyone else having these errors.
This is exact code I am using:
function Login(username, password, callback) {
    Backand.signin(username, password).then(function(response){
        console.log(response);
    }, function(error){
        console.log(error);
    });
}

The error is logged to the console as a null object.

A: It looks like the error was in fact on my end.
While attempting to set up my own Authorization service in my Angular app I inadvertently was adding an encoded Authorization token header somehow.  When the requests were being made to Backand from the Backand SDK, the headers were not correctly set and thus causing issues.


text:
Q: MSSQL Server Express: How to reclaim unused space At our company we are using a proprietary third party custom application that uses SQL Server Express as its backend. As you are aware SQL Server Express 2008 has a hard 10GB limit. For the "old" data in this database, we have a separate database offsite to which we store the data.
I am aware that purchasing SQL Server Enterprise would solve this issue, but being a small company, this is not a solution for us at this point in time. We do not need "old" records to be stored in the "live" SQL Express database that is being used by the proprietary software. So I can delete the "old" records from the SQL Express database, but the problem I am experiencing is how to reclaim the space consumed by the "old" data after deleting this data. I don't want to increase fragmentation by using the DBCC SHRINKDATABASE command. But any command I run, to rebuild the index, or shrink the database or the log files, doesn't reclaim this space. The 10GB database is currently showing less than 100MB of unused space according to sp_spaceused. I appreciate any of your input or help with this issue from one drop of SQL to another.

A: You will need to shrink the database if you want to reclaim the free space.

A: As Jason said, if you want the available space back, you'll need to shrink the database.
However, you say that SQL reports that there's only 100 MB of unused space. Presumably you're expecting this figure to be higher? If so, how much space would you expect to be able to claim back?
Reorganizing (rather than rebuilding) the indexes would take less working space. Have you tried that?