text:
Q: Path range index is not working in marklogic 9 I have to search words in specific path and for that I have set the path range index in admin and tried the below code in query console but it is not working.
cts:search(fn:doc(),cts:path-range-query("/root/author/name","=","word"),"unfiltered")
I have tried with the relative path and absolute path but it is not working. It is not even giving error.
Please suggest.

A: For me on v9.0-9, if I add a path-range-index for path author/name, type string, root collation, then a search of
cts:search(fn:doc(),cts:path-range-query("author/name","=","smith"),"unfiltered")

finds
<doc><author><name>smith</name></author></doc>

but doesn't find
<doc><author><name>zachary smith</name></author></doc>

However, if you are really searching for words, then a range index may not be what you need.  Take a look at value queries at
https://help.marklogic.com/Knowledgebase/Article/View/476/0/understanding-search-value-queries
or fields
http://docs.marklogic.com/guide/admin/fields


text:
Q: Android Studio passes wrong arguments to make in Android NDK Android Studio is passing wrong arguments to make of NDK and this results in a compilation error. I'm trying to compile Cool Reader and it looks like Andorid Studio has messed up the path symbol ( \ and /). The original source was built on Linux and thereby the path is specified as /.
In file included from C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\cr3engine.cpp:18:0:
C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\/docview.h:7:23: fatal error: lvdocview.h: No such file or directory
compilation terminated.
make.exe: *** [C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\build\ndk\debug\obj/local/armeabi-v7a/objs/cr3engine-3-1-0/C_\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\cr3engine.o] Error 1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Gowtham\adt-bundle-windows-x86\ndk\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\build\ndk\debug\Android.mk APP_PLATFORM=android-17 NDK_OUT=C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\build\ndk\debug\obj NDK_LIBS_OUT=C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\build\ndk\debug\lib APP_ABI=all
Error Code:
    2
Output:
    In file included from C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\cr3engine.cpp:18:0:
    C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\/docview.h:7:23: fatal error: lvdocview.h: No such file or directory
    compilation terminated.
    make.exe: *** [C:\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\build\ndk\debug\obj/local/armeabi-v7a/objs/cr3engine-3-1-0/C_\Gowtham\adt-bundle-windows-x86\eclipse\projects\android1\app\src\main\jni\cr3engine.o] Error 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Docview.h is called by #include "docview.h"

redpajama_set_name: RedPajamaStackExchange


text:
Q: OpenShift: can't connect to MySQLdb with a cron python script I'm setting up an application on OpenShift. It requires a Python script to run every hour and extract data from an online server into a MySQL database on OpenShift. I've been filling this database for some time now by running the Python script locally on my computer and using the port-forward technique. This works like a charm. Underneath is the port-forwarding info that's displayed while doing this.
Service Local               OpenShift
------- -------------- ---- -------------------
httpd   127.0.0.1:8080  =>  127.12.248.131:8080
mysql   127.0.0.1:3306  =>  127.12.248.130:3306
node    127.0.0.1:8081  =>  127.12.248.129:8080

Press CTRL-C to terminate port forwarding

And the variables I use in my local script...
host='127.0.0.1'
user='user_placeholder'
passwd='password_placeholder'
db='3v3'
port=3306

Of course I'd like the script to run automatically on the server of OpenShift so I don't have to do so myself. After a quick search I stumbled upon the cron method. It's possible to just put a python script in a map to make it run every hour. I set up some environment variables to access my database, just like I did in the local script. However, the script can't seem to connect to the MySQL database when I tail it. I've even printed the environment variables out and they're exactly the same as the ones I used to succesfully port-forward.
host=os.environ['OPENSHIFT_EXTMYSQL_DB_HOST'] # prints '127.12.248.130'
user=os.environ['OPENSHIFT_EXTMYSQL_DB_USERNAME'] # prints 'user_placeholder'
passwd=os.environ['OPENSHIFT_EXTMYSQL_DB_PASSWORD'] # prints 'password_placeholder'
db=os.environ['OPENSHIFT_EXTMYSQL_DB_NAME'] # prints '3v3'
port=int(os.environ['OPENSHIFT_EXTMYSQL_DB_PORT']) # prints 3306

The error message:
File "/var/lib/openshift/57c57f1889f5cfd9bb00006b/app-root/runtime/repo/.openshift/cron/minutely/test.py", line 36, in <module>
db = MySQLdb.connect(host=os.environ['OPENSHIFT_EXTMYSQL_DB_HOST'], user=os.environ['OPENSHIFT_EXTMYSQL_DB_USERNAME'], passwd=os.environ['OPENSHIFT_EXTMYSQL_DB_PASSWORD'], db=os.environ['OPENSHIFT_EXTMYSQL_DB_NAME'], port=int(os.environ['OPENSHIFT_EXTMYSQL_DB_PORT']))

File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)

File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)

_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '127.12.248.130' (113)")

I honestly don't know where this could go wrong. I know that it's not much of a lead but if anyone thinks to know what the problem could be, I'd be glad to hear.


text:
Q: How are the cardinalities of the object images of adjoint functors related? Here is a very silly question:
Adjoint functors satisfy
$$\mathrm{hom}_{\mathcal{C}}(FA,B) \cong \mathrm{hom}_{\mathcal{D}}(A,GB).$$
I consider numbers $a,b$ and read this as
$$b^{\,f(a)}=g(b)^a.$$
If the objects in the categories can be assigned cardinalities, do the functors actually fulfill a relation along those lines?

$\bf Edit$: If e.g. $|B^{FA}|=|B|^{|FA|}$ does make sense, just taking the cardinalities of the hom-sets tells us
$$\frac{|FA|}{|A|}=\log_{|B|}|GB|.$$
E.g. in a category with object being sets, the adjoint functors $FA:=A\times I$ and $GB:=B^I$ have
$\frac{|FA|}{|A|}=\frac{|A\times I|}{|A|}=|I|\ \ \ $ and $\ \ \ \log_{|B|}|GB|=\log_{|B|}|B^I|=|I|$.

A: I don't know if we can interpret this as an equation of numbers, but what about the following: For objects $a,b$  of a category the exponential $b^a$ is an object with a natural bijection $\hom(c,b^a) \cong \hom(c \times a,b)$. A category is called cartesian closed if it has all binary products and exponentials for any two objects. Now assume that $C$ is cartesian closed. Assume that $F : C \to C$ is left adjoint to $G$. We want to compare $b^{F(a)}$ with $G(b)^a$. Thus, we want to compare
$$\hom(c,b^{F(a)})=\hom(c \times F(a),b)$$
with
$$\hom(c,G(b)^a) = \hom(c \times a,G(b)) = \hom(F(c \times a),b)$$
Therefore, a natural isomorphism $b^{F(a)} \cong G(b)^a$ corresponds to a natural isomorphism $c \times F(a) \cong F(c \times a)$. Taking $a$ to be the terminal object $1$ and letting $x=F(1)$, we get that $F(c) \cong c \times x$. It follows $G(b) \cong b^x$. Therefore, the isomorphism reduces to the plausible isomorphism
$$b^{a \times x} \cong (b^x)^a.$$
This can be also checked directly. For arbitrary $F$, I don't know how to make sense of $b^{F(a)} \cong G(b)^a$.


text:
Q: Simple java arraylist programming question I am trying to tell whether that string was found in the list or not.
For instance, if I put Max in my list and search for Max, it should say "Max was found" If not, then it should say "Max was not found"
I do not know how to approach to getting the answer from here.
import java.util.ArrayList;
import java.util.Scanner;

public class OnTheList {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        ArrayList<String> list = new ArrayList<>();
        while (true) {
            String input = scanner.nextLine();
            if (input.equals("")) {
                break;
            }

            list.add(input);

        }

        System.out.print("Search for? ");
        System.out.print(scanner.nextLine());

        if (list.contains(list)) ----> I think this is the part where I am not getting it
            System.out.println(" was found!");
        else
            System.out.println(" was not found");

    }
}

A: You may store the word to search, here you ask for it with scanner.nextLine() and print it but didn't save it. Then use the variable you saved the word in, to check into the List
System.out.print("Search for? ");
String toSearch = scanner.nextLine();

if (list.contains(toSearch))
    System.out.println(toSearch + " was found!");
else
    System.out.println(toSearch + " was not found");

A: Here you didn't store the user input that you are getting from Search for ,and you are trying to search an element of the list but passing list as the argument for the contains() method ,So first store the user input for a variable the search that input by passing it as the argument to contains() method and make sure to close the scanner variable at the end of the program to avoid memory leaks like below.
import java.util.ArrayList;
import java.util.Scanner;

public class OnTheList {

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    ArrayList<String> list = new ArrayList<>();
    while (true) {
        String input = scanner.nextLine();
        if (input.equals("")) {
            break;
        }

        list.add(input);

    }

    System.out.print("Search for? ");
    String toSearch = scanner.nextLine();

    if (list.contains(toSearch))
        System.out.println(" was found!");
    else
        System.out.println(" was not found");

    scanner.close();

}
}


text:
Q: foursquare Invalid response My foursquare code was running fine all these days and suddenly it stopped working giving the following error message.
I am using the python foursquare wrapper [1]: https://pypi.python.org/pypi/foursquare/2014.01.18
ERROR:foursquare:Invalid response:

<title> ssl-cache-at51.hosts.fastly.net</title>

unknown domain: ssl-cache-at51.hosts.fastly.net
ERROR:foursquare:Invalid response:

<title> ssl-cache-at50.hosts.fastly.net</title>

unknown domain: ssl-cache-at50.hosts.fastly.net

Does anyone know how to solve this issue ?

A: Seems like either:

*

*Your requests are going through some sort of ISP proxy that's jamming you up

or

*

*Foursquare is having issues on their end

ref:
https://github.com/mLewisLogic/foursquare/issues/45


text:
Q: How can I merge two branches without losing any files? I have two branches with the following files in there:
branch a:
file_a
file_b
file_c

branch b:
file_a
file_d
file_e

I want to merge them, so that I get both files from a and b (and files that exist in both should normally be merged)! is that possbile?

A: this might help: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
in your case you would do the following:

*

*git checkout a (you will switch to branch a)

*git merge b (this will merge all changes from branch b into branch a)

*git commit -a (this will commit your changes)

take a look at above link to get the full picture.


text:
Q: Ember camelize() vs javaScript camelize() I'm trying to camelize an extracted value from an ember view, and I was hoping to get the lower case camelized form of a string as is written here http://docs.emberjs.com/symbols/Ember.String.html#.camelize
However, what I'm getting back is the capitalized version of it (the extracted value started off as Capitalized).

A: Try this Ember.String.camelize("my lovely property") which gives you myLovelyProperty

A: I can confirm that My-Lovely-Property isn't converted to myLovelyProperty. Nor is MY-LOVELY-PROPERTY -- it leaves those "OVELY" "ROPERTY" caps alone too and yields MYLOVELYPROPERTY which certainly doesn't feel like camel case. I'm not sure if that behavior is intended or not, but it seems neither this case nor yours is covered by the test examples.
If you or anyone else believes strongly that such cases should be covered in some way, perhaps submit a github issue or PR? Otherwise, for the case you describe you can use an expression like str.charAt(0).toLowerCase() + str.substr(1).camelize().


text:
Q: Hamiltonian flow vs Gradient flow A Hamiltonian vector field in a symplectic manifold is the analog of a gradient vector field in Riemannian manifold.
A simple computation using Cartan's magic formula shows that a Hamiltonian vector field preserves the symplectic structure, equivalently its flow acts by symplectomorphisms. However it is not the case that a gradient flow preserves the Riemannian metric, even for a Euclidean metric.
Why does it work in one case and not the other? I mean, I understand the computations, but is there any insight that can be given?


text:
Q: Bug in Gold Parser? LALR Here is a piece of my bnf grammer.
//this works
<ter-stmnt>     ::= <rval> '?' <rval> ':' <rval>
//this gets an error
<ter-stmnt>     ::= <bool-val> '?' <rval> ':' <rval>
<bool-val>      ::= <rval>

This seems insane, shouldnt the second be EXACTLY the same as the first? i prefer the second bc when reading i see that i expect a bool value as oppose to the generic rval which can mean anything.
I am using Gold Parser 3.4.4

A: The error that you're getting is:

Reduce-Reduce Conflict

  '?' can follow more than one completed rule. A Reduce-Reduce error is a caused when a grammar allows two or more rules to be reduced at the same time, for the same token. The grammar is ambigious. Please see the documentation for more information.

It's saying that after it's evaluated some tokens, it's unable to decide whether it's just read a <bool-val> or whether it read an <rval>.
To make more sense your grammar ought to say what a <bool-val> is, specifically, and  then say that an <rval> is a <bool-val> or other things.
Here's another example of a reduce/reduce error, and here's the GOLD documentation. Gold will try to hide (i.e. emit a warning instead of an error) about a shift/reduce, but it treats reduce/reduce as an error.
I don't entirely understand this; I'm new to parsing. Maybe you're right about this being unexpected behaviour? However the GOLD mailing list seems to be down at the moment, perhaps because it's moderated and Devin has been offline for months.

A: What error do you get? Can you include your whole grammar file? I don't get any error if I declare rules like ...
<ter-stmnt>     ::= <bool-val> '?' <rval> ':' <rval>
<bool-val>      ::= <rval>
<rval>  ::= '!'


text:
Q: Java LWJGL - Function is not supported error when trying to render GUI I am trying to render simple GUI elements to my screen over my 3D game. When I run my program,I get an IllegalStateException saying the Function is not supported. It throws up in the GUI class on the drawRect method:
package renderEngine;

import org.lwjgl.opengl.GL11;

public class GUI {
public float getRedFromHex(int color) {
    return (float)(color >> 16 & 0xFF) / 255F;
}
public float getGreenFromHex(int color) {
    return (float)(color >> 8 & 0xFF) / 255F;
}
public float getBlueFromHex(int color) {
    return (float)(color & 0xFF) / 255F;
}
public float getAlphaFromHex(int color) {
    return (float)(color >> 24 & 0xFF) / 255F;
}

public void drawRect(float x, float y, float width, float height, int color) {
    float r = this.getRedFromHex(color);
    float g = this.getGreenFromHex(color);
    float b = this.getBlueFromHex(color);
    float a = this.getAlphaFromHex(color);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glColor4f(r, g, b, a);
    GL11.glBegin(GL11.GL_QUADS);
        GL11.glVertex2f(x, y);
        GL11.glVertex2f(x + width, y);
        GL11.glVertex2f(x + width, y + height);
        GL11.glVertex2f(x, y + height);
    GL11.glEnd();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}

I am calling the method in my render class:
private GUI gui = new GUI();

public void render(Light sun, Camera camera) {
    prepare();
    shader.start();
    shader.loadSkyColour(RED,GREEN,BLUE);
    shader.loadLight(sun);
    shader.loadViewMatrix(camera);
    renderer.render(entities);
    shader.stop();
    terrainShader.start();
    terrainShader.loadLight(sun);
    terrainShader.loadViewMatrix(camera);
    terrainShader.loadSkyColour(RED,GREEN,BLUE);
    terrainRenderer.render(terrains);
    terrainShader.stop();
    gui.drawRect(100, 100, 300, 300, 0x00000000);
    terrains.clear();
    entities.clear();
}

What am I doing wrong?
EDIT:
Here is the stack trace :P
Exception in thread "main" java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL11.glColor4f(GL11.java:893)
at renderEngine.GUI.drawRect(GUI.java:28)
at renderEngine.MasterRenderer.render(MasterRenderer.java:85)
at engineTester.MainGameLoop.main(MainGameLoop.java:147)

A: Since version 3.0 Opengl introduced a deprecation model, the functions like glVertex, glColor, glTexCoord, etc., are deprecated.
These deprecated functions are removed in the core profile, they no longer exist, and hence you are greeted with that exception.
What you have to do is instead read up on modern way of opengl, VBOs and VAOs.


text:
Q: LISP macro fail, crashes slime I am using common lisp with slime in emacs and am trying to define a simple macro. However when I run the macro, the emacs slime buffer becomes unresponsive and my computer quickly becomes unusable. Even after exiting emacs I get error messages at the bash prompt about not being able to allocate memory.
I want to use my macro to write functions such as these two
(defun triad (foo scale)
  "Generates a triad on scale-step FOO of scale SCALE"
  (list (%part (- foo 1) scale)
    (%part (+ foo 1) scale)
    (%part (+ foo 3) scale)))

(defun quad (foo scale)
  "Generates a quad on scale step FOO of scale SCALE"
  (list (%part (- foo 1) scale)
    (%part (+ foo 1) scale)
    (%part (+ foo 3) scale)
    (%part (+ foo 5) scale)))

using a syntax like
(defchord 'mtriad '(1 3 5))
(defchord 'mquad  '(1 3 5 7))

I decided to use mapcar and a lambda function to generate the output I want. At the interpreter, this works to generate the  I want:
CL-USER> (mapcar (lambda (x) `(%part (+ ,x 2) scale)) '(1 3 5))
((%PART (+ 1 2) SCALE) (%PART (+ 3 2) SCALE) (%PART (+ 5 2) SCALE))

However when I try to put it inside of a macro in order to generate the defun call, it crashes slime and kills my memory as soon as I call it:
(defmacro defchord (name steps)
  `(defun ,name (foo scale)
     (quote ,(mapcar (lambda (x) `(%part (+ ,x 2) scale)) steps))))

I'm hoping this is a simple rookie mistake!

A: Your are quoting inside quote and you are quoting your arguments as if they were functions. If that is acceptable you could just make it a function:
(defun defchord (name steps)
  (setf (symbol-function name)
        (lambda (foo scale)
          (mapcar (lambda (step)
                    (%part (+ foo step) scale))
                  steps)))
  name)

;; test
(defchord 'mtriad '(1 3 5)) ;==> mtriad
(defun %part (x y) (cons x y))
(mtriad 2 10) ; ==> ((3 . 10) (5 . 10) (7 . 10))

A: Here's my implementation of the macro that generates the functions you initially listed:
(defmacro defchord (name steps)
  `(defun ,name (foo scale)
     ,(concatenate 'string "Generates a " (symbol-name name) " on scale-step FOO of scale SCALE")
     (list ,.(mapcar (lambda (i) `(%part (+ foo ,i) scale)) steps))))

Some examples:
> (macroexpand-1 '(defchord triad (-1 1 3)))
(DEFUN TRIAD (FOO SCALE)
  "Generates a TRIAD on scale-step FOO of scale SCALE"
  (LIST (%PART (+ FOO -1) SCALE) (%PART (+ FOO 1) SCALE)
        (%PART (+ FOO 3) SCALE)))

> (macroexpand-1 '(defchord quad (-1 1 3 5)))
(DEFUN QUAD (FOO SCALE)
  "Generates a QUAD on scale-step FOO of scale SCALE"
  (LIST (%PART (+ FOO -1) SCALE) (%PART (+ FOO 1) SCALE)
        (%PART (+ FOO 3) SCALE) (%PART (+ FOO 5) SCALE)))

That looks like a pretty good match for the functions you listed, I think. :-)


text:
Q: How to delete a line with starts with function by python3 I want to delete a line in 50,000 wikipages. Because that line is a dead external web page link. For example,  have a look at this wiki page.
The line consists of two parts. one is starting text another is the URL.
THe URL varies for each and every word but the text always starts with '*தமிழ் இணையப் பல்கலைக்கழக அகரமுதலியில் '. How can i delete the line which starts with fuction?
Sample code :

#!/usr/bin/env python
#-*- coding: utf-8 -*-
wikiPage = '''==உசாத்துணை==
* தமிழ் இணையப் பல்கலைக்கழக அகரமுதலியில்  [http://www.tamilvu.org/slet/servlet/o33.o33searh?CboSelect=1&TxtSearch=abdominal+muscle&OptSearch=&id=All abdominal muscle]'''

# part1 is a line of  'starts with'
part1 = '* தமிழ் இணையப் பல்கலைக்கழக அகரமுதலியில் '
part2 = '[http://www.tamilvu.org/slet/servlet/o33.o33searh?CboSelect=1&TxtSearch=abdominal+muscle&OptSearch=&id=All abdominal muscle]'
print(wikiPage.replace('part1',''))

How to delete part2 too? Please note that part2 is a url which differs fro every wiki page.

A: Create a new list (or however you store lines) of lines, then iterate through the old list, and only add lines that don't start with that string.
START_OF_LINE = "*தமிழ் இணையப் பல்கலைக்கழக அகரமுதலியில்"
new_lines = [] # or however you store lines

for line in lines:
    if line.startswith(START_OF_LINE):
        pass
    else:
        new_lines.append(line)

A: s_line = '*தமிழ் இணையப் பல்கலைக்கழக அகரமுதலியில்'

lines = [line for line in lines if not line.startswith(s_line)]


text: Q: How to rotate and move node in swift How to code this problem in swift, if touch position is at 30 degree angle of the current node position then move the node by rotating it by 30 degree to the destination point.


text:
Q: assets:precompile end of file reached I'm attempting to run a assets:precompile on my Rails 4 application but I keep getting:
rake aborted!
end of file reached

I am running this command on my VPS after capistrano complained of the same error. Any ideas?
[deploy@skateboxes skateboxes]$ cd /var/www/skateboxes/releases/20131024204508 && ( RAILS_ENV=production /usr/local/rvm/bin/skateboxes_rake assets:precompile )
rake aborted!
end of file reached
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/core_ext/marshal.rb:6:in `load'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/core_ext/marshal.rb:6:in `load_with_autoloading'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `block in []'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `open'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `open'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `[]'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:14:in `cache_get'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:84:in `cache_get_hash'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:54:in `cache_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/var/www/skateboxes/shared/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

A: This may be happening when there is a file in the cache directory that cannot be unmarshaled. Try cleaning up the temp directory.
https://github.com/sstephenson/sprockets/blob/v2.10.0/lib/sprockets/cache/file_store.rb


text:
Q: Transition EF Core 3.1 to storing string enum values, rather than ints I'd like to know if there is an elegant solution to the problem of an existing database that stores enum values as ints, but wanting to transition to storing strings for new records, but leave the ints alone in old records. Naturally, we can make the column types from int to string, and "2" meaning "Ready" can still be stored in a string column..
Is there a technique that allows EF to parse either "2" or "Ready" to that Status.Ready in enum Status { Ready = 2 } ? I know that EF Core has an EnumStringConverter that can understand "Ready" -> Status.Ready but is there a way of extending or customizing it so that it tries to parse the db value both ways? ("Ready" as enum element name -> success, "2" as enum element name -> fail, "2" as enum element value -> success) Would we write a conversion process that e.g examined if all the characters in the db value were numeric and hence parse it as a value, else parse it as a name?
Or do people who switch from using ints to using strings also write a massive migration to UPDATE every value in every enum'd column so that all the existing "2" become "Ready" ?

A: You could use a custom converter, like the following
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder
        .Entity<MyEntity>()
        .Property(e => e.MyStatusColumn)
        .HasConversion(
            v => v.ToString(),
            v => int.TryParse(v, out int val) ?
                 (Status)val :
                 (Status)Enum.Parse(typeof(Status), v)
        );
}

A: From my own practice, I store enum values as int in the database. For presentation purposes in the client side, I do the following trick.
In the entity class that has your enum property, Status, create another property that gets string value of that enum:
 public enum Status
 {
    None,
    Ready,
    InProcess,
    NotReady
 }

 public class Process
 {
    public int Id { get; set; }
    public Status Status { get; set; }
    public string GetStatus
    {
        get
        {
            return Status.ToString();
        }
    }
 }

Here, if your Process object has 1 as value of the Status property, the GetStatus property just returns Ready string.
Hope, this answers to your question.


text:
Q: jar execution says -- "com.mysql.jdbc.Driver" not found I have designed a project Database Migration.
While I run it from netbeans directly it executes properly, but when I use its jar - which is created by netbeans - then it gives an exception
com.mysql.jdbc.Driver not found
pls help me

A: You need to put the JDBC driver at the path. It is working in Netbeans, because it has configured it for you. Search how to set JDBC driver by downloading it from MySQl.

A: download the mysql jdbc driver jar and copy it the lib folder


text:
Q: How do I split Kotlin flow by some property of flowed objects Imagine we have an old good CRUD service over some User entity. We also have kind of event-driven system and we want to emit UserUpdated event every time when User is updating. Event object contains an userId: Int property.
On the event listener side we want to protect our system from event spamming. As far as I know, the most straightforward way to do this in Kotlin is to pass all event through flow with debounce operator. Now I guess if we get 10 events during 1 second we will pass to processing only the last one.
    flow
        .debounce(1000)
        .onEach { doSmthWithEvent(...) }
        .launchIn(coroutineScope)

But we don't want to debounce all events indiscriminately. We want to debounce only events related to particular userId. First thing that comes to my mind is to have a dedicated flow for each userId. But since we can have a hundreds of users we will  have a hundreds of flows in memory. Flows are lightweight but anyway it looks too bruteforce-ish.
So the question is are there any ways to kind of split a single flow by some event property into subflows and to apply debounce to this new subflow? Something like that
    flow
        .debounceBy(1000) { it.userId }
        .onEach { doSmthWithEvent(...) }
        .launchIn(coroutineScope)

A: I guess you can filter users by particularId and then use debounce if I correctly understand your issue:
flow
    .filter { it.userId == particularId }
    .debounce(1000)
    .onEach { doSmthWithEvent(...) }
    .launchIn(coroutineScope)


text:
Q: Get parent object from key or its value in a nested object I have an object which contains all information about folders and files of a directory in hierarchical manner.
for example
{
  "path": "./parent",
  "name": "parent",
  "type": "folder",
  "children": [
    {
      "path": "./parent/child1",
      "name": "child1",
      "type": "folder",
      "children": [
        {
          "path": "./parent/child1/file1",
          "name": "file1",
          "size": 651956838,
          "extension": ".pdf",
          "type": "file"
        },
        {
          "path": "./parent/child1/file2",
          "name": "file2",
          "size": 468327031,
          "extension": ".pdf",
          "type": "file"
        }
      ]
    },
    {
      "path": "./parent/child2",
      "name": "child2",
      "type": "folder",
      "children": [
        {
          "path": "./parent/child2/file3",
          "name": "file1",
          "size": 651956838,
          "extension": ".pdf",
          "type": "file"
        },
        {
          "path": "./parent/child2/file4",
          "name": "file2",
          "size": 468327031,
          "extension": ".pdf",
          "type": "file"
        }
      ]
    }
  ]
}

Now, I will have the path value and from this information I want to access the children property, which is sibling to the key of which that path was value of.
Say, I have path "./parent/child1", then I want to have the value of children property relative to this path which will be
  [
    {
      "path": "./parent/child1/file1",
      "name": "file1",
      "size": 651956838,
      "extension": ".pdf",
      "type": "file"
    },
    {
      "path": "./parent/child1/file2",
      "name": "file2",
      "size": 468327031,
      "extension": ".pdf",
      "type": "file"
    }
  ]

So I want to know if it is possible or not. If yes then how and if not then is there any other way to achieve similar result?

A: This can be done using a recursive function.

const paths = {
  "path": "./parent",
  "name": "parent",
  "type": "folder",
  "children": [
    {
      "path": "./parent/child1",
      "name": "child1",
      "type": "folder",
      "children": [
        {
          "path": "./parent/child1/file1",
          "name": "file1",
          "size": 651956838,
          "extension": ".pdf",
          "type": "file"
        },
        {
          "path": "./parent/child1/file2",
          "name": "file2",
          "size": 468327031,
          "extension": ".pdf",
          "type": "file"
        }
      ]
    },
    {
      "path": "./parent/child2",
      "name": "child2",
      "type": "folder",
      "children": [
        {
          "path": "./parent/child2/file3",
          "name": "file1",
          "size": 651956838,
          "extension": ".pdf",
          "type": "file"
        },
        {
          "path": "./parent/child2/file4",
          "name": "file2",
          "size": 468327031,
          "extension": ".pdf",
          "type": "file"
        }
      ]
    }
  ]
}

const pathtofind = "./parent/child1";

function findChildrenInPath(object, path) {
    if (path.startsWith(object.path)) {
        if (object.path == path) {
            return object.children;
        }
        else {
            for (let child of object.children) {
                const result = findChildrenInPath(child, path);
                if (result) {
                    return result;
                }
            }
        }
    }
}

const res = findChildrenInPath(paths, pathtofind);
console.log(res);

A: And here is another approach, without recursion:

const data={
  "path": "./parent",
  "name": "parent",
  "type": "folder",
  "children": [
{
  "path": "./parent/child1",
  "name": "child1",
  "type": "folder",
  "children": [
    {
      "path": "./parent/child1/file1",
      "name": "file1",
      "size": 651956838,
      "extension": ".pdf",
      "type": "file"
    },
    {
      "path": "./parent/child1/file2",
      "name": "file2",
      "size": 468327031,
      "extension": ".pdf",
      "type": "file"
    }
  ]
},
{
  "path": "./parent/child2",
  "name": "child2",
  "type": "folder",
  "children": [
    {
      "path": "./parent/child2/file3",
      "name": "file1",
      "size": 651956838,
      "extension": ".pdf",
      "type": "file"
    },
    {
      "path": "./parent/child2/file4",
      "name": "file2",
      "size": 468327031,
      "extension": ".pdf",
      "type": "file"
    }
  ]
}
  ]
};

function getChildrenOf(fs,pth){
  let ptha=pth.split('/');
  ptha.forEach((d,i,a)=>a[i]=(i?a[i-1]+'/':'')+d);
  // console.log(ptha);
  return ptha.filter(d=>d!==".").reduce((a,c)=>
a=a.find(d=>d.path===c && d.type==="folder").children
  ,[fs]);
}

console.log(getChildrenOf(data,"./parent/child1"));

As the data array does not contain any information about the current directory (./) I remove that element from the ptha array. Otherwise the search will allow searches in arbitrary depths of file structures.


text:
Q: Installed Java 14 but Java -version still showing old Java I have installed java 14 in my system at following location.C:\Program Files\Java\jdk-14.0.1 but on running java -version it is still pointing to java version "1.8.0_251". How do I change that to point to Java 14.
I have set my JAVA_HOME to C:\Program Files\Java\jdk-14.0.1\bin and appended the same to Path of system variables but still it is showing the older version.
Why is it happening, a little help will be deeply appreciated. Thanks

A: I found the problem, the Path system variable had entries from previously installed java versions. removing them did the trick. Thanks all for helping out with comments.


text:
Q: Speed up a nested Python loop while updating a dictionary I have the following Python nested loop and trying to decrease its execution time. I have tried a few optimizations but don't help much. I was wondering if someone can give some hints or if there is any Pythonic way or etc.
def(input_list, A, B, threshold):
   a_dict = {}
   idx = 0
   for sc, nb in zip(A, B):
       b_dict = {}
       for s, n in zip(sc, nb):
           if s >= threshold:
                b_dict.update(init_dict(n, s))
       a_dict[input_list[idx]] = b_dict
       idx += 1
   return a_dict

both A and B are numpy.ndarray.
For example, one of the optimizations I tried was to avoid the function call to init_dict(n,s) and directly update the b_dict without needing having a function call and creating another dictionary inside it, return it and then update the b_dict, which helps a bit. But any more optimization to avoid two loops for example or using multiprocessing or threading?
A is something like this:
 [[0.8921996  0.91602445 0.92908716 0.9417222  0.96200365]
  [0.4753568  0.6385271  0.6559716  0.67830306 0.7077361 ]
  [0.700236   0.75287104 0.7589616  0.7638799  0.77096677]
  ....
 ]

and B is:
 [[682506892 693571174 668887658 303551993  27694382]
  [ 15028940  14862639  54801234  14711873  15136693]
  [567664619 217092797 399261625 124879790 349055820]
  ....
 ]

The returned value (a_dict), is something like this:
 {
  '147840198': {
   '567664619': 0.7002360224723816, '217092797': 0.752871036529541,
   '399261625': 0.7589616179466248, '124879790': 0.7638798952102661,
   '349055820': 0.7709667682647705
   },
  '485045174': {
   '627320584': 0.24876028299331665, '297801439': 0.3101433217525482,
   '166126424': 0.3392677307128906, '579653715': 0.3781401515007019,
   '880315906': 0.40654435753822327
   },
  '39703998': {
   '273891679': 0.667972981929779, '972073794': 0.8249127864837646,
   '17236820': 0.8573702573776245, '675493278': 0.8575121164321899,
   '163042687': 0.8683345317840576
   },
  '55375077': {
   '14914733': 0.7121858596801758, '28645587': 0.7306985259056091,
   '14914719': 0.7347514629364014, '15991986': 0.7463902831077576,
   '14914756': 0.7500130534172058
   },
   .....
 }

_init_dict(n,s) is a function that gets n and s as key and value, respectively and returns a dictionary. As I mentioned, earlier, that step is not needed and we can directly use n and s, as key-value pair for b_dict.
threshold can be a number between zero and one and input_list is a list of strings such as bellow:
 ['147840198', '485045174', '39703998', '55375077', ....]

A: Ok, so given that the sub-lists in A are sorted, this collapses down pretty quickly.  Anytime you are looking for a threshold within a sorted list, looping is a BAD idea.  Bisection search is usually the weapon of choice.
Here are a couple (progressively better) variations on your code.  chopper3() gets this down to a 1-liner with a dictionary comprehension
from bisect import bisect_left

def chopper(output_keys, A, B, threshold):
    a_dict = {}
    for idx, (sc, nb) in enumerate(zip(A, B)):
        b_dict = {}
        chop_idx = bisect_left(sc, threshold)
        a_dict[output_keys[idx]] = {k:v for k,v in zip(nb[chop_idx:], sc[chop_idx:])}
    return a_dict

def chopper2(output_keys, A, B, threshold):
    chop_idx = [bisect_left(a, threshold) for a in A]
    res = {output_key: dict(zip(k[chop_idx:], v[chop_idx:])) for
        output_key, v, k, chop_idx in zip(output_keys, A, B, chop_idx)}
    return res

def chopper3(output_keys, A, B, threshold):
    return {output_key: dict(zip(k[chop_idx:], v[chop_idx:]))
            for output_key, v, k in zip(output_keys, A, B)
            for chop_idx in (bisect_left(v, threshold),)}

A = [   [0.50, 0.55, 0.70, 0.80],
        [0.61, 0.71, 0.81, 0.91],
        [0.40, 0.41, 0.42, 0.43]]

B = [   [123, 456, 789, 1011],
        [202, 505, 30, 400],
        [90, 80, 70, 600]]

output_keys = list('ABC')

print (chopper(output_keys, A, B, 0.55))
print (chopper2(output_keys, A, B, 0.55))
print (chopper3(output_keys, A, B, 0.55))

Yields:
{'A': {456: 0.55, 789: 0.7, 1011: 0.8}, 'B': {202: 0.61, 505: 0.71, 30: 0.81, 400: 0.91}, 'C': {}}
{'A': {456: 0.55, 789: 0.7, 1011: 0.8}, 'B': {202: 0.61, 505: 0.71, 30: 0.81, 400: 0.91}, 'C': {}}
{'A': {456: 0.55, 789: 0.7, 1011: 0.8}, 'B': {202: 0.61, 505: 0.71, 30: 0.81, 400: 0.91}, 'C': {}}
[Finished in 0.0s]


text:
Q: Not able to set ApplicationUser as foreign key without EF is creating a new table Im new in ASP.NET Core and EF.
When i try to add ApplicationUser as a foreign key, EF will create a new table "ApplicationUser" but i want to relate this field with the Identity Framework Table "ASPNetUser".
What do i wrong?
This is my code:
    public class Posts
{
    public int Id { get; set; }
    public string Content { get; set; }
    public DateTime Created { get; set; }
    [Key]
    public int CreatorId { get; set; }

    [ForeignKey("CreatorId")]
    public ApplicationUser Creator { get; set; }
}

EF created the migration like this:
  migrationBuilder.CreateTable(
            name: "ApplicationUser",
            columns: table => new
            {
                Id = table.Column<string>(nullable: false),
                UserName = table.Column<string>(nullable: true),
                NormalizedUserName = table.Column<string>(nullable: true),
                Email = table.Column<string>(nullable: true),
                NormalizedEmail = table.Column<string>(nullable: true),
                EmailConfirmed = table.Column<bool>(nullable: false),
                PasswordHash = table.Column<string>(nullable: true),
                SecurityStamp = table.Column<string>(nullable: true),
                ConcurrencyStamp = table.Column<string>(nullable: true),
                PhoneNumber = table.Column<string>(nullable: true),
                PhoneNumberConfirmed = table.Column<bool>(nullable: false),
                TwoFactorEnabled = table.Column<bool>(nullable: false),
                LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
                LockoutEnabled = table.Column<bool>(nullable: false),
                AccessFailedCount = table.Column<int>(nullable: false),
                FirstName = table.Column<string>(type: "nvarchar(150)", nullable: true),
                LastName = table.Column<string>(type: "nvarchar(150)", nullable: true),
                Birthdate = table.Column<DateTime>(type: "DateTime2", nullable: false),
                EntryDate = table.Column<DateTime>(type: "DateTime2", nullable: false)
            },
            constraints: table =>
            {
                table.PrimaryKey("PK_ApplicationUser", x => x.Id);
            });

        migrationBuilder.CreateTable(
            name: "Posts",
            columns: table => new
            {
                Id = table.Column<int>(nullable: false)
                    .Annotation("SqlServer:Identity", "1, 1"),
                Content = table.Column<string>(nullable: true),
                Created = table.Column<DateTime>(nullable: false),
                CreatorId1 = table.Column<string>(nullable: true),
                CreatorId = table.Column<int>(nullable: false)
            },
            constraints: table =>
            {
                table.PrimaryKey("PK_Posts", x => x.Id);
                table.ForeignKey(
                    name: "FK_Posts_ApplicationUser_CreatorId1",
                    column: x => x.CreatorId1,
                    principalTable: "ApplicationUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Restrict);
            });

        migrationBuilder.CreateIndex(
            name: "IX_Posts_CreatorId1",
            table: "Posts",
            column: "CreatorId1");

But my Users will be created in this table:

A: It looks like you want to use the [Table("AspNetUsers")] annotation.
See here: How to Specify Entity Framework Core Table Mapping?
Important Caveat: Since it looks like you're trying to re-use an existing table, you will need to create a migration but then modify it in order to prevent Entity Framework from trying to recreate the table.

A: So i figured it out... i forgot the Releationship in the DBContext...
After i added this, my Migration works as expeted and added ApplicationUser as foreign Key in my Post Model:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    modelBuilder.Entity<Posts>()
        .HasOne(p => p.Creator)
        .WithMany(p => p.Posts)
        .HasForeignKey(p => p.CreatorId)
        .OnDelete(DeleteBehavior.Cascade);
}

A: [Key] attribute is used to create primary key. It being assigned to Creator property caused EF to create separate column
public class Posts
{
    [Key]
    public int Id { get; set; }
    public string Content { get; set; }
    public DateTime Created { get; set; }

    [ForeignKey("Creator")]
    public int CreatorId { get; set; }

    [ForeignKey("CreatorId")]
    public ApplicationUser Creator { get; set; }
}


text:
Q: Toggle dialog not working in jQuery. How to show animation dialog in button click? I have a button which succesfully toggles many elements on the page, but they are all below the height of the starting page, leading to the user not clearly getting feedback that they've succesfully toggled. I want to use a jQuery dialog which toggles open when I succesfully toggle those other elements open.
So I did this (jQuery):
 window.onload = function () {
    $("#toggleAllSSSP").click(function () {
      $(".SSSP").toggle('fast');
      $( "#toggleSuccess" ).dialog({
        autoOpen: false,
        show: {
          effect: "blind",
          duration: 1000
        },
        hide: {
          effect: "explode",
          duration: 1000
        }
      });
      $( "#toggleSuccess" ).dialog( "open" );
    });
};

With inspiration from this page.
And here's the HTML
<button id="toggleAllSSSP">Show 4 levels of principles Principles (Default=3)</button>

You're now displaying 4 levels of Principles!

I tried adding css to #toggleSuccess with the result of an element appearing as normal in the flow of the DOM. I know I could use window.alert but would prefer this solution, thanks.

A: Please initialize your dialog separately (not inside "click" event handler). Also please be sure you've included jquery and jquery.ui to your scripts (+ jquery.ui.css). Hope it helps.

$("#toggleAllSSSP").click(function () {
  $(".SSSP").toggle('fast');
  $("#toggleSuccess").dialog( "open" );
});

$("#toggleSuccess").dialog({
  autoOpen: false,
  show: {
    effect: "blind",
    duration: 1000
  },
  hide: {
    effect: "explode",
    duration: 1000
  }
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<button id="toggleAllSSSP">Show 4 levels of principles Principles (Default=3)</button>

You're now displaying 4 levels of Principles!


text:
Q: Table structure without table tags, only divs I have a table structure with only divs and float left. I want it to be responsive (I know I have to add media queries). There is something wrong in my code. For now I want to reduce the window it changes to horizontal scroll which I tried and it doesn't work.

Here is my code:

FM

TNT

Alarmes

Criticité

Sans Sup

Non nominale

(chart)

2

5

(chart)

10

1

TICKETS

Non nominale

A suivre

Clôs

5

-

2

9

-

0

SITES

Perte HF

-3DB

Décro HS

Alarme RX

Alarme RX

GE

-

8

3

7

1

6

-

5

4

8

0

2

A: Step 1. Remove all the styles from the divs
Step 2 use inline-block instead of float.
Step 3 make each table-row enclosed in its own div with display: block except the ones you want alongside each other, which should be inline-block
Step 4 add a width to the parent div and overflow-x: auto;
Step 5 add a non-wrapping parent div around the two sections you want side-by-side, and put each of those in its own div
(if you want to only have the scrolling on the sites section, put that inside the div with class container)
HTML

FM

TNT

Alarmes

Criticité

Sans Sup

Non nominale

(chart)

2

5

(chart)

10

1

TICKETS

Non nominale

A suivre

Clôs

5

-

2

9

-

0

SITES

Perte HF

-3DB

Décro HS

-

8

3

-

5

4

Alarme RX

Alarme RX

GE

7

1

6

8

0

2

CSS
.pink {
   display: inline-block;
   width:6rem;
   background:pink;
}

.gold {
   display: inline-block;
   width:6rem;
   background:gold;
}
.aqua {
    width:6rem;
    display: inline-block;
    background:aqua;
}

.red {
  background-color: red;
  color: #fff;
  width: 18.5rem;
}

.double-red {
  background-color: red;
  color: #fff;
  width: 37.25rem;
}

.container {
  width: 18.5rem;
  overflow: auto;
}

.row {
  display: block;
}

.side-by-side {
  display: inline-block;
}

.no-wrap {
  width: 37.25rem;
  white-space: nowrap;
}

CodePen here: https://codepen.io/vogelbeere/pen/awxQMW


text:
Q: How to let VS Code know the path to Non-JDK Classes? My Java program imports a non JDK class downloaded and placed in the same directory as my Java file. How do I let VS Code know the path to this class so I don't get the red under squiggle for class not resolved error?
Currently when I compile I need to java -cp /path/to/Non-JDK/class.jar MyClass.java is there a way to add /path/to/Non-JDK/class.jar to the search path of the compiler so I can just java MyClass.java?

A:
You can click Add icon under JAVA PROJECTS -> Referenced Libraries, it will modify "java.project.referencedLibraries" in the settings.json file automatically, or you can modify it directly.


text:
Q: Concatenate list in python (Discord Bot) I wanted to program a bot in python. I'm currently following this Tutorial.
As I tried to implement the options variable (40:55) everything was fine but as I wanted to test the bot in Discord (currently at min 48:19) the bot doesn't add the new encouragement.
This is my code:
options = starter_encouragements
  if "encouragements" in db.keys():
    options = options + db['encouragements']

And this is the starter_encouragements list:
starter_encouragements = [
  "Cheer up!",
  "Hang in there!",
  "You are a great person / bot!"
]

The error message:

A: The TypeError is providing a useful piece of information. Your code is attempting to concatenate an ObservedList to a list. They are two different data structures. The ObservedList is a data structure defined in the replit package. In their tutorial they explain:

Under the hood, this feature works by replacing the primitive list and
dict classes with special replacements that listen for mutation,
namely replit.database.database.ObservedList and
replit.database.ObservedDict.

So the question becomes, "How do I get the list contained in the ObservedList so I can add the values to another List?" And that is pretty straight-forward. To get the list contained in the ObservedList, call the value attribute.
db["encouragements"].value

Change your code to:
options = starter_encouragements
  if "encouragements" in db.keys():
    options = options + db['encouragements'].value

If for some reason that does not work, try python's extend() method instead of the + operator. You need to use Mutable Sequence Type operations.
options = starter_encouragements
  if "encouragements" in db.keys():
    options = options.extend(db['encouragements'])


text:
Q: d3.js difficulty rendering bar chart code taken from bl.ocks sample I'm trying to run This Code in Fiddle but struggling to render anything. I've replaced the datasource with an object array within the script but not sure if I'm referencing it correctly.  Here's my fiddle
Any ideas?
d3.tsv(letters, type, function(error,letters) {
  x.domain(letters.map(function(d) { return d.letter; }));
  y.domain([0, d3.max(letters, function(d) { return d.frequency; })]);

A: As you suspected, the issue is the call to d3.tsv as you have replaced the data source in your code with the letters variable.
To get this to work, I commented out the call to d3.tsv so the x.domain call is the next statement in the script after the variable is declared, then removed the corresponding brackets further down (lines 53/54).  See working fiddle here: https://jsfiddle.net/mpxt79fh/


text:
Q: I have some issue about using useRouter | Next js This is my first time using useRouter and i really dont know how it works.
I want to take props.indexUrl and added dynamiacally into the url below, i have done several ways but always getting error.
import { useRouter } from "next/router";

const Component = () => {
    const router = useRouter();

    const {
        query: { indexUrl },
    } = router;

    const props = {
        indexUrl,
    };

    return props.indexUrl;
};

export const urls = [
    {
        url:
            "click.myyellowlocal.com/k.php?ai=19202&url=http%3a%2f%2f" +
            Component,
    },
    {
        url: "cse.google.vu/url?q=https%3A%2F%2",
    },
    {
        url: "sazhs.co.kr/member/login.html?noMemberOrder=&returnUrl=http%3a%2f%2",
    },
];

I have try like this before
import { useRouter } from "next/router";

const router = useRouter();

const {
    query: { indexUrl },
} = router;

const props = {
    indexUrl,
};

export const urls = [
    {
        url:
            "click.myyellowlocal.com/k.php?ai=19202&url=http%3a%2f%2f" +
            props.indexUrl,
    },
    {
        url: "cse.google.vu/url?q=https%3A%2F%2",
    },
    {
        url: "sazhs.co.kr/member/login.html?noMemberOrder=&returnUrl=http%3a%2f%2",
    },
];

and give an error Cannot read properties of null (reading 'useContext')
so i make like this
const Component = () => {
    const router = useRouter();

    const {
        query: { indexUrl },
    } = router;

    const props = {
        indexUrl,
    };
};

but i dont know how to get props.indexUrl to url like in the top code.
more detail, the router indexUrl is from other file
    function sendProps() {
        Router.push({
            // pathname: "/processUrl",
            pathname: "/urlList",
            query: { indexUrl },
        });
    }

how to get the value of props.indexUrl and add it into the list of url dynamiacally ??


text:
Q: Flask and heroku I have developed a flask app and intending to deploy it on Heroku but I have been facing problems. the API works fine on postman and localhost but when I deploy it the application crashes with an error code of H10.any suggestions plz?
the API is on OpenCV TensorFlow-CPU (coz Heroku doesn't support GPU I guess) Keras and dlib.
LIST of my requirements:
absl-py==0.11.0
astunparse==1.6.3
cached-property==1.5.2
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
Flask==1.1.2
flatbuffers==1.12
gast==0.3.3
google-auth==1.27.0
google-auth-oauthlib==0.4.2
google-pasta==0.2.0
grpcio==1.32.0
gunicorn==20.0.4
h5py==2.10.0
idna==2.10
importlib-metadata==3.4.0
itsdangerous==1.1.0
Jinja2==2.11.3
Keras==2.4.3
Keras-Preprocessing==1.1.2
Markdown==3.3.3
MarkupSafe==1.1.1
numpy==1.19.5
oauthlib==3.1.0
opencv-python==4.5.1.48
opt-einsum==3.3.0
protobuf==3.15.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyYAML==5.4.1
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.1
scipy==1.5.4
six==1.15.0
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tensorflow-cpu==2.4.1
tensorflow-estimator==2.4.0
termcolor==1.1.0
typing-extensions==3.7.4.3
urllib3==1.26.3
Werkzeug==1.0.1
wrapt==1.12.1
zipp==3.4.0

A: There are some compatibility issues with some dependencies in heroku and you can try downgrading a few depending on the error message you get. When I tried with you
requirement list I got :-
remote:        Successfully built termcolor wrapt
remote:        ERROR: tensorflow-cpu 2.4.1 has requirement wheel~=0.35, but you'll
have wheel 0.34.2 which is incompatible.
remote:        Installing collected packages: six, absl-py, astunparse, cached-
property, cachetools, certifi, chardet, click, Werkzeug, itsdangerous, MarkupSafe,
Jinja2, Flask, flatbuffers, gast, pyasn1, rsa, pyasn1-modules, google-auth, oauthlib,
idna, urllib3, requests, requests-oauthlib, google-auth-oauthlib, google-pasta,
grpcio, gunicorn, numpy, h5py, typing-extensions, zipp, importlib-metadata, PyYAML,
scipy, Keras, Keras-Preprocessing, Markdown, opencv-python, opt-einsum, protobuf,
tensorboard-plugin-wit, tensorboard, tensorflow-estimator, termcolor, wrapt,
tensorflow-cpu

in heroku cli logs (https://devcenter.heroku.com/articles/logging)
when I tried changed it to tensorflow-cpu 2.4.0 then it worked but it also depends whether you application will run after changing then it works but your application might not work so you will have to modify versions of dependencies to check if it is compatible with both heroku and your doesnt affect the working of your applications.
References :
https://github.com/Anirudh-thakur/FlaskNoteDetector#how-to-deploy-on-heroku-
https://flassger-banknote.herokuapp.com/apidocs/


text:
Q: Displaying Default Value In Dropdown Based On Information From Database This is my edit page. I want the default value to be the time received from the database called @l.begginingTime, which will the same as one of the values in the dropdown.
How do I do this?
@foreach (var l in Model.Cleaner.TimeAvailables)
  {
    <select class="form-control dropDown"  name="Sunday1From" value="@l.BegginingTime">
        <option value="">Unavailable</option>
        <option value="00:00:00">12:00 AM</option>
        <option value="00:30:00">12:30 AM</option>
        <option value="01:00:00">1:00 AM</option>
        <option value="01:30:00">1:30 AM</option>
        <option value="02:00:00">2:00 AM</option>
        <option value="02:30:00">2:30 AM</option>
    </select>
</td>

A: You should be able to use the attribute selected. Add that to whichever option in the dropdown you want to be selected by default.
Reference this post for a similar question.

A: Add your dynamic value as an option then set the selected attribute
@foreach (var l in Model.Cleaner.TimeAvailables)
      {
        <select class="form-control dropDown"  name="Sunday1From">
            <option value="@l.BegginingTime" selected>@l.BegginingTime</option>
            <option value="00:00:00">12:00 AM</option>
            <option value="00:30:00">12:30 AM</option>
            <option value="01:00:00">1:00 AM</option>
            <option value="01:30:00">1:30 AM</option>
            <option value="02:00:00">2:00 AM</option>
            <option value="02:30:00">2:30 AM</option>
        </select>

A: You can also use jQuery and javascript
$(document).ready(function() {
    $('.dropDown').val(beginTime);
}

A: You are using a html select which is completely separate from your model. So there is two option here.
Create your dropdown with MVC like this:
@Html.DropDownList("Model.Cleaner.TimeAvailables", (SelectList)@l.BegginingTime)


text:
Q: First TS file is the biggest: ffmpeg mp4 to hls While converting mp4 to hls, ffmpeg makes the 0.ts file the biggest comparing to others. How to fix it?

This is running on a Linux server, running Debian 9, FFMPEG 3.2.12-1~deb9u1.
$ ffmpeg -i input.mp4 -hide_banner -loglevel error -c copy -f hls -hls_time 7 -hls_list_size 0 -hls_segment_size 5000000 output.m3u8

I expect to get all the *.ts files to be less than 8MB.


text:
Q: teTeX Distribution in Slackware I have installed slackware 14. It has an in-built support for TeX. The distributions provided are teTeX and eTeX. Does it make a difference if I install TeXLive 2013? Secondly, I am not able to compile the documents using XeLaTeX in slackware.I can compile only using PdfLaTeX and eTeX.What should I do?

A: The teTeX project has been dead since May 2006, when Thomas Esser announced he would not maintain it any more. See http://www.tug.org/tetex/ for information about this.
At the time, XeTeX was available only for Mac OS X; indeed it was added to TeX Live only in the 2007 release (see Section 9.1.4 of the TeX Live manual), so it's not surprising that what you get from Slackware doesn't have it.
In the last seven years, TeX distributions have grown and there are many packages that weren't available in 2006; many have been updated and also the binaries have been rebuilt and debugged several times.
So my advice is to install TeX Live 2013 from TUG
The distribution installs into its own tree, under /usr/local/texlive, so it won't interfere with the system. Just make sure your PATH variable contains
/usr/local/texlive/2013/bin/<arch>

(where in your case <arch> stands for x86_64-linux, probably).
I usually advise to make a symbolic link
ln -s /usr/local/texlive/2013/bin/<arch> /usr/texbin

(or /usr/local/texbin, if you prefer) and to add /usr/texbin to PATH, so when a new release is installed, it's sufficient to recreate the right symbolic link, instead of changing the configuration files that set PATH.

A: Since Slackware still uses teTeX, let me supplement egreg's answer to note that TeX Live packages are available through SlackBuilds.org, an "officially endorsed" Slackware package repository.  Working with these packages should automate both the installation and upgrade procedures.


text:
Q: When installing app from google play getting error code -505 I have generated 3 different apps with different key store and with different package name from  android studio and published on google play store. When one app is installed and try to install second app or third app i get google play installation error. I am not sure what i am doing wrong here. As my keystore and packages are different. Done lots of RND but did not find any solution. Please help me out here. Also find attached error code screen shot.enter image description here

A: I have resolved this problem. Actually problem was accruing due to same permission in manifest of all of the 3 apps. I was not using project package name in the permissions. So when i install one app then try to install second app then permission mismatch problem was accruing. Once i have given package name in permission it start working fine. Before is was using :-
<permission
        android:name="com.example.gcm.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />

Then i convert this code by following code :-
<permission
        android:name="APP_PACKAGE_NAME.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="APP_PACKAGE_NAME.permission.C2D_MESSAGE"/>

This resolved my problem.


text:
Q: How do I display data in a DataGridView based on a selected value from a combo box? I have a ComboBox that lists Customer Names from an MS Access DB. When I select a customer name it populates a textbox with the corresponding CustomerID. I have a DataGridView which displays data from a table, however, how do I specify that only the data relating to the specific customer ID is shown?
The code for my DataGridView is as follows;
private void btnLoadDeliveryLog_Click(object sender, EventArgs e)
    {
        try
        {
            OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Carmine_Cycle_Couriers_Database.accdb");
            cn.Open();
            OleDbCommand cmd = new OleDbCommand();
            cmd.Connection = cn;
            string query = "Select * from tblDeliveryLog";
            cmd.CommandText = query;

            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;

            cn.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error " + ex);
        }

        }
    }

A:
Made changes to your code, try below code

    try
    {
        OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Carmine_Cycle_Couriers_Database.accdb");
        cn.Open();
        OleDbCommand cmd = new OleDbCommand();
        cmd.Connection = cn;

        //string query = "Select * from tblDeliveryLog";

        //Change query like this
        string query = "Select * from tblDeliveryLog WHERE customerid = @customerid";

        //Add parameter to query
        cmd.Parameters.AddWithValue("@customerid", TextBoxCustomerId.Text);

        cmd.CommandText = query;

        OleDbDataAdapter da = new OleDbDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        dataGridView1.DataSource = dt;

        cn.Close();
    }
    catch (Exception ex)
    {
        MessageBox.Show("Error " + ex);
    }

A: It is not clear what fields are in the grid and how the combo box is filled with data. Assuming the combo box is filled with a "CustomerID" as a ValueMember as your previous question shows and that there is a "CustomerID" field in the DataTable dt that is used as a data source to the grid that corresponds to the combo boxes ValueMember, then it may be easier to simply "filter" the existing data in the grid as opposed to re-querying the DB.
With a DataTable we could use a DataView to filter the grids data. However, we would need to "switch" the grids DataSource to each filtered DataView. In other words, we can not "directly" filter the DataTable and have it automatically update the grid.
Fortunately, a BindingSource WILL allow us to filter it and it will automatically update the grid and we never have to "switch" the grids DataSource.
Therefore, in the current code, you could add/edit the following code to set the grids data source to a BindingSource. Something like…
BindingSource OrdersBS;   // <- make a GLOBAL variable

OrdersBS = new BindingSource();
OrdersBS.DataSource = dt;
dataGridView1.DataSource = OrdersBS;

Then in the combo boxes SelectedIndexChanged event we could easily filter the grid based on what value is selected in the combo box. NOTE: I added an addition item to the combo box in the first position with the value of zero (0) and the customer's name of "All." This will allow the user to "un-filter" the grid data.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
  if ((int)comboBox1.SelectedValue != 0) {
    OrdersBS.Filter = "CustomerID = '" + (int)comboBox1.SelectedValue + "'";
  }
  else {
    OrdersBS.Filter = "";
  }
}

I hope this makes sense and helps.


text:
Q: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause because of Offset and Limit I am using php moreover, codeigniter to access an mdb file.
I connect and query the db when using the following:
$this->mov->query("Select * from Logger")->result_array();

So no issues there. The problems come up when i try to add a limit and offset to the query. As follows:
$this->mov->query("Select * from Logger Limit $limit offset $offset")->result_array();

I am sure that $offset and $limit are not empty.
I get the following error:

Error Number: 37000
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
Select * from Logger Limit 10 offset 0
Filename: C:/inetpub/wwwroot/system/database/DB_driver.php
Line Number: 691

I am more a Mysql oriented and do not have that much experience in MSAccess.
I am trying the workaround as suggestted in the comments and start using top but now i get this error:
Error Number: 37000

[Microsoft][ODBC Microsoft Access Driver] The SELECT statement
  includes a reserved word or an argument name that is misspelled or
  missing, or the punctuation is incorrect.
Select TOP 10 from Logger
Filename: C:/inetpub/wwwroot/system/database/DB_driver.php
Line Number: 691

A: For those being redirected here i have an answer which up to now i didn't find any mistakes. Hope i do not find.
My problem was for pagination and adapting Limit and offset.
Here is a way i found for MSAccess pagination. Please if you find any mistakes don't hesitate to write:
Select TOP {Rows/Page} * from {table} where {ID} not in (Select {ID} from (Select Top {Offset} * from {table} order by {column}) as tbl1) order by {column}

Where:
{Rows/Page} = Records to show per page
{table} = Table is your table
{ID} = A unique column in your table
{column} = Column in your table to order by


text:
Q: javascript: how to access window.top from window.opener? I am trying to refer to window.top in my popup window here http://www.globalrph.com/davescripts/popup.htm
once in the popup I want to access the main window's document but window.top is returning undefined.

A: To access your popup's opener use.
window.opener

To access your opener's top (e.g your opener is in an iframe)
window.opener.top

Once at the opener window you want you can access the document to change its context, the location to manipulate the URL etc.

A: If you want to move your popup to the same top position as the opening browser window and centered horizontally to the size of the opening browser window, in modern browsers you can use:
window.moveTo(window.opener.screenX + (window.opener.outerWidth / 2) - (window.outerWidth / 2), window.opener.screenY)

outerWidth and screenX and screenY work in IE9 and above and in modern browsers.
moveTo has been around a long time.
In this case we're getting the left position of the opening browser window, calculating its center and subtracting half the width of the popup. That gives the center position. Then we use window.opener.screenY to get the top position of the opening browser window and setting the popup's top the same.
Many browsers have popup blockers turned on by default and will require the user to click a link to open a popup. I have this web application that opens a popup window to preview the results. A lot of web applications use a positioned div for dialogs. Not knowing your application, I really can't give advice as to the best approach to take.


text:
Q: How to deal with Jahzracht? I'm having trouble with Jahzracht, both on the spelling and killing side of things. He does not seem to have a whole lot of vulnerabilities and so far the only thing I've seen that kind of works is trying to deny any damage on his attacks with Aegis (it also cures being on fire). While it does deny any and all damage when active, that's not very reliable, however, and doesn't deal much in terms of damage.
I thought I could kick him out of guard, then push him on the many fire cannons around, but they don't seem to deal any damage to him. Maybe use ice attacks instead? So far I've only got Frozen Shard, replacing Aegis, and Frost Blade, replacing Refresh; I'm not comfortable swapping either of these, so all I'm left with is Arctic Javelin in the air slot (which does mediocre damage) and Ice Tower, which deals no damage at all.
What's the key to this boss?

A: He's actually fairly easy when you use Frost Blade.  Without it, every 2-3 attacks on the boss will make him use his counter attack, which is the fire circle that surrounds him.  But with Frost Blade, this doesn't trigger, so you can attack him at will.
When he starts blocking your attacks, use a heavy attack to break his guard.  He will then jump on the side of the room and then jump back in the middle to unleash his fire attack.  You can jump approximately where he lands to avoid said fire attack, and then just spam your regular attacks again.
He will use the Fire Vortex 3 times or so during the fight (at fixed life values).  To avoid it, go in one of the corners, and try to avoid the little lasers that will pop up.  They pop right above your head, so move a little to dodge them all.  You should have enough space in a corner to never get hit by those.
Rince and repeat and he'll be gone in no time.  But don't forget to refresh the Frost Blade often.

A: Okay, here's how to deal with the boss:

*

*You need to have Aegis as your side spell (when playing as Reina)

*You need to have Frost Blade as your up spell

*You want to have Ice Tower as your down spell

*You want to have the kick-out-of-guard skill, (when playing as Reina) if the fight against Magus already didn't make this abundantly clear.

*You want to remember that your cancel skill (moving down) allows you to regain movement after being hit. This is crucial to avoid getting damaged for hundreds of points in one go.

*You want to remember that you have a helper and it's worth from time to time to remember to use your left trigger for it for some free damage. The divine air spell also is nice for this purpose.

*If you run out of mana, you're kind of screwed. Watch your mana consumption. Making an ice tower to jump onto for safety sounds nice, but you may run out of juice too fast that way; I did. Using the horizontal fire cannons as ledges costs no mana, takes no more time and is harder to get wrong.

Here's a list of things the boss can do:

*

*Attack you in quick succession. If you can, parry. Otherwise, just guard is fine. You can even take the hits; he doesn't hit for much so long as he doesn't push you into a fire column.

*Guard. Kick him out of guard, stun him and get some damage in.

*Jump up fast. This causes a wave of fire to spread on the floor. If the fire columns aren't active, save some mana by jumping on top of them. Otherwise, you can spend some mana by using Ice Tower and jumping up there, but I found it's more reliable to just run away and jump back at him. Once you're there you can safely use Frost Blade to bump your damage and avoid his bubble defense.

*Jump up slowly. This is his huge fireball nuke plus fire laser attack, and unless you get hurt into it, it's a fairly easy combo to avoid. Run for a corner. When a fire lazer forms above you, let go of the controller and let the fireball nuke thing slowly suck you in, avoiding the laser; once that's done, run again towards the corner. You should be able to get 0 damage out of this fairly easily.


text:
Q: Equivalent of `curl -v`, but as a server not a client? I know that curl is just for client side stuff, and I find it's curl -v tremendously useful for debugging HTTP issues.
However, I'm writing a client at the moment, and would love to see a verbose output of the data as it comes in on the server. What's the best way to do this? Is there a simple command line utility?
Things I want to see:

*

*When the headers come in.

*Does the connection stay open until the body is received?

*When does the connection/message terminate?

A: You could give netcat (http://nc110.sourceforge.net) a try.
netcat -l 80

This way netcat starts listening on port 80 an you could use a browser to connect to that.
This is my first answer so hope I'm doing this correct.


text:
Q: How to add additional x-axes but with different scale and color (matplotlib) I have the following plot:

Each of the three lines belongs to a different x-axis scale. For example, the x-axis of the Fully Connected line should range between 0.001 and 0.02; the x-axis of the kNN line should range between 2 and 40. I want to eliminate the current x-axis and have three x-axes, one below the other, each scaled and colored differently.
Here is my code:
## Plot means
x_full = np.linspace(0.001, 0.02, 20)
x_enn = np.linspace(0.05, 1.95, 20)
x_knn = np.linspace(2, 40, 20)
x = np.arange(len(x_full))

fig, ax = plt.subplots(1, 2, figsize=(13.2, 4))

## Set color
ax[0].set_prop_cycle(color=color_list)
ax[1].set_prop_cycle(color=color_list)

## Plot means
ax[0].plot(x, two_moons_acc_mean['full'], label='Fully Connected')
ax[0].plot(x[1:], two_moons_acc_mean['enn'][0.1:], label=r'$\epsilon$-N')
ax[0].plot(x, two_moons_acc_mean['knn'], label=r'$k$NN')

ax[1].plot(x, two_moons_acc_mean['full'], label='Fully Connected')
ax[1].plot(x[1:], two_moons_acc_mean['enn'][0.1:], label=r'$\epsilon$-N')
ax[1].plot(x, two_moons_acc_mean['knn'], label=r'$k$NN')

## Plot standard deviations
ax[0].fill_between(
    x,
    two_moons_acc_mean['full'] - two_moons_acc_std['full'],
    two_moons_acc_mean['full'] + two_moons_acc_std['full'],
    alpha=0.2
)
ax[0].fill_between(
    x[1:],
    two_moons_acc_mean['enn'][0.1:] - two_moons_acc_std['enn'][0.1:],
    two_moons_acc_mean['enn'][0.1:] + two_moons_acc_std['enn'][0.1:],
    alpha=0.2
)
ax[0].fill_between(
    x,
    two_moons_acc_mean['knn'] - two_moons_acc_std['knn'],
    two_moons_acc_mean['knn'] + two_moons_acc_std['knn'],
    alpha=0.2
)

ax[1].fill_between(
    x,
    two_moons_acc_mean['full'] - two_moons_acc_std['full'],
    two_moons_acc_mean['full'] + two_moons_acc_std['full'],
    alpha=0.2
)
ax[1].fill_between(
    x[1:],
    two_moons_acc_mean['enn'][0.1:] - two_moons_acc_std['enn'][0.1:],
    two_moons_acc_mean['enn'][0.1:] + two_moons_acc_std['enn'][0.1:],
    alpha=0.2
)
ax[1].fill_between(
    x,
    two_moons_acc_mean['knn'] - two_moons_acc_std['knn'],
    two_moons_acc_mean['knn'] + two_moons_acc_std['knn'],
    alpha=0.2
)

## Loglog plot
ax[1].set_xscale('log')
ax[1].set_yscale('log')

## Add Legend
ax[0].legend(loc='lower left', ncol=3, frameon=False)
ax[1].legend(loc='lower left', ncol=3, frameon=False)

A: You should use 3 different axes, one for each line you need to plot.
The first one can be:
fig, ax_full = plt.subplots()

full = ax_full.plot(x_full, y_full, color = 'red', label = 'full')

Then you can generate the others with:
ax_enn = ax_full.twiny()

And plot each line on the respective axis:
enn = ax_enn.plot(x_enn, y_enn, color = 'blue', label = 'enn')

Then you can move the axis to the bottom with:
ax_enn.xaxis.set_ticks_position('bottom')
ax_enn.xaxis.set_label_position('bottom')
ax_enn.spines['bottom'].set_position(('axes', -0.15))

And finally customize the colors:
ax_enn.spines['bottom'].set_color('blue')
ax_enn.tick_params(axis='x', colors='blue')
ax_enn.xaxis.label.set_color('blue')

Complete Code
import numpy as np
import matplotlib.pyplot as plt

x_full = np.linspace(0.001, 0.02, 20)
x_enn = np.linspace(0.05, 1.95, 20)
x_knn = np.linspace(2, 40, 20)

y_full = np.random.rand(len(x_full))
y_enn = np.random.rand(len(x_enn))
y_knn = np.random.rand(len(x_knn))

fig, ax_full = plt.subplots()

full = ax_full.plot(x_full, y_full, color = 'red', label = 'full')
ax_full.spines['bottom'].set_color('red')
ax_full.tick_params(axis='x', colors='red')
ax_full.xaxis.label.set_color('red')

ax_enn = ax_full.twiny()
enn = ax_enn.plot(x_enn, y_enn, color = 'blue', label = 'enn')
ax_enn.xaxis.set_ticks_position('bottom')
ax_enn.xaxis.set_label_position('bottom')
ax_enn.spines['bottom'].set_position(('axes', -0.15))
ax_enn.spines['bottom'].set_color('blue')
ax_enn.tick_params(axis='x', colors='blue')
ax_enn.xaxis.label.set_color('blue')

ax_knn = ax_full.twiny()
knn = ax_knn.plot(x_knn, y_knn, color = 'green', label = 'knn')
ax_knn.xaxis.set_ticks_position('bottom')
ax_knn.xaxis.set_label_position('bottom')
ax_knn.spines['bottom'].set_position(('axes', -0.3))
ax_knn.spines['bottom'].set_color('green')
ax_knn.tick_params(axis='x', colors='green')
ax_knn.xaxis.label.set_color('green')

lines = full + enn + knn
labels = [l.get_label() for l in lines]
ax_full.legend(lines, labels)

plt.tight_layout()

plt.show()


text:
Q: Iframe redirect error I have a facebook iframe application that is having trouble redirecting, I keep getting security certificate errors like these "Content was blocked because it was not signed by a valid security certificate.", here is the redirect code,
$params = array(
    'canvas'=>1,
    'fbconnect'=>0,
    'req_perms'=>'user_photos,publish_stream,offline_access',
    'next'=>'http://apps.facebook.com/my-test/',
    'cancel_url'=>'http://apps.facebook.com/my-test/',
);

$redirect = $facebook->getLoginUrl($params);

echo "<script language='Javascript' type='text/javascript'>top.location.href='$redirect';</script>";

and when I try to redirect the user using a PHP redirect, like so,
header('Location: '.$redirect);

all I get is a iframe filled with a black background.
Is there another way I could redirect the page? or fix this error?
Thanx in advance!

A: Make sure your not sending whitespace in your scripts before the header command.
An example of whitespace
<?php
echo ' ';

header('Location: home'); //Will not send.
?>

Another example:
     <-- Whitespace here maybe?
<?php
    header('Location: home'); //Will not send.
?>

Try turn on php errors to debug whats going on when you send the header command, using error_reporting(E_ALL);


text:
Q: How to invoke a command for each result? I want to invoke a command for each result of the executed command. Particularly, I want to invoke hg diff <filename> for each result, returned by hg status. Is it possible to do with a single bash command?
For instance, hg status returned:
M project/pom.xml
M project/api/pom.xml

And I want to execute hg diff for both project/pom.xml and project/api/pom.xml. How can I do that?

A: If you want to see all modified files, you could just run hg diff without arguments.
More generally, you could use something like
hg status -mn0 | xargs -0 hg diff

Here hg status -mn0 prints the file names of modified files delimited by a null byte, which is a better delimiter than newline because file names can contain newlines, and pipes the whole thing through xargs -0 hg diff, which splits its input at the null bytes and calls hg diff for each token. This can be used for all sorts of commands, not just hg diff.


text:
Q: How to show image on the right hand side of the notification in android I am working on android application . I need to create a notification for the app.
I am able to create it successfully using :
http://www.tutorialspoint.com/android/android_notifications.htm
I know NotificationCompat.Builder setNumber(int Number) . It sets the number on the notification on the right hand side . But instead of the number i want to show a small icon.
Do i need to use a custom layout , Because i am not able to find any API for this .
How do i do it .

A: To show an image at the bottom right end of the notification, we have to use the following APIs
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(baseContext).setLargeIcon(large_icon)
                .setSmallIcon(small_icon);

For devices running up to android Kitkat the setLargeIcon sets the image at the left end, while the setSmallIcon sets the image at the bottom right end of the notification.
For devices running on higher than Kitkat
the setLargeIcon sets the image at the Left end, while the setSmallIcon sets the image at the bottom right end of the Large Image.


text:
Q: Append svelte component to another component, depending on the viewport width There are 3 components - A, B, C.
C component is in A.
If viewport width smaller then x px need to remove C component into B.
Its easy to do with vanilla js. Is it possible to do in svelte without creating two C components ?
vanilla-js-example - <https://codepen.io/vladbelozertsev/pen/eYzoYmO?editors=1111>

A: No there isn't really an officially supported way / construct to do that. In Svelte, the only case where a component moves in the tree is with keyed lists:
{#each items as item}
  <MyComponent key={item.id}>{item.text}</MyComponent>
{/each}

There's been some discussion about portals, and even a lib.
Otherwise you can still implement something like this yourself, by using the DOM API to move the elements in a Svelte component yourself.
Bellow is an example that moves "a component" (really, the elements of the component -- the component itself stays in the same place in the virtual Svelte component tree) -- REPL.
Child.svelte

I am Child

App.svelte

<button on:click={goLeft}>Left</button>

<button on:click={goRight}>Right</button>

    <Child />


text: Q: EM Fields Transmitted from an antenna and photons What is the relationship between The EM waves (light) and photons in some context i studied light as photons and others as EM fields but how they are related....another questions : what's the name of the field of study that allows me to study antenna and wave propagation on the particle level (photons) and the relationship between different kind of particles in the matter


text:
Q: JMeter Array of variables to text file I am running a query via JDBC request and I am able to get the data and place it in a variable array. The problem is I want the values of the variables to be saved to a text file. However, each variable is being given a unique number  appended to it i.e. SCORED_1, SCORED_2,SCORED_3 etc. I am using a beanshell post processor to write to the text file. The problem is I unless I define A LINE Number. How can I get all results from a SQL query and dump them into a single variable without the variables separated by brackets and line separated on their own row.
 import org.apache.jmeter.services.FileServer;

 // get variables from regular expression extractor
 ClaimId = vars.get("SCORED _9"); // I want to just use the
 SCORED variable to contain all values from the array
 without "{[" characters.

  // pass true if want to append to existing file
 // if want to overwrite, then don't pass the second
 argument
 FileWriter fstream = new FileWriter("C:/JMeter/apache-
 jmeter-4.0/bin/FBCS_Verify_Final/Comp.txt", true);
 BufferedWriter out = new BufferedWriter(fstream);
 out.write(ClaimId);
 out.write(System.getProperty("line.separator"));
 out.close();
 fstream.close();

A: We are not telepathic enough to come up with the solution without seeing your query output and the result file format.
However I'm under impression that you're going into wrong direction. Given you're talking about {[ characters it appears that you're using Result Variable Name field

which returns an ArrayList which should be treated differently

However if you switch to Variable Names field

JMeter will generate a separate variable per each result set row and it should be much easier to work with and eventually concatenate

More information:

*

*JDBC Request

*Debugging JDBC Sampler Results in JMeter

A: JDBC request>Enter a Variable Name> Store as string>Add a Beanshell PostProcessor and add the following script.
    import org.apache.jmeter.services.FileServer;
{
FileWriter fstream = new FileWriter("C:/JMeter/apache-jmeter-4.0/bin/FBCS_Verify_Final/Comp.txt", false);
BufferedWriter out = new BufferedWriter(fstream);

 Count = vars.get("SCORED_#");
 Counter=Integer.parseInt(vars.get("SCORED_#"));
 for (int i=1;i<=Counter;i++)

 {

 ClaimId = vars.get("SCORED_"+i);
 out.write(ClaimId);
 out.write(System.getProperty("line.separator"));

 }

 out.flush();
 out.close();
 fstream.close();

}


text:
Q: align: control where equations are stretched I would like to format equations in a very particular way, the desired result would be:

        f(x)           = 42       (1)
        g_something(x) =  0       (2)

*

*the function names are left aligned (but the entire equations remain floating, and there is no extensive stretch)

*the equations are numbered (reason against array as there is no easy way to add the numbers*

*the numbers are right aligned to align decimal places (Bonus since currently not an issue)

Below you find a MWE with the basic equation and me trying to achieve my alignment by adding additional &
MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{align}
        f(x) &= 42 \\
        g_{\text{something}}(x) &= 1
    \end{align}

    %incorrect alignment of parts
    \begin{align}
        &f(x) &= 42& \\
        &g_{\text{something}}(x) &= 1&
    \end{align}

    %too much spacing
    \begin{align}
        &f(x) &=&& 42& \\
        &g_{\text{something}}(x) &=&& 1&
    \end{align}
\end{document}

I believe neither fleqn nor nccmath solve my issue. I came across nccmath in this answer however, the = signs are missaligned in that answer.
* (if I understand the answer correctly)

A: like this?

above system of equation is obtained by us of the alignat math environment:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{alignat}{3}
        &f(x)                    & = & 42 \\
        &g_{\text{something}}(x) & = & 1
    \end{alignat}
\end{document}

A: It's  alignat which gives control of the spacing between columns of alignment. Here you need 3 columns, hence 5 ampersands:
\documentclass{article}
\usepackage{amsmath}

\begin{document}

    \begin{alignat}{3}
        &f(x) & & ={}& 42& \\
        &g_{\text{something}}(x) & & =& 1&
    \end{alignat}

\end{document}


text:
Q: Reduce the time of displaying progress bar in WebView I have problem with reducing the time of displaying progress bar in WebView. For underesting a add image. enter image description here.
Where I can implement some thread of something to stop showing progress bar for one second, while my web running in WebView?
I tried implement thread before showing progress bar in onPageStarted, but it waiting for whole loading page, not only for loading progress bar.
We have very slow loading on web page, so we need showing to users one or two second loading page in webview without progressbar, after this time show "loading" progress bar.
If you have question, please ask me, we need quick respond to resolve this problem. I'm trying to find some solution, but nothing.
Thanks a lot!
There is my ChromeClien.class
public class MyWebChromeClient extends WebChromeClient {
private ProgressListener mListener;

public MyWebChromeClient(ProgressListener listener) {
    mListener = listener;
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
    mListener.onUpdateProgress(newProgress);
    super.onProgressChanged(view, newProgress);
}
public interface ProgressListener {
    public void onUpdateProgress(int progressValue);
}}

There is MainActivity.class
public class MainActivity extends AppCompatActivity{

private WebView webview;
ProgressDialog prDialog;
String cekani;

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    CookieManager.getInstance().setAcceptCookie(true);

    Boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE)
            .getBoolean("isFirstRun", true);

    if (isFirstRun) {
        //show start activity
        startActivity(new Intent(MainActivity.this, PrvniSpusteni.class));

    }

    getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit()
            .putBoolean("isFirstRun", false).commit();

    if(KontrolaInternetu.isInternetAvailable(MainActivity.this)) //Vrátí hodnotu TRUE, pokud je připojení k internetu k dispozici
    {
        webview =(WebView)findViewById(R.id.webView);
        //Nastavení webové stránky
        webview.loadUrl(getString(R.string.url_aplikace));
        webview.setWebViewClient(new MyWebViewClient());
        //Puštění JavaScriptu pro web
        webview.getSettings().setJavaScriptEnabled(true);
      webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        webview.getSettings().setDomStorageEnabled(true);
        webview.getSettings().setUseWideViewPort(true);
        webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        WebSettings ws = webview.getSettings();
        ws.setJavaScriptEnabled(true);
        ws.setAllowFileAccess(true);

        if (android.os.Build.VERSION.SDK_INT >= 21) {
            CookieManager.getInstance().setAcceptThirdPartyCookies(webview, true);
        }else {
            CookieManager.getInstance().setAcceptCookie(true);
        }

        webview.setWebChromeClient(new WebChromeClient(){
            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onPermissionRequest(final PermissionRequest request) {
                request.grant(request.getResources());
            }
        });

        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.ECLAIR) {
            try {
                Log.d(TAG, "Enabling HTML5-Features");
                Method m1 = WebSettings.class.getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                m1.invoke(ws, Boolean.TRUE);

                Method m2 = WebSettings.class.getMethod("setDatabaseEnabled", new Class[]{Boolean.TYPE});
                m2.invoke(ws, Boolean.TRUE);

                Method m3 = WebSettings.class.getMethod("setDatabasePath", new Class[]{String.class});
                m3.invoke(ws, "/data/data/" + getPackageName() + "/databases/");

                Method m4 = WebSettings.class.getMethod("setAppCacheMaxSize", new Class[]{Long.TYPE});
                m4.invoke(ws, 1024*1024*8);

                Method m5 = WebSettings.class.getMethod("setAppCachePath", new Class[]{String.class});
                m5.invoke(ws, "/data/data/" + getPackageName() + "/cache/");

                Method m6 = WebSettings.class.getMethod("setAppCacheEnabled", new Class[]{Boolean.TYPE});
                m6.invoke(ws, Boolean.TRUE);

                Log.d(TAG, "Enabled HTML5-Features");
            }
            catch (NoSuchMethodException e) {
                Log.e(TAG, "Reflection fail", e);
            }
            catch (InvocationTargetException e) {
                Log.e(TAG, "Reflection fail", e);
            }
            catch (IllegalAccessException e) {
                Log.e(TAG, "Reflection fail", e);
            }
        }
    }
    else
    {
    //Zobrazení AlertDialogu pokud není připojení k internetu
        runOnUiThread(new Runnable() {
            @Override
            public void run() {

                if (!isFinishing()){
                    new AlertDialog.Builder(MainActivity.this)
                            .setTitle(getString(R.string.no_internet))
                            .setMessage(getString(R.string.internet))
                            .setCancelable(false)
                            .setIcon(R.drawable.icon)

                            .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    finish();
                                    System.exit(0);
                                }})
                            .setNegativeButton(getString(R.string.zrusit), new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                }})
                            .show();
                }
            }
        });
    }

}

      //Při stisknutí tlačítka zpět se uživatel vrátí ve webview nazpět bez toho, aby aplikace spadla.
private final String TAG = MainActivity.class.getSimpleName();

// Progress bar - zobrazí se tehdy, pokud čekám na načítání stránky
private class MyWebViewClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {

        super.onPageStarted(view, url, favicon);

        prDialog = new ProgressDialog(MainActivity.this);
        prDialog.setIcon(R.drawable.icon);
        prDialog.setMessage(getString(R.string.nacitani_webove_stranky));
        prDialog.show();
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
        if(prDialog!=null){
            prDialog.dismiss();
        }
    }
}

  //Při stisknutí tlačítka zpět se uživatel dostane zpět pouze ve webview
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(event.getAction() == KeyEvent.ACTION_DOWN){
        switch(keyCode)
        {
            case KeyEvent.KEYCODE_BACK:
                if(webview.canGoBack() == true){
                    webview.goBack();
                }else{
                    finish();
                }
                return true;
        }

    }
    return super.onKeyDown(keyCode, event);
}

public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.endsWith(".mp3")) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.parse(url), "audio/*");
        view.getContext().startActivity(intent);
        return true;
    } else if (url.endsWith(".mp4") || url.endsWith(".3gp")) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.parse(url), "video/*");
        view.getContext().startActivity(intent);
        return true;
    } else {
    return true;
}}}

A:
Hey bro, you don't necessarily need to implement threads for your
  requirement. Firstly you can load the url in the webview and after a
  particular time period you can start displaying progress bar. For
  calling the progress bar after certain time period you can use
  Handler.

private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {

    super.onPageStarted(view, url, favicon);

    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
    @Override
     public void run() {

       //Do something after 100ms
       prDialog = new ProgressDialog(MainActivity.this);
       prDialog.setIcon(R.drawable.icon);
       prDialog.setMessage(getString(R.string.nacitani_webove_stranky));
       prDialog.show();

      }
     }, 100);

}

@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    if(prDialog!=null){
        prDialog.dismiss();
    }
}


text:
Q: How does a substitution cipher work in C? I've been researching the topic of encryption and I'm currently experimenting with using C. Does such a cipher work well in this programming language

A: Yes: "C" is a good implementation language for encryption.
No: Basic substitution cipher are not good/secure. For data encryption use AES.
Essentially a substitution cipher replaces the message characters with other characters based on some schedule. Simple examples are the Caesar cipher, ROT13 and One-time pad—the first two are trivial, the last is completely secure if implemented properly.
To study there are many references on the web.
There is even a free PDF book: Handbook of Applied Cryptography by Alfred J. Menezes, Paul C. van Oorschot and Scott A. Vanstone, see free download. Chapter is a reasonable start for current ciphers.
Other books:
Cryptography Decrypted by H. X. Mel and Doris M. Baker (good starter I really like)
Applied Cryptography by Bruce Schneier
Cryptography Engineering by Niels Ferguson, Bruce Schneier, and Tadayoshi Kohno
There are also some good free courses in the web as Coursera and Udacity.


text:
Q: what is the use of \ operator inside a list in python? What is the use of \ in python?
Example, I saw the following codes"
    data_idxs = [(self.entity_idxs[data[i][0]], self.relation_idxs[data[i][1]], \
                  self.entity_idxs[data[i][2]]) for i in range(len(data))]

or
    self.relations = self.train_relations + [i for i in self.valid_relations \
            if i not in self.train_relations] + [i for i in self.test_relations \
            if i not in self.train_relations]

I guess you write \ when you want to have your code continue in a new line? But I also saw that when you have a lot of parameter in a method definition, you can have new line without using .

A:
I guess you write \ when you want to have your code continue in a new line?

Yes. That's all it means.
In these cases it's not actually needed though because line continuation is implied by brackets.