text:
Q: Would you like to swing? In a comment to a recent question, a user explained that while the verb swing may mean "to move backwards and forwards on a seat called a swing", he went on to say that "[n]ormally, people in the UK say 'They're going on the swings' / 'She's playing on the swing' rather than describing the actual motion."
This is all very confusing to me, because in my mother tongue we directly describe the motion and do not use constructions like "go on" or "play on". So I'm wondering: If the verb swing does have the cited meaning of sitting on a swing and moving, but it is not commonly used to express that meaning, in what contexts would one actually use the verb swing with that meaning.
If, for example, a parent from the UK wanted to ask their child whether she wanted to sit on a swing and swing, would they say:

*

*Would you like to swing?

*Would you like to go on the swings?   (is the plural correct)

*Would you like to play on the swing?   (why singular here?)
I tried googling these and similar phrases, but the results were unconclusive.

A: *

*I would say if my child was sitting on the swing but not moving. A small child might be scared or might not know how to get themselves moving - they might need a push. Or they might just be doing something else, thinking, talking etc. So I would ask, "Do you want to swing?" before pushing them.

*and 3. are for me the same, and there is little difference between "swings" and "swing" for me. A single construction with multiple seats-on-chains could be called a swing or the swings. The context here is that my child is not yet sitting on that seat-on-chains. We are, perhaps, in the playground, but deciding whether today's fun will be on the swings or the roundabout.


text:
Q: Dismiss SwiftUI View Embedded in UINavigationController I am experiencing an issue when deep linking into a certain SwiftUI view from a link. the openTakeVC is what is called when deep linked. Currently it was to be embedded in a UINavigationController in order to work, if I try just presenting the UIHostingController I get a crash with this error:
Thread 1: "Application tried to present modally a view controller <_TtGC7SwiftUI19UIHostingControllerV8uSTADIUM8TakeView_: 0x14680a000> that has a parent view controller <UINavigationController: 0x1461af000>."

The dismiss functionality works perfectly fine if not embedded in a UINavigationController but I am only able to deep link that view using a UINavigationController.
Is there a fix for this error or a way to dismiss a UIHostingController embedded in a UINavigationController?
func openTakeVC(take: TakeOBJ) {
            DispatchQueue.main.async {

                guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
                if let _ = appDelegate.window?.rootViewController as? BannedViewController { return }

                //let vc = TakeSingleViewController(nibName: "TakeSingleView", bundle: nil, take: take)
                let vc = UIHostingController(rootView: TakeView(take: take))
                let nav = UINavigationController(rootViewController: vc)
                nav.modalPresentationStyle = .fullScreen
                nav.setNavigationBarHidden(true, animated: false)

                appDelegate.window?.rootViewController?.present(vc, animated: true, completion: nil)
                UserDefaults.removeURLToContinue()
            }
        }

in TakeView
@Environment(\.presentationMode) var presentationMode

  Button {
     UIImpactFeedbackGenerator(style: .light).impactOccurred()
     presentationMode.wrappedValue.dismiss()

     } label: {
        Image(systemName: "xmark")
     }
  }

A: What about creating the hostingcontroller as a separate vc and dismissing it from there?
TakeSingleVC:
final class TakeSingleVC: UIViewController {

    var viewModel: TakeViewModel
    var subscriptions = Set<AnyCancellable>()

    init(viewModel: TakeViewModel) {
        self.viewModel = viewModel
        super.init(nibName: nil, bundle: nil)
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        let childView = UIHostingController(rootView: TakeView(viewModel: viewModel))
        addChild(childView)
        childView.view.frame = view.bounds
        view.addSubview(childView.view)
        childView.didMove(toParent: self)

        viewModel.dismissSheet
            .sink { isDismissed in
                if isDismissed {
                    childView.dismiss(animated: true)
                }
            }.store(in: &subscriptions)
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}

Dismissing in TakeView
viewModel.dismissSheet.send(true)

TakeViewModel:
final class TakeViewModel: ObservableObject {

    // UIKit
    var dismissSheet = CurrentValueSubject<Bool, Never>(false)
}

and then change your presentation to
let vc = TakeSingleVC(viewModel: viewModel)
let nav = UINavigationController(rootViewController: vc)

redpajama_set_name: RedPajamaStackExchange


text:
Q: $CX\cup_{\overline f}CY$ is homeomorphis to reduced suspension $\Sigma X$ Currently I am reading Barratt-Puppe coexact sequence and I faced the following the problem : Let $$CX:=\frac{X\times [0,1]}{\big(\{1\}\times X\big)\cup\big(x_0\times[0,1]\big)}$$ be the reduced cone over $X$ and $x_0\in X$. Let $(Y,y_0)$ be another pointed space and $f:(X,x_0)\to(Y,y_0)$ be a pointed map. Consider the continuous map $\overline f:\overline X\to CY$ defined by $\overline f:[(x,0)]\mapsto[(f(x),0)]$ where $\overline X=\{[(x,0)]:x\in X\}$. I want to show $$CX\cup_{\overline f}CY\text{ is homeomorphic to }\Sigma X:=\frac{X ×[0,1]}{\big(X ×\{0,1\}\big)∪\big({x_0}×[0,1]\big)}.$$
Any help will be appreciated.


text:
Q: Unable to delete circle in tDocu layer in Eagle I am making a revision to my PCB board where the initial mounting holes were too large and therefore decreasing their size.
The holes are on the Dimension layer (20) and were created using the circle tool, located near the bottom of the left column and pictured below. When decreasing the dimension or deleting the holes completely, a circle of the original size still remains which is on the tDocu layer (51). I am unable to select it and therefore I am unable to remove it.

Is there a way to delete this circle which is present in the tDocu layer? It does not affect my board design as it is not included when manufactured, however it may cause confusion at a later point.
Here are some screenshots:

This is what it looks like prior to deletion.

This is the remaining tDocu circle.

This is the result when trying to select the region.

A: I think it's part of the part ARDUINOR3-BPLACE, which you can select by choosing the bottom left corner of the board and clicking properties. You can fix this in a few ways. The one I would recommend is using the exp-lbrs.ulp to generate a library from the board, modifying the resultant ARDUINOR3-BPLACE library part and then replacing the same part in your design with the modified library part.

A: I had a similar problem. A blind hole which were the remains of a leaded part I had deleted.  Hole was on the dimension layer. Could not delete the hole, could not even highlight or select, move, nothing.  I placed a new, slightly larger hole (using the hole menu) over the existing hole. Then when I deleted the new hole, the original hole was removed.  Quite frustrating but fixed. Easy.


text:
Q: Redeclared variable inside the block using let keyword and accessed before it but gives error var a=10;
{
 console.log(a);
 let a =20 ;
}

ReferenceError: a is not defined
Why it is giving the reference error even a is declared using var which should have its scope inside the block too ?


text:
Q: annotate a bubble chart Is there a proper or ideal way to annotate a bubble chart outside of what is required for a standard 2-variale scatterplot?
The bubble area is supposed to be associated with the 3rd variable, but is there something that should say so?  Is there a way to properly indicate what the third variable is?
So here is my scatterplot, except that bubbles replace the points, and the bubble area is related to a third variable, not x or y.

How do I say what the bubble sizes are?  Is there something that I need to say about the fit line being not weighted?  Should I have a x=y line?
I know that I will need title, axis labels, and to clean up units on the y-axis.  Is there anything else needed?

A: Here is a tool used to argue that fault detection algorithm health should be measured using lower confidence interval given sample size instead of prevalence.  It is a lower estimate, but it takes into account sample size, and protects from customer-facing falsehoods - which can be expensive.
Note the legend.
Plot:

Code:
# Purpose:  Show relationship between prevalence and CI for binomial

# -------------
# housekeeping
# rm(list=ls())

#libraries
require(pacman)
p_load(PropCIs)  #for Clopper-Pearson (exact)

#reproducibility
set.seed(09302016)

N_loops <- 100000  #decent sample size

#CI threshold
ci_threshold = 0.95

#stage store for loop
p_true    <- numeric(length = N_loops)
n_samp    <- numeric(length = N_loops)
prev      <- numeric(length = N_loops)
L_CI      <- numeric(length = N_loops)

store          <- data.frame(p_true, n_samp, prev, L_CI)

### main loop ###

for (i in 1:N_loops){

        #how many samples show up (uniform random)
        n_samp1         <- sample(x=c(1:300), size = 1,
                                  replace = FALSE)

        #true prevalence (uniform random)
        p_true1         <- runif(n = 1, min = 0, max = 1)

        #draw samples (binomial)
        mysamples      <- rbinom(n = n_samp1, size=1,
                                 prob = p_true1)

        #compute prevalence
        prev1 <- sum(mysamples)/length(mysamples)

        #compute the lower conf interval
        #  Agresti-Couli exact as "finish line"
        btest <- exactci(x = sum(mysamples),
                         n = length(mysamples),
                         conf.level=ci_threshold)

        L_CI1 <- btest$conf.int[1]

        #pack into store
        store$p_true[i]   <- p_true1
        store$n_samp[i]   <- n_samp1
        store$prev[i]     <- prev1
        store$L_CI[i]     <- L_CI1
}

#make scatterplots

#take off extreme tails
idx_kill <- which(store$p_true < 0.01 | store$p_true > 0.99)

store <- store[-idx_kill,]

#compute variance per row
var_samp <- store$n_samp*store$p_true*(1-store$p_true)

#convert to visually intuitive form
radius <- sqrt(var_samp/pi)/3

## make plot
par(mfrow=c(2,1))

#first subplot
symbols(x = store$p_true,
        y = store$prev,
        circles = radius,inches=0.2,
        fg="LightBlue",
        bg=rgb(red=0,green=0,blue=1,alpha=0.5),
        xlim=c(0,1),ylim=c(0,1),
        main="Prevalence based estimate",
        xlab="True Capability",
        ylab="Estimated Capability")

grid()
abline(a=0, b=1, col="Green", lwd=3)

#some annotations
text(0.25,0.85,"Over-estimate zone",pos = 4,bg="white")
text(0.4,0.8,"(ending up here is expensive)",bg="White")

text(0.7,0.15,"Under-estimate zone",pos = 4,bg="white")
text(0.75,0.1,"(ending up here is cheap)",bg="White")

legend(
        "topleft",
        title = "Uncertainty scaled by 3-sigma",
        legend=c("0.3",  "1.5", "3.0","6.0","9.0"),
        pch = 21,
        bty = "n",
        col = "black",
        pt.bg = "Blue",
        pt.cex = c(0.1,0.5,1,2,3)
)

#second subplot

symbols(store$p_true,store$L_CI,radius,inches=0.2,fg="yellow",
        bg=rgb(red=1,green=0,blue=0,alpha=0.6),xlim=c(0,1),ylim=c(0,1),
        main="Lower CI based estimate",
        xlab="True Capability",
        ylab="Estimated Capability")

grid()
abline(a=0,b=1,col="Green",lwd=3)

#some annotations
text(0.25,0.85,"Over-estimate zone",pos = 4,bg="white")
text(0.4,0.8,"(ending up here is expensive)",bg="White")

text(0.7,0.15,"Under-estimate zone",pos = 4,bg="white")
text(0.75,0.1,"(ending up here is cheap)",bg="White")

legend(
        "topleft",
        title = "Uncertainty scaled by 3-sigma",
        legend=c("0.3",  "1.5", "3.0","6.0","9.0"),
        pch = 21,
        bty = "n",
        col = "black",
        pt.bg = "Red",
        pt.cex = c(0.1,0.5,1,2,3)
)

par(mfrow=c(1,1))


text:
Q: Is it possible to run two Python files simultaneously in Sublime Text 3? I am trying to create a file sharing program using Python and to do that I am using a server. In order to test the program I need to use a different Python IDE to run the server and then use Sublime Text 3 to run the client. If possible, I would like to know if and how I can run both programs simultaneously in Sublime Text 3.

A: I feel it may just be best to run the python files via the terminal or command prompt. This would also in general be a better practice to run your programs. To run them, you would just need to type in... "python path/to/your/python/file"

A: Each window gets its own build process. You can open both files in separate windows, run the build on the server, then run the build on client and they will both run simultaneously.


text:
Q: What's a good resource-saving way to monitor a single Linux server? I have a single Linux server and it's occasionally unreachable for a while. I want to know what causes this (I suspect either high CPU or Memory usage). I would like to monitor:

*

*Global CPU/Memory usage

*CPU/Memory usage of individual processes (/etc/init.d services would suffice)

*Network traffic (broken down by process/service would be neat)

I'd like to see a graphs, but I'm not afraid to generate them myself using GNUPlot.
The server resources are limited, so I don't want to use any heavyweight tools.
On Windows machines, there is typically a tool called perfmon that can do this - is there any resource-saving tool like that for Linux? All I know is Nagios - too heavy weight for my case?

A: Munin should do the job for you. its pretty simple to setup and gives you the basics. It wont scale too well, but it will do a few servers easy.

A: Try SeaLion. Works great for multiple servers and is pretty lightweight for you to use for a single server even. Setup is pretty simple and shows all of what you ask in a simple timeline for easy debugging. Also, it will also warn you when your system is unreachable by email.
Besides all of this, the fact that caught me is the flexibility it offers to add any command you wish. So my usage isn't limited to just performance monitoring, I can extend it to monitor any application,etc when i need. I don't have to go looking for another tool. ;)


text:
Q: How single authentication can work for multiple server nodes in Spring Security I am using weblogic for deploying my spring boot application, and my same application is deployed on multiple nodes.
For example the two node in which the application is deployed is 9001 and 9002.
With basic security even if I am authenticated on the Node 9001 and trying to access the same URL on second node i.e on 9002, I am again getting redirected again to spring login page for authentication.
I want that once I authenticate using username and password on any node. I need not to authenticate again, Even if I am requesting to any other node.
Any kind of clue or help will be appreciated.
Thanks in advance.
The Security configuration file is
package com.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter{

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
            .withUser("test")
            .password("{noop}test")
            .authorities("USER");
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
            .authorizeRequests()
            .antMatchers("/userdetail").authenticated()
            .anyRequest().permitAll()
            .and()
            .formLogin();
    }
}

A: In my case it worked for both node when I enabled RedisHttpSession.
Below is the code which worked for me.
@Configuration
@EnableRedisHttpSession
public class RedisConfig {

@Bean
    public JedisConnectionFactory connectionFactory() {
        return new JedisConnectionFactory();
    }
}

also in pom.xml I needed to make two dependencies(For Spring boot).
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.session</groupId>
    <artifactId>spring-session-data-redis</artifactId>
</dependency>

You can also take reference about EnableRedisHttpSession from spring docs, and about spring session from
https://docs.spring.io/spring-session/docs/current/api/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSession.html
https://www.baeldung.com/spring-session


text:
Q: How to enable traceroute in linux machine I'm working on something in the transport layer and after i ran our custom policies for securing the policies i'm not able to do traceroute from the linux machine.
root@keystone-evm:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:echo
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:isakmp
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:radius
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:ntp
ACCEPT     icmp --  anywhere             10.222.4.212
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:domain
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:bootpc
ACCEPT     udp  --  anywhere             10.222.4.212         udp dpt:bootps
ACCEPT     123  --  anywhere             10.222.4.212
DROP       all  --  anywhere             anywhere
ACCEPT     udp  --  anywhere             anywhere             udp spts:33434:33524 state NEW,RELATED,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:echo
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:isakmp
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:radius
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:ntp
ACCEPT     icmp --  10.222.4.212         anywhere
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:domain
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:bootpc
ACCEPT     udp  --  10.222.4.212         anywhere             udp dpt:bootps
ACCEPT     123  --  10.222.4.212         anywhere
DROP       all  --  anywhere             anywhere
ACCEPT     udp  --  anywhere             anywhere             udp dpts:33434:33524 state NEW
root@keystone-evm:~# traceroute 10.222.4.100
traceroute to 10.222.4.100 (10.222.4.100), 30 hops max, 38 byte packets
 1traceroute: sendto: Operation not permitted

The given below is the command I issued to enable traceroute:

*

*iptables -A OUTPUT -o eth0 -p udp --dport 33434:33524 -m state --state NEW -j ACCEPT

*iptables -A INPUT -p udp --sport 33434:33524 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

A: Thanks for all the inputs.
I came up with a shell script to do the job for me. I believe this would be helpful for other users also to perform the task. Please note that the local machine IP. Please do the necessary changes accordingly.
#!/bin/sh
echo "Enabling Traceroute..."

#Outbound UDP traffic Policy

iptables -I OUTPUT -o eth0 -p udp --dport 33434:33524 -m state --state NEW -j ACCEPT

iptables -I INPUT -p udp --sport 33434:33524 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

#Inbound ICMP traffic Policy

iptables -I INPUT -p icmp --icmp-type 3/3 -d 10.222.4.212 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

iptables -I INPUT -p icmp --icmp-type 11  -d 10.222.4.212 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

A: First of all: the iptables -A command add the new rule after the end of your actual chains. They were processed only after the last rule in your chains. But it won't happen, because the last rule already filters everything out! You need to put these commands before your last rule, which can be done with the -I <n> flag of the iptables.
Second: Traceroute is working by sending ICMP packets, just as ping does. It is essentially a ping, which tries to get a list of the remote network nodes on the way to the target machine, by sending packets with low, but growing packet TTL fields.
I don't have any idea, from where you got this udp/33434 thing. If you want traceroute, enable ICMP, which doesn't have any ports.
Third: (reacting commect) It seems, sometimes traceroute don't use only simple icmp packets, but udp or even tcp packets as well. There is even a tool named tcptraceroute, which can do this last thing on a very good configurable way. If you aren't sure, check with strace or with a tcpdump, where your traceroute wants to actually communicate, and enable at least this port.

A: We can see from man 8 traceroute that:

*

*UDP is the default traceroute mechanism on Linux

*traceroute expects to get an "ICMP unreachable" message in response to its query

*traces start at port 33434 and increment by one for each hop

Meanwhile, Microsoft confirms that Windows uses "ICMP Echo Requests" in its implementation.
So, here is the answer to allow a host to correctly process inbound and perform outbound traceroutes. Append a rule to reject (not drop) traffic on UDP ports 33434-33474, and reply to echo requests, and allow the matching outbound packets as well, if you're restricting outbound traffic.
# reject (not drop) packets for inbound traceroutes from Linux boxes
iptables -I INPUT -p udp --dport 33434:33474 -j REJECT

# accept ping requests for Windows-style traceroutes
iptables -I INPUT -p ICMP --icmp-type echo-request -j ACCEPT

# allow ping responses for Windows-style traceroutes
iptables -I OUTPUT -p ICMP --icmp-type echo-reply -j ACCEPT

# allow the server to perform its own traceroutes
iptables -I OUTPUT -p udp --dport 33434:33474 -j ACCEPT

For the record, the excerpt from the man page:
LIST OF AVAILABLE METHODS
       In  general,  a  particular traceroute method may have to be chosen by -M name, but
       most of the methods have their simple cmdline switches (you can see them after  the
       method name, if present).

   default
       The traditional, ancient method of tracerouting. Used by default.

       Probe  packets  are udp datagrams with so-called "unlikely" destination ports.  The
       "unlikely" port of the first probe is 33434, then for each next probe it is  incre-
       mented by one. Since the ports are expected to be unused, the destination host nor-
       mally returns "icmp unreach port" as a final response.  (Nobody knows what  happens
       when some application listens for such ports, though).

       This method is allowed for unprivileged users.

   icmp       -I
       Most usual method for now, which uses icmp echo packets for probes.
       If you can ping(8) the destination host, icmp tracerouting is applicable as well.

   tcp        -T
       Well-known modern method, intended to bypass firewalls.
       Uses the constant destination port (default is 80, http).


text:
Q: Build errors with Visual C++ 2015 cross-platform I'm using the new cross-platform tools in Visual C++ 2015 to build a native shared library for Android.
I had the NDK (r10d) installed before installing VS2015 so I chose not to install the NDK in VS's secondary installer. Instead, after installation I set the NDK path under Tools > Options > Cross Platform > Android.
I had a problem with VS not finding the toolchain binary - it was looking for arm-linux-androideabi-gcc.exe under [NDK_ROOT]\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin while in my installation the file was in [NDK_ROOT]\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin. To remedy that I just renamed the windows-x86_64 directory to windows.
Now the problem is that build errors do not propagate to the Error List view. Instead, I get a single error in the Error List:
Severity    Code    Description                                         Project         File                                                                                Line    Source
Error       MSB6006 "arm-linux-androideabi-gcc.exe" exited with code 1. pexeso-android  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Application Type\Android\1.0\Android.Common.targets  194     Build

The only place I can view the actual errors is in the output window:
ANDROID_HOME=C:\Dev\Android\android-sdk
ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3\
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_05
NDK_ROOT=C:\Dev\Android\android-ndk-r10d
pch.h
PexesoAndroid.cpp
PexesoAndroid.cpp: In function 'jint JNI_OnLoad(JavaVM*, void*)':
PexesoAndroid.cpp:7:9: warning: unused variable 'jcPexeso' [-Wunused-variable]
  jclass jcPexeso;
         ^
PexesoAndroid.cpp: In constructor 'PexesoAndroid::PexesoAndroid(JNIEnv*)':
PexesoAndroid.cpp:26:2: error: invalid conversion from 'void (*)(jstring) {aka void (*)(_jstring*)}' to 'void*' [-fpermissive]
  };
  ^
PexesoAndroid.cpp:24:18: warning: unused variable 'method_table' [-Wunused-variable]
  JNINativeMethod method_table[] = {
                  ^
PexesoAndroid.cpp: In function 'jint JNI_OnLoad(JavaVM*, void*)':
PexesoAndroid.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

But this view is quite useless since, for instance, I cannot double click an error and have the IDE jump to the relevant line and source file.
Is this really what they meant when they said VS will be cross-platform?


text:
Q: SLT Error: Replication not successfull: The migration object has been deleted and must be recreated We try to build an SLT (SAP Landscape Transformation) Configuration which replicates one Table "new3_asdf" and one view on top of this table: new3_asdf_view_id.
So in transaction LTRS I added the view to the table:

In LTRC I added the table new3_asdf to replication. Even though there is no 'X' in column failed the replication does not work :((
The 'View Errors' Button reveals the Error / Cause:
Migration object Z_NEW3_ASDF_035 has been deleted due to changes in table definition

How can I recreate it according to the Help Text:

Source and destination databases are DB2 10.5

A: I have seen this error when you change the table structure in LTRS while the job is replicating in LTRC.  It appears to drop the target table, making your replication job fail because you have no target.  You have to have all your LTRS table config in place before LTRC or this message can happen.


text:
Q: What type of electronics is typically used to interface between PCs and custom hardware? I have tried to make this question acceptable for StackExchange, I am not looking for buying advice, just either examples of hardware that could have been used or the name of types of devices I should be researching.
I am very interested in automation and robotics but so far everything has been over my head in regards to my basic electronics knowledge.
I see in many places online like in this video on YouTube Link that often in the cases where vision is used the processing is done on a PC and that controls the hardware.
What is the name of the hardware that interfaces between the motor drivers and limit switches etc and the PC? I'm assuming for speed the interface would be USB or ethernet.
What are some examples of hardware that could have been used or what is the collective name of such hardware?
What is the name of the topic/category of technology I should be researching?

A: A USB-UART bridge (the most common brand name one is made by FTDI) is probably the easiest way.
On your custom hardware you use the regular UART port on the microcontroller and feeds it into the USB-UART bridge cable or chip which in turn plugs into your computer with a USB plug. On your PC you install USB drivers that make the computer think it is talking to a UART and write software on your computer as if it were a UART.
Before USB ports existed what you would have done is run the microcontroller UART through an RS-232 transceiver which converts the UART voltages to voltage levels appropriate for RS-232 signals and plug that into the computer with a dsub9 cable. The USB-UART bridge simulates the same thing, but with USB.
This is fast enough to do things like control but probably not fast enough to do things with streaming data (like machine vision).
RS-422 is extremely similar to RS-232. It is basically just UART but run through transceivers with different electrical signalling for longer distances. Can be used to have one transmitter drop the same message to multiple receivers that only listen and do not transmit back.
RS-485 is fairly similar because it is basically RS-422, but instead of being full-duplex it is half-duplex. That means no simultaneous two-way transmission which means you have to change up your protocol to account for this (the devices on both ends of the line can't just start transmitting whenever they want), however it is more suited for having more than 2 devices on the same line where all devices can transmit.
CAN is somewhat similar to RS-485 in that it is half-duplex but the signalling is quite different and it has a predefined message format. Namely, the pre-defined message format and different electrical signalling compared to RS-485 provide a standard addressing, error checking, and collision detection scheme (higher priority messages are able to transmit over top of lower priority messages transparently which leaves the higher priority message uninterrupted and stops the lower priority message, rather than interrupting both messages). RS-485 is incapable of this message override and requires interruption of both messages, and since there is no predefined addressing or protocol you need to cook up your own if you want more than two devices on the line (needs addressing) or more than one device to try transmitting whenever it wants (no master-slave relationships to coordinate communication on the line).
Beyond this you have native USB, ethernet, and all the fast but complicated stuff.

A: CANBUS is one of the most popular protocol for motor control. So, basic USB/CANBUS converters can be usefull to send commands to motor driver.

Image From: https://www.kanda.com/products/Lawicel/CANUSB.htm

Image From:https://canbuskits.com/what.php


text:
Q: Не удается получить переменные класса в списке Мне необходимо отсортировать список объектов класса, и вывести айди, название объектов
package com.para;

import java.lang.Comparable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Program {

    public static void main(String[] args) {
        List fruitList=new ArrayList();
        Fruit apple=new Fruit(1, "Apple", "Sweet");
        Fruit orange=new Fruit(2, "Orange", "Sour");
        Fruit banana=new Fruit(4, "Banana", "Sweet");
        Fruit grape=new Fruit(3, "Grape", "Sweet and Sour");

        fruitList.add(apple);
        fruitList.add(orange);
        fruitList.add(banana);
        fruitList.add(grape);
        Collections.sort(fruitList);
        fruitList.forEach(fruit -> {
            System.out.println(fruit.getId() + " " + fruit.getName() + " " +
                    fruit.getTaste());
        });

    }
}
class Fruit implements Comparable{
    private int id;
    private String name;
    private String taste;

    Fruit(int id, String name, String taste){
        this.id=id;
        this.name=name;
        this.taste=taste;
    }

    @Override
    public int compareTo(Object o) {
        Fruit f = (Fruit) o;
        return this.id - f.id ;
    }
}

Делал по примеру Клик. Но у меня ошибка:
java: cannot find symbol
  symbol:   method getId()
java: cannot find symbol
  symbol:   method getName()
java: cannot find symbol
  symbol:   method getTaste()

A: Указанная ошибка компиляции говорит об отсутствующих геттерах для полей класса Fruit:
java: cannot find symbol  symbol:   method getId()
java: cannot find symbol  symbol:   method getName()
java: cannot find symbol  symbol:   method getTaste()

Для доступа к свойствам/полям класса, объявленным как private используются методы геттеры (с префиксом get, для чтения), и сеттеры (с префиксом set, для чтения).
Их можно генерировать автоматически в любой приличной среде разработки типа Eclipse/IntelliJ IDEA и др., или же при помощи аннотаций @Getter/@Setter или @Data проекта Lombok, или, как бы это не было тяжело, написать их самостоятельно:
// class Fruit
public int getId() { return id; }
public String getName() { return name; }
public String getTaste() { return taste; }

Однако, данная ошибка могла бы вовсе не возникнуть, если бы в классе Fruit был переопределён метод toString, отвечающий за строковое представление объекта (для его генерации также существует аннотация Lombok ToString).
// class Fruit
@Override
public String toString() {
    return "Fruit: id=" + id + "; name=" + name + "; taste=" + taste;
}

Тогда построчный вывод списка выглядел бы просто как:
 fruitList.forEach(System.out::println);

Кроме того, при реализации интерфейса Comparable следовало бы указать, что сравниваются именно фрукты, а не фрукты с любыми объектами.
public class Fruit implements Comparable<Fruit> {

    @Override
    public int compareTo(Fruit f) {
        if (null == f) return 1; // null поместить в конец
        return Integer.compare(this.id, f.id);
    }
}

Тогда можно убрать излишнее приведение типов Fruit f = (Fruit) o;, которое может привести к ClassCastException.  Также при сравнении целых чисел лучше избегать вычитания, так как оно может привести к целочисленному переполнению, и использовать стандартный метод Integer::compare


text:
Q: DateTime Format yyyy-mm-dd 24hr How to format a DateTime as follows?
yyyy-mm-dd hh:mm:ss in 24 hr format
example
2001-03-16 14:45:00

A: You can use the HH format to get the hour in 24h, for sample:
string dateFormated = dateTimeObj.ToString("yyyy-MM-dd HH:mm:ss");

also use MM to get the month in 2 chars. You can take a look at MSDN documentation.

A: yyyy-MM-dd HH:mm:ss
For example:
DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")


text:
Q: How to consume properties from configmaps in Java Spring boot application deployed through Helm I have simple Spring boot application which I need to deploy on development and prod different namespaces on a Kubernetes cluster using Helm.
I was thinking about keeping multiple application.properties (application-dev.properties, application-prod.properties) files for each environment and then create configmaps from them through values.yaml files which also will be different for each environment and specified when I execute Helm upgrade.
Now the question is how do I consume values from config.maps as I understand I can either mount the properties file inside container for example /deployment/application.properties
Or expose each property as an environment variable inside container.
But how do I consume them from Java application?
Also at the moment when I create container image it has current application .properties inside /resources/ files embedded and this is what application is using from default so I need to overwrite this behaviour when application is running inside container as opposite to then when its just build and run manually on developer desktop.

A: You could certainly use environment variables as Bal Chua suggests. If you do that you can override particular values at install time using --set or if you've a lot of config you can use the '-- values' flag and pass in a custom values.yaml file.
Another approach is to load a whole file using .Files.Glob (example in github) and load the file as part of the chart. You can then mount the file to /config to consume it in your spring boot application. Then your config file would be in the same form as a Spring boot config file, rather than a helm values.yaml. Though in many cases there needn't be much difference.
There's a discussion of how you could do similar for secrets (presumably you'll want to put your passwords in secrets) and use it for CI/CD in https://dzone.com/articles/hunting-treasure-with-kubernetes-configmaps-and-se (which is the article accompanying the github example). Basically you would use .Files.Glob with .AsSecrets instead of .AsConfig so as to encode the content. Many helm charts have the option to generate a random password if not specified but I'd guess you probably don't need that.

A: Springboot can automatically infer variables from environment variables.  In your application.properties or application.yaml, just use ${MY_ENVIRONMENT_VARIABLE:my-defaultvalue}.
Use helm to populate your configmap.
Use configmap as environment variables into your deployment manifest.
This way you do not need to have multiple application.properties for dev, int ,prod inside your image.  Keeping it intact across deployment.
And then in your helm chart, you can have multiple values.yaml example values-dev.yaml or values-int.yaml.  you can also dynamically set helm values from command line, overriding the yaml file.
I have a demo app in github https://github.com/balchua/demo, which  uses this pattern.

A: I'd recommend mounting the files (application.properties or application.yml) inside the ConfigMap onto somewhere on the file system that Spring Boot can automatically detect - then your app stays nice and simple


text:
Q: Trouble passing data from if and if else I'm trying to create a simple tic tac toe program as part of some homework but having difficulty in checking whether or not the game has been won. As soon as I launch the program and enter a number, it straight away says "Player 2 wins!" and I can't see what I have done wrong.
#include "stdafx.h"
#include "tictactoe.h"

using namespace std;

void clearBoard(char gameBoard[])
{
    for (int i = 0; i < board_size; i++)
    {
        gameBoard[i] = free_char;
    }
}

void printBoard(char gameBoard[])
{
    system("cls");

    //for (int i = 0; i < board_width; i++)
    //{
        //cout << gameBoard[i] + 1 << " " << gameBoard[i] + 1 << " " << gameBoard[i] + 1 << endl;
    //}

    cout << gameBoard[0] << " " << gameBoard[1] << " " << gameBoard[2] << endl;
    cout << gameBoard[3] << " " << gameBoard[4] << " " << gameBoard[5] << endl;
    cout << gameBoard[6] << " " << gameBoard[7] << " " << gameBoard[8] << endl;
}

int askMove(int player)
{
    cout << "Player " << player << ", Select a square [1-9]: ";
    cin >> choice;

    return 0;
}

bool verifyMakeMove(char gameBoard[], int move, int player)
{
    if (player == 1)
    {
        mark = p1_char;
    }
    else
    {
        mark = p2_char;
    }

    if (move < 1 || move > 9)
    {
        cout << "You did not enter a number between 1 and 9. Try again." << endl;
    }

    if (move == 1 && gameBoard[0] == free_char)
    {
        gameBoard[0] = mark;
    }
    else if (move == 2 && gameBoard[1] == free_char)
    {
        gameBoard[1] = mark;
    }
    else if (move == 3 && gameBoard[2] == free_char)
    {
        gameBoard[2] = mark;
    }
    else if (move == 4 && gameBoard[3] == free_char)
    {
        gameBoard[3] = mark;
    }
    else if (move == 5 && gameBoard[4] == free_char)
    {
        gameBoard[4] = mark;
    }
    else if (move == 6 && gameBoard[5] == free_char)
    {
        gameBoard[5] = mark;
    }
    else if (move == 7 && gameBoard[6] == free_char)
    {
        gameBoard[6] = mark;
    }
    else if (move == 8 && gameBoard[7] == free_char)
    {
        gameBoard[7] = mark;
    }
    else if (move == 9 && gameBoard[8] == free_char)
    {
        gameBoard[8] = mark;
    }
    else
    {
        cout << "That move cannot be made. Try again." << endl;
    }

    return 0;
}

int checkEndGame(char gameBoard[])
{
    if (gameBoard[0] == gameBoard[1] && gameBoard[1] == gameBoard[2])
    {
        return 1;
    }
    else if (gameBoard[3] == gameBoard[4] && gameBoard[4] == gameBoard[5])
    {
        return 1;
    }
    else if (gameBoard[6] == gameBoard[7] && gameBoard[7] == gameBoard[8])
    {
        return 1;
    }
    else if (gameBoard[0] == gameBoard[3] && gameBoard[3] == gameBoard[6])
    {
        return 1;
    }
    else if (gameBoard[1] == gameBoard[4] && gameBoard[4] == gameBoard[7])
    {
        return 1;
    }
    else if (gameBoard[2] == gameBoard[5] && gameBoard[5] == gameBoard[8])
    {
        return 1;
    }
    else if (gameBoard[0] == gameBoard[4] && gameBoard[4] == gameBoard[8])
    {
        return 1;
    }
    else if (gameBoard[2] == gameBoard[4] && gameBoard[4] == gameBoard[6])
    {
        return 1;
    }
    else if (gameBoard[0] != free_char && gameBoard[1] != free_char && gameBoard[2] != free_char && gameBoard[3] != free_char && gameBoard[4] != free_char && gameBoard[5] != free_char && gameBoard[6] != free_char && gameBoard[7] != free_char && gameBoard[8] != free_char)
    {
        return -1;
    }
    else
    {
        return 0;
    }
}

int playGame()
{
    char gameBoard[10];

    int player = 1;

    int winner;

    clearBoard(gameBoard);

    do
    {
    printBoard(gameBoard);

    askMove(player);

    verifyMakeMove(gameBoard, choice, player);

    checkEndGame(gameBoard);

    if (player == 1)
    {
        player = 2;
    }
    else
    {
        player = 1;
    }
    } while (checkEndGame(gameBoard) == 0);

    if (checkEndGame(gameBoard) == 1)
    {
        cout << "Player " << player << " wins!" << endl;
    }
    else
    {
        cout << "It's a draw!" << endl;
    }

    return 0;
}

int main()
{
    playGame();

    return 0;
}

A: At the start of the game, the board is blank. All nine squares have the same value, so they are all equal to each other. In particular, all three squares of some row are equal, so according to your logic, someone has won the game. You need to add additional logic to avoid that conclusion.

A: The obvious problem is that in checkEndGame, you aren't checking for empty squares when you look for a line of three. The tests should be more like
if (gameBoard[0] != 0 && gameBoard[0] == gameBoard[1] && gameBoard[1] == gameBoard[2])
    ^^^^^^^^^^^^^^^^^^^^

There are probably other problems, which you can find by stepping through the code with a debugger.


text:
Q: Is it possible to build a custom split view as Salesforce has done with High Velocity Sales? I'd like to customize the split view panel in the console view as Salesforce has done with the high velocity sales console view, using LWC components.

How do they support the tabular navigation of the console view while having a custom split view ?


text:
Q: System.Net.WebException: The remote server returned an error: (500) Internal Server Error. System.Net.WebException: The remote server returned an error: (500) Internal Server Error.   at System.Net.HttpWebRequest.GetResponse()   at SMS.Testpage.btnsubmit_Click(Object sender, EventArgs e)
this is the error i m getting when my i m uploading my files to the remote server. As in case of local host it is working fine and returning the same wat i am expecting , but i m not getting why it is behaving like this , if any one having the idea on my errors , plz let me get out of this big issue.I really struggling with this issue since 3 weeks.
Here is my web config code---
<configuration>
  <connectionStrings>
    <add name="mydbcon" connectionString="Data Source=xyz;Initial Catalog=smspro;Persist Security Info=True;User ID=xyz;Password=xyz" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime />
     <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    <!--<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>-->
  </system.web>
  <appSettings />

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="epBasicHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="tcpBinding" receiveTimeout="00:15:00" sendTimeout="00:15:00"  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <security mode="None">
            <transport clientCredentialType="None" protectionLevel="None" />
            <message clientCredentialType="None" />
          </security>
        </binding>
        <!--<binding name="epNetTcp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/`enter code here`>
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
            <message clientCredentialType="Windows"/>
          </security>
        </binding>-->
      </netTcpBinding>
    </bindings>
    <services>
      <service name="SMS.Services.Communication">
        <endpoint address="http://localhost:3053/Services/Communication.svc" binding="webHttpBinding" contract="SMS.Services.ICommunication"
                  behaviorConfiguration="Web"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="Web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment  minFreeMemoryPercentageToActivateService="0"/>
    <!--<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />-->
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

A: Your code is crashing when it runs in the server. You need to get more details about why it is crashing inorder to fix it. The first thing to do is to update the web config so that it can give you more details of the error. Set the customErrors element's mode property value to "Off"
<system.web>
    <customErrors mode="Off" />
    //Other items goes here
</system.web>

The possible reasons i can think of are

*

*You have an incorrect connection string. Some have the code is not
able to access your db server. Double check the db server name is
correct.

*The code do not have permissions to write to some directory (When you do a file upload, you need to make sure that the directories permission's are updated so that ASP.NET can write to that folder).


text:
Q: Find UMVUE of $P(X_1+X_2+X_3 =2)$ Where $X_1, ... X_n \sim$ Poisson$(\lambda)$ (independent) Let $X_1, ... , X_n \sim $ Poisson$(\lambda)$ (independence is assumed) Find the UMVUE $T(X_1,...,X_n) $ of $g(\lambda) := P(X_1+X_2+X_3=2)$
So we have $g(\lambda) := P(X_1+X_2+X_3=2) = e^{-3\lambda}\frac{(3\lambda)^2}{2!}$
$S(\underline{X}) = \sum_{i=1}^n X_i$ is complete and sufficient. and $S(\underline{X}) \sim $ Poisson$(n\lambda)$
So I want to find $h$ such that  $T(\underline{X}) = h(S(\underline{X}))$.
Setting up we have $\displaystyle E[h(S)] = e^{-3\lambda}\frac{(3\lambda)^2}{2!} \implies \sum_{k=0}^\infty \frac{e^{-n\lambda(n\lambda)^k}}{k!}h(S) = e^{-3\lambda}\frac{(3\lambda)^2}{2!}$
The next step I made was to get a sum on the RHS so I have and moved the $e^{-n\lambda} $ over:
$\displaystyle \sum_{k=0}^\infty \frac{(n\lambda)^k}{k!}h(k) = \sum_{k=0}^n\frac{((n-3)\lambda)^k}{k!}\frac{(3\lambda)^2}{2!} = \sum_{k=0}^\infty \frac{(n\lambda)^k}{k!} \bigg( \sum_{j=0}^k {k \choose j}(n\lambda)^{-j}(-3\lambda)^{j}\frac{(3\lambda)^2}{2!} \bigg)$
However, I don't think I have computed this correctly, from what I have above I should be able match to get this $T(\underline{X})$
Looking for input if I did this correctly.
EDIT: I have $h(S)$ but I should have $h(k)$ so I will change this

A: You want to solve for $h(\cdot)$ where for every $\lambda>0$,
$$E[h(S)]=\sum_{k=0}^\infty h(k)\frac{e^{-n\lambda}(n\lambda)^k}{k!}=c\,e^{-3\lambda}\lambda^2$$
for some positive constant $c$.
That is,
$$
\sum_{k=0}^\infty \frac{h(k)n^k}{k!}\lambda^k=c\,e^{(n-3)\lambda}\lambda^2
=c\sum_{j=0}^\infty \frac{(n-3)^j}{j!}\lambda^{j+2}
=\sum_{k=2}^\infty \frac{c(n-3)^{k-2}}{(k-2)!}\lambda^{k}
$$
Now compare coefficients of $\lambda^k$.

A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
By definition, the answer is given by
\begin{align}
&\bbox[10px,#ffd]{\sum_{k_{1} = 0}^{\infty}{\lambda^{k_{1}}\expo{-\lambda} \over k_{1}!}
\sum_{k_{2} = 0}^{\infty}{\lambda^{k_{2}}\expo{-\lambda} \over k_{2}!}
\sum_{k_{3} = 0}^{\infty}{\lambda^{k_{3}}\expo{-\lambda} \over k_{3}!}\
\overbrace{\bracks{z^{2}}z^{k_{1} + k_{2} + k_{3}}}^{\ds{\large \delta_{k_{1} + k_{2} + k_{3}, 2}}}}
\\[5mm] = &\
\expo{-3\lambda}\bracks{z^{2}}\bracks{\sum_{k = 0}^{\infty}{\pars{\lambda z}^{k} \over k!}}^{3}
\\[5mm] = &\
\expo{-3\lambda}\
\underbrace{\bracks{z^{2}}\expo{3\lambda z}}
_{\ds{{\pars{3\lambda}^{2} \over 2!}}} =
\bbx{\large{9 \over 2}\,\lambda^{2}\expo{-3\lambda}} \\ &
\end{align}


text:
Q: clang - useless push rax and pop rcx? Today, whilst disassembling some binaries I built earlier (clang x86_64), I came across something [seemingly] useless.
_baz:                                   ## @baz
    .cfi_startproc
## BB#0:
    pushq   %rax ; What?
Ltmp7:
    .cfi_def_cfa_offset 16
    leaq    (%rsp), %rax
    movq    %rsi, (%rax)
    xorl    %edx, %edx
    movq    %rax, %rsi
    callq   _something
    movq    %rax, %rdi
    callq   _something_else
    movl    (%rax), %eax
    popq    %rcx ; What?
    retq
    .cfi_endproc

I see rax being saved and then later restored to rcx, and I don't see the point of doing that, as rax is a scratch register (which doesn't seem to need saving here) and rcx (another scratch register, also for 4th register-passed arg) never seems to be used here.


text:
Q: What meta-information is contained in an image file? I'm wondering what information is contained in an image file like JPEG or PNG.
I know that most of them contain a metadata file, but anything else other than that?
Anything relates to the license key or personal information in there?
Does software like Photoshop hide some user data in an image?

A: To the best of my knowledge, Photoshop does not store any personally identifiable metadata in addition to whatever is already in the file and stored by the operating system.
This answer cannot address all packages as each is different.

A: Go grab a copy of ExifTool for your system and experiment with some images. The info contained in the image can be as simple as the camera info, resolution, and timestamp or it could also include other data like GPS location. It really depends on the tool that created the image.


text:
Q: How to find the new speed a vector needs to be travelling at? I'm currently working on an investigation about applying velocity and position vectors to naval ships and aircraft (In a 2-dimensional plane). In my current question, I am tracking the motion of a ship (G) and a helicopter (N) and when they intersect.
The vector equation representing the helicopter is N = [24 - 7t, 12 + 24t] where t is the time in hours after the starting time of 9pm and the vector equation representing the motion of the ship is G = [15.5 + 8t, 5 + 15t]. On the graph of their vector equations the helicopter does not intersect with the ship due to it travelling too fast (originally 25km/h). For the purpose of the investigation, I am allowed to assume that the objects stay perfectly on their paths, therefore I can take the intersection point to be exactly (22.31, 17.78).
What the question asks is "What new speed the helicopter needs to be travelling at to intersect the ship and what time does the intersection occur?" (units in km and time, t, in hours) How exactly do I go about solving this?

A: For the helicopter, the velocity is along the unit vector
$ \hat{v_1} = \dfrac{ \langle -7, 24 \rangle }{\sqrt{7^2 + 24^2}} = \langle - \dfrac{7}{25} , \dfrac{24}{25} \rangle $
So if its speed along that direction is $s_1$, then its position as a function of time is
$ N(t) = \langle 24, 12 \rangle + t s_1 \hat{v_1} $
For the ship, its position is given as
$ G(t) = \langle 15.5 , 5 \rangle + t \langle 8, 15 \rangle $
If the helicopter and the ship are at the same position at the same time, then
$ \langle 24, 12 \rangle + t s_1 \hat{v_1} = \langle 15.5 , 5 \rangle + t \langle 8, 15 \rangle $
which reduces to
$ \langle 8.5 , 7 \rangle = t \bigg( \langle 8, 15 \rangle - s_1 \langle - \dfrac{7}{25} , \dfrac{24}{25} \rangle \bigg) $
If the vector on the left of the above equation is a multiple of the vector on the right, then the following determinant is $0$
$ \begin{vmatrix} 8.5 && 8 + \dfrac{7}{25} s_1 \\ 7 && 15 - \dfrac{24}{25} s_1 \end{vmatrix} = 0 $
Expanding the determinant,
$ 8.5 ( 15 - \dfrac{24}{25} s_1 ) - 7 (8 + \dfrac{7}{25} s_1 ) = 0 $
and this simplifies to
$ 71.5 - \dfrac{253}{25} s_1 = 0 $
From which, $s_1 \approx  7.0652 $
And this gives
$ t = \dfrac{8.5}{8 - 1.9783} = 0.8518  $
If we substitute the speed $s_1$ and the time $t$ , we get the meeting position
$ N(t) = \langle 24 +  (0.8518) (7.0652) (- \dfrac{7}{25} ) , 12 + (0.8518)(7.0652) \dfrac{24}{25} \rangle = \langle 22.31 , 17.78 \rangle $
Substitute $t$ in $G(t)$
$G(t) = \langle 15.5 + 8 (0.8518) , 5 + 15 (0.8518) \rangle = \langle 22.31, 17.78 \rangle $

A: Alternative approach:
Ignoring your specific reported speed of $25 km/h$, and taking your reported intersection point at face value, I should point out that there is some rounding error here.
For example, for the helicopter:

*

*$24 - 7t = 22.31 \implies t \approx 0.2414.$

*$12 + 24t = 17.78 \implies t \approx 0.2408.$
For the ship:

*

*$15.5 + 8t = 22.31 \implies t = 0.85125$.

*$5 + 15t = 17.78 \implies t = 0.852.$
So, neither the helicopter nor the ship will exactly hit the $(22.31,17.78)$ coordinate.
Ignoring this, the answer is simple.  Slow down the helicopter so that it's time to reach the intersection point equals the ship's time.
Since the relative times are

*

*helicopter : $t \approx 0.2408$

*ship : $t \approx 0.852$
Multiply the helicopter's speed by $~\displaystyle \frac{0.2408}{0.852}$.  Then, they both reach the intersection point at the exact same time.  And the intersection time will be the time originally scheduled for the ship to reach that point.

The remainder of this answer shows the mathematical approach needed to calculate the intersection point, and times exactly.  It will be assumed that the scalar $s$ is applied to the helicopter's speed, to slow it down.  So, $0 < s < 1.$
Then, the helicopter's position is $(24 - 7st, 12 + 24st).$
The ship's position is $(15.5 + 8t, 5 + 15t).$
So, you have two equations in the two unknowns $s$ and $t$ that need to be solved.  Assume that the intersection point is $A,B$, which is some unknown value that has yet to be determined.
Then
$$24 - 7st = A = 15.5 + 8t \implies 8t + 7st = 8.5. \tag1 $$
$$12 + 24st = B = 5 + 15t \implies 15t - 24st = 7. \tag2 $$
Now comes the tricky part.  The RHS of (1) and (2) above represent two equations in the two unknowns, $s,t.$
The simplest approach is to multiply the first equation by $(24)$ and multiply the 2nd equation by $(7)$, and then add them together.
This will result in an equation where the $(st)$ term has been eliminated, so that $t$ can be directly calculated.  Then, everything will fall into place.  Following this approach, you have that
$$192t + 168st = 204. \tag3 $$
$$105t - 168st = 49.  \tag4 $$
(3) and (4) may now be added together.
$$297t = 253 \implies t = \frac{253}{297} = \frac{23}{27} \approx 0.85185. \tag5 $$
Plugging this value of $t$ back into (4) above yields
$$\left[105 \times \frac{23}{27}\right] - \left[168 \times \frac{23}{27} \times s\right] = 49 \implies s = \frac{13}{46}. \tag6 $$
So, with $~\displaystyle t = \frac{23}{27}, ~s = \frac{13}{46},~$ the time taken by the ship and helicopter will both be $t$.  Here, the speed of the helicopter will have been slowed down, by the factor $s$.
Now, the exact intersection point $A,B$ may be calculated, using (1) and (2) above.
$$A = 15.5 + 8t = 15 + \left(\frac{27}{54}\right) + \left(\frac{8 \times 23 \times 2}{54}\right)
= 15 + \frac{395}{54} = 22 + \frac{17}{54}.$$
$$B = 5 + 15t = 5 + \left(15 \times \frac{23}{27}\right)
= 5 + \frac{345}{27} = 17 + \frac{7}{9}.$$


text:
Q: How to show that the group is abelian? I have this exercise:

a. Let $\sigma \in S_{15}$ be an element of order 5. What type of
  cycles can occur in the decomposition of $\sigma$ in disjoint cycles?
b. Let $S \subseteq S_{15}$ be one of the Sylow 5-group in $S_{15}$.
  What is the order of S? Show that S is abelian and that all nontrivial
  elements are of order 5.
c. Let p be a prime number and let $0<k<p$ be a natural number. Show
  that the Sylow p-subgroups of the symmetric group $S_{kp}$ is abelian.

my attempt and questions:
a.In this part I think we only can get 5 cycles, because the order of a product of disjoint cycles is the least common multiple of the orders of all, and 5 is a prime number.
b.
Since the order of $S_{15}$ is 15!. We must have that the order of the Sylow 5-subgroup is $5^3=125$, since 5 occurs 3 times in the product of the order. But I am not sure how to show that S is abelian and that all nontrivial elements are of order 5. For all I know there might be elements of order 25 and 125. 15! is so big that there should be no problem for this to fit, so there must be another argument for this? And how do I show that S is abelian?
c. Here I have no idea. But I guess it is a generalisation of b. So if I knew b, maybe it would be easier.

A: Your solution for part a is correct. (Or, at least, it is true that every cycle in the product of disjoint cycles must be a 5-cycle. There can, of course, be more than one cycle in the product.)
Now we look at the rest of the problem. I will prove part c because part b is a special case of it.
We want to show that if $p$ is a prime number, and $0<k<p$ is a natural number, then the Sylow $p$-subgroups of the symmetric group $S_{kp}$ are abelian.
First, note that the multiples of $p$ which are less than or equal to $kp$ are $p, 2p, 3p, ..., kp$, and each of these is divisible by $p$ exactly once since $k<p$. Thus the largest power of $p$ which divides $(kp)!$ is $p^k$, and so the Sylow $p$-subgroups of $S_{kp}$ have order $p^k$.
Let $G$ be a Sylow $p$-subgroup of $S_{kp}$. We will show that every element of $G$ has order $p$. To see this, let $x$ be an element of $G$, and consider the disjoint cycle structure of $x$. We note that the order of $x$ must be a divisor or $p^k$ and hence is a power of $p$. Thus the length of each cycle in the disjoint cycle structure of $x$ must be a power of $p$. But since $x$ is an element of $S_{kp}$, the length of each cycle can be at most $kp$, and hence is not divisible by $p^2$. (Since $k < p$). Thus the length of each cycle in the disjoint cycle structure of $x$ is $p$, and we see that $x$ has order $p$. (This wasn't actually required in part c, but was asked in part b, and so I have included it)
To show that $G$ is abelian, we will exhibit a Sylow $p$-subgroup of $S_{kp}$ which is abelian. The result then follows because all of the Sylow $p$-subgroups of $S_{kp}$ are isomorphic.
Consider the subgroup of $S_{kp}$ which is generated by the elements $x_1, x_2, ..., x_k$ where $x_m$ is the cycle $(((m-1)p+1)\,\, ((m-1)p+2)\,\,...\,\,mp)$. (e.g. $x_1$ is the cycle $(1\,\,2\,\,3\,\,...\,\,p)$, $x_2$ is the cycle $((p+1)\,\,(p+2)\,\,...\,\,2p)$, and so on)
We note that these cycles are disjoint, and hence commute.
We can see that the elements of this subgroup are precisely the elements
$$\prod_{i=1}^{k} x_i^{m_i}$$
where $0 \leq m_i < p$ for each $i$. We see that the group has $p^k$ elements, and hence is a Sylow $p$-subgroup of $S_{kp}$.
We can also see that the group is abelian, by noting that if
$$a = \prod_{i=1}^{k} x_i^{m_i}\quad\text{and}\quad b = \prod_{i=1}^{k} x_i^{n_i}$$
then
$$ab = \prod_{i=1}^{k} x_i^{m_i+n_i} = ba$$
where the last equality follows since the $x_i$'s commute.


text:
Q: Android - How to increase the size of this circle I've a custom progress circle, this is the code :
import android.app.Dialog;
import android.content.Context;

public class CustomProgressDialog extends Dialog {
    MaterialProgressBar progress1;

    Context mContext;
    CustomProgressDialog dialog;
    public CustomProgressDialog(Context context) {
        super(context);
        this.mContext=context;
    }
    public CustomProgressDialog(Context context, int theme) {
        super(context, theme);
    }

    public CustomProgressDialog show(CharSequence message) {

        dialog = new CustomProgressDialog (mContext,R.style.ProgressDialog);
        dialog.setContentView(R.layout.view_material_progress);

        progress1 = (MaterialProgressBar) dialog.findViewById (R.id.progress1);

        progress1.setColorSchemeResources(R.color.red,R.color.green,R.color.blue,R.color.orange);
        dialog.setCancelable(true);
        if(dialog!= null) {
            dialog.show ();
        }
        return dialog;
    }
    public CustomProgressDialog dismiss(CharSequence message) {
        if(dialog!=null) {
            dialog.dismiss();
        }

        return dialog;

    }

}

It makes a circle progress bar like the image below, I want to make it bigger like the double size of the current.
enter image description here
How can I do so ?


text:
Q: Android Studio crashed | now what option do I have ? I created a service file , and tried to call it using startService() , however it underlined it with red color, so I deleted that service file, and created it again. I repeated this twice, and after Android Studio says internal IDE error. Now I am not able to create an Activity or Java Class. Also not able to start the emulator as well. Studio tells me to submit a bug report. I did . And now what other possible solutions do I have to fix my IDE ?

A: Try to delete Android Studio user data (.AndroidStudio) and reinstall Android SDK


text:
Q: How to search Windows Search Indexed files with Powershell Every now and then, I have to locate some files on my network, wich is indexed by the Windows Search service. Entering the pattern on the Explorer search bar get the results in about 10s or so, but when I use the following command, the search usually takes some minutes (2 to 3 min)
gci -Recurse -Filter "VaR*.xlsb"

Is there a way to take advantage of the indexed files database to speed up my search?

A: I Found my answer adapting a  vbs script to Powershell, There is the code:
Function Search {
param (
    [Parameter(ValueFromPipeline = $true)][string]$Path,
    [Parameter(Mandatory=$true)][string]$Pattern)

    if($Path -eq ""){$Path = $PWD;}

    $pattern = $pattern -replace "\*", "%"
    $path = $path + "\%"

    $con = New-Object -ComObject ADODB.Connection
    $rs = New-Object -ComObject ADODB.Recordset

    $con.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")
    $rs.Open("SELECT System.ItemPathDisplay FROM SYSTEMINDEX WHERE System.FileName LIKE '" + $pattern + "' AND System.ItemPathDisplay LIKE '" + $path + "'" , $con)

    While(-Not $rs.EOF){
        $rs.Fields.Item("System.ItemPathDisplay").Value
        $rs.MoveNext()
    }
}

This way is blazing Fast. I tested against the answer pointed by David and It was 3x Faster, but this answer only works with indexed files


text:
Q: Determine a user's current local time based on their country ISO code in PHP and MySQL I'm using a CRON task to run a PHP script that sends emails in the afternoon according to the recipients' local time determined by their country's ISO code.
I don't store dates in UTC, so I can only determine the time zone from the ISO code of my user's country.
My server is configured on the time zone of France (UTC+0200).
How do I select users whose local time is currently afternoon?
MySQL users table

+------------+-----------+---------------------+---------------------+
| company    | Country   | Email               | Date                |
+------------+-----------+---------------------+---------------------+
| ABC        | US        | john.doe@domain.com | 2018-08-19 12:53:58 |
| DEF        | FR        | doe.john@domain.com | 2021-10-04 08:12:27 |
| GHJ        | CN        | john.d@domain.com   | 2022-03-15 17:32:19 |
+------------+-----------+---------------------+---------------------+


text:
Q: Inform AngularJS about file upload with Django For my webpage I use Django 1.9 for the server-side and AngularJs for some client-side tasks (validation etc).
Also for the CSS I use Bootstrap (and the Angular-Ui).
Now I created the forms I need in Django which inserts them on the actual page. Amongst others, I have an input field of type file which lets the user upload a file.
When the user has chosen a file, I would like to do some checks in AngularJs. The problem is: I have no clue how I can get some kind of callback from Django to know that the upload-file window was closed.
My current solution involves a plain javascript function which is bound to the upload field and calls an AngularJs function, but this does not work properly.
So in my forms.py it looks like that:
class UploadForm(forms.Form):
    fa_file = forms.FileField(label='Select a Fasta file',
                               widget=forms.TextInput(attrs={'type': 'file'})

The part of the html page where this field is inserted looks like that:

    <input type="text" id="uploadFile" placeholder="Choose File" disabled="disabled"/>

        Upload
        {{ form.fa_file }}

The javascript function which is bound to the file-upload field is:

This on change method is executed whenever the user finishes choosing a file. Essentially this is the behavior I want to achieve and the AngularJS function of my controller 'changeFaFileValue' is executed as well.
But it seems that the execution happens in its own scope. I can tell because I have a watcher in my AngularJS controller for a variable which is changed in 'changeFaFileValue' and this watcher is not triggered when the function is called via this plain Javascript on change function.
But if I call the 'changeFaFileValue' from somewhere in my controller, the watcher executes as expected.
The methods in the controller look like this:
$scope.$watch('allow_submit', function(){
   console.log("IT WORKED.");
});

$scope.changeFaFileValue = function(newPath){
    $scope.fa_file_js = newPath;
    $scope.allow_submit = !$scope.allow_submit;
}

I think I am missing something important here.
Can you please tell me what would be the correct way to achieve the desired behavior? Is my approach correct at all?


text:
Q: Content of Listview gets drawn over UI elements below in Flutter Could someone help me with the following issue? I am not sure if this is a bug or intended behaviour. I have the following layout:
Column(
    Flexible( ListView[..] )

    Row(
        Flexible(
            TextField(..) <-- input field
        ),
        Container(Icon[]) <-- button

)

Scrolling very very quickly makes the content of my ListView getting drawn over the Row in the other container? Could this be a bug in Flutters drawing engine or did I miss to set some boundaries for my ListView?

Normal / expected layout:

After scrolling very quickly:

A: I believe this is an issue already fixed in dev channel.
Execute in command line shell
flutter channel dev
flutter doctor


text:
Q: How would I get the product value out of a async function inside a map in javascript I have the following code. I want to take the result of product variable and put them into an array outside of the lineItems.data.map so I can parse the arrary send a request with it's contents. I am a little stuck as to how to do this. I tried creating an empty array and pushing to it but it did not work. Any help would be great. thanks.
The array can be inside the first async function but I can't figure it out at this moment.
   async function (err, lineItems) {

     await lineItems.data.map(async (item) => {
         console.log(item);
         const product = await stripe.products.retrieve(item.price.product);
         return product;
      });

  // I want an array here containing the product

  }

A: Right now, lineItems.data.map returns an array of promises. You can't await that directly, but Promise.all will let you await an array of promises just fine!
async function foo(err, lineItems) {
  const arr = await Promise.all(lineItems.data.map((item) => {
    return stripe.products.retrieve(item.price.product);
  }));
  // resolved array should be here
  console.log(arr);
}

foo();

Here's a trivial example showing this all in action:

const prom = (num) => new Promise(res => res(num * 2));

async function foo() {
  const vals = await Promise.all([1, 2, 3].map(x => prom(x)));
  console.log(vals);
}

foo();


text:
Q: AOSP build stopped: subcommand failed I got this error when tried to build the AOSP build
repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r33 --depth=1

I can't find anyone who experienced the same.
[  5% 3232/63193] Lex: applypatch <= bootable/recovery/edify/lexer.ll
FAILED: out/target/product/generic/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/target/product/generic/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
[  5% 3239/63193] target StaticLib: li...IES/libv8src_intermediates/libv8src.a)
ninja: build stopped: subcommand failed.
14:04:56 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1

Which bring me to the point the issue may lay down in the environment.
VirtualBox, 8gb RAM, 160gb space, Ubuntu 18.04
Does anyone have a proposal what might go wrong here?

A: Try running export LC_ALL=C before building.
I had a similar error when building on Ubuntu 18.04.


text:
Q: jQuery Mobile IOS Only Elastic Scrolling Happening While Not At Bottom of Page issue TLDR;
Everything works fine unless I try to scroll down the page with my touch start inside of a horizontally scrolling div, because page has the elastic scrolling effect while not at bottom or top. Removing jQuery Mobile fixes this problem. This is only happening in IOS, Android is fine. TLDR;
I'm having an issue with jQuery Mobile and scrolling.
I have a page that is greater than my screen (on iPhone 5s). This page has 2 horizontally scrolling divs on it with images.
The scrolling divs are as follows
HTML:

    <input type="radio" name="cover" value="26" id="Cover26" data-role="none" class="offScreen">

CSS:
.list{width:auto;height:190px;overflow:hidden;overflow-x:auto;overflow-y:visible;white-space:nowrap;-webkit-overflow-scrolling:touch;}
    .list label{width:110px;height:170px;margin:0 8px 5px;padding:0;position:relative;overflow:hidden;vertical-align:top;display:inline-block;}
    .list input{position:absolute;top:-999px;left:-999px;}

This scrolling works fine horizontally, but when I touch inside one of these divs and pull up on the screen to scroll down the page, the page has the elastic scrolling effect(see images). Scrolling down the page works find if my touch starts outside the horizontal div.

*

*First view of page

*

*Elastic scrolling happening when page isn't at bottom

*

*At actual bottom of page

*

*Elastic scrolling happening when page isn't at the top

Scrolling up and down the page is only possible when the touch starts outside of the horizontally scrolling div. If I remove jQuery Mobile this issue no longer happens. I believe it has something to do with jQuery Mobile's vmouse events. But I haven't been able to tell for certain and I'm not sure if I can remove those event handlers and have the page still work with jQuery Mobile.
Form as far as I can tell this is only happening on IOS. I've tried and android phone and everything works as expected.
I've been stuck on this for a while and can't figure out what else I can do to fix it. Any ideas are helpful. Thanks for looking!
For anyone that would like a demo here are some I'm hosting. I would have put them on jsfiddle but jsfiddle doesn't support setting viewport for the mobile page to render properly.

*

*Page with jQuery Mobile which doesn't work

*Same page without jQuery Mobile which does work

A: The problem appears to be caused by the below CSS styles.
#cover-builder-page, #page-builder-page {
  width:100%;
  height:100%;
}

When you set page's height to 100%, it sets height according to available space in viewport. If you set min-height to 100% it will work, or just remove it all together.

Demo (1)

(1) Tested on iPhone 5 - Safari


text:
Q: Regex capture first words before character subsequently - oracle How do i capture the  word before the = sign, there is another equal sign in the URL which i do not want to capture
 SELECT
  REGEXP_SUBSTR('TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3',
                '([^|]+)=', 1,1,NULL,1) "TType"
  FROM DUAL;

From the above string TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3
I only want TType,Status,URL,day
Note: The string has a pipe delimiter | for the parameters

A: You can use
SELECT
  TRIM(',' FROM REGEXP_REPLACE('TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3',
                '=[^|]+($|\|)', ',')) "TType"
  FROM DUAL

The REGEXP_REPLACE will find and replace with a comma all occurrences of a =[^|]+($|\|) pattern that matches

*

*= - a = char

*[^|]+ - one or more chars other than |

*($|\|) - either end of string or |.

See an online demo.

A: You could do something like this:
select  level as ord,
        regexp_substr('TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3',
                      '(\||^)([^|=]*)', 1,level,null,2) as token
from    dual
connect by level <=
        regexp_count('TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3',
                     '(\||^)([^|=]*)')
;

ORD TOKEN
--- --------
  1 TType
  2 Status
  3 URL
  4 day

In a more complex situation (where you may have several input strings, distinguished by an ID of some sort), the query is a bit more complex, but the "regexp" part is the same.
Note that this query finds all the "attribute names", not just the first one. The regular expression searches for each "attribute-value pair" beginning (either the beginning of the string or a pipe character, (\||^) - note that the verbatim pipe character must be escaped), and from there, it takes the longest continuous substring of characters other than pipe character and equal sign ([^|=]*) and it returns the second capture group.
In particular, this means that if a "pair" doesn't have an equal sign, the whole substring ("between pipe characters") will be returned. For example: if the input is
'TType=SEND|Status=OK|blah blah|day=3'

then the third token returned by the query will be all of 'blah blah'. That can be changed as needed (or, alternatively, if you know that all such substings always contain an equal sign, the issue is moot).


text:
Q: ignore a main in a header file I'm trying to use (Ligra) in a project. The framework works as long as the chief header "ligra.h" is included. Trouble is, that header has an implementation of parallel_main, which is a macro wrapper around main with OpenMP trickery. So if I wanted to write a simple program:
#include "ligra.h"
#include <iostream>

int main(){
std::cout<<"Hello World";
return 0;
}

It would not compile. Redefinition of symbol main.
Also, I need a parallel_main, with the exact macro trickery done in the "parallel.h" header.
So  I think I have two options:
1) modify the file, add a pair of #ifdef LIGRA_MAIN's and not define the macro at compile time. Thus I can have my own main and not have redefinition. Trouble is I need my project to be using the upstream version of ligra, and Julian Shun, the original developer has probably forgottten about his project (and github, since he ignored more than one pull request).
2) Use/Write a #pragma that would strip that function out at the include stage.
I don't know how to do that last part, and would be very much in your debt if someone who did, reached out.

A: A solution that does not involve modifying library files (but is somewhat brittle) could be to do the following:

*

*#include "ligra/parallel.h" (this does #define parallel_main main).

*#undef parallel_main to prevent this rewriting of function names.

*#include "ligra/ligra.h" as usual. Since parallel.h has an include guard, its repeated inclusion is prevented and parallel_main will not be redefined.

*Proceed as normal.
You might also want to wrap this into a header so you only have to write it once.
Alternatively, you could do what @user463035818 suggests and redefine main only for the inclusion of ligra.h for very similar effect. The difference is in the names that the parallel_main function(s) from ligra will get.

A: You can simply not include ligra.h. If there is something useful in that file, then create a copy of the file - excluding the main function - and use that copy.
Sure, that means that if the upstream ligra.h is updated, your copy will not have the corresponding changes. However, given the premise "the original developer has probably forgottten about his project", this is probably not a problem. If the premise is wrong, then a better approach would be to create a pull request to make the framework usable as a library.


text:
Q: jQuery - does the submit event hold the query string or data of the submitted form? I have this code
$("#dummy_div").on('submit', "form", function(event){
    console.log(event);
    event.preventDefault();
});

Does the event object contain hold the query string or data of the submitted form? If not, is there a way to get them short of iterating over the form fields?

A: no the event doesn't store the querystring, but you could obtain all the fields value via serialize() jQuery method applied to the form to obtain a querystring-like value
See http://api.jquery.com/serialize/ for further reference

A: Getting the query string for a form is quite easy, just use .serialize(). .serializeArray() may be also helpful

A: You can use serialize
$("#dummy_div").on('submit', "form", function(event){
    event.preventDefault();
    var form = $(this);

    $.ajax({
       url: form.attr('action'),
       type: form.attr('method'),
       data: form.serialize(),
       success: function(r) { }
    });
});


text:
Q: How to put two conditions in ANT Target? My need is to check two conditions in my ANT Target. If either of them is true the ant target must execute.
<target name="generateArtifacts" if="${generateABC}" or if="${generatePQR}">
...
/>

The above syntax in WRONG. How to make it correct?

A: Maybe there's something simpler, but the following would do, I think:
<condition property="artifactsMustBeGenerated">
    <or>
        <isTrue value="${generateABC}"/>
        <isTrue value="${generatePQR}"/>
    </or>
</condition>

<target name="generateArtifacts" if="${artifactsMustBeGenerated}">
    ...
/>


text:
Q: li.hover not changing color Here is my html

                PennyTracker

                        <button
                                class="pure-button pure-button-success pure-button-large"
                                data-ng-click="setRoute('new')">

                            Transaction
                        </button>

                  ......

and here is the css I try to change the color when hover on li
.pure-menu li.hover {
    background: red;
    color: #000000;
}

But I see no red color when I hover, I see

What is that I am doing wrong?

A: You must put : instead of . ,hover is not a class.
.pure-menu li:hover {
  background: red;
  color: #000000;
}


text:
Q: NPE when responses are referenced from external yaml files I'm splitting YAML files, however I'm getting the following exception while generation code:
java.lang.NullPointerException
    at io.swagger.v3.parser.ResolverCache.updateLocalRefs(ResolverCache.java:162)
    at io.swagger.v3.parser.ResolverCache.loadRef(ResolverCache.java:152)
    at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalResponse(ExternalRefProcessor.java:205)
    at io.swagger.v3.parser.processors.ResponseProcessor.processReferenceResponse(ResponseProcessor.java:76)
    at io.swagger.v3.parser.processors.ResponseProcessor.processResponse(ResponseProcessor.java:38)
    at io.swagger.v3.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:56)
    at io.swagger.v3.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:83)
    at io.swagger.v3.parser.OpenAPIResolver.resolve(OpenAPIResolver.java:49)
    at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:53)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:19)

A sample of what I'm trying to achieve (openapi.yaml):
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths:
  /{appId}/subscriptions:
    get:
      summary: read all of the active subscriptions for the app

      responses:
        '200':
          description: OK (Successful)
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/subscription'
        '400':
          $ref: './common.yam#/components/responses/E400'
        '401':
          $ref: './common.yam#/components/responses/E401'
components:
  schemas:
    subscription:
      type: string

and common.yaml:
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths: {}
components:
 responses:
    E400:
      description: Bad request
    E401:
      description: Unauthorized

Context:
$ tree
├── common.yaml
└── openapi.yaml
$ openapi-generator version
3.3.0

Observations:
One observation is that, if 'schemas' is referred from external file insted of 'responses', the code generation works.
So ! What's the issue if 'responses' being referred from external yaml file?
The following works: - 'schemas' referred externally instead of 'response' (openapi.yaml):
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths:
  /{appId}/subscriptions:
    get:
      summary: read all of the active subscriptions for the app

      responses:
        '200':
          description: OK (Successful)
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: './common.yam#/components/schemas/subscription'
        '400':
          $ref: '#/components/responses/E400'
        '401':
          $ref: '#/components/responses/E401'
components:
 responses:
    E400:
      description: Bad request
    E401:
      description: Unauthorized

and common.yaml:
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths: {}
components:
  schemas:
    subscription:
      type: string

context:
$ tree
.
├── common.yaml
└── openapi.yaml
$ openapi-generator version
3.3.0

A: This issue is fixed in openapi-generator-cli-4.0.0-beta3.
However, for 3.3.0 version below would work
What I observed is that the if common.yaml file below, causing the issue, is modified to common_modified.yaml, the issue is resolved and no Null pointer exception.
YAML causing issue common.yaml
openapi: 3.0.0
    info:
      title: Common Data Types
      version: "1.0"
    paths: {}
    components:
     responses:
        E400:
          description: Bad request
        E401:
          description: Unauthorized

Modified YAML fixing the issue common_modified.YAML
openapi: 3.0.0
    info:
      title: Common Data Types
      version: "1.0"
    paths: {}
    components:
     responses:
        E400:
          description: Bad request
          content:
            applictaion/json:
        E401:
          description: Unauthorized
          content:
            applictaion/json:

It seems that the open API looks for content if referred externally. NOT SURE THOUGH. BUT works for me!


text:
Q: Active link in unordered list when page loads I am have a gallery that I am trying to figure out how I can have one of the links in an unordered list already be selected. This is what I have so far:
     `
     Inbound
     Outbound
     Web Development
     Creative Design
     Printing Services
     Sign Creation

 '

A: The easiest way to do that would probably be to just "click" the link.
$(document).ready(function () {
    gallery();
    $('#someId').click();
});

Offtopic: Your code looks like a lot more stuff should be moved to $(document).ready().


text:
Q: Mysql making --secure-file-priv option to NULL I am running MySQL in Ubuntu. I getting this error while running specific set of queries.

The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

When I did SELECT @@secure_file_priv; in my mysql server I got /var/lib/mysql-files/. I think I need to make this to NULL.
This is the query I am running:
LOAD DATA INFILE :file INTO TABLE test_files
COLUMNS TERMINATED BY ',' ENCLOSED BY '\"'
LINES TERMINATED BY '\n';

Now the question is how to make this NULL?

A: Try:
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.12-0  |
+-----------+
1 row in set (0.00 sec)

mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/     |
+---------------------------+
1 row in set (0.00 sec)

Change file: /etc/mysql/my.cnf
[mysqld]
.
.
.
secure_file_priv=NULL
.
.
.

Restart MySQL.
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| NULL                      |
+---------------------------+
1 row in set (0.00 sec)

UPDATE
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/     |
+---------------------------+
1 row in set (0.00 sec)

File: /var/lib/mysql-files/myfile.csv
1,"Row 1"
2,"Row 2"
3,"Row 3"

mysql> DROP TABLE IF EXISTS `test_files`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE TABLE IF NOT EXISTS `test_files` (
    ->   `col0` INT,
    ->   `col1` VARCHAR(20)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> LOAD DATA INFILE '/var/lib/mysql-files/myfile.csv'
    -> INTO TABLE `test_files`
    -> COLUMNS TERMINATED BY ',' ENCLOSED BY '\"'
    -> LINES TERMINATED BY '\n';
Query OK, 3 rows affected (0.01 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 0

mysql> SELECT
->   `col0`,
->   `col1`
-> FROM
->   `test_files`;
+------+-------+
| col0 | col1  |
+------+-------+
|    1 | Row 1 |
|    2 | Row 2 |
|    3 | Row 3 |
+------+-------+
3 rows in set (0.00 sec)

A: Thank you wchiquito for your solution, which has led me in the right direction.
I would like to add a solution for MySQL 8 under Windows 10. In which a few points differ.
The my.ini file can be found in a different location:
C:\ProgramData\MySQL\MySQL Server 8.x\my.ini

A longer description can be found here: https://stackoverflow.com/a/20136523/1316649
The variable to be changed is called secure-file-priv and it must be unset.
[mysqld]
...
secure-file-priv=
...

After restarting MySQL under services you can check with
SELECT LOAD_FILE ('C:\\path\\to\\file\\content.txt');
SELECT LOAD_FILE ('C:/path/to/file/content.txt');

whether the file is loaded. The content should be visible here, not NULL. A simple backslash doesn't work for me.


text:
Q: web interface to python program: upload and download files I am trying to make a simple web application where one can upload a file and provide the file to a python script. Flask seems appropriate for such purpose. The user can then download the file output from the script. Please let me know how can I parse the file in the python script and get the output. So far I managed to do the following which uploads the file:
from flask import Flask
from flask import request
app = Flask(__name__)

def allowed_file(filename):
    return '.' in filename and \
        filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS

@app.route('/', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        file = request.files['file']
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return redirect(url_for('uploaded_file',
                        filename=filename))
    return '''
<!doctype html>
<title>Upload new File</title>

Upload new File

<form action="" method=post enctype=multipart/form-data>

<input type=file name=file>
<input type=submit value=Upload>
</form
'''
app.run()

A: File reading is well documented here:
http://docs.python.org/tutorial/inputoutput.html
Once you have a file, here is how you can get its contents:
f = open(os.path.join(app.config['UPLOAD_FOLDER'], filename),'r')
data = f.read()

A: Flask is not the good way to handle file upload task.  I recommend nginx file upload module


text:
Q: Php code to play audio streaming in android not work hello I need your help I need the code to play audio streaming serve what I need is that when the person enter php page from your android mobile download mp3 player and sound in android prederterminado the way it is in this page http://s2.viastreaming.net/mobile.php?port=6520 prefectamente served well but I would do the same with this code works but I was told that the problem is that if the file but does not sound what the problem please if someone know the subject .. I need your help please
<?php

header("Content-type: audio/mpeg");
header("Transfer-Encoding: chunked");
header("Transfer-Encoding: none");
header("Connection: close");

$sock = fsockopen($streamname,$port);

$streamname = "193.17.192.13"; //IP
$port = "80"; // PORT
$path = "/;stream.mp3";

fputs($sock, "GET $path HTTP/1.0\r\n");
fputs($sock, "Host: $ip\r\n");
fputs($sock, "User-Agent: WinampMPEG/2.8\r\n");
fputs($sock, "Accept: */*\r\n");
fputs($sock, "Icy-MetaData:1\r\n");
fputs($sock, "Connection: close\r\n\r\n");

fpassthru($sock);

fclose($sock);
?>

A: Let's take a close look at the data you are returning from your PHP script.  Your response headers:
HTTP/1.1 200 OK
Date: Fri, 25 Jan 2013 04:19:16 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze8
icy-notice1:
This stream requires Winamp

icy-notice2: SHOUTcast Distributed Network Audio Server/Linux v1.9.8

icy-name: Atmosfera 96.5 Grupo Emisoras Unidas
icy-genre: Rock
icy-url: http://www.atmosfera.fm
icy-pub: 1
icy-br: 64
Connection: close
Transfer-Encoding: chunked
Content-Type: audio/mpeg

The problem you likely have is that your are sending your stream with chunked encoding.  This is supported by later versions of Android (>2.3 I think), but not before.  Chunked encoding is also not compatible with many other players such as VLC and early versions of Winamp.
The simple solution is to make sure your server is sending back HTTP/1.0 responses, which do not use transfer-encoding.  I haven't tested this, but since you are using Apache, try this:
apache_setenv('force-response-1.0','true');

Also, remove your two header() calls with Transfer-Encoding.
Once this is done, test and see if it works.  By the way, you can use a tool such as Wireshark to easily see what is going on with your streams.


text:
Q: Not able to save if Mongoose Schema(req.body) is an array of objects I am using Angular 6 js as Client side framework. From Client req.body data
 which is sent to server is an array of objects
     [ { email: 'Testserver' },
       { email: 'Liveserver' }]
But when I save no data is being saved in the collection.An empty
   emailServer array is being saved.Any suggestions where am I going wrong?
app.js file-:
    const MongooseSchema = require('../models/mongoose')

     app.post('/',(req,res)=>{
     var obj = new MongooseSchema(req.body);
      obj.save((err,success)=>{
       if(err){
           res.send(err)
       }
       res.send(success)
     })

mongoose.js file
    var mongoose = require('mongoose');
    Schema = mongoose.Schema;

   var MongooseSchema = new Schema({

    emailServer : [{
    email : {type:String}

    }]

    },{ collection: "RegisteredUserDetails" })

    module.exports = mongoose.model('MongooseSchema',MongooseSchema)

A: The structure of the document you're creating has to match what's defined in your schema. The posted data doesn't include the emailServer field name, so you need to add that:
var obj = new MongooseSchema({emailServer: req.body});


text:
Q: Create an azure policy to block role assignments to certain principal types, except when created by specified users I have a requirement that subscription owners may only create role assignments for applications, not for users and groups. There should be an exception for certain identities that are be allowed to create role assignments for users and groups.
The policy below works, for existing role assignments. Existing role assignments to groups/users created by the specified IDs are compliant. Existing role assignments to users/groups created by other principals are not compliant. Great!
But when one of the specified IDs creates a new role assignment, it is denied.
{
    "properties": {
        "displayName": "eslz-restrict role assigments",
        "description": "Restrict role assignments to SPNs only, except when granted by specified ids",
        "mode": "All",
        "metadata": {
            "version": "1.0.0",
            "category": "RoleAssignments"
        },
        "parameters": {},
        "policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "equals": "Microsoft.Authorization/roleAssignments"
                    },
                    {
                        "anyOf": [
                            {
                                "field": "Microsoft.Authorization/roleAssignments/principalType",
                                "equals": "User"
                            },
                            {
                                "field": "Microsoft.Authorization/roleAssignments/principalType",
                                "equals": "Group"
                            }
                        ]
                    },
                    {
                        "anyOf": [
                            {
                                "not": {
                                    "field": "Microsoft.Authorization/roleAssignments/createdBy",
                                    "in": [
                                        "bcd054a8-7cbf-4317-a673-93d32b7e296a",
                                        "13f29b01-7105-4f63-bd56-259ce07df96d"
                                    ]
                                }
                            },
                            {
                                "not": {
                                    "field": "Microsoft.Authorization/roleAssignments/updatedBy",
                                    "in": [
                                        "bcd054a8-7cbf-4317-a673-93d32b7e296a",
                                        "13f29b01-7105-4f63-bd56-259ce07df96d"
                                    ]
                                }
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "deny"
            }
        }
    }
}


text:
Q: Showing that $R$/~ is compact This is question from general topology.
Question : Let $a$~$b$ iff $a-b$ is an integer. Show that $R$/~ is compact.
But, my attempt : $R$/~ is homoemorphic to $(0, 1]$ . (It's easily shown)
However, $(0, 1]$ is not closed w.r.t standard metric topology on $R$. Then by heine-borel, it should not be compact...
What did I do wrong?

A:
But, my attempt : $R$/~ is homoemorphic to $(0, 1]$ . (It's easily shown)

This is were you are wrong: $\mathbb{R}/\sim$ is actually not homeomorphic to $(0,1]$.
Consider $S^1=\big\{z\in\mathbb{C}\ \big|\ \lVert z\rVert=1\big\}$, i.e. the standard sphere and let
$$f:S^1\to \mathbb{R}/\sim$$
$$f(z)=[arg(z)/2\pi]_\sim$$
where $arg$ stands for the complex argument. I leave as an exercise that this is a homeomorphism.

A: Consider the following two continuous maps:
$$i: [0,1] \to \Bbb R$$
the inclusion map $i(x)=x$, and the projection
$$\pi : \Bbb R \to \Bbb R / \sim$$
You can check that the composition $\pi \circ i$ is continuous and surjective.
Thus $\Bbb R / \sim$ is the coninuous image of $[0,1]$. Since $[0,1]$ is compact, so is $\Bbb R / \sim$.
Note that $\pi (i(0)) = \pi (i (1))$, so this is not a homeomorphism.