text:
Q: gl::DrawArrays fails when tesselation shaders attached I'm using the OpenGL SuperBible 6th edition, and learning about tessellation shaders. I get a INVALID_OPERATION error from gl::DrawArrays. This is my code:
extern crate libc;
extern crate glutin;
extern crate gl;

use std::io::Read;

fn main() {
    unsafe {
        let win = glutin::WindowBuilder::new()
                  .with_gl_profile(glutin::GlProfile::Core)
                  .build_strict()
                  .unwrap();

        win.make_current().unwrap();
        gl::load_with(|s| win.get_proc_address(s));

        gl::DebugMessageCallback(
            std::mem::transmute(gl_debug_message),
            std::ptr::null_mut());

        let program = build_shader_program();
        gl::UseProgram(program);

        let mut vao = std::mem::uninitialized();
        gl::GenVertexArrays(1, &mut vao);
        gl::BindVertexArray(vao);

        gl::PolygonMode(gl::FRONT_AND_BACK, gl::LINE);

        let red = [1.0, 0.0, 0.0, 1.0];

        let mut running = true;
        while running {
            for event in win.poll_events() {
                if let glutin::Event::Closed = event {
                    running = false;
                }
            }

            win.swap_buffers().unwrap();
            gl::ClearBufferfv(gl::COLOR, 0, &red[0]);

            gl::DrawArrays(gl::TRIANGLES, 0, 3);
        }
    }
}

extern "system"
fn gl_debug_message(_source: u32, _type: u32, _id: u32, _sev: u32,
                    _len: i32, message: *const libc::c_char,
                    _param: *mut libc::c_void)
{
    unsafe {
        let s = cstring_to_string(message);
        panic!("OpenGL Debug message: {}", s);
    }
}

fn build_shader_program() -> u32 {
    let vert = load_and_compile_shader("a.vert", gl::VERTEX_SHADER);
    let tesc = load_and_compile_shader("a.tesc", gl::TESS_CONTROL_SHADER);
    let tese = load_and_compile_shader("a.tese", gl::TESS_EVALUATION_SHADER);
    let frag = load_and_compile_shader("a.frag", gl::FRAGMENT_SHADER);

    unsafe {
        let program_id = gl::CreateProgram();
        gl::AttachShader(program_id, vert);
        gl::AttachShader(program_id, tesc);
        gl::AttachShader(program_id, tese);
        gl::AttachShader(program_id, frag);
        gl::LinkProgram(program_id);

        let mut result = std::mem::uninitialized();
        gl::GetProgramiv(program_id, gl::LINK_STATUS, &mut result);
        assert_eq!(result, gl::TRUE as i32);

        program_id
    }
}

unsafe fn cstring_to_string(mut cs: *const libc::c_char) -> String {
    let mut v : Vec<u8> = Vec::new();
    while *cs != 0 {
        v.push(*cs as u8);
        cs = cs.offset(1);
    }
    String::from_utf8(v).expect("c-string not utf8")
}

fn load_file_as_cstring(path: &str) -> std::ffi::CString {
    let mut contents = Vec::new();
    let mut file = std::fs::File::open(path).unwrap();
    file.read_to_end(&mut contents).unwrap();
    std::ffi::CString::new(contents).unwrap()
}

fn load_and_compile_shader(path: &str, shader_type: u32) -> u32 {
    let contents = load_file_as_cstring(path);
    unsafe {
        let shader_id = gl::CreateShader(shader_type);

        let source_ptr = contents.as_ptr();
        gl::ShaderSource(shader_id, 1, &source_ptr, std::ptr::null());
        gl::CompileShader(shader_id);

        let mut result = std::mem::uninitialized();
        gl::GetShaderiv(shader_id, gl::COMPILE_STATUS, &mut result);
        assert_eq!(result, gl::TRUE as i32);

        shader_id
    }
}

Running this program causes a debug message:
OpenGL Debug message: glDrawArrays has generated an error (GL_INVALID_OPERATION)

I've omitted the shaders (a vertex shader, a fragment shader, a tessellation control shader and a tessellation evaluation shader), but I can show them if that is necessary. They are very basic, I just didn't want to clutter the question. In fact they are the ones in this example program from the sb6 git repository. They compile and link with no errors.
If I remove the calls to gl::AttachShader for both tessellation shaders, there are no errors, and a simple wireframe triangle is drawn. With the tessellation shaders, it is supposed to draw the same triangle, just cut up into smaller triangles.
I've looked the documentation for glDrawArrays on this site, and my code doesn't seem to be doing any of the things that can cause an INVALID_OPERATION error, afaict.

A: A tessellation shader does not render primitives, but patches. The primitives are created during the tessellation. See Tessellation.
You must use the Primitive type gl::PATCHES instead of gl::TRIANGLES. In addition, you have to specify the size of a single patch by setting the parameter gl::PATCH VERTICES with gl::PatchParameteri:
gl::DrawArrays(gl::TRIANGLES, 0, 3);
gl::PatchParameteri(gl::PATCH_VERTICES, 3);
gl::DrawArrays(gl::PATCHES, 0, 3);


text:
Q: Connnect to Linux from Windows using PuTTY over the Internet I want to connect to Linux from Windows using PuTTY, over the Internet. This will give my friends access to execute shell script files on my Linux (Ubuntu). I have tried this on Windows 7 and Linux and VirtualBox, but it shows: connection refused.

A: You need to port forward the SSH port to the internal address of your Linux machine. The default port is 22. Also, you need to make sure that you allow every IP in your sshd_config file.

A: If you are getting the error for connection refused this means you donot have Open-ssh server configured on your linux machine so as to accept request from client machine
For debain user's command is
sudo apt install openssh-server
refer_here_for_more

A: Does your linux box have public IP  ? or it's on Virtualbox ?
If it has public IP you may have to open your firewall on your DSL/Cable Router.
If your Linux box is on Internal network, you may not be able to loin over internet. Try using "Teamviewer"

A: If it says "Connection refused" in Putty, please check the following factors,

Check is there any firewall configured in Linux machine and make sure you add your machine's IP address on firewall's rules to allow remote connection through putty
Check is there any local firewall or Gateway firewall blocking the connection, if so please add firewall rule to allow the connection
Check whether you are using the correct Port number for connection

A:
I want to connect Linux from Windows using putty, over the Internet.
  I have tried this on Windows 7 and Linux and VirtualBox, but
  it shows "connection refused."

This has nothing to do with Windows, Linux or anything. It's all a networking issue. If you want to do what you describe you need to make sure your Internet connection allows network connections from the outside world. And the two major things you need to check is:

*

*Can you ping the remote host?

*Is SSH port 22 open on the remote host?

1. Check if you can ping the remote host.
If you have access to a system outside of the system, then you should do the following checks. First, can you ping the host's IP address from outside like this; using 123.456.789.0 as an example:
ping 123.456.789.0

If you don't get the pings returned, then you have your problem right there. If you get a response back, that's good.
2. Check if port 22 is open on the remote host.
Now check if the SSH port is open by using nmap like this; again using 123.456.789.0 as an example:
nmap 123.456.789.0 -p 22

The output should be something like this if it's open:
Starting Nmap 6.25 ( http://nmap.org ) at 2014-10-23 09:46 EDT
Nmap scan report for 123.456.789.0 (123.456.789.0)
Host is up (0.15s latency).
PORT   STATE SERVICE
22/tcp open  ssh

If either of those fail, you will not be able to connect to the remote host. How to solve depends on your host machine network setup. If you have a router with a firewall in it you might need to open up port 22 and/or map all networking from port 22 on the router to your machine.  But it's all idiosyncratic to your setup so we can't really provide a step-by-step for that. These are just the basic concepts.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python: how to redirect child process output even when it contains no newline I've a Python script starting a process (CMake) and redirecting it's output to the console:
proc = subprocess.Popen([cmake,my_args], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in proc.stdout:
    sys.stdout.write(line.decode('utf-8'))
res = proc.wait()

This works fine and any message from CMake is outputed to my console.
However, at some point, the CMake script shows a progression using this code:
execute_process(COMMAND ${CMAKE_COMMAND} -E echo_append "Adding modules")
...
execute_process(COMMAND ${CMAKE_COMMAND} -E echo_append "." )
...
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "done\n" )

This is smart and results in "Adding modules......." being displayed on a single line with a new dot added for every module processed.
But as this output has no newline untill it's done, it only gets reported by my Python script after the last module is added and "done\n" is displayed. I'd like my Python script to report this message dot by dot so that I can see the progression.
Is there any way to catch a sub-process output regardless if it contains new lines or not?
Note: I can modify either the Python or the CMake script...

A: Complete answer:
This is the correct code:
import subprocess
import sys

proc = subprocess.Popen([cmake,my_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

while True:
    out = proc.stdout.read(1)
    if out == '' and proc.poll() != None:
        break
    if out != '':
        sys.stdout.write(out)
        sys.stdout.flush()

The proc.stdout.read(1) ensures the buffer size will be 1, and the proc.poll() != None ensures that the output won't stop when you are waiting between characters. Also, I suppose you could use print(out, '') instead of:
sys.stdout.write(out)
sys.stdout.flush()

but I didn't have time to test that :)
Complicated and incomplete answer:
This could work, but needs modifications. And it is a more "low-level" approach.
You'll need to set the bufsize argument inside your subproccess.Popen constructor. The default value is -1 which is the system default buffer which in most cases is "line buffered".
So you'll need to set bufsize = 0 to get every character. In very io intense applications, this might result in performance issues (because read/write syscalls are expensive)
According to the docs:

bufsize will be supplied as the corresponding argument to the open() function when creating the stdin/stdout/stderr pipe file objects:
0 means unbuffered (read and write are one system call and can return short)
1 means line buffered (only usable if universal_newlines=True i.e., in a text mode)
any other positive value means use a buffer of approximately that size
negative bufsize (the default) means the system default of io.DEFAULT_BUFFER_SIZE will be used.


text:
Q: Fixed Header, Fixed Footer, Full Height multiple scrollable column layout I'm struggling with an application layout. I'd like to implement it with HTML & CSS only, but desperation is approaching. I need:

*

*A fixed height, 100% width, static header

*A fixed height, 100% width, static footer

*A fixed width content area, centered & full remaining height

The content area needs:

*

*2 columns, both are full height

The above is fairly simple, but might need to change to accommodate this next part.
Each column needs:

*

*Static Header

*Static Footer

*Scrollable content area in between the header and the footer

I've spent the day trying various approaches (even one based on--gasp--tables) with no real success.
|--------------------------------------------------|
| Fixed height, 100% width, static page header     |
|----|-------------------|--------------------|----|
     |Fixed Col 1 header | Fixed Col 2 header |
     |-------------------|--------------------|
     |  Scroll overflow  |  Scroll overflow   |
     |  Fixed width      |  Fixed width       |
     |  Full height      |  Full height       |
     |                   |                    |
     |                   |                    |
     |-------------------|--------------------|
     |Fixed Col 1 footer | Fixed Col 2 footer |
     |                   |                    |
|----|-------------------|--------------------|----|
| Fixed height, 100% width, static page footer     |
|                                                  |
|--------------------------------------------------|

A: OK, I've got a working version, tested in IE & Firefox.
http://jsfiddle.net/vna48w5w/3/
border-box was quite helpful.
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;

A: Alright so after looking at your fiddle and telling you table layouts are the devil. Here is my solution. Note: the scroll isn't working because you didn't provide content... so you may need to fool around with that.
So here is the markup

   header

     header

         some junk

     footer

    header

        more junk

    footer

   footer

and here is the styles
body{
    height:100%;
}
header, footer{
width:100%;
height:50px;
background-color:pink;
}
main{
margin:0 auto;
height:100vh;
background-color:blue;
}
.col1, .col2 {
width:50%;
float:left;
}

.col1{
background-color:red;
height:100%;
}
.col2{
background-color:green;
height:100%;
}
.col1 header, .col1 footer {
     background-color:purple;
}
 .col2 header, .col2 footer {
 background-color:yellow;
 }
 .col1 footer{
 position:relative;
 }
 .foo{
 width:100%;
 height:82%;
 overflow:scroll;
 }

you will probably need to play with it a bit to make it look how you want. But in the the fiddle if you drop these in it makes the layout the same as that picture you provided.


text:
Q: Android change activity with touch I'm wondering how could i implement in an app the following behaviour : changing activities within the application using gesture similar to changing screens on the homescreen.
Let's say i'm in activity B and if i do a sweep from left to right ( ---> ) i would get to activity C and if i do it from right to left, i would get the A activity.
With the cool animation like when switching screens.
Any ideas ?
Thank you!

A: This will be hard to implement, but you can try catch touch events in views of your B activity, and start Activities A or C.
Here is good instruction of animation for activities.

A: for changing the activity you can do one way (note animation not implemented in this) by implementing onTouch() method of activity now track on the down event get the current tap location and in move set the flag for move event if you tap and move then only change. Now in up event get the current location of the tap and compare it.
If the up event location was less then down event location then start activity A if the up event location was more than down event location then start activity C

A: If you want to implement something like in the new Google+ app, you might look at ViewPager and one of the ViewPagerIndicator implementations, for example this one (which I have already used successfully) or this one (which I'm going to check out over the weekend).
This may in some cases be much easier than actually switching between activities, having the same "effect" for the user.

A: Better you port your activity code to fragments.
You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities.
Otherwise you can also use ViewFlipper depending on you requirement


text:
Q: Adding multiple values to redis hash I am trying to add multiple values to a hash in Redis using hmset.
Example :
hmset test1 name abc lastname B age 20
Next time when I try to add different values to the same hash key fields, it is replacing them with the existing value.
Is it possible to add multiple values to the same field in Redis using scala or nodejs?
Actual result
hmset test1 name abc lastname B age 20
hmset test1 name aa lastname D age 21
hgetall test1

*

*"name"

*"aa"

*"lastname"

*"BJ"

*"age"

*"20"

Expected result
hmset test1 name abc lastname B age 20
hmset test1 name aa lastname D age 21
hgetall test1

*

*"name"

*"abc"

*"aa"

*"lastname"

*"B"

*"D"

*"age"

*"20"

*"21"

A: Each field in the Hash has a single String value associated with it, and you can only replace the value with a new one.
It is possible that the OP's use case can be accommodated with the Stream data structure, as it appears that the need is to keep an historical log of the changes.


text:
Q: Does GlassFish 5.0.1 (with Java 8) supports EJB 2.1 and EJB 3.1? Does Does GlassFish 5.0.1 (with Java 8) supports EJB 2.1 and EJB 3.1 ?
I installed GlassFish with Payara and tried to deploy my .EAR application with EJB 3.1 Entity and session beans and it hangs up on
ServletContext.log():Initializing Spring root WebApplicationContext
I waited for hours and nothing.
Yes i know, EJB is dead and i should migrated to spring... im just looking for alternatives where to keep my old EJB based apps without any migration.
Full last log lines:
...
[2020-06-11T16:22:27.773+0300] [Payara 5.201] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: ThreadID=101 ThreadName=admin-thread-pool::admin-listener(1)] [timeMillis: 1591881747773] [levelValue: 800] [[
  Portable JNDI names for EJB WulogEJB: [java:global/CCC-ear-RAYAPP-1.0.1-SNAPSHOT-payaraora/CCC-ejb-entity-in-payara-1.0.1-SNAPSHOT/WulogEJB, java:global/CCC-ear-RAYAPP-1.0.1-SNAPSHOT-payaraora/CCC-ejb-entity-in-payara-1.0.1-SNAPSHOT/WulogEJB!com.Tree.common.entityejb.WulogEntityHome]]]

[2020-06-11T16:22:27.922+0300] [Payara 5.201] [INFO] [] [javax.enterprise.web] [tid: ThreadID=101 ThreadName=admin-thread-pool::admin-listener(1)] [timeMillis: 1591881747922] [levelValue: 800] [[
  WebModule[/TreeOnline-RAYAPP] ServletContext.log():No Spring WebApplicationInitializer types detected on classpath]]

[2020-06-11T16:22:28.011+0300] [Payara 5.201] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: ThreadID=101 ThreadName=admin-thread-pool::admin-listener(1)] [timeMillis: 1591881748011] [levelValue: 800] [[
  Initializing Mojarra |version.string| for context '/TreeOnline-RAYAPP']]

[2020-06-11T16:22:28.471+0300] [Payara 5.201] [INFO] [] [javax.enterprise.web] [tid: ThreadID=101 ThreadName=admin-thread-pool::admin-listener(1)] [timeMillis: 1591881748471] [levelValue: 800] [[
  WebModule[/TreeOnline-RAYAPP] ServletContext.log():Initializing Spring root WebApplicationContext]]

*

*I made glassfish-web.xml to add in EAR

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
  <security-domain>java:/TreeSecurityDomain</security-domain>
  <resource-ref>
    <res-ref-name>jdbc/treeDataSource</res-ref-name>
    <jndi-name>treeDataSource</jndi-name>
  </resource-ref>
</glassfish-web-app>

I previously used Wildfly but its removed EJB Entity support after Version 9.
I have compiled my app on JAVA 8 with EJB 3.1 Entity and session beans.
+ created connection under -> JDBC connection pools -> with JNDI property
+ disabled portable jndi names with set server.ejb-container.property.disable-nonportable-jndi-names="true"
Maybe my glassfish-ejb-jar.xml are with incorrect syntax?
<?xml version="1.0" encoding="UTF-8"?>
<glassfish-ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:s="urn:security:1.1"
    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                     http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
    version="3.1" impl-version="2.1">
    <assembly-descriptor>
        <s:security>
            <ejb-name>*</ejb-name>
            <s:security-domain>TreeSecurityDomain</s:security-domain>
            <s:missing-method-permissions-deny-access>false</s:missing-method-permissions-deny-access>
        </s:security>
        <container-transaction>
            <method>
                <ejb-name>*</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Supports</trans-attribute>
        </container-transaction>
    </assembly-descriptor>

    <enterprise-beans>
        <entity>
            <ejb-name>AminataEJB</ejb-name>
            <resource-ref>
                <res-ref-name>jdbc/treeDataSource</res-ref-name>
                <jndi-name>java:treeDataSource</jndi-name>
            </resource-ref>
        </entity>
        <entity>
            <ejb-name>AmeliaEJB</ejb-name>
            <resource-ref>
                <res-ref-name>jdbc/treeDataSource</res-ref-name>
                <jndi-name>java:treeDataSource</jndi-name>
            </resource-ref>
        </entity>
    </enterprise-beans>
</glassfish-ejb-jar>

Could it be because of describing tags?
xmlns:jboss="http://www.jboss.com/xml/ns/javaee"

and
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                     http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"

?

A: Enabled debug level and saw a lot of this:
DEBUG o.s.jndi.JndiObjectFactoryBean - Converted JNDI name [java:comp/env/TREE/treeDataSource] not found - trying original name [TREE/treeDataSource]. javax.naming.NamingException: Lookup failed for 'java:comp/env/TREE/treeDataSource' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitTreeFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: No object bound to name java:comp/env/TREE/treeDataSource]

Does this means I need to edit all my JNDI bindings from java:treeDataSource to java:comp/env/TREE/treeDataSource ?


text:
Q: Potatoes, carrots, eggs or potato, carrot and egg When writing recipes is it true that native speakers use singular and plural forms when they list ingredients but when talking  about them being cooked cut fried etc only the singular form is used?
For example
Ingredients
1 potato or 2 potatoes.
1 egg
1 carrot
3 carrots depends on how many of them are needed.
1 sausage
1 cucumber
But when chopped, fried, etc only the singular as in "These salad is made with potato, egg, carrot, sausage, cucumber and mayonnaise. Not "potatoes, eggs, and carrots and sausages, and cucumbers.

A: Some foodstuffs are non-countable nouns, any many can become non-countable when used as ingredients. For example, you can count eggs while they are in their shell, but once several eggs are cracked and beaten you would likely refer to the mix as "egg" in singular form. A recipe might list "3 eggs, beaten" in the ingredients, but the method might then say something like "add the egg to the bowl", meaning all of the egg mixture derived from the 3 eggs.
In your example where you are referring to a "salad made with potato, egg, carrot and mayonnaise", it is fine to use the ingredients in singular form because you are not quantifying the amount of salad. You are in effect saying that any given quantity of the salad will contain some carrot, some potato etc. You only need to start specifying the amounts or numbers of ingredients when you are being specific about the amount of the end product, such as in a recipe where it might state "to make this salad for 4 people you will need 4 eggs... etc".


text:
Q: Interpreting ceramic antenna datasheets I am considering using an ceramic antenna for my RF product design, but I am not sure how to interpret some of these antennas' datasheets which specify a ground plane surface.
For example the datasheet of this ceramic antenna from Johanson which specifies an example board with a a ground plane of a certain size:

Here are some of the questions about this design:

*

*Do I really need to have all these vias all around my GND plane?

*I have components soldered on top of the ground plane, will it affect the performance?

*This is a 4-layer board with two signal layers, a power plane and a GND plane, does this affect the performance as well?

*Is the 20mm x 40mm ground plane a recommendation, a minimum, or a maximum? If my PCB is bigger and a different overall form, will it still work?

A:
Do I really need to have all these vias all around my GND plane?

The vias make sure your ground plane is low-inductively coupled to the bottom ground plane. So, yes, you'll need a lot of vias, and placing them on the border of the top layer makes to avoid ungrounded parts of that plane.
If you need every single one: can't say. Get an estimate for the inductivity of your single via, and make sure you have enough in parallel that even at your RF, the effective resistance is small enough.

I have components soldered on top of the ground plane, will it affect the performance?

Then you've broken the ground plane, and that will indeed affect performance. The point is that you need the ground plane as ground plane around the microstrip feed of your antenna, and where it borders on the "copper-free" PCB area. If you ensure that is "clean", you've done well enough.

I this is a 4-layer board with two signal layers, a power plane and a GND plane, does this affect the performance as well?

Probably?

Is the 20mm x 40mm ground plane a recommendation, a minimum, or a maximum? If my PCB is bigger and a different overall form, will it still work?

The "19mm, can even be shortened" in your picture answers the question "is it a minimum?" with "no".
Generally, it's a ground plane. The bigger, the better, always.


text:
Q: Can't get data from localhost:8081 (expressjs API), I've tried vue-resource and axios I am learning VueJS and wanted to make a project. So I've to get data from ExpressJS server/API. I've tried vue-resource and axios. both of them returned status code 0.
I think my API is not responding correctly to HTTP requests.
What should I concentrate on while building API.
P/S: Sorry, can't upload any code, because I'm using different computer.

A: Your question is not clear. However, you mention this:

I think my API is not responding correctly to HTTP requests.

This may be the case and that would mean that your Express server is not running as expected. The causes I could think of for this are:

*

*You are not listening on port 8081, but rather on other port and you
have not noticed this. If you used Express-generator, the default
port is 3000.

*You are not calling the correct route from the front-end. Make sure
    that you are trying to access the correct url. For example you may
    have done the routing as follows:

localhost:8081/api/foo

and later be calling:

localhost:8081/foo

expecting to get a correct answer...
I would recommend to debug your server. Check the logs!
I really doubt your problem has to do with your front-end framework.

A: I fixed it with
res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type, \Authorization');


text:
Q: Grab all IDs except for Min Value I am trying to get the other KeyLocationIDs from the NumberOfDuplicates. I want to exclude the Min(KeyLocationID) and want a list of the others.
select CompanyID, Location, EventCode, count(*) as NumberOfDuplicates, min(KeyLocationID) as KeepThisOne
from trip.KeyLocations
group by CompanyID, Location, EventCode
having count (*) > 1
order by location asc

A: What you are missing here is the where statment.
There are several ways to do this, here are some examples:
as sugested by @nobody
or you could do:
select CompanyID, Location, EventCode, count(*) as NumberOfDuplicates,
min(KeyLocationID) as KeepThisOne
from trip.KeyLocations
group by CompanyID, Location, EventCode
having KeyLocationID > min(KeyLocationID)
order by location asc

OR you could do:
select CompanyID, Location, EventCode, count(*) as NumberOfDuplicates,
min(KeyLocationID) as KeepThisOne
from trip.KeyLocations
group by CompanyID, Location, EventCode
having KeyLocationID != MIN(KeyLocationID)
order by location asc

A: select CompanyID, Location, EventCode, count() as NumberOfDuplicates
from trip.KeyLocations
where
KeyLocationID not in (select min(KeyLocationID) from trip.KeyLocations group by CompanyID, Location, EventCode)
group by CompanyID, Location, EventCode
having count () > 1
order by location asc


text:
Q: How do I "update my packagelist using package manager" on Ubuntu 14.04 I'm following this guide on installing Kivy. Step 2 is

*Update your packagelist using your package manager

I'm very new to Ubuntu/Linux and don't know how.

A: Because you've already opened a terminal, with a simple command
sudo apt-get update

That's always necessary if you have done something like:
sudo add-apt-repository ppa:kivy-team/kivy

From man apt-get
update
    update is used to resynchronize the package index files from their
    sources. The indexes of available packages are fetched from the
    location(s) specified in /etc/apt/sources.list. For example, when
    using a Debian archive, this command retrieves and scans the
    Packages.gz files, so that information about new and updated packages
    is available. An update should always be performed before an upgrade
    or dist-upgrade. Please be aware that the overall progress meter will
    be incorrect as the size of the package files cannot be known in
    advance.


text:
Q: Test component with "declare var" In my angular2 app I have js file "connection.conf.js" with var:
var appTypeConf = "example-app";

Component uses the variable from "connection.conf.js":
declare var appTypeConf: string;

export class Component {
  public appType = appTypeConf;
}

it works corectly in my app, but when I test application with karma,
I receive a error:
ReferenceError: Can't find variable: appTypeConf (line 9)

How to corectly declare a variable in the component spec file?

A: I found the solution, I had to add connection.conf.js path to files array in karma.conf.js
var files = [
  // ***
  'app/connection.conf.js'
]


text:
Q: Image ContentScale not applied correctly when Coil's Crossfade is set to true I am using Coil to load a remote image in Jetpack Compose but I am facing a strange problem.
Here is the code that I am working with:
 Column() {

            Image(
                painter = rememberImagePainter(
                    data = recipe.featuredImage,
                    builder = {
                        crossfade(true)
                        placeholder(R.drawable.empty_plate)
                    }
                ),
                modifier = Modifier
                        .fillMaxWidth()
                        .height(225.dp),
                contentScale = ContentScale.Crop,
                contentDescription = null

            ) ....}

When I set crossfade to true the image is not cropped or stretched to fit the Width. However, when the crossfade is false the image is properly cropped to fit the Width.
Strangely, when I scroll the image off the screen and then scroll the image back to the screen, it is properly cropped even when the Crossfade is set to true.

Image A - Image not displayed properly,       Image B - Correct display that I need.
I want to use crossfade because the images take a bit of time to load and I want to show the image the first time the screen loads instead of the user having to scroll down for the image to display properly.
Have looked around but can't figure out how to resolve this, any leads?

A: Actually, the problem I have is a reported bug and the extract from this reads as follows:
... "To work around this for now, the size of the placeholder can be reduced to be less than the size of the loaded image. In the sample project, this can be done by reducing width and height of ic_food.
I tried looking into this, and it seemed to be happening because the placeholder image was bigger (and had a different aspect ratio) than the loaded image. This meant that the intrinsic size of the CrossfadePainter was based off the size of the placeholder".
To resolve the issue I simply used a smaller placeholder in dimens (24 x 24) and left the Crossfade on, this resolved the problem.


text:
Q: Is "the smallest open set containing zero" a well defined concept? A function is said to be continuous at zero iff:
$\lim_{x \rightarrow 0}{f(x)} = f(0)$
Could this be the same as saying:

*

*Let $\Delta$ = the smallest open set containing zero

*$f(x) = f(0), \forall x \in \Delta$
Am I misunderstanding what a limit is, or are these two definitions equivalent?
Edit:  I've got a few responses saying that there is no such set as $\Delta$.  I agree.  However, it seems to me that the expression:
$\lim_{x \rightarrow 0}{f(x)} = f(0)$
is definitively claiming to evaluate $f$ at some unspecified value or values $x \neq 0$ but not claiming any particular values.  To be specific, for any particular value you could name, the claim that the limit exists does not claim it needs to evaluate f at that point.  So, what exactly is it claiming?

A: As others have commented, no smaller set exist (for a standard usage of smaller, at least). In terms of open sets, what you can say is that $f$ is continuous at $p$ if for every open set $V$ containing $f(0)$, there is an open set $U$ containing $0$ such that $f(U) \subseteq V$. This allows you to take arbitrarily small intervals, in particular, which approximates your intuitive idea of taking the 'smallest' such set.
Many concepts in analysis, in particular, use this same thought process: defining notions by making sense of approximations up to arbitrary precision.

A: There is no smallest open set containing zero.
Any open set containing zero by definition contains an open interval containing zero and that interval contains a smaller open interval containing zero.

A: There is no such thing as "the smallest open set containing $0$". That's so because if $A$ is an open subset of $\mathbb R$ (I'm assuming that you're working in $\mathbb R$) and $0\in A$, then $A\supset(-\varepsilon,\varepsilon)$, for some $\varepsilon>0$. If $A\varsupsetneq(-\varepsilon,\varepsilon)$, take $A^\star=(-\varepsilon,\varepsilon)$; otherwise, take $A^\star=\left(-\frac\varepsilon2,\frac\varepsilon2\right)$. In each case, $A^\star$ is an open set containing $0$ and $A^\star\varsubsetneq A$.


text:
Q: Is there a difference between "entrée" and "entry"? From a recent op-ed in the Washington Post (emphasis mine):

But immigration gives Trump entrée to African Americans with an issue that will resonate with many and at least give him a hearing.

I looked up "entrée" in the dictionary, and as the context and definition indicated, the meaning is extremely similar to "entry" at the least.  However, I am a native speaker who has never seen "entrée" used outside of the context of eating.
Can "entry" and "entrée" be used totally interchangeably, or does one or the other have connotation or a slightly different meaning or usage?

A: An entry is  place where you enter; entrée is permission to enter.
(An entrée is also the main course of a meal.  The two words cannot be exchanged for each other.)
The sentence means that Trump's xenophobia will be his figurative ticket into the circle of attention of black voters.


text:
Q: LTE applications Let k be a positive integer. Find all positive integers n such that
$3^k | 2^n - 1$
I just started reading and learning about the Lifting the Exponents Lemma, and I want to try and use it in this problem.
So I know that if that said statement is true, then
$V_3(2^n - 1) > 0$
I guess you can express it as$V_3(2^n - 1^n)$, but in the lifting the exponent lemmas, I can't find one theorem that can solve the above expression, since 3 does not divide 2-1.


text:
Q: How to create dynamic tabs using include with PrimeFaces I try to add tabs dynamically using ui:include, but I can not get the good behavior!
If I look at the HTML response, the content is there, but does not appear in the tab.
If i try to open a 2nd tab with an other content the html result contain the same content as the 1st tab.
A tab is added with the following command:
<p:commandLink id="appC1" update=":tabview" actionListener="#{tview.sideBarAction}"
value="App 1">
    <f:param id="c1ParamId" name="pageViewId" value="App1" />
</p:commandLink>

and the tabview:
<p:tabView id="tabview" value="#{tview.tabs}" var="tab">
<p:tab title="#{tab.title}" closable="true">
    <p:panel id="myPanel">
    <ui:include src="#{tab.content}"/>
    </p:panel>
</p:tab>
</p:tabView>

I tried to do this programmatically, but I have not had best results!

A: Try with c:forEach like that:
<p:tabView id="tabPanel" activeIndex="#{tabView.activeIndex}"
                       style="width: 100%; height: 100% !important;">
                <p:ajax event="tabClose" listener="#{tabView.onTabClose}"/>
                <p:ajax event="tabChange" listener="#{tabView.onTabChange}"/>
    <c:forEach items="#{tabView.tabs}" var="tab">
          <p:tab titletip="#{tab.id}" title="#{tab.label}" closable="true">
              <ui:include src="#{tab.url}"/>
          </p:tab>
    </c:forEach>

</p:tabView>

Good luck! :)


text:
Q: How do I reverse selected lines order in Vim? For example, if I have four lines as follows:

the first line
  the second line
  the third line
  the fourth line

I want to reverse them to

the fourth line
  the third line
  the second line
  the first line

How could I do this in Vim?

A: A command :Rev[erse] and optional mappings for your vimrc, so you don't have to remember and perform the non-obvious steps of this recipe:
" Reverse the lines of the whole file or a visually highlighted block.
    " :Rev is a shorter prefix you can use.
    " Adapted from http://tech.groups.yahoo.com/group/vim/message/34305
command! -nargs=0 -bar -range=% Reverse
    \       let save_mark_t = getpos("'t")
    \<bar>      <line2>kt
    \<bar>      exe "<line1>,<line2>g/^/m't"
    \<bar>  call setpos("'t", save_mark_t)

nmap <Leader>r :Reverse<CR>
xmap <Leader>r :Reverse<CR>

(:xmap maps for Visual but not Select mode, as :help mapmode-x advises for mapping printable characters.)
(Based on: http://tech.groups.yahoo.com/group/vim/message/34305 )

A: For those more comfortable with Visual mode:
 1. Identify the line number above the selection you want flipped using :set nu.
 2. Shift-V to highlight selection you want flipped (visual mode).
 3. :g/^/m <Line number from step 1>.
Note that in visual mode it will automatically show up as
    :'<,'>g/^/m <Line number> when you type in the command from 3.
This command works by moving the selection one line at a time into the line number that you give it. When the second item gets pushed into the line number given, it pushes the first down to line number + 1. Then the third pushes the first and second down and so on until the entire list has been pushed into the single line number resulting in a reverse ordered list.

A: On Mac OS X, tac does not exist, but you can use tail -r to the same effect:
:%!tail -r

This also works nicely for visual mode:
:'<,'>!tail -r

Excerpt from tail(1)'s manpage:

The -r option causes the input to be displayed in reverse order, by
  line.  Additionally, this option changes the meaning of the -b, -c and
  -n options.  When the -r option is specified, these options specify the number of bytes, lines or 512-byte blocks to display, instead of
  the bytes, lines or blocks from the beginning or end of the input from
  which to begin the display.  The default for the -r option is to
  display all of the input.

A: Let' say you are at the line 3, hence we have a range 3 to 6. Just type.
:3,6g/^/m2

A: To reverse all the lines in a file,
:global/^/move 0

Abbreviated:
:g/^/m0

For an explanation see
:help 12.4

which also shows how to reverse just a range of lines.

A: Select the desired lines, hit !, and in the resulting prompt pipe the lines through tac a la :'<,'>!tac.  See man tac for more details.


text:
Q: Windows Forms Windows 8 Theme How to apply windows 8 theme for windows forms ?

Note : What i want to achieve is clearly using the style so that any user [with\without] windows 8 installed can see my application with windows 8 style. {Just Like Any Other Style?]

A: Not sure why you would want to, because it makes your UI inconsistent with other applications in the OS - chances are users won't be happy. To help you convert the whole OS, there are 3rd party themes available on the internet. For Windows 7, there is one by deviantart. Or try Windows 8 Transformation pack, which supposedly can even work on XP.
If you want to style your particular app, there are 3rd party UI components you can use, but they are all paid (from what I know). Some vendors, for example, are Devexpress and Telerik.


text:
Q: SQL Server 2017 Express Edition - Installing Error 2147467259 (The system cannot find the path specified) I am installing SQL Server Express Edition 2017 in a Dell Laptop Intel Core i7-5600U CPU 2.6 GH and 8GB RAM. Windows 8.1 Enterprise 64 bits. And I just keep on getting the error: "The system couldn´t find the path specified" Decimal error code 2147467259.
I had Visual Studio 2017, I uninstalled it and uninstalled the Visual C++ redistributables, but I still can´t install the SQL 2017. Any idea about what else to do would be greately appreciated.


text:
Q: React Native - how can i share a message in bold font weight? I am using react native Share API and I want to share a message in bold font weight
I can not seem to find a way to do it
Does anyone know how it can be done?

A: I haven't found anything about sharing bold text, but you can use the already assigned bold characters found in the Unicode characters here:
https://unicode.org/charts/nameslist/n_1D400.html
I made this function that transforms characters to bold using this method:
const toBold = text =>{
  const charSet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '?', '.', ',', '"', "'"];
  const targetCharSet = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '❗', '❓', '.', ',', '"', "'"];
  const textArray = text.split('');
  let boldText = '';
  textArray.forEach((letter) => {
    const index = charSet.findIndex((_letter) => _letter === letter);
    if (index !== -1) {
      boldText = boldText + targetCharSet[index];
    } else {
      boldText = boldText + letter;
    }
  });
  return boldText;
}

Usage:
toBold('Hi Mom');

Output:

Note:
The text might not show up in your console.


text:
Q: Using maven to connect to a local project I have two projects in eclipse:

*

*framework:  A general library used in several projects.

*client:  A project that uses framework.

client is quite large, possibly larger than framework at this point.  I am using client as sort of a test fixture for framework.  I want to make a few changes in framework and test them in client.  Currently, I have to do a full build of framework, install it into a maven repo, and then rebuild client.
Is there a way to just have client point to framework directly on my local disk?  Any other hints for developing in such a situation (ie is the a better way)?

A: You can specify dependencies from the local disk using <systemPath> like so:
<dependency>
    <groupId>example.logging</groupId>
     <artifactId>commons-logging</artifactId>
     <version>1.0.0</version>
     <scope>system</scope>
     <systemPath>${project.basedir}/lib/commons-logging.jar</systemPath>
</dependency>

I'm not sure if you can point to a directory that has a pom in it, but at least you don't have to deploy it into maven.

A: The m2eclipse plugin is fairly intelligent about Maven dependencies. If you have the framework dependency open as a separate project in Eclipse, I think it should use its code for client rather than the version in your repository. You might need to tweak your project settings if you're already using m2eclipse and it doesn't do this.

A: Running mvn install on Framework will build it and install it in your local Maven repository (that is, the Maven repository on your local disk). When you run your tests in Client, Maven will automatically use the version of Framework in your local repository.


text:
Q: Building a query using NOT EXISTS in jpa criteria api I have two tables named as table1 ,table2.Both the tables are having same no  of fields.There is no relation between these two tables.My requirement is I want all the records in table1 which are not there in table2. So I have written a query using Criteria API. But it is not giving the correct result. As I am new to this JPA and criteria API, can any one point me where I am doing wrong.The below code I am using to do this.
CriteriaBuilder cb = mediationEntityManager.getCriteriaBuilder();
CriteriaQuery<Table1>  cq = cb.createQuery(Table1.class);
Root<Table1> table1 = cq.from(Table1.class);
cq.select(table1)

Subquery<Table2> subquery =  cq.subquery(Table2.class)
Root table2 = subquery.from(Table2.class)
subquery.select(table2)
cq.where(cb.not(cb.exists(subquery)))
TypedQuery<Table1> typedQuery = mediationEntityManager.createQuery(cq);
List<Table1> resultList = typedQuery.getResultList();

MySQL Query :
SELECT table1
FROM   table1 table1
WHERE  NOT EXISTS (SELECT table2
                   FROM   table2 table2
                   WHERE  table2.name = table1.name
                          AND table2.education = table1.education
                          AND table2.age = table1.age)
       AND table1.name = 'san'
       AND table1.age = '10';

I need the JPA criteria API query for the above mentioned MySQL query.

A: You can try the below code with Criteria API. I haven't tried, but you can try modifying the code accordingly.
CriteriaBuilder cb = mediationEntityManager.getCriteriaBuilder();
CriteriaQuery<Table1> query = cb.createQuery(Table1.class);
Root<Table1> table1 =  query.from(Table1.class);
query.select(table1);
//--
Subquery<Table2> subquery = query.subquery(Table2.class);
Root<Table2> table2 = subquery.from(Table2.class);
subquery.select(table2);
//--
List<Predicate> subQueryPredicates = new ArrayList<Predicate>();
subQueryPredicates.add(cb.equal(table1.get(Table1_.name), table2.get(Table2_.name)));
subQueryPredicates.add(cb.equal(table1.get(Table1_.age), table2.get(Table2_.age)));
subQueryPredicates.add(cb.equal(table1.get(Table1_.education), table2.get(Table2_.education)));
subquery.where(subQueryPredicates.toArray(new Predicate[]{}));
//--
List<Predicate> mainQueryPredicates = new ArrayList<Predicate>();
mainQueryPredicates.add(cb.equal(table1.get(Table1_.name), "san");
mainQueryPredicates.add(cb.equal(table1.get(Table1_.age), "10");
mainQueryPredicates.add(cb.not(cb.exists(subquery)));
//--
query.where(mainQueryPredicates.toArray(new Predicate[]{}));
TypedQuery<Table1> typedQuery =  mediationEntityManager.createQuery(query);
List<Table1> resultList = typedQuery.getResultList();

Also, you can try below JPQL query, which is easier to understand, alter & debug.
SELECT t1
FROM   table1 t1,
       table2 t2
WHERE  t1.name = 'san'
       AND t1.age = '10'
       AND (t2.name <> t1.name
             AND t2.education <> t1.education
             AND t2.age <> t1.age);


text:
Q: Append header to all Http Requests -> Angular2 I need the equivalent of the interceptor in Angular 1.x.
I found a lot of solutions in old questions, but apparently they are not working anymore!
Can you provide a solution that works with the latest release of Angular 2?

A: You can override Angular's Http class, add headers there and then provide CustomHttp class in your modules:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { RequestOptionsArgs, RequestOptions, ConnectionBackend, Http, Request, Response, Headers } from "@angular/http";

@Injectable()
export class CustomHttp extends Http {

headers: Headers = new Headers({ 'Something': 'Something' });
options1: RequestOptions = new RequestOptions({ headers: this.headers });

constructor(backend: ConnectionBackend,
    defaultOptions: RequestOptions) {
    super(backend, defaultOptions);
}

get(url: string, options?: RequestOptionsArgs) {
    console.log('Custom get...');
    return super.get(url, this.options1).catch(err => {
        console.log(err);
    });
}
}

You need to do the same for post, put, delete etc.
And in your module:
{ provide: Http,
    useFactory: (
        backend: XHRBackend,
        defaultOptions: RequestOptions) =>
        new CustomHttp(backend, defaultOptions),
    deps: [XHRBackend, RequestOptions]
}


text:
Q: Change WIA scanner source in powershell script So i am using a script to automate scanning, everything is good except that my scanner always uses the flatbed for scanning and I can't seem to change the source to Feeder. Here is the code i'm using
# Create object to access the scanner

$deviceManager = new-object -ComObject WIA.DeviceManager
$device = $deviceManager.DeviceInfos.Item(1).Connect()
# Create object to access the scanned image later
$imageProcess = new-object -ComObject WIA.ImageProcess

# Store file format GUID strings
$wiaFormatBMP  = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"
$wiaFormatPNG  = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}"
$wiaFormatGIF  = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}"
$wiaFormatJPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
$wiaFormatTIFF = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"

# Scan the image from scanner as BMP
foreach ($item in $device.Items) {
    $image = $item.Transfer()
}

# set type to JPEG and quality/compression level
$imageProcess.Filters.Add($imageProcess.FilterInfos.Item("Convert").FilterID)
$imageProcess.Filters.Item(1).Properties.Item("FormatID").Value = $wiaFormatJPEG
$imageProcess.Filters.Item(1).Properties.Item("Quality").Value = 5
$image = $imageProcess.Apply($image)

# Build filepath from desktop path and filename 'Scan 0'
$filename = "$([Environment]::GetFolderPath("Desktop"))\Scan {0}.jpg"

# If a file named 'Scan 0' already exists, increment the index as long as needed
$index = 0
while (test-path ($filename -f $index)) {[void](++$index)}
$filename = $filename -f $index

# Save image to 'C:\Users\<username>\Desktop\Scan {x}'
$image.SaveFile($filename)

# Show image
& $filename

I only need to change the scanner source and then save all the images.

A: So after a lot of research and experiments. I finally made it work.
foreach($prop in $device.Properties){
    if( $prop.Name -eq "Document Handling Select"){
        $prop.Value=1
    }
}

But this still only gave me 1 image so i had to use a while loop over all the code i gave before. Works perfect now!


text:
Q: Solve $yy' = \sqrt{y^2+y'^2}y''-y'y''$ Solve $$yy' = \sqrt{y^2+y'^2}y''-y'y''$$
First I set $p = y'$ and $p' = \frac{dp}{dy}p$ to form:
$$yp=\sqrt{y^2+p^2}\frac{dp}{dy}p-p\frac{dp}{dy}p \rightarrow y=\sqrt{y^2+p^2}\frac{dp}{dy}-\frac{dp}{dy}p$$
I am trying to come up with a clever substitution to deal with the square root and $p$ of :
$$y=\frac{dp}{dy}(\sqrt{y^2+p^2}-p)$$

A: After OP's work
$$y=\frac{dp}{dy}(\sqrt{y^2+p^2}-p)$$
This is a homogeneous equation for $p(y)$
$$\frac{dp}{dy}=\frac{y}{\sqrt{y^2+p^2}-p}=\frac{\sqrt{y^2+p^2}+p}{y}$$
Let $p=vy$, then get
$$v+y\frac{dv}{dy}=\sqrt{1+v^2}+v \implies \int \frac{dv}{\sqrt{1+v^2}}= \int \frac{dy}{y}$$
Let $v=\tan t$, thenwe get
$$\ln(\sec t+ \tan t)=\ln cy \implies cy=\sqrt{1+v^2}+v \implies c^2y^2-1=2cp$$
$$\implies \frac{dy}{dx}=\frac{c^2y^2-1}{2c}\implies \int\frac{2cdy}{c^2y^2-1}=\int dx+b$$
$$\implies \ln \left(\frac{cy-1}{cy+1} \right)=x+b \implies y=\frac{1}{c}\left(\frac{1+ae^x}{1-ae^x}\right)$$

A: Let $y=e^z$ which makes the equation to be
$$z'+(z'-\sqrt{z'^2+1}) \left(z''+z'^2\right)
   =0\implies z''=z'\sqrt{1+z'^2}$$ Reduction of order $(p=z')$ leads to
$$p'=p\sqrt{1+p^2}$$ Switching variables gives
$$x'=\frac 1 {p\sqrt{1+p^2}}\implies x+c_1=\log (p)-\log \left(1+\sqrt{1+p^2}\right)$$ Solving for $p$
$$p=\frac{2 e^{(x+c_1)}}{1-e^{2(x+c_1)}}=-\text{csch}(x+c_1)$$
Half-angle substitution leads to
$$z=\log \left(\coth \left(\frac{x+c_1}{2}\right)\right)+c_2$$ Back to $y$
$$y=c_3 \coth \left(\frac{x+c_1}{2}\right)$$
Hoping no mistake !

A: Note that
$$
(y^2+y'^2)'=2y'(y''+y)=2\sqrt{y^2+y'^2}y''
$$
so that separation and integrating once gives
$$
y'+C=\sqrt{y^2+y'^2}
$$
If $C=0$ this only has the zero solution. For $C\ne 0$ square it and simplify
$$
2Cy'+C^2=y^2\implies \frac{y'}{C+y}+\frac{y'}{C-y}=-1,
$$
if $y$ is not a constant function with value $\pm C$. Otherwise this integrates to
$$
\ln|y-C|-\ln|y+C|=x+d\implies \frac{y-C}{y+C}=De^x\implies y(x)=C\frac{1+De^x}{1-De^x}.
$$
Depending on the sign of $D$, this can be expressed via the hyperbolic tangent or cotangent.


text:
Q: Absolutely but not uniformly convergent Let $$f_n(x) =
\begin{cases}
0, & \text{if }x<\frac{1}{n+1}, \\
\sin^2\frac{\pi}{x}, & \text{if }\frac{1}{n+1}\le x\le\frac{1}{n}, \\
0, & \text{if }x>\frac{1}{n}.
\end{cases}$$Show that $\{f_n\}$ converges to a continuous function, but not uniformly. Use the series $\sum f_n$ to show that absolute convergence, even for all $x$, does not imply uniform convergence.
My proof: It's easy check that limit function $f(x)$ of $\{f_n\}$ is null function, i.e. $f(x)\equiv 0$. But $\{f_n\}$ does not uniformly converges since $$M_n=\sup \limits_{\mathbb{R}}|f_n(x)-f(x)|=\sup \limits_{[\frac{1}{n+1}, \frac{1}{n}]}\sin ^2\left(\frac{\pi}{x}\right)=\frac{1}{2}-\frac{1}{2}\inf \limits_{[\frac{1}{n+1}, \frac{1}{n}]}\cos \left(\frac{2\pi}{x}\right)=1$$ which does tends to zero as $n\to \infty$.
Also $\sum \limits_{n}f_n(x)$ absolutely converges for any $x\in \mathbb{R}$ but does not converges unifromly since $$M_n=\sup \limits_{\mathbb{R}}\left|\sum \limits_{k=n+1}^{\infty}f_k(x)\right|=\sup \limits_{\mathbb{R}}(f_{n+1}(x)+f_{n+2}(x)+\dots)\ge \sup \limits_{\mathbb{R}}f_{n+1}(x)=$$$$=\sup \limits_{[\frac{1}{n+2}, \frac{1}{n+1}]}\sin ^2\left(\frac{\pi}{x}\right)=1.$$
What did you think about my proof? Are my reasoning correct?


text:
Q: Is there any guide, how to use DOM modifying javascript libraries, plugins with Blazor? I would like to use Blazor, preferably server side. I also would like to use, reuse my existing themes and visual design, however this many time includes using great javascript libraries, which modifies DOM programmatically to achieve their effect.
As far as I understand Blazor works with virtual DOM. What I do not understand how can the virtual DOM be in sync the real DOM, if any javascript code modifies the real DOM behind Blazors back.
The only way I could imagine, if there is a mechanism built in to Blazor to deal with this scenario, however even after years after Blazor in the scene, I can not see it documented, the issue I am talking about does not seem even a topic in Google searches.
Question
Is there any way to use Blazor with javascript libraries, which are modifying DOM? I mean have Blazor any built in mechanism to deal with this, or in case it have no, is there any common best practice?

A: From the documentation:

Interaction with the Document Object Model (DOM)
Only mutate the Document Object Model (DOM) with JavaScript (JS) when
the object doesn't interact with Blazor. Blazor maintains
representations of the DOM and interacts directly with DOM objects. If
an element rendered by Blazor is modified externally using JS directly
or via JS Interop, the DOM may no longer match Blazor's internal
representation, which can result in undefined behavior. Undefined
behavior may merely interfere with the presentation of elements or
their functions but may also introduce security risks to the app or
server.
This guidance not only applies to your own JS interop code but also to
any JS libraries that the app uses, including anything provided by a
third-party framework, such as Bootstrap JS and jQuery.
In a few documentation examples, JS interop is used to mutate an
element purely for demonstration purposes as part of an example. In
those cases, a warning appears in the text.
For more information, see Call JavaScript functions from .NET methods
in ASP.NET Core Blazor.


text:
Q: Create a S3 bucket on each AWS account created with terraform I am using terraform to create multiple AWS accounts using aws_organizations_account. What I am now trying to do is to create a aws_S3_bucket on each new created accounts.
resource "aws_organizations_account" "this" {
  for_each  = local.all_user_ids
  name      = "Dev Sandbox ${each.value}"
  email     = "${var.manager}+sbx_${each.value}@example.com"
  role_name = "Administrator"
  parent_id = var.sandbox_organizational_unit_id
}

resource "aws_s3_bucket" "b" {
  bucket = "my-tf-test-bucket"
  acl    = "private"
}

Everything is working as expected for aws_organizations_account during my terraform apply but my S3 bucket is created inside my current AWS project while I am trying to create a S3 bucket for every new AWS account.

A:
Step 1:     Create_terraform_s3_buckets.tf

# First configure the AWS Provider
provider "aws" {
  access_key = var.aws_access_key
  secret_key = var.aws_secret_key
  region     = var.aws_region
}

// then use the resource block and create all the buckets in the variable array
// Here setup your accounts would in the variable for e.g. My_Accounts_s3_buckets
variable "My_Accounts_s3_buckets" {
  type = list
  default = ["Testbucket1.app", "Testbucket2.app", "Testbucket3.app"]
}

Look up the s3_bucket objectfor more help from Terraform ref. aws_s3_bucket
 // resource "aws_s3_bucket" "rugged_buckets" "log_bucket" { <- different types of options on your buckets
 resource "aws_s3_bucket" "b" {
  count         = length(var.My_Accounts_s3_buckets) // here are you 3 accounts
  bucket        = var.My_Accounts_s3_buckets[count.index]
  acl           = "private"
  region        = "us-east-1"
  force_destroy = true

 tags = {
  Name        = "My Test bucket"
  Environment = "Dev"
 }

}

Step 2: You can now automate this with the variables file.

# Make sure you keep this order

variable "My_Accounts_s3_buckets" {
  type = list
  default = ["mybucket1.app",
             "mybucket2.app" // you can add more.. as needed
            ]
}


text:
Q: How to fix this error which is stating something is not a function? I am trying to append this: '
' + htmlEncode(imagefilename) + '
' when the user clicks on the cancel button (.imageCancel). But it is giving me this error: $('
').text(value).html(); is not a function. How can this error be fixed? Is it because
$('.cancelImage').eq(window.lastUploadImageIndex).append('
' + htmlEncode(imagefilename) + '
');

is in the $(".imageCancel").on("click", function(event) { function?
function htmlEncode(value) {
    return $('
').text(value).html();
}

function startImageUpload(imageuploadform, imagefilename) {

    $(".imageCancel").on("click", function (event) {

        $('.cancelImage').eq(window.lastUploadImageIndex).append('
' + htmlEncode(imagefilename) + '
');

        var image_file_name = $(this).attr('image_file_name');
        jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)

        $(this).parent().remove();

        $('.upload_target').get(0).contentwindow

        return stopImageUpload();

    });

    return true;
}

A: Try changing the function to
function htmlEncode(value) { return $('
').text(value || '').html(); }

I suspect that .text() might be a little un-rigorous about testing its argument, and interpreting a null as meaning that you want the function to return the current text content of the selected element.
Now, as to why the argument would be null, well, that depends on the rest of your code.


text:
Q: DataTables filter doesn't range numbers from JSON data I've encountered the problem. DataTables doesn't range number loaded from JSON.
I try to filter fourth column data[3].  The chrome console does not display any error.
I can see 'processing' modal while enter a number into an input field but it does nothing.
My script looks like this:
(function(){
$.fn.dataTable.ext.search.push(
    function( settings, data, dataIndex ) {
        var min = parseInt( $('#min_room').val(), 10 );
        var max = parseInt( $('#max_room').val(), 10 );
        var rooms = parseFloat( data[3] ) || 0;

        if ( ( isNaN( min ) && isNaN( max ) ) ||
             ( isNaN( min ) && rooms <= max ) ||
             ( min <= rooms   && isNaN( max ) ) ||
             ( min <= rooms   && rooms <= max ) )
        {
            return true;
        }
        return false;
    }
);

$(document).ready(function() {
    $('#datatabletest').DataTable({

    "order": [[ 0, "desc" ]],
    "deferRender": true,
    "processing": true,
    "serverSide": true,
    "ajax": "http://www.site.ru/jsonfile/"
});

    var table = $('#datatabletest').DataTable();

    $('#min_room, #max_room').keyup( function() {
        table.draw();
    });
});
})();

The json file was created by django-datatables-view and looks like this:
{
  "recordsTotal": 129,
  "recordsFiltered": 129,
  "draw": 0,
  "data": [
    [
      "2016-04-04",
      "Твардовского 22/5",
      "м-н КСМ",
      1,
      1250,
      2,
      "Наталья"
    ],
    [
      "2016-01-17",
      "Крылова 4",
      "м. Красный проспект",
      4,
      32000,
      107,
      "Собственник"
    ], ...

My table part of html file:
<form>

              Число комнат:

                <input type="text" id = "min_room" placeholder="0" class="form-control">

                <input type="text" id="max_room" placeholder="5" class="form-control">

          </form>

                td1
                td2
                td3
                td4
                td5
                td6
                td7

                td1
                td2
                td3
                td4
                td5
                td6
                td7


text:
Q: the code show bad input and index out of range on the lines, how can i fix it what's the problem with my code and how can I fix it.
The problems are in lines:
world[r].append(element)
world = createWorld()
world = createWorld()
Now I show all of the code, but it seems too long need more text to make it available to post, so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.so ignore this part.
This was the error given:
IndexError: list index out of range

There are more details in the code below, appreciate it if you can help:)
import random

SIZE = 4
EMPTY = " "
PERSON = "P"
PET = "T"
POOP = "O"
ERROR = "!"
CLEANED = "."
MAX_RANDOM = 10

def clean(world, endRow, endColumn):
    print("Scooping the poop")

    for r in range(SIZE):
        for c in range(SIZE):
             if world[r][c] == POOP:
                 world[r][c] = CLEANED

def count(world, endRow, endColumn):
    print("Counting number of occurances of a character")
    number = 0
    element = input("Enter character: ")

    for r in range(SIZE):
        for c in range(SIZE):
            if world[r][c] == element:
                number += 1

    return(element, number)

def createElement():
    tempNum = random.randrange(MAX_RANDOM)+1

    if ((tempNum >= 1) and (tempNum <= 5)):
        tempElement = EMPTY

    elif ((tempNum >= 6) and (tempNum <= 7)):
        tempElement = PERSON

    elif (tempNum == 8):
        tempElement = PET

    elif ((tempNum >= 9) and (tempNum <= 10)):
        tempElement = POOP

    else:
        tempElement = ERROR

    return(tempElement)

def createWorld():
    world = []
    r = 0

    while (r < SIZE):
        world.append([])
        c = 0
        while (c < SIZE):
            element = createElement()
            world[r].append(element)
            c = c + 1
            r = r + 1
        return(world)

def display(world):
    print("OUR WORLD")
    print("========")
    r = 0
    while (r < SIZE):
        c = 0
        while (c < SIZE):
            print(world[r][c], end="")
            c = c + 1
        print()
        r = r + 1
    print("========\n")

def getEndPoint():
    endRow = int(input("Enter the row: "))
    while not 0 <= endRow <= 3:
        print("Invalid input. Row value should be in range 0-3")
        endRow = int(input("Enter the row: "))
    endColumn = int(input("Enter the column: "))
    while not 0 <= endColumn <= 3:
        print("Invalid input. Column value should be in range 0-3")
        endColumn = int(input("Enter the column: "))

    return (endRow, endColumn)

def start():

    world = createWorld()
    display(world)
    endRow, endColumn = getEndPoint()
    element, number = count(world, endRow, endColumn)
    print("# occurances of %s=%d" % (element, number))
    clean(world, endRow, endColumn)
    display(world)

start()

A: You need to update the r value in the outer loop, currently it is being updated in the inner loop.
def createWorld():
    world = []
    r = 0

    while (r < SIZE):
        world.append([])
        c = 0
        while (c < SIZE):
            element = createElement()
            world[r].append(element)
            c = c + 1
        r = r + 1
    return (world)


text:
Q: Not able to connect to azure database using pyodbc library I am not able to connect to my azure database in python using pyodbc library.
When I pass the connection string in the below format:
*
cnxn = pyodbc.connect(
    'DRIVER={SQL Server};'
    'SERVER= servername;'
    'DATABASE=dbname;'
    'username=username;'
    'password=password'
)

*

*

I get the following error:
line 4, in
cnxn = pyodbc.connect(
pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
When I pass the connection string in the below format:
*
cnxn = pyodbc.connect(
    driver = '{SQL Server}',
    server = 'servername',
    database = 'dbname',
    username = 'username',
    password = 'password'
)

*

*

I get the following error:
line 4, in
cnxn = pyodbc.connect(
pyodbc.InterfaceError: ('28000', "[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user

A: In order to give you full answer please add where are trying to connect to the server from: your computer? a server?
Did you make sure that you IP is whitelisted ?
did you tied to connect to the DB with SSMS(sql server management studio) so you know for sure it is not a user/password issue?
A possible solution if you are trying from your windows base computer is to
to install ODBC Driver 13&17 and then change your code:
 driver = '{ODBC Driver 17 for SQL Server}'

A: Below is the correct format of the connection string:
cnxn = pyodbc.connect(
    'DRIVER={SQL Server};'
    'SERVER= servername;'
    'DATABASE=dbname;'
    'UID=username;'
    'PWD=password'
)


text:
Q: Oracle XML version Is it possible to work with XML in oracle so that it does not convert empty nodes?
I have XML files:
<foo></foo>

If I convert from clob to XMLTYPE and then do some operations (e.g. updatexml) the file will be converted and empty nodes will be saved like this: <foo/>
And this format is not supported by PrestaShop...


text:
Q: Can calling WSAStartup() from several threads cause a deadlock? I'm developing an app that has one TCP server and several UDP servers/listeners. Each server is a separate thread, same as the worker threads for established TCP connections. I'm calling WSAStartup() in each of the threads.
Sometimes, calling WSAStartup() hangs (it looks like a deadlock to me). Here is the stack trace:
  ntdll.dll!_KiFastSystemCallRet@0()
  ntdll.dll!_ZwWaitForSingleObject@12()  + 0xc bytes
  ntdll.dll!_RtlpWaitForCriticalSection@4()  + 0x8c bytes
  ntdll.dll!_RtlEnterCriticalSection@4()  + 0x46 bytes
  ntdll.dll!_LdrpGetProcedureAddress@20()  + 0x17d bytes
  ntdll.dll!_LdrGetProcedureAddress@16()  + 0x18 bytes
  kernel32.dll!_GetProcAddress@8()  + 0x3e bytes
  vld.dll!03203723()
  [Frames below may be incorrect and/or missing, no symbols loaded for vld.dll]
  ws2_32.dll!CheckForHookersOrChainers()  + 0x22 bytes
  ws2_32.dll!_WSAStartup@8()  + 0xa7 bytes

This deadlock happens during the initialization faze. I see that the TCP server is started and that one TCP connection is established, while only one of UDP servers is started. The stack trace is from the function that should initiate the rest of UDP servers. My guess is that while I'm trying to init UDP sever and calling WSACStartup(), another tread is handling another socket operation, for example a new TCP connection and it's also calling WSAStartup()?
My question is whether calling WSAStartup() from several threads can cause this deadlock?
Also I checked is the WSACleanup() called before the deadlock, and it isn't. The execution never reaches any of WSACleanup().
I'm aware that only one call to WSAStartup should be enough, yet calling WSAStartup() several times should not be a problem (MSDN]1):
"An application can call WSAStartup more than once if it needs to obtain the WSADATA structure information more than once."
Hence, I would like to establish whether this deadlock is caused by WSAStartup() or something else.

A: The WSAStartup function typically leads to protocol-specific helper DLLs being loaded. As a result, the WSAStartup function should not be called from the DllMain function in an application DLL. This can potentially cause deadlocks. Dllmain is called in DLL loader critical section which is primary reason of this deadlock.
For more details :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms742213%28v=vs.85%29.aspx

A: You don't have to call WSAStartup() multiple times at all.  Once per program is fine.

A: I think that Luke is right. You cannot call WSAStartup() in DllMain() or in initializers of global/static variables. Change your code so that it does not happen.

A: WSAStartup doesn't actually lead to LoadLibrary of any kind, so I don't feel like it is a loader lock case.
Instead, it is obvious that windows API is being trapped in your case (term trap is better here, because hook has other meaning in Windows).
Thus, I believe that the problem is not in concurrent use of WSAStartup, but in side effects of third party traps over original Windows API functions in your process. I think, you need to clean up your environment from any external influence (api traps from your side or from anti-virus software, whatever).
By the way, make sure that each thread of yours provides WSAStartup with its own separate copy of WSADATA output parameter


text:
Q: Gridview is not displaying expected results when databinding When databinding my gridview from data stored in my database I am seeing a small square appear instead of the expected gridview results.

The code I'm using:
 try
        {

               DataTable dsDetalle = new DataTable("Data");
            using (MySqlCommand commandSql = cn.CreateCommand())
            {
                commandSql.CommandType = CommandType.Text;
                commandSql.CommandText = "select * from detalle where iddetalle=@iddetalle and idlocal=@idlocal";
                commandSql.Parameters.AddWithValue("@iddetalle", "txt_boleta.Text");
                commandSql.Parameters.AddWithValue("@idlocal", "txtlocal.Text");
                MySqlDataAdapter sqlAdapter = new  MySqlDataAdapter(commandSql);
                sqlAdapter.Fill(dsDetalle);
            }
            GridView1.DataSource = dsDetalle;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {

            lblerror.Text = ex.ToString();
        }

A: You must omit quotes in the values of each parameter:
 using (MySqlCommand commandSql = cn.CreateCommand())
 {
    commandSql.CommandType = CommandType.Text;
    commandSql.CommandText = "select * from detalle where iddetalle=@iddetalle and idlocal=@idlocal";
    commandSql.Parameters.AddWithValue("@iddetalle", txt_boleta.Text);
    commandSql.Parameters.AddWithValue("@idlocal", txtlocal.Text);
    MySqlDataAdapter sqlAdapter = new  MySqlDataAdapter(commandSql);
    sqlAdapter.Fill(dsDetalle);
 }

Also ensure you are opening the SQL connection and binding it with your SQL command


text:
Q: How to Iterate to type: mimeType Hi I've a mimeType in ORTB, but couldn't pass compile, is there anyway to iterate banner.mimes and cast it to string?
cerr << "banner.mimes:" << banner.mimes.empty() << endl;
if (!banner.mimes.empty()){
    for(auto & mime : banner.mimes) {
       cerr << "banner.mime:" << mime << endl;
       std::vector<ORTB::MimeType> mimes;
       mimes.push_back(mime.toString());
       ctx.br->segments.add("mimes", mimes);
    }
}

it says:   error: cannot bind âstd::basic_ostreamâ lvalue to     âstd::basic_ostream&&â
/usr/include/c++/4.6/ostream:581:5: error:   initializing argument 1 of âstd::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char, _Traits = std::char_traits, _Tp = ORTB::MimeType]â

A: On line 5 you're declaring a vector of mimes, so line 6 should be mimes.push_back (mime), or if you want the vector to contain strings you should change line 5 to std::vector<std::string>. Note that the call to mime.toString () requires toString be a member of ORTB::MimeType.
For the error involving the ostream operator (<<) you need to provide a way for the compiler to convert MimeType to something compatible with ostream. I'm going to assume that  mime is an object of type ORTB::MimeType, but if it's not you just need to insert the appropriate class.
There are two ways you can do this: Either a member function of ORTB::MimeType:
namespace ORTB {
    class MimeType {
    // Class definition...
    public:
    std::ostream& operator<< (std::ostream& stream) {
    // output MimeType's information here: return stream << Value1 << Value2...;
    }
}

Or by creating a similar function at a more global scope if you don't have access to the definition of ORTB::MimeType:
    std::ostream& operator<< (std::ostream& stream, const MimeType& mt) {
    // output MimeType's information here: return stream << mt.Value1 << mt.Value2...;
    }

Note that with option #2 you need public access to whatever you're outputting. Ideally your data would be specified as private, so you would have to use public getters.


text:
Q: Avahi-browse Command Shows Same IPv4 address For eth0 & wlan0 , even wlan0 is not configured When I am running the command [avahi-browse -t -a -r -k] on my machine which is showing me the same ipv4 address for both eth0 & wlan0. Even if I am not configured wlan0. If I am supposed to configure wlan0 for one of my network machines , After that When I am running [avahi-browse -t -a -r -k] command I am getting original IP for the configured machine but also getting duplicate IP for all other machines which are in Network.
kernel version- 4.19.0-17-amd64
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Demo Output After Running [ avahi-browse -t -a -r -k ] command on my machine

DEB-NUC8i3BE-G6BE94800D7J:~$ avahi-browse -t -a -r -k
DEB-NUC10i5F-G6FN04300231 _scorer-api._tcp eth0 192.168.10.221:11230
DEB-NUC10i5F-G6FN04300231 _scorer-api._tcp wlan0 192.168.10.221:11230
DEB-NUC8i3BE-G6BE924007ZC _scorer-api._tcp eth0 192.168.10.207:11230
DEB-NUC8i3BE-G6BE924007ZC _scorer-api._tcp wlan0 192.168.10.207:11230
DEB-NUC8i3BE-G6BE93100AEJ _scorer-api._tcp eth0 192.168.10.143:11230
DEB-NUC8i3BE-G6BE93100AEJ _scorer-api._tcp wlan0 192.168.10.143:11230
DEB-NUC8i3BE-G6BE94800D7J _scorer-api._tcp eth0 192.168.10.113:11230
DEB-NUC8i3BE-G6BE94800D7J _scorer-api._tcp wlan0 192.168.10.150:11230
DEB-NUC8i5BE-G6BE101003H4 _scorer-api._tcp eth0 192.168.10.194:11230
DEB-NUC8i5BE-G6BE101003H4 _scorer-api._tcp wlan0 192.168.10.194:11230

In above Output I configured the wlan0 for my machine i.e. DEB-NUC8i3BE-G6BE94800D7J and It shows original IP for wlan0 but other machine not configured with wlan0 but still Showing me duplicate IP address for wlan0.


text:
Q: Where did the Slytherin house go during the Battle of Hogwarts?

Now when the Slytherin students were able to escape, they were running and shouting, except for Goyle and Zabini who are grabbed by Malfoy.
Where did the House go afterwards? Did they fight the Death Eaters?

A: Is this a movie or a book question?
Regardless, Professor McGonagall instructs the Slytherins to leave the Great Hall with Filch, but does not direct Filch to take the Slytherins to any particular place.

'Thank you, Miss Parkinson,' said Professor McGonagall in a clipped voice. 'You will leave the Hall first with Mr Filch. If the rest of your house could follow.'
  Harry heard the grinding of benches and then the sound of the Slytherins trooping out on the other side of the Hall.
Harry Potter and the Deathly Hallows - Chapter 31, The Battle of Hogwarts - Page 491 - Bloomsbury

In the movie, Professor McGonagall directs Filch to take the Slytherins to the dungeons. As the Slytherin dormitories are in the dungeons, it's unclear whether Filch is supposed to lock them up in their dorms, or if there is another dungeon the Slytherins are to be locked up in. The movie clip you provide obviously doesn't clarify which dungeon was meant.
Book: It's not stated.
Movie: One of the Hogwarts dungeons


text:
Q: angular ui bootstrap modal is not working properly with ng repeat hey guys i was trying to assign each modal to each item i have but it doesn't seem to work like what i expected.
i was expect it will only trigger one modal in a time, not all together.
for example i have 3 items here, each item has its delete button and every button can trigger a modalbox.

however i click any delete button it will trigger all modalbox like this

this  is the code i have so far
html(the modal view)

controller
$http.post('/channelHandler/getChannelByUser',data).
      success(function(channelData) {
        $scope.channels = channelData;
       $scope.open = function () {
                $scope.items = channelData;
                var modalInstance = $modal.open({
                  templateUrl: 'myModalContent.html',
                  controller: ModalInstanceCtrl,
                   resolve: {
                    items: function () {
                    return $scope.items;
                  }
              }
                });
              }
        })
    })

modalInstanceCrtl
var ModalInstanceCtrl = function ($scope, $modalInstance,items) {
                  $scope.modalData = items;
                  $scope.cancel = function () {
                    $modalInstance.dismiss('cancel');
                  };
                  $scope.confirm = function(titleform){
                    if(titleform === items.title){
                        $http.delete('/contentHandler/post/'+$routeParams.permalink+'/delete').
                        success(function(data){
                          $location.path('/');
                        }).error(function(err){
                          alert(err);
                           $scope.errorMessage = err;
                        });
                    $modalInstance.dismiss('cancel');
                    }else{
                      $scope.errorMessage = "Please enter the correct title "
                    }

                  }

                };

may i know is it the correct approach to do this ?

A: Some information is missing but probably it should look something like this:
html(the modal view)

controller
$http.post('/channelHandler/getChannelByUser',data).
  success(function(channelData) {
    $scope.channels = channelData;

    $scope.delete = function ( currentChannel ) {
      var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,
        resolve: {
          item: function () {
            return currentChannel;
          }
        }
      });
    }
  });

The delete button need something like ng-click="delete( data )". In which data is a single channel.
modalInstanceCrtl
var ModalInstanceCtrl = function ($scope, $modalInstance, item) {

  $scope.data = item;

  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
  $scope.confirm = function(titleform){
    if (titleform === items.title) {
      $http.delete('/contentHandler/post/'+$routeParams.permalink+'/delete').
         success(function(data){
           $location.path('/');
         }).error(function(err){
           alert(err);
           $scope.errorMessage = err;
         });
      $modalInstance.dismiss('cancel');
    }else{
      $scope.errorMessage = "Please enter the correct title "
    }
  }
};


text:
Q: Where is this formula for generating pythagorean triples coming from? I'm reading Stillwell's Mathematics and Its History. In the chapter about pythagorean triples, he says that we now know that the general formula for generating pythagorean triples is:
$$a = r\cdot(m^2 - n^2)   ,\ \, b = r\cdot(2mn) ,\ \, c = r\cdot(m^2 + n^2)\tag{1}$$
And that there is a special case which gives all solutions $a,b,c$ without common divisor:
$$a = m^2 - n^2 ,\ \, b = 2mn ,\ \, c = m^2 + n^2\tag{2}$$
I'm just no so sure where are these formulas coming from. I've made the following trial: By looking $(2)$, I've written the formula for the pythagorean theorem and I've switched only the $c$:
$$a^2+b^2=\color{red}{(m^2 + n^2)^2}$$
And expanded it:
$$a^2+b^2=\color{red}{m^4+2n^2m^2+n^4}\tag{3}$$
Then my guess is that I should find arbitrary $a$, $b$ (and perhaps some integers?) written in terms of $n$ and $m$ such that $(3)$ is true. So I guess I need to split the polynomial in (perhaps) some arbitrary way such as:
$$a^2+b^2=\color{red}{m^4+2n^2m^2}\color{green}{+n^4}$$
$$a^2+b^2=\color{red}{m^4+n^2m^2}\color{green}{+n^2m^2+n^4}$$
And then find $a,b$ such that:
$$\begin{eqnarray*}
  {a^2}&=&{m^4+2n^2m^2} \\
  {b^2}&=&{n^4}
\end{eqnarray*}$$
Or:
$$\begin{eqnarray*}
  {a^2}&=&{m^4+n^2m^2} \\
  {b^2}&=&{n^2m^2+n^4}
\end{eqnarray*}$$
Or any arbitrary combination such that $(3)$ holds. I'm still a little stuck, am I on the right path? I've looked wikipedia article on pythagorean triples and there's no much insight into this matter.

A: There is a fair bit of work to do to prove this theorem but you could look here, starting on page 2.  The article is aimed at a secondary school level audience, so hopefully it should be fairly accessible.
Note that the main difficulty is not proving that the formulae give some possible $a,b,c$ but proving that they give all possible $a,b,c$.

A: If you read a few pages further you will find  that Exercises 1.31. and 1.3.2 give a derivation of the Pythagorean triple formula using a rational parametrization of the circle (see also  the "geometry" section of the Wikipedia article).
More generally, if a conic curve with rational coefficients has one rational point $\rm\:P\:$ then it has infinitely many, since any rational line through $\rm\:P\:$ will intersect the curve in another point, necessarily rational, since if one root of a rational quadratic is rational then so is the other. Therefore, by sweeping lines of varying rational slopes through $\rm\:P\:$ we obtain infinitely many rational points on the conic.  Projecting these points onto a line leads to a rational parametrization of the conic. For a very nice exposition see Chapter $1$ of Silverman and Tate: Rational Points on Elliptic Curves. There are also many online expositions, e.g. search on "rational parametrization Pythagorean triple".
There are also many other ways to derive the formula. A particularly beautiful one-line way employs Hilbert's Theorem $90$ - see the award winning expository Monthly paper by Olga Taussky Sums of Squares.

A: It comes from a rather sneaky relation that $2m^2n^2=4m^2n^2-2m^2n^2$. If we have $c=m^2+n^2$, then $$c^2=(m^2+n^2)^2=m^4+2m^2n^2+n^4=\\m^4-2m^2n^2+n^4+4m^2n^2=(n^2-m^2)^2+(2mn)^2=a^2+b^2$$ where $a=(m^2+n^2),b=2mn$.


text:
Q: QT Creator: Trigger a Slot with Code? I may have worked myself into a corner but this sounded to me like a good idea at the time.
I have been developing an interface that permits a user to modify settings of a robotic device, i.e. speed, directions, force, etc.  with a very large series of options in the form of ComboBoxes.  The problem is that there are about a thousand of these things, in sub categories.  e.g. Speed category x1, x2, x3, Y1, y2, etc.  So rather than create a thousand comboboxes in QT, I thought the good idea was to create one set of 50 (ish) and then provide a few button to switch between categories.  So when the user selects speed QT, populates the comboboxes with the appropriate options, sets the style sheets and text for the labels etc.  So it appears as though a dedicated page exists.  Then if the user selects Direction, QT Writes the current index of each box to a dedicated array and then repopulates the boxes, labels etc with the appropriate content.  I then do this over and over for the various needs of the system.
All of that seems to work fine.  However I am now in a bind where the options provided to navigate to each page have grown.  For instance I have forward / backward buttons (like you woudl expect in a set-up wizard), as well as action menus at the top to jump to a page.  So now the code is becoming very repetitious. If you select the next button, I write the current values to array, then repopulate.  If you jump to the page from anywhere, I look to see where I am, write it to array, and populate the boxes.  Thus if I need to change anything I have to make the change in numerous places in the code.
I know that this is not optimal.  What I woudl like to do is run a continuous loop as I woudl normally do with Micros in C.  So the program can look at a variable in each pass and if it is then it does. I am not however skilled enough to figure this loop out in QT.  So my new thought was...
Is it possible to trigger an action or slot with a variable.  For example, if the user presses the Next button it triggers a slot for a button that does not exist, so that QT will execute a particular line of Code? Then I can have 1 dedicated section focused on reading and writing boxes, with a bunch of actions that will take me there.

A: You can make a signal that is triggered with an emit call in your code, so you'd hook up the next button signal of clicked to a slot that does some work and moves on, or directly calls another signal that you've created that triggers a slot elsewhere, or do some work in a lambda triggered by the button press.

A: I would first load all the ComboBoxes options in a QStringList array (or maybe an array of QList<QLatin1String> lists - for memory saving and code efficiency).
Then I would keep an array of a 1000 integers for current ComboBox indexes.
When the user changes a value in some ComboBox, the currentIndexChanged signal will trigger the corresponding slot (a single slot for all the ComboBoxes would be enough - sender()->objectName() to get the name of the ComboBox which had sent the signal):
void WindowWidget::on_ComboBox_currentIndexChanged(int index)
{
    name = sender()->objectName();
    /* here change the corresponding integer in the current
       indexes array */
}

On Next/Back button push repopulate the ComboBoxes. Also, provide some 'Save' button for saving the ComboBoxes indexes (or trigger the Save slot on some action, i.e. on window close either even on a timer signal).


text:
Q: Cast to a type by its OID? I would like to cast a value to a type using not the type name, but the OID of the type. Is this possible? So instead of:
SELECT '{{a}}'::char[]

do
SELECT '{{a}}'::1002

(although the above results in a syntax error)
Context: I'm writing a library in Python to query PostgreSQL, which includes conversions from PostgreSQL types to Python types, and I want to make sure I test all the types, and it seems easiest to go through all the OIDs listed at https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat

A: I dont know about the possibility to call by oid, but
why not just in your library in python use the table pg_type , if you have the postgresql database?
i guess you want to build the automatic test for you mappings between types of Postgresql and Python, so you before checks can query from that table relevant information about build-in types in Postgresql
select *  from pg_type

you can filter by typtype (base type or others) and by typcategory (numeric, arrays , etcs)
The doc about pg_type
p.s. Hope this will help =)


text:
Q: Kaspersky Internet Security. Внедрение в другие процессы В Kaspersky Internet Security есть возможность ограничивать функционал конкретных приложений через меню "Управление программами" -> "Подробности и правила" -> "Права".
Один из блоков - "Внедрение в другие процессы".
Т.о. антивирус может запретить приложению внедряться и читать/писать память других процессов.
Подскажите, пожалуйста, как это реализовано с технической точки зрения? У меня есть необходимость реализовать подобный функционал в моем приложении.
Например запрет на чтение памяти других процессов, я себе представляю следующим образом:
DLL Injection в целевое приложение -> Хук на ReadProcessMemory -> Замена своей функцией, которая будет давать отказ.
Так ли это работает в антивирусе?


text:
Q: Take new columns as output table - KDB I have a query which returns results of data, which runs on a frequent basis. The new table will contain results of the old table as well but I only want to take whatever is in new in the most recent run of the new table and send that as an email. I already have the line for the email and trade data but just need a way to be able to:

*

*display the results of the new table to be emailed

*save the complete results of the new table to be used in the next run of the query

e.g.
Old results: tbl
| idx | name  | age |
| 0   | Tom   | 30  |
| 1   | Jerry | 25  |
| 2   | Bob   | 30  |
| 3   | Ken   | 45  |

New results: tbl
| idx | name  | age |
| 0   | Tom   | 30  |
| 1   | Jerry | 25  |
| 2   | Bob   | 30  |
| 3   | Ken   | 45  |
| 4   | Sam   | 40  |

output required:
| 4   | Sam   | 40  |

and then save the New results to be used in the next run
Thanks! :)

A: If the only changes between runs is that records are being appended onto the new table, you could just keep a variable denoting the last index seen and then select only those rows where idx is larger than that.
If the indexes are always increasing, this could be achieved using a query like
lastidx:exec last idx from tbl
select from tbl where idx>lastidx

If the idx values don't always increase monotonically, you could keep a count of the number of rows instead and only
lasti:count tbl
select from tbl where i>=lasti

This doesn't require saving the whole table in memory for use in the next iteration.
E.g to start with the old table had 4 rows so lasti = 4
q)tbl
idx name  age
-------------
0   Tom   30
1   Jerry 25
2   Bob   30
3   Ken   45

q)lasti
4

The new table comes in and running the command selects the new row
q)tbl
idx name  age
-------------
0   Tom   30
1   Jerry 25
2   Bob   30
3   Ken   45
4   Sam   40

q)select from tbl where i>lasti
idx name age
------------
4   Sam  40

lasti can then be updated to reflect the new count
q)lasti:count tbl
q)lasti
5

A: One way you can get this done, assuming the idx is the unique key :
q)old:([] idx:0 1 2 3; name:`T`J`B`K; age: 30 25 30 45)
q)new:old,enlist `idx`name`age!(4; `S;40)  //new output from your query

q)out:()
q)if[0<count i:new[`idx] except old[`idx] ; out:new i ; old:new]

q)out
idx name age
------------
4   S    40

Another way, if your new records are always added to the last of old records:
q)old:([] idx:0 1 2 3; name:`T`J`B`K; age: 30 25 30 45)
q)i:count old
q)new:old,enlist `idx`name`age!(4; `S;40) //new output from your query

q)out:()
q)if[i<c:count new  ; out:(i-c)#new  ; old:new; i:c]
q)out
idx name age
------------
4   S    40