text:
Q: send reminder email for one time I have a list in sharepoint online that name is DOPI,
There is a field that call Status, it contains the two values: Draft & Manager
I want to send reminder email just for one time to the person who their status is DRAFT.
I create another list for send emails that name is: Admin email send, that means if create a new item in this list,
workflow should be run and send reminder email to the users in DOPI list with the DRAFT status. just for One time
Can you give me the solution?
Thanks

A: You can use "Call HTTP Web Service" action to get the users in the DOPI list with the Draft status. Then send email for all users who are returned from the web service response.
There are two blogs for your reference:
SharePoint 2013 - Understanding and Using the SharePoint 2013 REST Interface
Get Items from SharePoint list using Call HTTP Web Service Action (SharePoint Designer 2013)


text:
Q: Programmatically stop Java EE application during initializaton Is there any Java EE standard (application server cross-compatible) way how to stop the Java EE application during initialization i.e. during running of @PostConstruct anotated method of @Singleton @Startup class?
@Singleton
@Startup
public class Initializer {

    @PostConstruct
    public void checkConfiguration() {
        // stop application here
    }
}

I search for soft way to stop just the application, to whole application server, nothing like System#exit.

A: If you throw any kind of RuntimeException (such as IllegalArgumentException for configuration errors) from an @PostConstruct annotated method in an @Startup annotated @Singleton then the entire application will fail deployment.
From §4.8.1 "Singleton Session Bean Initialization" of the EJB 3.2 specification:

If the Startup annotation appears on the singleton session bean class or if the singleton session bean has been designated via the deployment descriptor as requiring eager initialization, the container must initialize the singleton session bean instance during the application startup sequence. The container must initialize all such startup-time singleton session beans before any external client requests (that is, client requests originating outside of the application) are delivered to any enterprise bean components in the application.

This can't be satisfied if initialisation fails.

redpajama_set_name: RedPajamaStackExchange


text:
Q: TKinter object movement I'm working with this code for a pong game but I'm not that good with TKinter, I was wondering if anyone knew how to make the object in question move from left to right as well as up and down.
def key(self, event):
    global player1,player2
    print ("pressed"), repr(event.char)
        if event.char == 'w':
            if self.canvas.coords(self.paddle1)[1]>=0:
                self.canvas.move(self.paddle1,0,-self.paddleSpeed)
            if event.char == 'a':
                if self.canvas.coords(self.paddle1)[0]>=0:
                    self.canvas.move(self.paddle1,0,-self.paddleSpeed)
            if event.char == 's':
                if self.canvas.coords(self.paddle1)[3]<=self.winHEIGHT:
                    self.canvas.move(self.paddle1,0,self.paddleSpeed)
            if event.char == 'd':
                if self.canvas.coords(self.paddle1)[2]<=self.winWIDTH:
                    self.canvas.move(self.paddle1,0,self.paddleSpeed)

def motion(self, event):
    coords1 = self.canvas.coords(self.paddle1)
    width1 = coords1[2]-coords1[0]
    height1 = coords1[3]-coords1[1]
    coords1[2] = event.x
    coords1[1] = event.y
    coords1[0] = event.x+width1
    coords1[3] = event.y+height1
    self.canvas.coords(self.paddle1,coords1[0],coords1[1],coords1[2],coords1[3])


text:
Q: Is it a bad practice to return different properties for each entity implementation? I'm building a REST API and I have an entity Contact (interface) with two implementations:
interface Contact {
    val id: String
    val email: String
}

class IndividualContact(
    override val id: String,
    override val email: String
    val name: String,
    val lastName: String) : Contact

class CompanyContact(
    override val id: String,
    override val email: String
    val tradeName: String) : Contact

I have an endpoint "GET /contacts" that returns all the contacts, individuals and companies. So, the response looks like this:
[
    {"id": "1", "name": "John","lastName": "Doe", "email": "john@mail.com"},
    {"id": "2", "tradeName": "ACompany", "email": "hello@acompany.com"}
]

As you see, properties differs. Is this a bad practice? Is it a bad practice even if I include a discriminator property type in each item?

A:
Is this a bad practice? Is it a bad practice even if I include a discriminator property type in each item?

I wouldn't consider it a bad practice, necessarily - but it may be incomplete.
The piece that seems to be missing is anything that looks like a stable schema; what assumptions are consumers expected to make about data that is present, data that is missing, and so on.
For instance, in this case we might have schema that look something like
Required: { id: integer, email: string}
Optional-Extension-1 : { name: string, lastName string }
Optional-Extension-2 : { tradeName: string }

Expressed this way, you have a homogeneous set of properties.  It just happens in your example that the first answer has the Required and Optional-Extension-1 parts, where the second entry has the Required and Optional-Extension-2 parts.
So long as the clients have a clear understanding that they must-ignore/must-forward the optional parts that they don't understand, and have some sense for what standard thing to do if a part they are expecting is missing, you can add (documented) extensions to your hearts content.
Versioning in Event Sourced Systems, by Greg Young, is a good starting point.  You can also find good hints in the documentation for many of the standard message formats (Protocol Buffers, Avro, etc.)
The very basic rules are: you can't add new required fields to an existing message schema, and you can't change the meaning of fields that are defined.  (If you need to do either of those, you are defining a new message schema altogether).


text:
Q: How do i get only the max value of a column SQL i'm using this code
SELECT S.id_usuario, C.cnt
  FROM promos_usuarios S
       INNER JOIN (SELECT id_usuario, count(id_usuario) as cnt
                     FROM promos_usuarios
                    GROUP BY id_usuario) C ON S.id_usuario = c.id_usuario

after using this code, i get this
table
And i only need the max value of the column cnt, not the entire count, what can i do to make this work? i'm sorry if this doesnt make any sense, english isnt my main lenguage.

A: You can use a correlated subquery:
SELECT id_usuario, COUNT(*) as cnt
FROM promos_usuarios
GROUP BY id_usuario
ORDER BY COUNT(*) DESC
FETCH FIRST 1 ROW ONLY;

Note all databases support FETCH FIRST.  Your database may use SELECT TOP or LIMIT or something else.


text:
Q: vmware + visual studio 2013 kernel debugging To develop window driver I make vs 2013 + vmware debugging environment.
My pc spec is good.
When i use win7 normally in vmware, it's performance is good.
But once i start debugging, it show very bad performance in vmware, not host pc.  Host pc is not bad.
Even I can't make folder in foreground of vmware.
I also use virtualKD + pure windbg.  It's same...
My processor is i5, and ram is 8G.  I allocate 2 processor and 2G to vmware.
Why is debugging performace very bad?
I must develop driver within a few day...  I have no time.

A: Pretty straightforward, 2GB isn't enough RAM. Give at least 4.


text:
Q: Does using SecureZeroMemory() really help to make the application more secure? There's a SecureZeroMemory() function in WinAPI that is designed for erasing the memory used for storing passwords/encryption keys/similar stuff when the buffer is no longer needed. It differs from ZeroMemory() in that its call will not be optimized out by the compiler.
Is it really so necessary to erase the memory used for storing sensitive data? Does it really make the application more secure?
I understand that data could be written into swapfile or into hibernation file and that other processes could possibly read my program's memory. But the same could happen with the data when it is still in use. Why is use, then erase better than just use?

A: It exists for a reason. :)
If you keep sensitive data in memory, then other processes can potentially read it.
Of course, in your application, passwords or other secure data may not be so critical that this is required. But in some applications, it's pretty essential that malicious code can't just snoop your passwords or credit card numbers or whatever other data the application uses.

A: Also note that it might be that some OS'es will not zero memory before giving it to an application, this means that an application might randomly request memory, scan it for possibly interesting content and do something with it.
If that application would only get zero'd memory, of course it would have a harder time trying to get interesting data.

A: SecureZeroMemory() will certainly not make your application perfectly secure. The fact that the password was already in memory is already a security hole. Using SecureZeroMemory() will definitely make it less likely that your password can be retrieved. I don't see any reason not to use it, so why not? Just remember that there are many other things you have to worry about too.

A: If you actually have password data or other secrets, you're also going to want to make sure that the memory they are in doesn't get swapped out, otherwise the swap file can become a problem (I think the function you want is 'VirtualLock' for a windows app). Further you'll need to detect windows going into hibrenate and wipe the data at that point too. I believe Windows will send a message to every app when it's about to hibrenate.

A: It does. Hibernation file is not encrypted, for example. And if you don't securely clear the memory, you might end up with trouble. It's just a single example, though. You should always hold secret stuff in memory only as long as needed.


text:
Q: Javascript issues, need to color values inside table based on selection from 2  i want to color parts of a table based on the selection in 2 menus, as in, i want to color the selected values, and the ones between.
The whole table is green, and i want to put red on the selected values and everything between them.
I am having issues getting it to work, if anyone could take a look and give me a hint, it would be great.
http://jsfiddle.net/fqwvy/1/
I think the issue lies in my function... the
function placeColor();

A: var picked_time = {}; // make array for current level price

{ } does not create an array in javascript, but rather an object. Use [ ]


text:
Q: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind (JBOSS)
I'm using JBoss 4.0.5 GA on Windows 7 with Java version 1.5 (I have to use older java version and a JBoss because I'm working with a legacy system). And when I'm starting the server I get the following error:
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind

And I believe this causes many other exceptions:
11:09:26,925 WARN  [ServiceController] Problem starting servicejboss.cache:service=TomcatClustering Cache
java.lang.NullPointerException
    at org.jgroups.protocols.FD_SOCK.down(FD_SOCK.java:235)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FD.down(FD.java:278)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.stack.Protocol.down(Protocol.java:540)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.NAKACK.down(NAKACK.java:297)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.UNICAST.down(UNICAST.java:262)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:292)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.GMS.down(GMS.java:605)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FC.down(FC.java:122)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FRAG2.down(FRAG2.java:146)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.STATE_TRANSFER.down(STATE_TRANSFER.java:217)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:331)
    at org.jgroups.JChannel.down(JChannel.java:1035)
    at org.jgroups.JChannel.connect(JChannel.java:374)
    at org.jboss.cache.TreeCache.startService(TreeCache.java:1424)
    at org.jboss.cache.aop.PojoCache.startService(PojoCache.java:94)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:417)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy8.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:417)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy5.deploy(Unknown Source)
    at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
    at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
    at org.jboss.Main.boot(Main.java:200)
    at org.jboss.Main$1.run(Main.java:490)
    at java.lang.Thread.run(Thread.java:619)

I greatly appreciate if anyone could help. At least to figure out where I should look for the solution (e.g. Is this an error related to windows 7 and JBoss clustering incompatability? Is this because of a wrong port configuration? etc.)
Thanks.

A: This problem occurs on some Windows systems that have the IPv6 TCP Stack installed. If both IPv4 and IPv6 are installed on the computer, the Java Virtual Machine (JVM) may have problems closing or opening sockets at the operating system level.
Add the following JVM option: -Djava.net.preferIPv4Stack=true
I've seen this happen on Windows 7 and Windows 2008 systems which have both IPv4 and IPv6 stacks installed by default.

A: I had similar problem. I used process-xp and kill javaw.exe, then restart the application. It works for me.

A: I ran into the same issue on Win7 trying to implement the example here:
http://download.oracle.com/javase/tutorial/networking/sockets/clientServer.html
The default port in the example code is 4444. Using this port I got
"Unrecognized Windows Sockets error: 0: JVM_Bind"
I changed the port to 44444 and tried again.  I got a popup from the Windows Firewall service asking me if this application had permission to access the network.  Selecting OK I no longer get the error message when I launch my server.
After some experimenting I found that with a port of 5000 or less I would get the JVM_Bind error.  Any port of 5001 or above would bind without issue.

A: It's problem of JAVA 32/64 bit. try run your jar with 32 bit JVM

A: I was having this issue with my Tomcat and it turned to be a port conflict with Skype. In my Skype->Options->Advanced->Connection I unchecked the following "Use port 80 and 443 as alternatives for incoming connections". This solved the problem completely.

A: this solved my problem :) Add the following JVM option: -Djava.net.preferIPv4Stack=true

A: open command prompt as administrator. Then do a netsh winsock reset

A: I had the same issue with Tomcat on Windows 10.  Added this to the catalina.bat file near the top:
SET JAVA_OPTS=-Djava.net.preferIPv4Stack=true

A: You have very likely another process already bound on a port that JBoss is using (8080?) and this prevent JBoss from starting correctly (see this page for a list of ports used by JBoss).
Either find the conflicting process and shut it down:

*

*use netstat -a -o -n and look for ports used by JBoss (e.g. 8080) and the corresponding pid

*then use tasklist /FI "PID eq <pid>" to find the process

Or change JBoss defaults ports. There are several ways to do that but the best way is to use the Service Binding Manager (see detailed instructions in Configuring Multiple JBoss Instances On One Machine).

A: I know this is an old issue, but I've just recently figured out one cause of the issue, as well as the solution. My server socket program worked fine until I put the code into a loop, then I got the error Unrecognized Windows Sockets error: 0: JVM_Bind on every attempt to accept() after the first attempt. I had code like this:
ServerSocket ssock = null;
Socket sock = null;

while (loopCount < loopLimit) {
    ssock = new ServerSocket(port);
    ssock.setSOLimit(millis);
    sock = ssock.accept();
    // some code here...
    loopCount++;
}

It was only when I put ssock = new ServerSocket(port) and  ssock.setSOLimit(millis); above the loop that I eliminated the error.

A: I hade to add SystemRoot parameter in java parameters. I dont don't know why java doesn't have this parameter. It was working before. With

SystemRoot=C:\Windows

it works.
I execute the java as Windows service nssm.


text:
Q: ProgressBar for ftp upload I have this code and I would like to add a progress bar. Please give me some instruction. I don't know where to start the coding. Thanks!
private void uploadbutton_Click(object sender, EventArgs e)
{
    try
    {
        openFileDialog1.ShowDialog();
        FileInfo feltoltfile = new FileInfo(openFileDialog1.FileName);
        FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpadress + "/" + feltoltfile.Name);
        request.Method = WebRequestMethods.Ftp.UploadFile;
        request.Credentials = new NetworkCredential(textBox1.Text, textBox2.Text);
        StreamReader sourceStream = new StreamReader(feltoltfile.ToString());
        byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
        sourceStream.Close();
        request.ContentLength = fileContents.Length;
        Stream requestStream = request.GetRequestStream();
        requestStream.Write(fileContents, 0, fileContents.Length);
        requestStream.Close();
        FtpWebResponse response = (FtpWebResponse)request.GetResponse();
        serverstatus.Items.Add(response.StatusDescription +" "+feltoltfile.Name+ " --> " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
        response.Close();
        ftplista.Items.Clear();
        FTPlistalekerdezes(ftpadress, textBox1.Text, textBox2.Text);
        MessageBox.Show("Ready!");
    }
    catch(Exception ex)
    {
        MessageBox.Show("Error!" + ex.Message);
    }
}

A: Untested code, but should give you an idea. Further more I used the using statement:
openFileDialog1.ShowDialog();
FileInfo feltoltfile = new FileInfo(openFileDialog1.FileName);
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpadress + "/" + feltoltfile.Name);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(textBox1.Text, textBox2.Text);
using (var sourceStream = feltoltfile.OpenRead())
using (var requestStream = request.GetRequestStream())
{
    long fileSize = request.ContentLength = feltoltfile.Length;
    long bytesTransfered = 0;

    byte[] buffer = new byte[4096];
    int read;
    while ((read = sourceStream.Read(buffer, 0, buffer.Length)) > 0) //while there are still bytes to be copied
    {
        requestStream.Write(buffer, 0, read);
        requestStream.Flush();
        bytesTransfered += read;
        //trigger progress event...
    }
}
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
    serverstatus.Items.Add(response.StatusDescription + " " + feltoltfile.Name + " --> " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
}
ftplista.Items.Clear();
FTPlistalekerdezes(ftpadress, textBox1.Text, textBox2.Text);
MessageBox.Show("Ready!");


text:
Q: Mounting SMB network share on desktop I am trying to mount a smb network share onto the desktop via python, I don't want the share to be mounted in a folder, but were all the other mounted shares are (if I use 'connect to Server' in OSX I want my python mount to be mounted in the same location).
Here is the current python code:
directory = os.path.expanduser('~/Desktop')
directory = os.path.normpath(directory)
os.system("mount_smbfs //server/servershare " + directory)

When I run the above, something strange happens. In finder, my home, which has the icon of a house and my username changes to the mount name, it screws it up a bit.

A: If you want to do this this the kosher, Finder-like way, do it in AppleScript via shell via Python:
os.system("osascript -e 'mount volume \"smb://server/servershare\"'")

You don't need anything else -- there's no mount point. This is identical to choosing "Connect To Server", and the resulting volume will show up in /Volumes as expected.
If you need to specify a username and/or password, you can do so:
os.system("osascript -e 'mount volume \"smb://server/servershare\" \
as user name \"myUserName\" with password \"myPassword\"'")

If you want to do it your original way using mount_smbfs, I think you want directory to be a folder you create in /Volumes, e.g. /Volumes/mySmbVolume, though I've never tried to do it this way. As you have it written, you're replacing your actual Desktop folder with the volume you're mounting. You could, however, make a folder inside Desktop for and use that for directory, and it might work. However, I'd do it like I wrote it to be most standard with the usual Mac way of doing things.

A: If you had desired to also open up a Finder window on the desktop, then this is another solution and one I wound up using myself.
import os

os.system("open -g smb://Server/Share")
#perform a timeout loop checking for finished attachment
if os.path.exists("/Volumes/Share"):
  # I use a for loop around this to sleep a second and try 20 times.
  # it needs to handle waiting for a server to wake from sleep and then attach
#Do my important functions
os.system("umount /Volumes/Share")

The pros are:

*

*Uses the keychain credentials for the current user

*Will wake up a sleeping Mac to attach to the smb share

*Will automatically create/delete the attachment directory in /Volumes

*(for others) this can work equally well in a shell script

The cons are:

*

*It uses Finder, so will open a window with the location on your desktop. If you don't mess with the window, it will close on its own when you umount

*It returns before the network is attached, so you need code to check for the mounted volume, sleep, and eventually move forward or error out.

*Repeating 1: If you are trying to run in the background and someone else is at the console, then popping open a Finder window really rots.  You can use -g to leave the window behind other on the desktop, but if you want to run hidden in the background then Ivan X's solution is preferred.

On the other hand, if you want a new Finder window then this works well.


text:
Q: Fullcalendar is not displaying on visualforce page I have been trying to show events that are accociated with  contact on vf page using fullcalendar plugin, I am not getting any error but calendar is not getting displayed on vf page.
Controller in vf:
<apex:page controller="CalendarExample" action="{!pageload}" Showheader="false">

    <apex:includeScript value="{!$Resource.fullCalendarcss}" />
    <apex:includeScript value="{!$Resource.fullcalendarprintcss}" />
    <apex:includeScript value="{!$Resource.fullcalendarmincss}" />
    <apex:includeScript value="{!$Resource.fullcalendarminjs}" />
    <apex:includeScript value="{!$Resource.fullcalendarjs}" />
    <apex:includeScript value="{!$Resource.momentjs}" />
    <apex:includeScript value="{!$Resource.jqueryuicustommin}" />
    <apex:includeScript value="{!$Resource.jquerymin}" />

    <apex:sectionHeader title="My Calendar Events" />
    <apex:outputPanel id="calPanel">
        <apex:form>

                <apex:commandButton value="{!IF(includeMyEvents,'Hide My Events','Show My Events')}" action="{!toggleMyEvents}" />

Contact's Birthdays

Campaigns

My Events

 Calendar

        </apex:form>
    </apex:outputPanel>

</apex:page>

public class CalendarExample {
    public Boolean includeMyEvents {get;set;}
    Public list < calEvent > events {get;set;}
    String dtFormat = 'EEE, d MMM yyyy HH:mm:ss';
    Public CalendarExample() {
        includeMyEvents = true;
    }
    Public pagereference pageload() {
        events = new list < calEvent > ();
        contact con = [select id from contact where lastname = 'kiran'];
        system.debug('--------------' + con);
        for (Event evnt: [select Id, Subject, isAllDayEvent, StartDateTime, EndDateTime from Event where whoid =: con.id]) {
            DateTime startDT = evnt.StartDateTime;
            DateTime endDT = evnt.EndDateTime;
            calEvent myEvent = new calEvent();
            myEvent.title = evnt.Subject;
            myEvent.allDay = evnt.isAllDayEvent;
            myEvent.startString = startDT.format(dtFormat);
            myEvent.endString = endDT.format(dtFormat);
            myEvent.url = '/' + evnt.Id;
            myEvent.className = 'event-personal';
            events.add(myEvent);
        }
        return null;
    }
    public PageReference toggleMyEvents() {
        if (includeMyEvents) {
            includeMyEvents = false;
        } else {
            includeMyEvents = true;
        }
        pageload();
        return null;
    }
    public class calEvent {
        public String title {get;set;}
        public Boolean allDay {get;set;}
        public String startString {
            get;
            private set;
        }
        public String endString {
            get;
            private set;
        }
        public String url {get;set;}
        public String className {get;set;}
    }
}

A: Try removing some of the tags you have that create styling like these two in particular and replace them with standard html like divs, spans, H1s, etc.:
<apex:sectionHeader title="My Calendar Events" />
<apex:outputPanel id="calPanel">

These are limiting your page sizes. If you wrap everything in a
 or
 that should solve your issue. You might still need the output panel, but definitely not the section header. And definitely remove the standard stylesheets to see if you really need them!


text:
Q: How can I retrieve a document with a defined amount of sorted nested fields? Here is my problem: let's assume I have a Facebook post indexed on ElasticSearch. This post has many comments as nested fields, which, themselves, have a "likes" count. So, the mapping would be something like this:
"mappings": {
    "post": {
        "properties": {
            "id": {
                "type": "integer"
            },
            "comments": {
                "type": "nested",
                "properties": {
                    "like_count": {
                        "type": "integer"
                    }
                }
            }
        }
    }
}

A post could have thousands of comments, but what if I want to retrieve only the 10 most liked comments from a certain post (so I'd have to define the post's id, limit a size for the field array and define a sort rule)? Is it possible? I've tried many ways using the "nested" query, but with no success.
Any ideas?
Edit: one of the queries I tried, in case anyone still has a doubt about what I want:
{
    "query": {
        "match": {
            "id": 81500
        }
    },
    "sort": [
        {
            "comments.like_count":
                {
                    "order": "desc"
                }
        }
    ],
    "nested": {
        "path": "comments",
        "inner_hits": {
            "size": 10
        }
    }
}

A: Try this query:
{
    "query": {
        "match": {
            "id": 81500
        }
    },
    "sort": [
        {
            "comments.like_count":
                {
                    "order": "desc"
                }
        }
    ],
    "size": 10
}


text:
Q: Appending new frames to an existing DICOM file I am working with DCMTK to modify an input DICOM file.
This is a Multi-Frame DICOM file on my disk. I need to add new frames into the PixelData element, and save the output using the same input filename.
The restriction is that I can not load the whole PixelData in memory. I would like to append new frame to the end of DICOM file, directly. Does anyone have any idea on how to do this ?

A: Too bad you are using DCMTK, if instead you were using GDCM, you could simply instantiate the FileStreamer class and append any Pixel Data chunk you would like:
See FileStreamer documentation.


text:
Q: SwipeRefreshLayout no muestra mi RecyclerView apenas la agrego al XML Tengo un problema con un SwipeRefreshLayout, lo quiero implementar para poder realizar la función de Pull to refresh en una vista que contiene un RecyclerView, el problema es que cuando agrego el SwipeRefreshLayout y ejecuto mi app el RecyclerView ya no me muestra nada, se me muestra en blanco completamente, este es mi archivo XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:layout_width="match_parent">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/list"
        android:name="com.seccion.yugioh.ui.inicio.InicioCartasItemFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        app:layoutManager="LinearLayoutManager"
        tools:context=".ui.inicio.InicioCartasItemFragment"
        tools:listitem="@layout/fragment_inicio_cartas_item" />

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

No entiendo cual es el problema, simplemente estoy agregando el SwipeRefresh para poder recargar mi RecyclerView cuando el usuario tire de la vista pero una vez se agrega ya no se ve nada en el RecyclerView.
Se supone que la lista debe mostrar una lista de cartas:

Y cuando ejecuto mi aplicacion ya con el SwipeRefresh no se muestra nada:

Y esta es mi clase donde cargo ese RecyclerView:
public class InicioCartasItemFragment extends Fragment {

    private int mColumnCount = 1;
    //Declaramos como variable global el recyclerView
    private RecyclerView recyclerView;
    //Declaramos como variable global nuestro adaptador
    private MyInicioCartasItemRecyclerViewAdapter adapter;
    //Creamos una lista gobal de nuestra respuesta del servidor que contiene el modelo de nuestro json
    private List<ResponseCartas> cartasList;
    //Creamos una instancia a nuestra clase ViewModel que nos permitira recuperar la informacion y enviarla al adapter
    private CartasViewModel cartasViewModel;

    public InicioCartasItemFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //Inicializamos nuestra clase ViewModel
        cartasViewModel = ViewModelProviders.of(getActivity()).get(CartasViewModel.class);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_inicio_cartas_item_list, container, false);
        // Set the adapter
        if (view instanceof RecyclerView) {
            Context context = view.getContext();
            recyclerView = (RecyclerView) view;

            if (mColumnCount <= 1) {
                recyclerView.setLayoutManager(new LinearLayoutManager(context));
            } else {
                recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
            }
            adapter = new MyInicioCartasItemRecyclerViewAdapter(cartasList, getActivity());
            recyclerView.setAdapter(adapter);
            loadCartas();
        }

        return view;
    }

    //En este metodo debemos mandar a llamar al metodo de getListaCartas que se encuentra en nuestra clase ViewModel
    //a este metodo le pasaremos un observador que nos permitira pasar los datos una vez cargados a nuestro adaptador
    private void loadCartas() {
        cartasViewModel.getListaCartas().observe(getActivity(), new Observer<List<ResponseCartas>>() {
            @Override
            public void onChanged(List<ResponseCartas> responseCartas) {
                //a la lista que creamos en esta clase debemos igualarla a la lista que noes devuelve como respuesta nuestro servidor
                cartasList = responseCartas;
                //Una vez que rescuperamos la lista de cartas de servidor la enviamos a un metodo dentro de nuestra clase adapter
                adapter.setData(cartasList);
            }
        });
    }

}

A: EL problema estaba en mi onCreateView, estaba instanciando de diferente forma el RecyclerView como vista principal dentro de mi XML, lo he cambiado por esto y ha funcionado:
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tienda_cartas_item_list, container, false);
        swipeRefreshLayout = view.findViewById(R.id.swipe_view_tienda);

        // Set the adapter
        Context context = view.getContext();
        recyclerView = (RecyclerView) view.findViewById(R.id.list_tienda);
        if (mColumnCount <= 1) {
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
        } else {
            recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
        }
        //Al adapter debemos de pasarle la nueva lista que creamos y el contexto de la clase con getActivity
        adapter = new MyTiendaCartasItemRecyclerViewAdapter(tiendaCartas, getActivity());
        recyclerView.setAdapter(adapter);
        loadCartasTienda();

        swipeRefreshLayout.setOnRefreshListener(this);

        return view;
    }


text:
Q: Prove the sequence $x_n=n^2-2n$ diverges. I am to prove that the sequence $(x_n)=n^2-2n$ diverges. So far this is what I have.

Suppose that $(x_n)$ is convergent. That is, $(x_n)$ $\rightarrow$ $L \in \mathbb{R}$. As every convergent sequence is bounded, $(x_n)=(n^2-2n)$ is bounded. Then there exists $M \in \mathbb{R}$ such that $(x_n) \leq M$ for all $n \in \mathbb{N}$. By the Archimedean property, there exists $n \in \mathbb{N}$ such that $n > M$. But $(x_n)=(n^2-2n)=n(n-2)>n$ when $n>3$, so $n(n-2)>n>M$, a contradiction. Therefore $(n^2-2n)$ diverges.

To me this seems to be enough for the proof but I am still new to proving sequences are divergent. Does this make sense, or am I missing a vital piece of information?


text:
Q: Datepicker jQuery, strange when i write directly in the input I have something strange with jQuery datepicker.
If i choose a date with datepicker, it's ok, no problem.
But if i write a date directly in the input, for example : 19/05/1990 (french format)
When i write the first number of the year (here 1), jquery select automaticaly the date 2001 in my datepicker and remove the value on my input....
Do you have an idea ?
Edit : Here, all options i use
yearRange: "-113:+0",
                changeMonth: true,
                changeYear: true,
                closeText: 'Fermer',
                dateFormat: "dd/mm/yy",
                prevText: '<Préc',
                nextText: 'Suiv>',
                currentText: 'Courant',
                monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
                'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
                monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
                'Jul','Aoû','Sep','Oct','Nov','Déc'],
                dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
                dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
                dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa']

A: You need to specify the correct localization when you instantiate the datepicker() function.
Please see the localization documentation and example or the "Localization" section of datepicker's API (which specifically suggests using jquery.ui.datepicker-fr.js).
$( selector ).datepicker( $.datepicker.regional[ "fr" ] );

Please see a working example of the datepicker() "localized" for France at http://jsfiddle.net/ZfpQ6/4/

A: If you want to prevent the jump to 2001 when you type 1 for the year you can override the behaviour of the plugin overriding the function _doKeyUp before create your instance.
var oldKeyUp = $.datepicker._doKeyUp;

$.datepicker._doKeyUp = function(event){
    var inst = $.datepicker._getInst(event.target);
    var tmpValue = inst.input.val();
    var arr = tmpValue.split('/');
    if (arr.length == 3){
        if (arr[2].length == 4){
            return oldKeyUp(event);
        }
    }
    return false;
}

$( "#datepicker" ).datepicker({...});

With this the plugin will wait until you have the full 4 digits of the year (assuming the format "dd/mm/yy").


text:
Q: Using Google Transit Layer on Google My Maps I've played with this a fair amount and have determined there isn't a simple way to render Google Transit Layer onto a map I've created through Google My Maps. These are the solutions I've come up with which all lead to dead ends:

*

*Use the Google Maps API to render the Google Transit Layer and my Google My Maps map. The issue with this is I've read My Maps isn't accessibly through the API, and even if it was, I wouldn't be able to use the Google Maps phone app to view the two maps, I'd have to navigate to a page I'm hosting.

*I've found 3 stores of public GTFS feeds, none of which have the cities I'm looking into (but Google does). If they did have the cities I wanted, I did find Google's GTFS to KML development tools in Python. Then I would have been able to import the KML to create a layer on My Map, but no such luck.

*Use a 3rd party service such as Maps Channel to composite the two maps together. I can't seem to get this service to work, but it stands to reason that if it has access to My Maps that the API should allow access, but who knows.

If someone comes upon a solution to this which doesn't require manually creating a GTFS or KML file for a city or something equally labor intensive, let me know.

A: So while the transit lines can't be added to a layer in My Maps, and Google-defined layers (traffic, transit, etc.) can't be activated in My Maps, the transit layer can be activated both in the Google Maps phone app and web app and a map from my map can be opened without loading it into the My Maps web app. Bizarre, but I'm just glad to have a solution even if it requires a few extra clicks.


text:
Q: How to handle SOAP request Payload and send a SOAP response XML in node js I have a SOAP web service written in C# that can handle SOAP request and Respond accordingly using SOAP Action and ReplyAction Headers.
[OperationContract(Action = "http://www.example.com/schemas/xxxx/xxxx/service/authenticationagent/2013/03/01/IAuthenticationAgentService/GetPostPromptResult", ReplyAction = "http://www.hp.com/schemas/imaging/OXPd/service/authenticationagent/2013/03/01/IAuthenticationAgentService/GetPostPromptResult")]
            [XmlSerializerFormat]
            PostPromptResult GetPostPromptResult(string authenticationContextId, string languageCode, string serverContextId);

I need to implement the same web service using Javascript and serve it using node js server.
I was able to handle REST web service request and response since they have a URI to hit.
[OperationContract]
        [WebInvoke(UriTemplate = "/PostPromptAuthentication", Method = "POST", RequestFormat = WebMessageFormat.Xml)]
        [XmlSerializerFormat]
        AuthenticationResult GetPostPromptResult(AuthenticationRequest postPromptQuery);

And in node js server I can do this,
 if (request.url.match('PostPromptAuthentication')) {
                    var data = fs.readFileSync('PostPromptAuthentication.xml', 'utf-8');
                    if(!validationResult)
                    {
                        data = data.replace('succeeded','failed');
                    }
                    response.writeHead(200);
                    response.end(data);

For SOAP, I dont have an URI to hit. I only have request and response XML payloads which have SOAP Action and Reply Action in their headers.
How do I handle these SOAP requests in node js?
Is there something like
 request.SOAPAction.match('') in javascript?

Any kind of help is appreciated.


text:
Q: It's that possible in JavaScript Help, how can I make this to "Correct" true without change the condition.
Just changing the Variable value.
In JavaScript
         Let Variable;
\*
         If(Variable == 1 && Variable == 2 && Variable == 3)
             Console.log("Correct");
           else
           Console.log("Incorrect");

*\

A: Use this given below code, it's working as per your logic
let variable;
if(variable == 1 && variable == 2 && variable == 3) {
    console.log("Correct");
} else {
  console.log("Incorrect");
}

Note: given condition never correct because one variable only hold one value use or condition (||).
let variable;
if(variable == 1 || variable == 2 || variable == 3) {
    console.log("Correct");
} else {
  console.log("Incorrect");
}


text:
Q: ExtJs clear checkboxes in a tree panel In a extjs app, I have a tree panel that is loading json data from a store. In that information I have a property checked that allows manipulate a checkbox over a row in the tree panel.
How can I do to uncheck graphically the checkbox by listening a button? (Clean all checked boxes)
Here's a fiddle that explain a bit the situation.
https://fiddle.sencha.com/#fiddle/17v3

A: Update your code like so:
Ext.application({
    name: 'Fiddle',

    launch: function() {
        Ext.define('modeloCapa', {
            extend: 'Ext.data.Model',
            fields: ['nombre']
        });

        var treeStore = Ext.create('Ext.data.TreeStore', {
            model: 'modeloCapa',
            proxy: {
                type: 'ajax',
                url: "data1.json",
                reader: {
                    type: 'json',
                    root: 'Result'
                }
            }
        });

        var tree = Ext.create('Ext.tree.Panel', {
            title: 'Test',
            width: 500,
            store: treeStore,
            rootVisible: false,
            renderTo: Ext.getBody(),
            columns: [{
                xtype: 'treecolumn',
                flex: 2,
                sortable: true,
                dataIndex: 'titulo'
            }],tbar: [{
                xtype: 'button',
                 id: 'btnApagarCapas',
                 text : 'Button',
                 width: 100,
                 tooltip: 'Uncheck!!',
                 iconAlign : 'center',
                    listeners: {
                        click : function(){
                            treeStore.suspendEvents();
                            treeStore.getRootNode().cascadeBy(function(node) {
                                if (node.get('checked')) {
                                    node.set('checked', false);
                                }
                            });
                            treeStore.resumeEvents();
                            tree.getView().refresh();
                    }
                }
            }]
        });
    }
});

Loop over all the nodes, uncheck the ones that are checked. The suspend events is to prevent the view from refreshing each node as it is unchecked, just do it in bulk at the end.


text:
Q: Should instance of Employee contain a reference to instance of Office, or should Office contain an array of Employee? Title is an abstraction of what I am actually doing, but in essence the same.
The main entity I will be dealing with are the Employees themselves; "Send package to employee John Doe". In order to work with a given Employee, I need to use the IOffice they belong to, and each office has a different way of delivering that package to that Employee. I am not really interested in how the package is delivered, just that it gets there.
In the first way mentioned in the title, it would look something like this:
public class Employee
{
    private IOffice _office;

    public Name { get; set; }

    public void Send(Package package)
    {
        _office.Send(package, this)
    }
}

public class SomeOffice : IOffice
{
    public void Send(Package package, Employee employee)
    {
        // Implementation of how this office gets the package to employee
    }
}

Doing it this way, I can simply have a list of all employees, and employees in the same office can share the same IOffice object.
The second approach like so:
public class Employee
{
    public Name { get; set; }
}

public class SomeOffice : IOffice
{
    public List<Employee> Employees { get; set; }

    public void Send(Package package, Employee employee)
    {
        // Implementation of how this office gets the package to employee
    }
}

This makes it harder to have instance of Employee and send a package to it. You must get the instance you want from the Employees-collection, and pass it into the office's Send-method. However, it keeps the Employee-class simpler, and makes the IOffice take care of everything.
There are probably other ways to go about this also. How would you do it?
Edit:
For concrete example, replace IOffice with a CommunicationInterface, such as SerialPort, UdpClient, TcpClient etc.
At the end of each endpoint there are different Devices (Employees). These devices all behave similarly, but how to send them a request (Package) and get a response back differs.
From my program, I want to have a list of all available devices, across all CommunicationInterfaces, and send requests to them, and get responses back.

A: I find it hard to give general solutions of this kind since system architecture is always highly depending upon the entire domain.
If routing packages to employees is a main concern in your system, maybe neither Office nor Employee have to know about how they relate to each other.
You could also think about an additional Entity of your system, like an EmployeeRegister for example, which can look-up the Office for an Employee instance. Than you can deliver this Package to the Office.
In an additional step, you can encapsulate this specific step into a Postmaster Entity, which just accepts a Package and an Employee. It utilizes such a register to find the Office and then delivers it.

A: One thing I see with the first example that could lead to confusion is that the Employee is not sending the package, they are receiving the package. I think the send method leads to confusion that the Employee is sending the package, when the Employee is receiving the package.
I think the second example is better. The SomeOffice class has a reason to keep a list of Employees and is the entity that will perform the Send() if you think about it in terms of an actual office that might send a physical package to an employee.

A: The send function is a red herring, because it is unrelated to the basic question, which is whether you should have each employee know their office, or whether you should have each office know which employees are in it.  The send function does not affect, nor is it affected by, the answer to the basic question.  It probably should not be a function of either Office or Employee; it is an application concern, so it probably belongs to your application logic.  (Some Application object perhaps.)
Now, you seem to understand that the two approaches are equivalent: you can have each employee know their office, or you can have each office know which employees are in it.
Personally, I would go with the first approach, because it more readily maps to a relational database model, and this has specific advantages.  In a database, this kind of relationship would always be implemented by including in each employee row the id of the office row that the employee belongs to.  The fact that this is how it is done in relational databases should, in and by itself, be sufficient reason to choose this approach, but if you want specific examples of why it would be better, consider this:

*

*There is a possibility of error.  Two offices may, by mistake, contain the same employee, in which case you have invalid data.  As a matter of fact, in relational databases this is called a many-to-many relationship, where it is in fact permissible for many entities of one kind to be related to many entities of another kind; but your situation does not call for a many-to-many relationship, therefore it should not be implemented as if it was a many-to-many relationship.

*Suppose you want to delete an employee.  If each office has its own list of employees, then in addition to deleting the employee object, you now have to visit all of your office objects, see if any one of them contains that employee, and if so, remove the employee from the list of employees of that office.

A:
There are probably other ways to go about this also. How would you do it?

I would start out by considering the boundary between the real world, and the digital model.  Employee and Office are fine entities, but they are in the real world; you can't change the real world by sending a command to your model.
When little Bobby Tables enrolled, the model got trashed, but the students didn't get hurt.
So dig harder - what's the entity controlled by the model that tracks the information that you want?  "EmployeeRecord" is a punt, not wrong, but too shallow to be of use.  You know what the thing is -- a relationship between Employee and Office.  So -- OfficeAssignment? Probably looks like an EmployeeId, an OfficeID, an effective start and end date to cover use cases where the employee relocates?
Your send package use case might not touch Employee or Office at all.  The client UI creates a RoutingSpecification based on the location of the package and the identity of the recipient, and a query of OfficeAssignments picks out an OfficeId, which is then used to run a query against the RoutingPolicies to determine the correct Itinerary for this Delivery....

A: What is missing from the code examples is what you are expecting it will look like actually interacting with the classes.
It sounds like you are starting with a reference to an Employee. In the first approach, sending a package looks like:
employee.Send(package);

And in the second, more like:
var office = offices.Find(o => o.Employees.Contains(employee));
office.Send(package, employee);

The simplicity of the first example seems worth the trouble of carrying around the Office reference: not only do you not have to perform a lookup, but the existence of the Office class is completely hidden by this interface.
If you're shuffling employees around frequently, need to traverse the relation in both directions, and are worried about consistency, then you can have the .Office and .Employees properties delegate to a third class that actually maintains that relation. That's more or less how ORMs work.

A:
...I need to use the IOffice they belong to, and each office has a
  different way of delivering that package to that Employee.

It sounds to me that the code should be employee specific rather then office, package and employee specific.
Each employee should implement their own way of receiving a package and each office will only know that each employee can receive a package.
I would start of with creating an abstract employee class:
public abstract class Employee
{
    public Name { get; set; }
    public abstract void Receive(Package Package)
}

The implementation of the class
public class Boss: Employee
{
    public override void Receive(Package Package)
    {
        //Handle specific receive for the boss
    }
}
public class Programmer: Employee
{
    public override void Receive(Package Package)
    {
        //Handle specific receive for the real boss
    }
}

When the office then sends a package to each of its employees it will use each employees Receive method and your code will be employee type specific
public class SomeOffice: IOffice
{
    public List<Employee> Employees { get; set; }

    public void Send(Package package, Employee employee)
    {
        employee.Receive(package);
    }
}


text:
Q: Login Angular - PHP error i'm creating an app with Angularjs and PHP, which try connect to file PHP of other Domain, but when i call the file it never show me the info.This my Controller...
myapp.controller('loginCtrl', function loginCtrl($scope, $http) {

$scope.doLogin = function()
{
    $http({
        method: 'POST',
        url: 'http://www.domain.com/login.php?',
        data:
        {
            'usuario'   : $scope.usuario,
            'password'  : $scope.password,
            'Type'      : 1
        },

    })
    .success(function(data, status)
    {
        alert('Validado');
        $scope.data = data;
        if(data == 'No encontrado')
        {
            $scope.aviso = 'Usuario o contraseña invalidos';
        }
        else
        {
            $scope.aviso = 'Bienvenido';
        }

    })
    .error(function(data, status) {

            $scope.data = data || "FALSE";
            $scope.status = status;
            $scope.aviso = 'Ha pasado algo inesperado';
    });

};

});
And this is my Template...

        <form>

Login

            Usuario
            <input type="text"      ng-model="usuario">
            Contraseña
            <input type="password"  ng-model="password">

            <input type="submit" value="Entrar" ng-click="doLogin()" class="btn btn-primary">

{{aviso}}

        </form>

But it never in to .success(), when i use Mozilla and Chorme the firebug is empty, but when i use:
 $http.get('http://www.domain.com/login.php?usuario=user1&password=123456&Type=1')
    .success(function(data, status).... appears the next error:

 XMLHttpRequest cannot load http://www.domain.com/login.php?usuario=user1&password=123456&Type=1. Origin http://localhost:8081 is not allowed by Access-Control-Allow-Origin.

I have been unable to fix it, If somebody know the Answer I'll appreciate it.
Thanks

A: You would have to create a local proxy script or enable CORS. CORS is usable by most browsers, but not all. Using a local proxy script is probably the safest bet. Basically, all Ajax requests would go through the proxy passing the remote address to use thereby keeping in line with the same-domain access policy.
A good PHP proxy: https://github.com/eslachance/php-transparent-proxy
More on CORS: http://en.wikipedia.org/wiki/Cross-origin_resource_sharing


text: Q: Why if we have a singular covariance matrix then the data is over fitted? If we have D dimensional training data and the covariance matrix was not exist for those data, then we have over fitting. I think this is related to make sure that the observations must has low correlation, but I cannot understand how can we observe data from the same source and we expect that they have low correlation. What am I missing here?


text:
Q: constexpr typed non-dynamic uninitialized storage In C++20, we have
constexpr T* std::allocator<T>::allocate( std::size_t n );

to allocate typed dynamic uninitialized storage (and construct_at to construct objects) in compile-time.
But do we have typed non-dynamic storage in compile-time, for example, a typed aligned_storage?

Edit: One useful usage of this is to implement constexpr static_vector:
template<class T, size_t Cap>
class static_vector {
    size_t size;
    Storage<T, Cap> storage;
};


text:
Q: (Oracle): Columns in partially dropped state I use Oracle 10g. Since months I have the following error regarding a table:
ORA-12986: columns in partially dropped state. Submit ALTER TABLE DROP COLUMNS CONTINUE

The statement ALTER TABLE DROP COLUMNS CONTINUE fails for overtime.
I have no DBA privileges on this database.
What could I do?  Drop & recreate the table?
It's a massive table with million of records.
What I tried:

*

*Once upon a time, I made the following command to set some columns
in unused state:
ALTER TABLE hr.admin_emp SET UNUSED (hiredate, mgr);

Then, I gave the following command:
ALTER TABLE hr.admin DROP UNUSED columns;

The system hangs up, the operation is too long, so it faults.
Now the table hr.admin has two columns in partially dropped state,
and I can't go neither forward, nor backward.
I don't understand why this happened.

*I made the following steps, the system hangs up at STAGE TWO:
STAGE ONE
 ============
SQL> select * from user_unused_col_tabs;

TABLE_NAME  COUNT
----------- ----------
TEMP        1

STAGE TWO
 ============
SQL> alter table temp drop unused columns;

Table altered.

STAGE THREE
 =============
SQL> select * from user_unused_col_tabs;

no rows selected

*Checkpoint 500 option
I am trying again with the following statement:
ALTER TABLE MYUSER.MYTABLE DROP COLUMNS CONTINUE CHECKPOINT 500;

Could the CHECKPOINT 500 option help me?

A: We have given for about twelve consecutive times the command:
ALTER TABLE MYUSER.MYTABLE DROP COLUMNS CONTINUE CHECKPOINT 250;

The statement was automatically killed every 48 hours, this is the reason because we had to launch it several times.
About 500 hours of elaboration to definitely drop the columns in partially dropped state...!!
It is confirmed that CHECKPOINT 250 makes a "commit", so at the next launch of the same command, you start from the point of stop.


text:
Q: Is there a maximum object count in Azure Caching (Preview) I know there's a maximum memory limit in Azure Caching but is there a maximum object count as well?  It feels like the cache would get slower as the number of keys is increasing.
Background:
I need to keep some numbers in memory for each user (summaries which is expensive to calculate from db but cheap to increment in memory on the fly). As the concurrent users grows I'm worried I might outgrow the cache if there's a limit.
My intended solution:
Let's say i have to keep the Int64 'value1' and 'value2' in memory for each user.
Cache items as userN_value1, userN_value2, [...] and call DataCache.Increment to update the value of each counter when changed like this:
DataCache.Increment("user1_value1", 2500, 0, "someregion");

As the amount of users grow this may result in a lot of items. Is this something I should worry about? Is there a better approach I haven't thought of?

A: As far as I know there is no object limitation, you are only bound by memory, if your cache experiences memory pressure then it will evict objects to free it up, the data deletion process is asynchronous and follows the least recently used (LRU) policy

A: In practice the limit is imposed by the number of instances and size of the VM selected for the cluster.
The Capacity Planning Guide spreadsheet is very interesting, I used it to compare our current usage of the Shared Cache Service in order to find the matching configuration (and then compare cost).
If you adapt the settings Max Number of Active Objects and Average Object Size (Post-Serialization) to your scenario you can notice how the proposed configuration rises.
There seems to be a limitation: if you increare the requirement you can encounter "Cluster Size greater than 32 Not Supported. Consider splitting into multiple clusters". I assume that if you need more than 32 nodes in the cluster, each as a ExtraLarge VM, you reached the limit.


text:
Q: When BroadcastReceiver runs, which thread is it running on, system wide or only your applications? I have an Alarm go of using BroadcastReceiver, but I am a little confused on Threads. I would like to have it run on a separate thread so it doesn't cause unresponsiveness to anything else, but when looking on the Android Docs, I still don't really know if there is only one Main thread, or each application has its own Main thread.
For example, if my application isn't running, what would the point of running a separate thread in the BroadcastReceiver if each application runs its own Main thread, meaning I wouldn't be affecting the users' other processes. Since mine wasn't running, havent it do its thing wouldn't hurt. But in contrast, if there is one Main thread for all applications then I would need to move the actions to a separate thread. I hope I am not asking a stupid question. I just want to understand it thoroughly. Thanks in advance.

A: After some browsing around the Android Developer page, I believe that BroadcastReceivers run on the Main IO thread.
BroadcastReceivers have the function goAsync that allows

the implementation to move work related to it over to another thread to avoid glitching the main UI thread due to disk IO.

Source

A: Basic rule of android is, all the components of android runs in Main thread (UI thread) by default.
Broadcast receivers are very light weight components of android, which has to do its functionality with in maximum of 10 seconds (as per android documentation).
Since you want to kick off an alarm from receiver, I don't think it is really going to have serious effect on your UI responsiveness for the user. So it is not really required to start a different thread just to kick off the alarm from your receiver.
Ref taken from developer android

A: A broadcast receiver is registered to the system that it is currently running on under the application that it is for. Specifically it does not halt anything on the main thread because it's done asynchronously. The message for this particular is broadcast and is then passed to whatever process is registered to listen to that broadcast via an IntentFilter (if it is protected it will require a permission or will not be available).
However; good practice is when you receive the broadcast, you start an AsyncTask to run whatever procedure you'd like to run.
You have nothing to worry about how the broadcast receiver works.


text:
Q: Having trouble using XSLT to parse a simple XML file XSLT:
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ps="http://schemas.microsoft.com/powershell/2004/04"
    exclude-result-prefixes="ps">
    <xsl:template match="/">

            <xsl:call-template name="report">
                <xsl:with-param name="report" select="." />
                <xsl:with-param name="heading">Today</xsl:with-param>
            </xsl:call-template>

    </xsl:template>
    <xsl:template name="report">

                    IP
                    Hits

                <xsl:for-each select="$report/ps:Objs/ps:Obj/ps:Props">
                    <xsl:sort select="Hits" order="descending" data-type="number" />

                        <xsl:attribute name="class">
                            <xsl:choose>

                                <xsl:when test="position() mod 2 =  0">alt row</xsl:when>
                            </xsl:choose>
                            <xsl:if test="Hits > 1000"> alert</xsl:if>
                        </xsl:attribute>
                        <xsl:value-of select="ps:S[@N='Name']"/>
                        <xsl:value-of select="ps:I32[@N='Count']"/>

                </xsl:for-each>

    </xsl:template>

</xsl:stylesheet>

XML file: http://pastebin.com/Nzq6bC9b
(I have not included the XML directly because I can not seem to get it to format legibly)
I have been asked to assist making a XSLT document correctly pull info from an XML file and create a table with the data. I have no prior experience with XSLT and have searched quite a bit trying to accomplish my task. I have seen many examples, but I can not find any that show how to pull from a file formatted like mine. If someone could assist me it would be greatly appreciated.

A: First thinks first, please provide complete and well-formed documents like Minimal, Complete and Verifiable example like michael.hor257k and Michael Kay mentioned already before.
XML-File linked via Pastebin is wrong, cause the root-element objs is not closed.
Change your named template to following:
<xsl:template name="report">
    <xsl:param name="report"/>
    <xsl:param name="heading"/>
    ...
</xsl:template>

Result

                IP
                Hits

                "16.249.75.135,
                87319

                "26.249.91.195,
                22510

                "16.249.69.8,
                6370

                "68.181.230.228,
                3818


text:
Q: Can't run the ls command on the root directory without using sudo CentOS 7.6.180
GNOME-CLASSIC 3.28.2
I've always been able to run ls on the / directory in the system above.
Now it just hangs when I run ls.  Same if I try to see the / dir with software other than the terminal.
However, I can successfully run ls on the / dir is I use sudo.
This change happened after I cancelled a large rsync job in the / dir ( ctrl c ) and issued a reboot -f command.
I don't know if those things are the cause.
How can I restore the ability to read the / directory with ls?

A: It is hard to say exactly what will solve the problem but it is likely your filesystem has been corrupted, possibly some information containing file permissions which is why root can see everything but another user hangs. It is not 100% sure since I do not have access to your filesystem obviously but ls is should not hang. If you do not have permissions for something, it should fail immediately rather than hang.
The most likely way to solve this is to repair the file system. Given that the root file system is mounted when the system boots, you have to do this from an operating system running on a different disk. If you have a dual-boot system, then use the other OS. Otherwise, there are many Linus Rescue images that can be burned into a CD or written to a USB key. You then boot from that and use a shell to do a filesystem check. The general form of the command is:
fsck [options] /dev/<DEV>

Replace <DEV> above with the device partition on which the root filesystem is mounted, usually something like nvme0n1p1 or sda1. Without any options fsck may not do anything, so you can add -a for automatic repair, -f to force the repair when fsck reports the filesystem is marked clean, -y to accept automatically all repair options, in case there are lots of errors.
The exact command depends on the fileystem, so check the man page before to confirm these options apply to you. There are specialized fsck versions for many file systems, for example:
fsck.jfs

For JFS which add an option to get the journal from a separate device.

A: The problem solved itself.
I connected back to that computer this morning.
The problem was gone.
My theory is that the "cancelled" rsync still had something running, something was blocking ls from operating on /
Thanks much for responding.


text:
Q: each_with_index is outputting the array I have a rails application that calls the helper method in the view by:
 <%= link_to_receipts @purchase_request %>

in the helper I have:
link_to_receipts purchaserequest
   purchaserequest.receipts.each_with_index do |receipt,i|
     #some code here commented out...
   end
end

but it outputs the array like so on the view:

[#>tagged_by: "joe somebody", purchase_request_id: 39, created_at: "2011-08-22 20:39:18",updated_at: "2011-08-22 20:39:18">]

If I comment out the each_with_index it will not show the array, but if it is there it will.  Any ideas?

A: I found the problem.  In the helper method I had the variable html first initialized in the block like so:
link_to_receipts purchaserequest
    purchaserequest.receipts.each_with_index do |receipt,i|
     html = ""
     #more code here
    end
 end

When it should have been declared outside of the block:
link_to_receipts purchaserequest
html = ""
    purchaserequest.receipts.each_with_index do |receipt,i|
     #code here
    end
 end


text:
Q: Check if 2 BSTs have the same in-order traversal simultaneously using recursion I am looking at this problem discussed on YouTube:

Given two binary trees, determine whether they have the same inorder traversal:
      Tree 1              Tree 2

         5                   3
       /   \               /   \
      3     7             1     6
     /     /                   / \
    1     6                   5   7

   [1,3,5,6,7]           [1,3,5,6,7]

I wanted to know how to solve this problem by doing a simultaneous in-order traversal of both trees using only recursion. I know people alluded to it in the comment section but I assume they mean iteratively.
My first thought was to use 1 function and pass in 2 lists to hold the values of the trees, and then compare them in the parent function. But this seems to work on only trees that have the same height (I think).
def dual_inorder_traversal(self, p, q, pn = [], qn = []):
    if not p and not q: return
    if not q: pn.append(p.val)
    if not p: qn.append(q.val)
    if p and q:
        self.dualInorder(p.left, q.left)
        pn.append(p.val)
        qn.append(q.val)
        self.dualInorder(p.right, q.right)
    return pn, qn

I then tried mutual recursion in which I have two functions, one that recurses tree1 and another that recurses tree2 and have them call each other. My idea was that we could append the root in the tree1 function when we visit it, and then then pop it from the list and compare when we visit the root in the tree2 function. Not even going to post what I tried because it didn't work at all lol. Also not even sure if mutual recursion is even possible in this case.

A: You are right that your first attempt to recurse through both trees in a single recursive function is difficult to do when the trees have different shapes: you may need to recur deeper in one tree, while in the other you are stuck at a leaf. This means you need to maintain lists to collect values (as can be seen in your code).
But storing values in lists is really defeating the purpose of the challenge. You might then as well collect all values in two lists and compare the lists, or collect the values of one tree in one list and compare against that list while making the traversal in the other (as is done in the video you linked to). Yet, it should not be necessary to use that much space for the job.
The idea to have two separate traversals going on in tandem is more promising. It becomes really easy when you make the traversal function a generator. This way that function stops running whenever the next value is found, giving you the opportunity to proceed in the other traversal also with one step.
Here is an inorder generator you could define in the Node class:
class Node:
    def __init__(self, value, left=None, right=None):
        self.value = value
        self.left = left
        self.right = right

    def inorder(self):
        if self.left:
            yield from self.left.inorder()
        yield self.value
        if self.right:
            yield from self.right.inorder()

Now it is a matter of iterating through p.inorder() and q.inorder() in tandem. You can write this with a loop, but itertools has a very usefull zip_longest function for that purpose:
from itertools import zip_longest

def same_inorder(p, q):
    return all(v1 == v2 for v1, v2 in zip_longest(p.inorder(), q.inorder()))

There is a boundary case when the trees have a different number of nodes, but their inorder traversal is the same until the smaller tree is fully iterated. Then zip_longest will fill up the gap and produce None values to compare with. So as long as the tree nodes do not have None as value, that is fine. If however you expect nodes to have None values (quite odd), then use a different filler value. For instance nan could be an option:
 zip_longest(p.inorder(), q.inorder(), fillvalue=float("nan"))

As a demo, let's take these two trees:
             5                   3
           /   \               /   \
          3     7             1     6
         /     /                   / \
        1     6                   5   7

Then you can create and compare their inorder traversals as follows:
tree1 = Node(5,
    Node(3,
        Node(1)
    ), Node(7,
        Node(6)
    )
)

tree2 = Node(3,
    Node(1),
    Node(6,
        Node(5),
        Node(7)
    )
)

print(same_inorder(tree1, tree2))  # True

Time and Space use
Let's define  as the number of nodes in the first tree and  as the number of nodes in the second tree.

*

*Runtime complexity = O(+)

*Average, auxiliary space complexity = O(log() + log())

The auxiliary space excludes the space already used by the input, which is  O(+). On top of this we need to use the stack during the recursion. On average that will be O(log() + log())


text:
Q: How do I access the component object of the child components I render in a list? I have a JSON payload with a service in my component, but then I'm not sure how would I obtain a reference to the list items component objects from the parent component.

A: You can do this using ngFor loop.
 {
  "data": [
      {
        "id": "4",
        "name": " Name1"
      },
      {
        "id": "21",
        "name": " Name2"
      },
      {
        "id": "24",
        "name": " Name3"
      },
      {
        "id": "11",
        "name": " Name4"
      }
  ]
}

In HTML Code
<select>
    <option *ngFor="let item of data"
    [value]="item.id" >
  {{item.name}}
</option>
</select>


text:
Q: Trying to remove unwanted space in a table, I'm trying to create a 6 cell table on my site that contains 3 images and i want the corners of the three images to touch, with no boarder or padding. I've tried everything I can think of but everythng I've tried has resulted in unwanted spaces.
this is the code that I'm using
Can someone tell me what I'm doing wrong?

A: First of all, you have to make sure those cells (i.e. td) do not have any paddings.
Another tricky point is that by default each img would have some small whitespace beneath it. You have to add display: block to the img to remove that whitespace.
(Reference: https://stackoverflow.com/questions/5804256/image-inside-div-has-extra-space-below-the-image)
td {
  padding: 0;
}

td img {
  display: block;
}

Live demo:
https://jsfiddle.net/21b3ujmk/


text:
Q: How to change a background color in Javascript based on an entered value I am trying to create a page that, upon entering a temperature of or higher than 70, the result page will turn red, and if the temperature is below 70, then it will turn blue. I already have a sample page for the first part of the code for the submit page. I just don't want the words to turn colors, I want the entire page to turn colors based on the temperature. Can anyone help?

<?php
if (isset($_POST['temperature'])): //isset determines if var has valid contents, even empty string

    //if var is set, show what it contains
    $myFahrenheit = (int)$_POST['temperature']; //cast value sent via post to an integer

    $myCelsius = intval(($myFahrenheit-32) * (5/9)); //calc celsius
    echo '
You entered ' . $myFahrenheit . ' in Fahrenheit!!
';
    echo '
 It is '. $myCelsius .' in celsius!!
';
    //put link on page to reset form
    print 'Reset page';
else:
    //show form
?>

    <form action="<? print $_SERVER['PHP_SELF']; ?>" method="post">
    Enter your temperature in Fahrenheit <input type="text" name="temperature">

    <input type="submit" value="Show me the temperature in celsius!!">
    </form>
<?
endif;
?>

A: I guess a simple  styling will work here?

<?php
    $style = '';
    if (isset($_POST['temperature']))
    {
        if ($_POST['temperature'] >= 70)
            $style = 'background-color: red;';
        else
            $style = 'background-color: blue;';
    }
?>
<body style="<?php echo htmlspecialchars($style); ?>">

A: use it like this

<?php
if (isset($_POST['temperature'])) //isset determines if var has valid contents, even empty string
{//if var is set, show what it contains
$myFahrenheit = (int)$_POST['temperature']; //cast value sent via post to an integer
if($myFahrenheit > 70)
   echo "";
else
   echo "";
$myCelsius = intval(($myFahrenheit-32) * (5/9)); //calc celsius
 echo '
You entered ' . $myFahrenheit . ' in Fahrenheit!!
';
echo '
 It is '. $myCelsius .' in celsius!!
';
//put link on page to reset form
print 'Reset page';
}else{ //show form
?>

A: if($myFahrenheit > 70)
  echo '';
else
  echo '';


text:
Q: Debugging Visual Studio web application in Release Mode I have a Visual Studio 2013 Web Application project that breaks when in Release mode. No console errors are thrown and I think that it must have something to do with script minifying/concatenating. Everything's fine when I build in Debug Mode.
So I'm trying to figure out how to debug when in Release mode and having no luck.
Most articles, like this one, suggest modifying C/C++, Linker and other properties... but I don't have see those options, I assume because I'm working on a web app project.

Are there other ways I can enable debugging, break points, console.logs, etc in Release Mode?

A: If you're trying to debug a web application then no you're not going to see those options, as they're only available for C++ solutions. To debug a C# or VB web application you need shouldn't need to do any special configuration.
If it's not working however there are some simple things you can check, firstly that the PDB files are generated. These are essentially debug symbols that match the original source code up to the compiled output, allowing visual studio to step through the code and they should be placed in the same directory as your DLLs.

Once you've got your PDB in place all you need to do is attach the debugger. Now for a web application this can be a little confusing at first (if you're using IIS). IIS has several application pools:

The IIS process that you want to attatch to is called w3wp which is a little confusing at first. And potentially there are several of them (one for each AppPool that is active and running). Make sure you've got the Show processes from all users checked to see the processes listed:

To make this whole process easier, if you're running a version of Visual Studio that allows extensions take a look at AttatchTo. It adds a menu option you can click (and convert to a toolbar button/shortcut) that will automatically attach to all the IIS instances to debug your code.


text:
Q: MassTransit publish call hangs I've been working on setting up a producer to load messages in Azure Service Bus using MassTransit. The code sits in our .net core web api. My method to send is pretty simple and looks like this.
public class ServiceBusProxy : IMessageProxy
{
    private readonly ILoggerManager _logger;
    private readonly IPublishEndpoint _endpoint;

    public ServiceBusProxy(ILoggerManager logger, IPublishEndpoint publishEndpoint)
    {
        _logger = logger;
        _endpoint = publishEndpoint;
    }

    public async Task QueueMessage(int userId, Message message)
    {
        await _endpoint.Publish(message);
    }
}

This code currently hangs on publish and doesn't return. I updated the calling code to use async and await as well. Configuration is pretty simple as well.
services.AddMassTransit(x =>
        {
            x.UsingAzureServiceBus((busContext, busConfig) =>
            {
                busConfig.Host("our connection string");
                busConfig.ConfigureEndpoints(busContext);
            });
        });

Is there something obvious that could be causing deadlock?

A: Feels very silly but added one config setting and now it works fine. The host call has some config where I set TransportType to ServiceBusTransportType.AmqpWebSockets.
busConfig.Host("connection string", hostConfig =>
                {
                    hostConfig.TransportType = ServiceBusTransportType.AmqpWebSockets;
                });


text:
Q: Office 365 Groups vs Security Groups I understand the purpose of Office 365 Groups. However, even without any Office 365 services, it appears that Office 365 Groups have some advantages like soft delete and expiration.
Is there any reason NOT to use the "Office 365 Group" type when creating new groups in Azure AD?


text:
Q: Sphinx real-time индекс поиск по части слова Я создал индекс:
index berni_filter2
{
    rt_mem_limit    = 512M
    type            = rt
    path            = /var/lib/sphinxsearch/data/berni_filter

    rt_attr_uint    = product_id
    rt_attr_uint    = store_id
    rt_field        = product_name
    rt_attr_json    = attributes

    prefix_fields   = product_name
    expand_keywords = 1
    min_infix_len   = 2
    dict            = keywords
}

Пробую найти товар по имени через SphinxQL:
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mothercare')

Запрос работает хорошо, но я также хочу, чтобы при поиске "mother" находились товары, содержащие "mothercare". Пробовал:
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mother')
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mother*')
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name *mother*')

Так же менял min_infix_len на min_prefix_len. Ничего не работает.

A: Моей ошибкой было то, что я не удалял индекс с диска после изменения конфига. Рабочий финальный конфиг:
index berni_filter
{
    rt_mem_limit    = 512M
    type            = rt
    path            = /var/lib/sphinxsearch/data/berni_filter

    rt_attr_uint    = product_id
    rt_attr_uint    = store_id
    rt_field        = product_name
    rt_attr_json    = attributes

    index_exact_words = 1
    expand_keywords   = 1
    min_prefix_len    = 3
    min_word_len      = 2

    morphology        = stem_enru
    dict              = keywords
}


text:
Q: How to copy text between 2 html tags? I want to copy all the text in a website between tags:

 and

using bash.
Do you have an idea how to do it?

A: As the comment above states: don't even try. There is no reliable way to parse HTML with Bash internals.
But when you're using a shell you may as well use third-party command line tools such as pup which are built for HTML parsing on the command line.

A: Yes, an HTML parser is a better choice.  But if you are just trying to grab the text in between the first set of P tags quickly, you can use Perl:
perl -n0e 'if (/
(.*?)<\/p>/s) { print $1; }'

For example:
echo "

A test
here
today

whatever

" | perl -n0e 'if (/
(.*?)<\/p>/s) { print $1; }'

This will output:
A test
here
today


text:
Q: Unity collider OnTriggerEnter not getting called I've made many colliders before and that I used was (collider otherOnTriggerEnter(collider other)) and then check if the other collider is the one I want by comparing TAG. But this time I'm not triggering the canMelee boolean. My code:
ArrayList Enemy;
public StatData stat;

[SerializeField]
private bool canMelee = false;

/// <summary>
/// OnTriggerEnter is called when the Collider other enters the trigger.
/// </summary>
/// <param name="other">The other Collider involved in this collision.</param>
void OnTriggerEnter(Collider col)
{
    if (col.tag == "Enemy")
    {
        Debug.Log("Now you can do melee attack!");
        canMelee = true;
    }
}

So I wrote this code but somehow this doesn't work I checked the tag and added it to the player game object but it still doesn't work.
I tried to add another debug to check if OnTriggerEnter() is happening just above the if branch : Debug.Log("Triggered"); and it gets triggered.
I can't just figure put what's wrong. Please help me.

A: First double check that your enemy game objects have the tag "Enemy". Next make sure that your player collider has the "Is Trigger" option selected in the Unity inspector.
Next try using
col.gameObject.CompareTag("Enemy")
instead of: col.tag == "Enemy" in your if statement.
Check out the Unity documentation as well on Colliders:
Unity Collider documentation
Unity Component.CompareTag method with example
Hope this helps!

A: The first advice I can give you, is ALWAYS, when writting a code Debug it, just make always sure that every step in your code is beeing executed. Inside every if just debug what it is supposed to check and if its true, inside your void, make sure its running the void, etc...
Next:
-Check if you have your object tagged as "Enemy", this can be on of the most common errors, and its so easy to solve, you may have written it wrong, or just not set it up.
-Here is the trigger documentationdocumentation.
-After this, make sure your gameobject is market as triggered.
-If you want you can use also colliders, and this also shows you how to check the tag.
Make sure you set all of this up, if this doesn't helped you, comment bellow, with prints, your gameobjects, codes, etc related to this.


text:
Q: Threads deadlocking G'day,
I was trying to do a simple multithreading experiment using ruby 1.9.3.
The code:
require 'thread'

ary = *0..10

res = 0
mutex = Mutex.new
#cv = ConditionVariable.new

ary.each do |x|
    p "Iteration no. #{x}"
    t = Thread.new do
        p "Thread taking care of #{x}"
        mutex.synchronize do
            #cv.wait(mutex)
            res += x
            t.stop
        end
    end
end

Thread.list.each do |t| t.join; end
puts res

The call
brode@curral:~/coding$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
brode@curral:~/coding$ ruby mt.rb
"Iteration no. 0"
"Iteration no. 1"
"Iteration no. 2"
"Iteration no. 3"
"Iteration no. 4"
"Thread taking care of 2"
"Thread taking care of 1"
"Thread taking care of 0"
"Thread taking care of 3"
"Iteration no. 5"
"Thread taking care of 4"
"Iteration no. 6"
"Thread taking care of 5"
"Iteration no. 7"
"Thread taking care of 6"
"Iteration no. 8"
"Thread taking care of 7"
"Iteration no. 9"
"Thread taking care of 8"
"Iteration no. 10"
"Thread taking care of 9"
"Thread taking care of 10"
mt.rb:21:in `join': deadlock detected (fatal)
    from mt.rb:21:in `block in <main>'
    from mt.rb:21:in `each'
    from mt.rb:21:in `<main>'

What am I doing wrong, here? I've tried plenty of stuff, calling Thread#join instead of Thread#stop, not calling any Thread method at all when I'm done, etc.
Thanks in advance!

Revised code:
require 'thread'

ary = *0..10

res = 0
mutex = Mutex.new

ary.each do |x|
    p "Iteration no. #{x}"
    t = Thread.new do
        p "Thread taking care of #{x}"
        mutex.synchronize do
            res += x
        end
        t.stop
    end
end

Thread.list.each &:join
puts res

A: Do not stop a thread while it is holding a mutex. The stop method puts the current thread into a sleeping state and schedules some other thread. Now, the first thread is holding the mutex so whichever other thread is scheduled next ends up waiting for the stopped thread to release the mutex which is never going to happen. Deadlock.

A: @FranciscoP.whatever you define in a loop remains local to the loop, you have called the thread in the loop it would not be available outside the loop, I think you should define a variable outside the loop and pass the thread into the variable, then the thread would be available for you when the loop is completed.
e.g:
threads = []

threads << Thread.new do
ary.each do |x|
    p "Iteration no. #{x}"
        mutex.synchronize do
            res += x
        end
end
threads.each { |t| t.join }

A: You can't use the variable t inside of the thread. Try using Thread.stop, indicating the current thread. As in:
require 'thread'

ary = *0..10

res = 0
mutex = Mutex.new

ary.each do |x|
    p "Iteration no. #{x}"
    t = Thread.new do
        p "Thread taking care of #{x}"
        mutex.synchronize do
            res += x
        end
        Thread.stop
    end
end

Thread.list.each &:join
puts res

Also I don't know if you will be able to join stopped threads. Why not reactivating then before the join?
Thread.list.each {|t| t.run; t.join }
puts res

A: You can't do Thread.list.join because this list include main thread.
If you do Thread.main.join it raises error because you are waiting yourself and that's nonsense.
You could do:
Thread.list.delete_if { |t| t == Thread.main }.map(&:join)


text:
Q: Role of Compactness in proving equivalence of norms for finite dimensional spaces I have some problems in understanding the following proof for equivalence of norms for finite dimensional space.

Theorem : let $v$ be a finite dimension space. If $||.||$ and $|||.|||$ are two norms on $v$, then there are $c_1$ and $c_2$ s.t. for all $x \in v$ , $c_1||x|| \leq|||x||| \leq  c_2||x||$.

for showing  $|||x||| \leq  c_2||x||$, it was simple. The norm of $|||.|||_{\infty}$ and $ ||.||_{2}$ are compared, but for showing  $c_1||x|| \leq|||x|||$ it was written:

$ S =\{x \in v :||x|| =1\} = \{(\alpha_1,...\alpha_n)^{T} \in R^{n}, ||\alpha_1e_1+...\alpha_n e_{n}|| =1 \}$
$ S\subseteq R^{n}$ ,and  S is closed and bounded => S is compact and since $0 \notin S => distanace (0, S) =d>0$ ==> $ \forall x \in v: \quad \frac{1}{d} |||x|||| \leq ||x|| \quad $

I cannot understand the last part of the proof:

$ S\subseteq R^{n}$ ,and  S is closed and bounded => S is compact and since $0 \notin S => distanace (0, S) =d>0$ ==> $ \forall x \in v: \quad \frac{1}{d} |||x|||| \leq ||x|| \quad $

Can anyone help please?
Thanks
P.S.
I have not took a course in real analysis. I read the very basic facts about compact and closed set.
-As an example, I understand how rational numbers are dense in real numbers set.
-I understand if a set contains its limit points, it is considered as a closed set.


text:
Q: Powershell GUI Imported text file missing newline/carriage return I have a powershell GUI which imports a text file and displays it in a textbox when a button is clicked
But even though the text file contains one entry per line when it gets displayed in the textbox it is all on one line...
The text file looks like this-

But when I import it it looks like this-

This is the code I am using-
$button_hosts = New-Object system.windows.Forms.Button
$button_hosts.Text = "Hosts"
$button_hosts.Width = 60
$button_hosts.Height = 25
$button_hosts.location = new-object system.drawing.point(20,55)
$button_hosts.Font = "Microsoft Sans Serif,10"
$mydocs = [Environment]::GetFolderPath('MyDocuments')
$button_hosts.Add_Click({
    $textBox_hosts.Text = Get-Filename "$mydocs" txt
    $textBox_hostlist.Text = Get-Content $textBox_hosts.Text
})
$GUI.controls.Add($button_hosts)

Any idea how to get it to display the same? I cant add any extra data to the txt file as it is an output from another program

A: Set the lines property, not the text property.
$textBox_hostlist.Lines = Get-Content $textBox_hosts.Text

A: Get-Content reads the content one line at a time and returns a collection of objects, each of which represents a line of content.
The means that you have to join the collection with carriage returns and linefeeds:
(Get-Content $textBox_hosts) -Join "`r`n"

A: For your WinForms TextBox, do you have the multiline property set to true?
https://msdn.microsoft.com/en-us/library/12w624ff(v=vs.110).aspx
If not, it defaults to single line.