text:
Q: Gradle Kotlin FileCollection JavaExec classpath I'm attempting to create a gradle kotlin based SoapUI launcher of sorts sans plugins using native gradle functionality for incorporating SoapUI tests into our ci/cd pipeline.  So far I have the following:
val soapui: Configuration by configurations.creating

dependencies {
    // Old version is intentional
    soapui("com.smartbear.soapui:soapui:5.4.0")
}

var clazzpath: List<Any> = mutableListOf()
var files: FileCollection = project.files()

task("soapui", JavaExec::class) {
    doFirst {
        // Validating iteration causes resolution
        soapui.forEach { clazzpath += it }

        // Validating contents of List
        //clazzpath.forEach { println(it) }

        // Creating a FileCollection from my List
        files = project.files(clazzpath)

        // Validating contents of my FileCollection
        //files.forEach { println(it) }
    }

    // My first thought which does not work
    //classpath = soapui

    // My second thought which also does not work
    //classpath = project.files(clazzpath)

    // My third thought which also does not work
    classpath = files

    systemProperties = mapOf(
        "soapui.properties.MyProject" to "src/test/integration/environments/my.properties")
    main = "com.eviware.soapui.SoapUI"

    // Will be invoked for automated test runs
    //main = "com.eviware.soapui.tools.SoapUITestCaseRunner"

    args = listOf("src/test/integration/my_project.xml")
}

I've found that iterating over a configuration causes gradle to resolve the configuration allowing for all the transitive dependencies to be discovered.  The commented println statements validate that.
When using classpath = soapui, the SoapUI main jar file is put on the classpath, the main class is found, and the SoapUI GUI starts up fine.  However, none of it's transient dependencies end up on the classpath and test cases fail when their assertions are performed.
When I try constructing the classpath explicitly, nothing ends up on the classpath and the SoapUI GUI fails to load because the main class is not found.
> Task :soapui FAILED
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
Error: Could not find or load main class com.eviware.soapui.SoapUI
Caused by: java.lang.ClassNotFoundException: com.eviware.soapui.SoapUI

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':soapui'.
> Process 'command 'C:\<path to JDK\bin\java.exe'' finished with non-zero exit value 1

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

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed
<list of transitive dependencies on one line with no path separation characters (;)>

That last line of output may be what was used as the classpath, which consists of a list of all the transitive dependencies printed one after another without any path separation characters (semicolons).
Based off of my investigation and reading of the documentation, I'm clearly misunderstanding how this is supposed to work.  What am I missing?

A: Time for me to publicly eat some crow.  Turns out, the error I'm investigating has nothing to do with gradle or my understanding of it.  Firstly, in the question I mention that the last line of output is a list of all the SoapUI 5.4.0 dependencies on one line without any path separators.  It turns out that was being caused by my lack of experience with gradle.  In the gradle build file I was working with, I had the following task defined as part of my investigation of gradle.
task("soapuiDependencies") {
    soapui.forEach { print(it.toString()) }
}

Since the code is not inside a doFirst {} or doLast{} block, it is executed when the task is realized, and does not need to be called explicitly for the output to be sent to the console.  Lesson learned.  What I should have had was
task("soapuiDependencies") {
    doLast {
        soapui.forEach { print(it.toString()) }
    }
}

Or some such.  Second lesson has to do with dependency versions.  Soapui 5.4.0 is packaged with json-path-0.9.1.jar (yikes, that's old) which contains the file
com/jayway/jsonpath/spi/JsonProvider.class

while gradle is pulling in as a dependency json-path-2.7.0.jar which contains the file
com/jayway/jsonpath/spi/json/JsonProvider.class.

Causing a ClassNotFoundException on the JsonProvider class when invoked via gradle.
This is the root of my problem and has nothing to do with my understanding of how gradle FileCollections, JavaExec, or classpath parameters work.  I know I'm treading with dinosaurs, but hopefully the lessons learned will be of help to someone else.


text:
Q: systemd seems to ignore _netdev option for NFS in Ubuntu 16.04 I have the following mount for NFS in /etc/fstab:
192.168.1.6:/var/share /media/share nfs hard,intr,retrans=10,timeo=10000000,_netdev 0 0

On reboot my system hangs; turns out it's the mount as proved by systemd-analyze blame.
The status:
● media-share.mount - /media/share
   Loaded: loaded (/etc/fstab; bad; vendor preset: enabled)
   Active: failed (Result: timeout) since Tue 2016-04-26 21:13:43 EDT; 6min ago
    Where: /media/share
     What: 192.168.1.6:/var/share
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 1071 ExecMount=/bin/mount 192.168.1.6:/var/share /media/share -t nfs -o hard,intr,retrans=10,timeo=10000000,_netdev (code=kille

Apr 26 21:12:12 j-Lemur systemd[1]: Mounting /media/share...
Apr 26 21:13:42 j-Lemur systemd[1]: media-share.mount: Mounting timed out. Stopping.
Apr 26 21:13:42 j-Lemur systemd[1]: Mounted /media/share.
Apr 26 21:13:43 j-Lemur systemd[1]: media-share.mount: Unit entered failed state.

This appears to be a bug?
After logging in and running systemctl restart media-share.mount it is fixed (because the network is available now).

A: I had the same problem.
There's some info on the Ubuntu Community Help Wiki here suggesting it is intentional behaviour by Ubuntu 16:

Under NFSv3 (type nfs) the _netdev option will tell the system to wait to mount until the network is available. With a type of nfs4 this option is ignored, but can be used with mount -O _netdev in scripts later. Currently Ubuntu Server does not come with the scripts needed to auto-mount nfs4 entries in /etc/fstab after the network is up.

My solution was to the add "vers=3" before "_netdev", forcing the connection to use NFS v3. Obviously this might not help in your case, if you are relying on NFS v4.
Other options could include AutoFS or shell scripting.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Migrating a Virtualbox virtual machine into a physical dual-boot system I'm running a Linux Mint 12 virtual machine in Virtualbox. I would like to move it into a dual-boot setup with my Windows 7 installation. I have lot of settings in there, and apps installed, and my research says that I cannot just copy files.
I guess I could accomplish this by having some kind of list that I could then import for apt-get to install, and then have a back-up of my ~/ files... Am I on the right track, or totally lost?

A: I have personally never successfully performed a Virtual to Physical (V2P) conversion. However, there are some guidelines and several third party tools that can help with this process.
I suggest beginning with the guidelines provided by VMware.
This answer on SE SuperUser discusses a method specific to VirtualBox and the possibilities for success and failure.
My guess is this will be a worthwhile exercise. However, the part that concerns me is making your current physical system 'dual-boot'. If you have not already partitioned your hard drive to be dual-boot, things could get very ugly, very quickly. My suggestion would be to use the Linux Mint installer to create a dual-boot boot loader and partition, and then try to image your virtual disk onto the newly created area.

A: I think you're on the right track.  If I was in your position, this is how I'd tackle it:
Do a new install of Linux Mint 13, now that it's out.  Hopefully it can manage repartitioning your disk and shrinking your existing NTFS partition non-destructively, but usually it's much safer and easier to simply install to a clean disk.
Learn to use aptitude, should let you reinstall all your apps pretty quick.  If it wasn't installed via apt-get, then it's probably sitting in /usr/local/ or /opt/
Install virtualbox on LM13 so you can run your old LM12 install.  Then just use rsync to migrate your files and directories over.  If you haven't installed many services, there probably isn't that much you need to do beyond bringing over your home directory.
Sure, this seems like it could be a bit messy, but I've pretty much carried my same /home directory for 10 years through at least 3 distros of Linux.  Data migration is actually pretty easy, there aren't any user settings buried in some registry or somewhere else on the filesystem.  It can be a bit more work migrating services, but even then the files to migrate would be limited to the /etc and /var directories.

A: Use dd and Get the partitons on a external hdd or pendrive. Use a live gparted cd to resize your windows. Create relevant partitions and restore them. Edit relevant files fstab etc. Reinstall grub. You shld be done :)


text:
Q: XPath for nodes which only have certain attributes? For example, I only want the script nodes which only have type attribute, i.e. the first one.
<script type="text/javascript">
<script type="text/javascript" language="JavaScript">

A: This XPath,
//script[@type and not(@*[name() != "type"])]

will select all script elements that have a @type attribute and no other attributes.

This XPath,
//script[not(@*[name() != "type"])]

will select all script elements that have no attributes not named type.  It's like the first XPath except doesn't require that @type be present – it'll also select <script/>.


text:
Q: C# for win32 or c++ I know C++ windows programming is harder than C#. Because we should Create WNDCLASS and Initalize it  and using API Funcs and...
But My Question is here , for windows programming ,Is C# better than C++ ?
If yes , why large programs are created with C++ .

A: Its not "large programs" when C++ is favored over C# managed code.
There are limits to what can be done with managed code, for instance you cannot write hardware drivers or other programs that interface with hardware. You cannot even access all of the Win32 API from purely managed code. Some programs have high performance requirements and are therefore more suited to C++. Sometimes C++ is used simply because the company developing the software has skilled C++ developers. Sometimes C++ is used because the developers don't want the software to be dependent on the .NET framework (which isn't installed out of the box on XP and earlier Windows versions). Sometimes C++ is chosen so that a cross platform application can be developed.
In broad terms, C# is easier to learn and is a more powerful and productive language & framework than C++/MFC/COM etc. But C++ is a very broad tool, and can produce solutions to many very diverse problems, from writing operating systems, real time systems, embedded applications, databases, business software, desktop software, server software, libraries/frameworks, etc, etc.
C# is better suited to a particular class of problem. It is pretty much limited to running on Windows (with the exception of Silverlight & Mono). C# suits rapid application development, which means it is better suited to one-off custom software, such as many internal applications developed within large organizations. And as I've indicated, its more suited to developing desktop and server application software over drivers and other low level software.
If you're looking at which language to start learning, a smart choice would be: C then C++ then C#. This will give you the foundation you need to become a really good object oriented programmer, with an understanding of how lucky we are to have C#! If you don't have 10 years to spare, then go ahead and start with C#. Whatever you do, don't start with C++ or you are likely to give up your programming career in despair and join the circus where things make more sense.

A: If I could start from scratch all the c++ projects I have done in the past, 99% of the code would be in .NET. Especially when it comes to UI. WPF, Winforms are much more powerful than MFC.
What type of program will you develop? Please elaborate and then we can make a recomendation.
** EDIT
A good example is Visual Studio itself. VS 2010 is based on WPF now.

A: Better? Better how? Easier? Faster?
C++ is a monster to learn, huge and complex as it is. C# is considerably "friendlier" and easier to work with. C# often lets you complete tasks faster and easier than C++, because the language and it's framework does a lot of work for you. This is part of what makes C# better than C++, and what makes C++ better than C#.
If you let C# do the work for you, that means that you as a programmer sacrifice some control. This is what sets a high-level language apart from a low-level one. For demanding applications, programmers tend to pick a language that provides the necessary amount of abstraction while still providing the desired control. This is why many demanding applications (such as video games) are written in C++. It has a fairly large array of high-level features, while still packing the horsepower to pull really low-level code for situations where you need absolute control of the hardware. It is also why many business applications and other less demanding applications are written in a high level language such as C#, since these applications have no use for low-level features, and can safely enjoy the gains of high-level ones without worrying about performance penalties.
In C#'s case, all applications created with it run in the .NET runtime environment. This is a disadvantage for programs that need to run fast, since you want to be as close to the hardware as possible. So again, C++ wins for demanding applications where either execution speed or memory usage is crucial. Also C++ can be used on a very large amount of platforms, anything from PCs to coffee machines (okay, cell phones, then), while C# is officially limited to platforms running Microsoft Windows.
As for ease of development on Windows, C# is a clear winner. There are available frameworks for C++ too, but they are not even close to C# when it comes to getting things done fast and easy. That said, it is perfectly possible to write complex GUI applications for Windows in C++ without swearing too much.
Anyway, I hope you see how little sense it makes to compare languages like this. It's much like comparing a hammer to a screwdriver. Choosing a language is about choosing the right tool for the job. Many tools overlap - you can accomplish pretty much the same in C++ and C#, which complicates the choice. If you really want to read into this (going for an "educated choice"), I suggest you read up on the individual languages. If you just wonder which language to learn, I suggest you start with C#, and learn C++ if you ever need to (or want to).

A: C++ and C# both are really good languages, having said that both have their own specialities.
C++ is ideal for applications which needs to highly optimized memory and cpu usage like verly low level device driver development
C# is far superior for creating business applications like accounting and database driven applications which would take ages if you try building them in C++
In short
C++ is for applications which require highly optimized memory and CPU usage.
C# is far productivity and enterprise applications


text:
Q: Python Unit Test Start Directory Not Importable I have encountered this error and tried a number of fixes posted on this site but have had no luck. I wrote a unit test and cannot call it due to the Start Directory Not Importable error. My file structure is:
Root
    └── tests
        └── fixtures
            └── customFile.json
        ├── __init__.py
        └── functionTest.py
    └── Lambdas
        └── FunctionA
            ├── __init__.py
            └── FunctionToTest.py

and my unit test looks like this:
import unittest
import json
import boto3

from Lambdas.FunctionA import FunctionToTest

s3 = boto3.client('s3', 'us-east-1')
file = s3.get_object(Bucket="BUCKET", Key="KEY")

mapper = s3.get_object(Key="KEY", Bucket="BUCKET")
mapperJSON = json.loads(mapper['Body'].read().decode('utf-8'))

path = r"./tests/fixtures/customFile.json"
with open(path) as file:
    endList = json.load(file)
    file.close()

class TestMatchModeler(unittest.TestCase):
    def test_run(self):
        test = FunctionToTest(file, mapperJSON)
        self.assertEqual(len(test), len(endList))

if __name__ == '__main__':
    unittest.main()

and the actual code it's testing is:
def FunctionToTest(file, mapperjson):
    Fields = mapperjson['mappings']

    lines1 = file['Body'].read().decode('utf-8').split('\n')
    fieldnames = lines1[0].replace('"','').split(',')
    testls = [row for row in csv.DictReader(lines1[1:], fieldnames)]
    out = json.dumps(testls)
    jlist1 = json.loads(out)

    dicts = []
    Fieldsinv = {v: k for k, v in Fields.items()}
    for i in jlist1:
        d = {}
        for k, v in i.items():
            if k in Fieldsinv:
                d[Fieldsinv[k]] = v
        d['individual_id'] = str(uuid.uuid4())
        dicts.append(d)
    return dicts

Essentially the customFile.json is a list of dictionaries that I know are correct, and I want to test that my code modifies a CSV correctly to have the same number of dicts. This question has been asked a lot and the answer is always to have the files linked via an init.py file but as you can see I've done that and it still doesn't work.
I'm sure this may get flagged as a duplicate but im not sure what else to try.

A: It looks like you are missing the __init__.py files in some directories: root, tests and lambdas.
See here: python - unittest - ImportError: Start directory is not importable

A: turns out running this command
python -m tests.functionTest

did the trick


text:
Q: The mechanism behind Unity3D visual programming third party tools First sorry for posting this here.I just got no answer to this question on "Unity Answers"I have been looking into the tools like uScript or Strumpy Shader Editors which are node based visual programming tools like Unreal Kismet or 3DsMax particle flow system. I have been researching on how in fact these tools generate the source code in Unity.So I assume that during the node logic assembly the code should be generated and compiled to DLLs (in Unity all the source code is compiled into DLLs)dynamically.I started looking into such C# assemblies like Reflections , Microsoft.CSharp and System.CodeDom.Compiler; I even tried to write a C# class in Unity via the editor as a text and then parse and compile it into DLL using the above mentioned tools(it was ok but the DLL was existing only during the Runtime in the temp..) Therefore I would like to know is this the approach those tools are likely to use? Or there is a better and cleaner way to do it ?Thanks .

A: I'm actually in the process of doing the same thing.. I think you are on the right path with the Compiler classes. I dont think you can emit IL on the fly on mobile devices as a security sandbox issue but I'm dynamically creating c# code and compiling it into persistent dll's like this..
CompilerParameters compilerParameter = new CompilerParameters();
compilerParameter.OutputAssembly = "/Your/Path/Here.dll";
CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider("CSharp");

StringBuilder code = new StringBuilder();
code.AppendLine("public static class Test {");
//More code here...
code.AppendLine("}");
var compilerResult = codeDomProvider.CompileAssemblyFromSource(compilerParameter, code.ToString());

Hope this helps..


text:
Q: On windows, the CORS preflight OPTIONS request is sent and returned, but then the PUT request will hang 'pending' indefinitely I have been developing node.js web and desktop applications that communicate with each other via Express.js.
The web app will send CORS PUT requests to the desktop client, and then the desktop client will perform some set of functionality.
On Mac, the CORS preflight OPTIONS request will be sent and returned, and then the PUT request will be properly sent and returned. On windows however, the CORS preflight OPTIONS request is sent and returned, but then the PUT request will hang 'pending' indefinitely. There is no indication that the request has been received by the desktop client, not that it has simply failed to send a response. This will occur using IE10+, Chrome, or Firefox.

A: Does the PC happen to have Sophos installed on it? Sophos has this awesome feature where it makes your life a living hell.
I only have a screenshot of the preference on Mac, but I assume you can find a similar preference pane.


text:
Q: Why does OSGI bundle with ActorSystemActivator fail with Logger timeout upon start? I wrote an OSGI "Hello World" app in Scala using the akka-osgi_2.10-2.3.4 library and all the needed dependencies. Actually here are all the dependencies maven reports:
+- com.typesafe.akka:akka-actor_2.10:jar:2.3.4:compile
|  \- com.typesafe:config:jar:1.2.1:compile
+- com.typesafe.akka:akka-slf4j_2.10:jar:2.3.4:compile
|  \- org.slf4j:slf4j-api:jar:1.7.5:compile
+- org.apache.felix:org.osgi.core:jar:1.4.0:compile
+- com.typesafe.akka:akka-osgi_2.10:jar:2.3.4:compile
|  +- org.osgi:org.osgi.core:jar:4.3.1:compile
|  \- org.osgi:org.osgi.compendium:jar:4.3.1:compile
+- org.scala-lang:scala-library:jar:2.10.4:compile

The app uses the simplest possible Activator class that takes advantage of the default start and stop methods offered by ActorSystemActivator. The Activator class code looks as follows:
import akka.actor.ActorSystem
import org.osgi.framework.BundleContext
import akka.osgi.ActorSystemActivator

class Activator extends ActorSystemActivator {

  def configure(bundleContext: BundleContext, system: ActorSystem): Unit = {
  }
}

I use IBM JDK 1.7 and in the eclipse juno-64 (on ubuntu 12.04) environment I set bootdelegation in config.ini as described in the official documentation:
org.osgi.framework.bootdelegation=sun.misc

I started Eclipse with the -console argument and I deployed the bundled app in the OSGi framework. This is what I'm getting when I run ss in the OSGi console:
426     <<LAZY>>    test-osgi_0.0.1.SNAPSHOT

The issue I have is with starting the bundle. When I try to start it:
osgi> start 426

I get an Akka timeout exception:
[WARN] [01/06/2015 15:04:02.530] [Gogo shell] [EventStream(akka://bundle-426-ActorSystem)] Logger log1-Logging$DefaultLogger did not respond within Timeout(25000 milliseconds) to InitializeLogger(bus)
error while starting up loggers
akka.ConfigurationException: Logger specified in config can't be loaded [akka.event.Logging$DefaultLogger] due to [akka.event.Logging$LoggerInitializationException: Logger log1-Logging$DefaultLogger did not respond with LoggerInitialized, sent instead [TIMEOUT]]
    at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$1.applyOrElse(Logging.scala:114)
    at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$1.applyOrElse(Logging.scala:113)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33)
...

I checked online and I found issues similar to mine but none of the suggested solutions worked for me. I tried modifying the default logger response timeout to different values, I changed the DefaultLogger with other versions (DefaultOSGiLogger), I added the org.osgi.framework.system.packages.extra=sun.misc configuration, but nothing helped.
I also tried the akka-sample-osgi-dining-hakkers example but I ran in an OSGi nightmare...
What am I missing?

A: The information from the link attached by sschaef (thank you) helped solve the issue. It's a workaround that makes possible start the Akka system without hacking the dependency libraries. As mentioned in that thread, apparently is a class loader issue, and the solution (that I followed) uses a listener to activate the system.
I still have extended ActorSystemActivator (although this can be avoided as pointed out by sschaef) and I reused the code from the extended class in the overridden start and stop methods. Here is the code that worked for me:
class Activator extends ActorSystemActivator {

  private var system: Option[ActorSystem] = None
  @volatile var bundleListener: org.osgi.framework.BundleListener = null

  def configure(bundleContext: BundleContext, system: ActorSystem): Unit = {}
  override def getActorSystemName(context: BundleContext): String = "my-actor-system"

  override def start(context: BundleContext) = {
    bundleListener = new org.osgi.framework.BundleListener() {
      override def bundleChanged(event: org.osgi.framework.BundleEvent) {
        if (event.getBundle == context.getBundle) {
          if (event.getType == org.osgi.framework.BundleEvent.STARTED) {
            system = Some(OsgiActorSystemFactory(context, getActorSystemConfiguration(context)).createActorSystem(Option(getActorSystemName(context))))
            system foreach (addLogServiceListener(context, _))
            system foreach (configure(context, _))
          }
        }
      }
    }
    context.addBundleListener(bundleListener)
  }

  override def stop(context: BundleContext) = {
    if (bundleListener != null)
      context.removeBundleListener(bundleListener)
    system foreach (_.shutdown())
  }
}


text:
Q: jquery dynamic ID assignment won't work I have a form that its values should appear in a template before submitting
I have tried everything in a small file for testing, works fine.
but in the project, it won't.
The code below shows that the first line won't work
the second line works fine
$(".contractform").on("blur", "input", function() {

  $("input").map(function() {

    // this line does not work
    $('#main_doc div #' + this.id).html(this.val());

    // this line works fine
    $("#main_doc div  #ref_no").html("10a");
  });
});

the error that i have in console is that

Error: Syntax error, unrecognized expression: #main_doc div #
  jquery-3.0.0.min.js:2:13136

I have checked several questions around here about assigning dynamic ID but it won't work in my situation, works only in a test experimental files.


text:
Q: Would it be possible to utilize the higgs boson field in order to generate more inertia? Since the Higgs boson provides mass would it be possible at all to use the field in a way that generates more inertia? For example, could we utilize it in a way to make a vehicle or something smaller move with more inertia than it would previously be able to?

A:
Since the Higgs boson provides mass would it be possible at all to use the field in a way that generates more inertia?

No.

For example, could we utilize it in a way to make a vehicle or something smaller move with more inertia than it would previously be able to?

No.


text:
Q: Proving an inequality using Cauchy-Schwarz
I am supposed to use the Cauchy Schwarz inequality to solve this problem but I am stuck. I can't see how the square root of $N$ comes out. Could anyone please help me?

A: If $x_1,\ldots,x_N$ are a basis of orthonormal vectors and $\psi$ has a unit norm, $\psi$ can be decomposed as
$$ \psi = \sum_{k=1}^{N}\alpha_k x_k,\qquad\sum_{k=1}^{n}\alpha_k^2=1 $$
and
$$\begin{eqnarray*} \sum_{k=1}^{N}\|\psi-x_k\|^2 &=& \sum_{k=1}^{N}\left[(\alpha_k-1)^2+\sum_{j\neq k}\alpha_j^2\right]\\&=&\sum_{k=1}^{N}\left[2-2\alpha_k \right]=2N-2\sum_{k=1}^{N}\alpha_k\end{eqnarray*}$$
where by the Cauchy-Schwarz inequality
$$\left|\sum_{k=1}^{N}\alpha_k\right|^2\leq \sum_{k=1}^{N}1\sum_{k=1}^{N}\alpha_k^2 = N, $$
hence:
$$ \sum_{k=1}^{N}\|\psi-x_k\|^2 \geq 2N-2\sqrt{N} $$
as wanted.

A: Observe that
$$\|\psi-x\|^{2}=\left<\psi-x,\psi-x\right>=\|\psi\|^{2}+\|x\|^2-\left<\psi,x\right>-\left<x,\psi\right>=2-2{\rm Re}\left<\psi,x\right>$$
and thus
$$\sum_{x}\|\psi-x\|^{2}=2N-2{\rm Re}\left<\psi,\sum_{x}x\right>$$
But
$${\rm Re}\left<\psi,\sum_{x}x\right>\leq\left|\left<\psi,\sum_{x}x\right>\right|\leq\|\psi\|\left\|\sum_{x}x\right\|=1\cdot\sqrt{N}$$
where the last equality follows from the fact that the $x$'s are orthogonal. This finishes the proof yielding
$$\sum_{x}\|\psi-x\|^{2}\geq 2N-2\sqrt{N}$$


text:
Q: What's the difference between a project and a workspace in sublime? I think both are doing the same! When should I use aworkspace and when a project, and what are the differences?

A: Projects in Sublime are contained in sublime-project files, and allow you to:

*

*Control what folders are present in the project

*Per folder control of what files and folders from within are rejected from the project or included in the project

*Can contain settings that apply only to files open in that window

*Can contain build systems that apply only from within that window

*Persist the window layouts, open files, undo buffers, selected items in panels, and so on in an associated sublime-workspace file (or files; you can have more than one sublime-workspace associated with a particular project.

Workspaces in Sublime are are stored in sublime-workspace files, and:

*

*Contain anonymous project data as in a sublime-project file, except that your only access is to the list of folders open; the ability to control the contents of them or to use project specific settings and build systems is not present. This information is considered Anonymous because it's not persisted to disk, and is not editable (except in adding or removing folders using menu items)

*Persist the window layouts, Open files, undo buffers, selected items in panels, and so on.

A sublime-project always has one or more sublime-workspace files associated with it, whereas it is possible to have a sublime-workspace file that is not associated with a project if you desire.
Generally speaking, if you're working with source control (e.g. git), then you would include a sublime-project file in the repository but not a sublime-workspace file. This is because anything you do will modify the workspace file as well, making life painful when it comes to checking things in.
So, overall, the tradeoff between using Projects or just Workspaces revolves around what you're doing. If you're just opening folders and want to persist that window, but you don't have any need for the more advanced abilities that Projects provide, there's no reason to use them.


text:
Q: R grepl not giving desired result loading CSV I dont know what I could be overlooking here but I am importing a csv file with a bunch of names into a data.frame. When I pull the data frame value and run grepl against it there is no match. If I take that same value and manually create a string it matches fine. Any help would be appreciated.
I obviously cant give you the CSV or the data source so I have tried to include all the code below.
After further look, it seems the string no longer has a space
> Parks[1,2]
[1] "Abraham Lincoln Birthplace National Historical Park"
> typeof(Parks[1,2])
[1] "character"
> grepl(" ", Parks[1,2], fixed = TRUE)
[1] FALSE
> grepl("National Historical Park", Parks[1,2])
[1] FALSE
> grepl("National", Parks[1,2], fixed = TRUE)
[1] TRUE
> grepl("National Historical Park", "Abraham Lincoln Birthplace National Historical Park")
[1] TRUE

> grepl(" ", "Abraham Lincoln Birthplace National Historical Park")
[1] TRUE

A: The blank spaces were unicode \u2022 characters. Running the following code before grepl results in the desired result.
> Code <- Parks[1,2]
> Code <- gsub('[^\x20-\x7E]', ' ', Code)
> grepl(" ", Parks[1,2], fixed = TRUE)
[1] TRUE
> grepl("National Historical Park", Parks[1,2])
[1] TRUE


text:
Q: Why does batch norm have learnable scale and shift? As far as I understand it, batch norm normalises all the input features to a layer to a unit normal distribution, $\mathcal{N}(\mu=0,\sigma=1)$. The mean and variance $\mu, \sigma^2$ are estimated by measuring their values for the current mini-batch.
After the normalisation the inputs are scaled and shifted by scalar values:
$$\hat{x}_i' = \gamma \hat{x}_i + \beta$$
(Correct me if I'm wrong here - this is where I start to get a bit unsure.)
$\gamma$ and $\beta$ are scalar values and there is a pair of each for every batch-normed layer. They are learnt along with the weights using backprop and SGD.
My question is, aren't these parameters redundant because the inputs can be scaled and shifted in any way by the weights in the layer itself. In other words, if
$$y = W \hat{x}' + b$$
and
$$\hat{x}' = \gamma \hat{x} + \beta$$
then
$$y = W' \hat{x} + b'$$
where $W' = W\gamma$ and $b'=W\beta + b$.
So what is the point of adding them of the network is already capable of learning the scale and shift? Or am I totally misunderstanding things?

A: There is a perfect answer in the Deep Learning Book, Section 8.7.1:

Normalizing the mean and standard deviation of a unit can reduce the expressive power of the neural network containing that unit. To maintain the expressive power of the network, it is common to replace the batch of hidden unit activations H with γH+β rather than simply the normalized H. The variables γ and β are learned parameters that allow the new variable to have any mean and standard deviation. At first glance, this may seem useless — why did we set the mean to 0, and then introduce a parameter that allows it to be set back to any arbitrary value β?
The answer is that the new parametrization can represent the same family of functions of the input as the old parametrization, but the new parametrization has different learning dynamics. In the old parametrization, the mean of H was determined by a complicated interaction between the parameters in the layers below H. In the new parametrization, the mean of γH+β is determined solely by β. The new parametrization is much easier to learn with gradient descent.


text:
Q: Finding E(XY) for joint probability density $Joint \:probability\;f(x,y) =  2/3 \:for\: 0  < x < 1, 0 < y < 2, x < y, and\: 0\: otherwise $
$E(XY)=\int_{0}^{1}\int_{x}^{2} \frac{2}{3}xy \:dy \:dx = \frac{7}{12} - (1)$
$E(XY)=\int_{0}^{2}\int_{0}^{y} \frac{2}{3}xy \:dx \:dy = \frac{4}{3} - (2)$
Hello, I am quite new on multivariable calculus so I am a little unsure why the answers for eqn (1) and (2) are different.
From what I recalled from class, there is no difference if we integrate w.r.t x or y first. So I suspect that the limits of my integration for eqn (2) is wrong.
So I am wondering if there is an easy way to correctly remember what are the limits of integration for these types of questions and how would I find E(XY) if I were to integrate w.r.t x first?
Edit: Missed out the $xy$ in the integrals

A: The second integral should be written as two summands:
$$E[XY]=\int_0^1\int_0^y \frac{2}{3}xy dxdy+\int_1^2\int_0^1 \frac{2}{3}xy dxdy$$
You can see this by drawing the support region of $f(x,y)$. It's bounded by $x=y$, $x=0$, $x=1$ and $y=2$ lines. When $y<1$, $x$ starts from $0$ and ends at $y$. When $y>1$, $x$ should end at $1$ (instead of $y$) because $y$ is greater than 1.


text:
Q: JavaScript: I need checkbox input to be checked while clicked on the  Tag I want to make the checkbox inout be checked as per the below snapshot code so when I click of any of the Todo Item (Buy Lunch,....etc.) the checkbox input be checked and after writing below code it is only applied on the first element only whatever I clicked any paragraph (Todo item).
// Clicking Todo Item to fire checked Input

let paragraphs =document.querySelectorAll('p');
let checkBoxInput = document.getElementById('checkedInput');

  for(var i=0; i < paragraphs.length; i++){
    paragraphs[i].addEventListener('click', function () {
          this.style.color = "#2a6850";
          checkBoxInput.checked = true;
      }, false);
  }

So how to click each todo list item not to click on checkbox itself and it being fired and make this like image not
EJS File:

    <input type="checkbox" name="" id="checkedInput">

        <%= newItem %>

CSS

input:checked + p {
    text-decoration: line-through;
    text-decoration-color: #2da883;
}

A: You could use label instead of p, so that browser does the work for you.
Your EJS file would look like that:

    <input type="checkbox" name="checkedInput" id="checkedInput">

        <%= newItem %>

But you have to make sure that after your app is rendered each checkbox has a unique id.

A: I had Solved it Used the below code I had created ... Thanks all :)
let paragraphs =document.querySelectorAll('p');
let checkBoxInput = document.querySelectorAll('input[type=checkbox]');

          for(var i=0; i < paragraphs.length; i++){
            paragraphs[i].addEventListener('click', function () {

                this.style.color = "rgb(228 233 253)";
                this.style.borderRadius = "10%";
                this.style.backgroundColor = "#0c0b07";
                this.previousElementSibling.checked = true;

              }, false);
             }


text:
Q: Writing cypher query for traversing the path I am new to Neo4j.
I am using this query to get the below layout in traversing the path in first image:

Code:
MATCH p = (r:Reports)<--(s:Schedules)<--(m:MDRMs)<--(br:Business_Requirements)-->(rp: Report_Logic)-->(ra: Reporting_layer_attributes)
where r.Report_Name ='FFIEC 031' and s.Schedule = 'RC-B - Securities' RETURN p

Blue coloured nodes are referred as Business_Requirements which have additional linked Silver coloured (Business_Attributes) nodes with relationship as MAPPED_TO.
How can I bring out the below layout through cypher query. Since the silver color nodes are not in the path, I was not able to pull the below required layout in the second image:

A: You can extend the MATCH by adding a second path p2, and including it in the RETURN
MATCH p = (r:Reports)<--(s:Schedules)<--(m:MDRMs)<--(br:Business_Requirements)-->(rp: Report_Logic)-->(ra: Reporting_layer_attributes),
      p2 = (br)<-[:MAPPED_TO]-(ba:Business_Attributes)

where r.Report_Name ='FFIEC 031' and s.Schedule = 'RC-B - Securities'
RETURN p,p2

in case the MAPPED_TO rel is not always there, you can also use the OPTIONAL MATCH
MATCH p = (r:Reports)<--(s:Schedules)<--(m:MDRMs)<--(br:Business_Requirements)-->(rp: Report_Logic)-->(ra: Reporting_layer_attributes)
where r.Report_Name ='FFIEC 031' and s.Schedule = 'RC-B - Securities'
OPTIONAL MATCH p2 = (br)<-[MAPPED_TO]-(ba:Business_Attributes)

RETURN p,p2


text:
Q: Jquery scroll not working on IE I found a demo about parallax scroll. But this one just work on Chrome or Firefox. On Internet Explorer, it seems not work.
    [Demo][1]
Please help me, thanks and sorry about my english!
[1]: http://codepen.io/hudsonmarinho/pen/FHGeK


text:
Q: jQuery-steps: disable submit on click I want to disable the Finish button in a jQuery-steps form once it has been clicked. Currently, users are able to repeatedly submit the form by clicking the Finish button multiple times.
There are a couple suggestions on how to approach this that did not solve the problem for me. I could see the first one in action - the color of the button changed as per the code - but it didn't stop me from being able to repeatedly submit my form.
My JavaScript is below (I'm not sure HTML would be informative here but could include it as well); does anyone have suggestions for how to approach this? Is onFinishing not the appropriate place to be disabling the button?
  $("#form").steps({
            stepsOrientation: "vertical",
            bodyTag: "fieldset",
            onStepChanging: function (event, currentIndex, newIndex) {
               omitted for brevity
            },
            onStepChanged: function (event, currentIndex, priorIndex) {
                omitted for brevity}
            },
            onFinishing: function (event, currentIndex) {
                var form = $(this);

                //Applying colour for finish button
                var result = $('ul[aria-label=Pagination]').children().find('a');
                $(result).each(function () {
                    if ($(this).text() == 'Finish') {
                        $(this).attr('disabled', true);
                        $(this).css('background', 'green');
                    }
                });

                form.validate().settings.ignore = ":disabled, :hidden";

                // Start validation; Prevent form submission if false
                return form.valid();
            },
            onFinished: function (event, currentIndex) {
                var form = $(this);
                event.preventDefault();
                getResult();
                enableFinishButton: false;
                // Submit form input
                //form.submit();
            }
        }).validate({
            errorPlacement: function (error, element) {
                $('#step1Errors').append(error);
            },
            rules: {omitted for brevity},
            messages: {omitted for brevity}
        });

A: You can always use submit handler to disable the button click and then the success function to enable it again after the form has been submitted/passed validation.
submitHandler: function() {
    $(".yourButton").prop('disabled', true);
},
success: function(response){
        //success process here
       $(".yourButton").prop('disabled', false);
}

Update
Based on your fiddle, you can alternately hide the button when the user makes it to the final button and clicks it, then when the current index is not 7, simply show everything again.
In the fiddle you provided change your JS code to this and you will see what I am talking about.
$("#example-vertical").steps({
    headerTag: "h3",
    bodyTag: "section",
    transitionEffect: "slideLeft",
    onStepChanged: function (event, currentIndex, priorIndex) {
        if(currentIndex != 7){
            var result = $('ul[aria-label=Pagination]').children().find('a');
            $(result).each(function () {
                $(this).css('display', 'block');        //turn everything visible again
            });
        }
        if (currentIndex === 1 && priorIndex === 0) {

        }
        },
        onFinishing: function (event, currentIndex) {
            var form = $(this);
            var result = $('ul[aria-label=Pagination]').children().find('a');
            $(result).each(function () {
                if ($(this).text() == 'Finish') {
                    //$(this).attr('disabled', 'disabled');
                    //$(this).css('background', 'green');
                    $(this).css('display', 'none');
                    alert("Now you cannot click the #finish button twice,"+
                        "press Previous and it will reappear");
                }
            });

        form.validate().settings.ignore = ":disabled, :hidden";

        return form.valid();
        },
        onFinished: function (event, currentIndex) {
            alert(event+":"+currentIndex);
            var form = $(this);
            event.preventDefault();
            getResult();
            // enableFinishButton: false;
            // Submit form input
            //form.submit();
        },
    stepsOrientation: "vertical",
    }).validate({
        /*
        submitHandler: function() {
            alert("submit handler function not being called, validate not working");
            $("#finish").prop('disabled', true);
        },
        success: function(response){
            alert("success function not being called, validate not working");
            $("#finish").prop('disabled', false);
        },
        */

        errorPlacement: function (error, element) {
            $('#step1Errors').append(error);
        },
        rules: {
        },
        messages: {

        }
});

But here is an update to your fiddle, I'm not sure how long this link will be live though:
https://jsfiddle.net/n1a0zLpk/1/

A: Replace
         $(this).attr('disabled', true);
with
         $(this).attr('disabled', 'disabled');
I hope it will work!!

A: if yout want hide #finish/span Finish.
Just modify file steps.min.js and wizard_steps.js

*

*on steps.min.js search word where Finish and #finish and delete that word.

*on wizard_step.js just comment the all of onFinished function


text:
Q: Where are GPS coordinates stored in a video taken with Galaxy S10 stock camera v9.0.05.29? I have a Samsung Galaxy S10 and I am using the stock Camera app (com.sec.android.app.camera, version 9.0.05.29).
I have the "Location tags" enabled so that my phone correctly saves GPS coordinates to the photos I take.
This used to work also for .mp4 videos, so that the location was stored in the metadata tag "GPSCoordinates".
However, all my recent videos do not have such tag and hence their GPS coordinates are lost.
Digging back into my library, I figured out that the change occurred in July 2019:

*

*Firmware G973FXXU1ASE7 (Jun 2019): GPS data saved in .mp4 tag GPSCoordinates

*Firmware G973FXXU2ASF3 (Jul 2019): NO GPS data saved in the videos

If I take a recent .mp4 file:

*

*The default Samsung Gallery app seems to be able to show the GPS location of the video while it is on the phone

*Google Photos app shows the location, while Google Photos from the web shows no location

*After transferring via USB the .mp4 to a PC, by using exiftool I cannot find any tag which has the GPS coordinates

Does anyone know if Samsung changed the metadata format?
Any idea on how to recover this piece of information from the stock .mp4 videos?

A: I fixed it!
You have to go into those two apps:

*

*Settings > Apps > App Management > Photos > Permission > Storage

Set it to Don't Allow and then revert it back to Allow management of all files.
Then go to:

*

*Settings > Apps > App Management > Camera > Permission > Storage

*Settings > Apps > App Management > Camera > Permission > Location

and for both permissions do the same.
The problem is now fixed on Android 12 on OnePlus 8T


text:
Q: Is super a reference variable in java? How can we write S.O.P(super.x) which should only be possible if super was a reference variable?
Is super a reference variable?
If not, does it mean that we can access non static data members stored in objects without the following syntax "reference variable"."data member"?

A: Few points about super
1.) super is a keyword in java
2.) A static or instance variable in a subclass may have the same name as a superclass variable. In this case, the variable hides the superclass variable and it can have same type or different types.
3.) It is possible to access hidden variable by super keyword.
4.) Note that super keyword enables you to access the superclass variable and construct a subclass by using the same variable name.

A: We can directly access super class variable.
For Example
System.out.println(x);

Super class variable scope will based its access modifier


text:
Q: Can i have if statement inside a Template Match= in xslt I want acheive 3 things.
First is rename the GroupArea to GroupBox Nodes.
Second is Put a  tag after the GroupBox and GroupArea Node.
Third is to move all child GroupArea and GroupBox Nodes and its content to ParentNode of XML. To acheive this i am using 2 template match and this is messing up things.
I cannot upload an image to show this for now.
If i can put a If-else logic inside the first templateMatch then i should be fine. I think i cannot do that. But by using 2 of them, the line  "xsl:apply-templates select="node()" in the second templateMatch is coping over the entire node including child GroupArea to a GroupArea instead of just renaming the GroupArea to GroupBox.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*" />

<xsl:template match="@*|node()">
<xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!--First Template Match. To Move all the child GroupArea and GroupBox to Parent and inject a Blank Controls Tag-->
<xsl:template match="GroupBox|GroupArea">
<xsl:copy>
    <xsl:apply-templates select="@*[not(self::GroupBox | self::GroupArea )]" />
<GroupBox>
<Controls>
         <xsl:apply-templates select="node()[not(self::GroupBox | self::GroupArea )]" />
    </Controls>
</GroupBox>
</xsl:copy>
<xsl:apply-templates select="GroupBox|GroupArea|GROUPAREA|GROUPBOX" />
</xsl:template>

<!--Second Template Match. To Convert all the GroupArea to GroupBox and then Inject the Blank Control Tags-->
<xsl:template match="GroupArea">
<GroupBox>
<xsl:apply-templates select="@*" />
<Controls>
    <xsl:apply-templates select="node()" />
</Controls>
</GroupBox>
</xsl:template>

</xsl:stylesheet>

Is there anyway to acheive the same. XML FILE Below
<MyControls>
<GroupBox Id="GroupBox1" Title="Public Event Details">
<Textbox HasPopup="False" Id="NameOfEvent" Title="Name of Event"> </Textbox>
<GroupBox Id="ctrl_0" Title="">
<CheckBox  Title="Public Property" AccessItem="0"></CheckBox>
<Textbox HasPopup="False" Id="Location" Title="Location or Route" ></Textbox>
</GroupBox>

<GroupArea Id="ctrl_1" Title="">
<Textbox  Id="_MATaxNumber" Title="MA Tax Number"  AccessItem="0" HintText=""></Textbox>
<Textbox HasPopup="False"  Id="AttExp" Title="Attes Expected" ></Textbox>
</GroupArea>

<GroupBox Id="ctrl_2" Title=""/>

<GroupBox Id="ctrl_3" Title="">
    <CheckBox  Id="CBPublicEventDetails_VendingFood" Title="Food"  AccessItem="0"></CheckBox>
    <CheckBox  Id="CBPublicEventDetails_VendingGoods" Title="Goods" AccessItem="0"></CheckBox>
    <Textbox HasPopup="False" Id="VendingVendors" Title="Total Vendors" ></Textbox>
</GroupBox>

<GroupArea Id="ctrl_4" Title="">
<CheckBox Id="CBPuEntLiveMusic" Title="Live Music"  AccessItem="0"></CheckBox>
<CheckBox Id="CBPubliEntStage" Title="Stage" AccessItem="0"></CheckBox>
</GroupArea>

<GroupBox Id="ctrl_5" Title="">
    <CheckBox  Id="CBPublicEventDetails_GamesGames" Title="Games" AccessItem="0"></CheckBox>
    <CheckBox  Id="CBPublicEventDetails_GamesOther" Title="Other"  AccessItem="0"></CheckBox>
</GroupBox>

<GroupBox Id="ctrl_6" Title="">
<Textbox HasPopup="False"  Id="SecurityHow" Title="How will they be identified?"/>
<Textbox HasPopup="False" Id="SecurityNumber" Title="Security Personnel #"/>
</GroupBox>

<GroupBox Id="ctrl_19" Title="">
<CheckBox Id="cb_pubeventdetails_emswalk" Title="Run/Walk" AccessItem="0"></CheckBox>
<CheckBox  Id="cb_pubeventdetails_emsboat" Title="Boating/Swim" AccessItem="0"></CheckBox>

<GroupArea id="gaAdjustmentResults">
    <Grid id="gdAdjustmentResults" >
        <Columns>
                            <GridColumn ID="gc1"  DataType="Int"></GridColumn>
        </Columns>
    </Grid>

    <GroupArea id="gaAdjustmentNew" >
        <Grid id="gdAdjustmentResults" >
        <Columns>
            <GridColumn ID="gcAdjustment"  DataType="Int"></GridColumn>
        </Columns>
        </Grid>
    </GroupArea>
</GroupArea>
</GroupBox>
</GroupBox>
</MyControls>

WHAT I AM GETTING AS OUTPUT WITH THIS XSL. SHOWING JUST THE SECTION WITH ISSUE. AT THE BOTTOM I HAVE ATTACHED THE COMPLETE TRANSFORMED XML.
WHILE USING THE XML AND XSL YOU WILL SEE BELOW RESULT SEE I HAVE A INNER GROUPBOX STILL FOUND. IF YOU REMORE THE SECOND TEMPLATEMATCH YOU WILL NOT FIND THE INNER GORUPAREA BUT IT WILL BE A GROUPAREA AND NOT A GROUPBOX
<GroupBox id="gaAdjustmentResults">
<Controls>
  <Grid id="gdAdjustmentResults">
    <Columns>
      <Label ID="gc1" DataType="Int">
      </Label>
    </Columns>
  </Grid>
  <GroupBox id="gaAdjustmentNew">
    <Controls>
      <Grid id="gdAdjustmentResults">
        <Columns>
          <Label ID="gcAdjustment" DataType="Int">
          </Label>
        </Columns>
      </Grid>
    </Controls>
  </GroupBox>
</Controls>

FURTHER IF YOU SEE THE TRANSFORMATION, IS THERE ANYWAY I CAN MOVE THE 2 GRID NODES AND ADD IT TO THE BOTTOM OF THE FILE INSIDE THE OUTER CONTROLS TAG.
Expected Output
<MyControls>
<GroupBox Id="GroupBox1" Title="Public Event Details">
<Controls>
  <Textbox HasPopup="False" Id="NameOfEvent" Title="Name of Event">
  </Textbox>
</Controls>
</GroupBox>
<GroupBox Id="ctrl_0" Title="">
<Controls>
  <CheckBox Title="Public Property" AccessItem="0">
  </CheckBox>
  <Textbox HasPopup="False" Id="Location" Title="Location or Route">
  </Textbox>
</Controls>
</GroupBox>
<GroupBox Id="ctrl_1" Title="">
<Controls>
  <Textbox Id="_MATaxNumber" Title="MA Tax Number" AccessItem="0" HintText="">
  </Textbox>
  <Textbox HasPopup="False" Id="AttExp" Title="Attes Expected">
  </Textbox>
</Controls>
</GroupBox>
<GroupBox Id="ctrl_2" Title="">
<Controls>
</Controls>
</GroupBox>
<GroupBox Id="ctrl_3" Title="">
<Controls>
  <CheckBox Id="CBPublicEventDetails_VendingFood" Title="Food" AccessItem="0">
  </CheckBox>
  <CheckBox Id="CBPublicEventDetails_VendingGoods" Title="Goods" AccessItem="0">
  </CheckBox>
  <Textbox HasPopup="False" Id="VendingVendors" Title="Total Vendors">
  </Textbox>
</Controls>
</GroupBox>
...........
...........

<GroupBox id="gaAdjustmentResults">
<Controls>
  <Grid id="gdAdjustmentResults">
    <Columns>
      <Label ID="gc1" DataType="Int">
      </Label>
    </Columns>
  </Grid>
</Controls>
</GroupBox>

<GroupBox id="gaAdjustmentNew">
    <Controls>
      <Grid id="gdAdjustmentResults">
        <Columns>
          <Label ID="gcAdjustment" DataType="Int">
          </Label>
        </Columns>
      </Grid>
    </Controls>
  </GroupBox>
</GroupBox>
</MyControls>

A: Based on what you posted, I came up with some examples which may help you find a solution. I'm assuming some things since you didn't post your input source.
All you have to do to rename GroupArea to GroupBox (wherever they may be in your source), and not process children which are GroupArea or GroupBox is:
<xsl:template match="GroupArea">
    <GroupBox>
        <xsl:apply-templates select="@*|node()[not(self::GroupBox | self::GroupArea )]" />
    </GroupBox>
</xsl:template>

Assuming you have an identity transform somewhere:
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

the descendants and attributes will be copied to the result tree.
You also want an element after the <GroupBox> nodes. I didn't understand what you want inside it, so I left it empty:
<xsl:template match="GroupArea | GroupBox">
    <GroupBox>
        <xsl:apply-templates select="@*|node()[not(self::GroupBox | self::GroupArea )]" />
    </GroupBox>
    <Controls></Controls>
</xsl:template>

Now, to make all your <GroupBox> nodes children of the document element, you just need to match a template in the document element and select your GroupArea | GroupBox nodes from there:
<xsl:template match="RootElement">
    <xsl:apply-templates select="//GroupBox | //GroupArea" />
    ...
</xsl:template>

Try this stylesheet. If the structure of your source is not too different from what I imagined, it might work at least as a starting point:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="RootElement">
        <xsl:apply-templates select="//GroupBox | //GroupArea" />
    </xsl:template>

    <xsl:template match="GroupArea | GroupBox">
        <GroupBox>
            <xsl:apply-templates select="@*|node()[not(self::GroupBox | self::GroupArea )]" />
        </GroupBox>
        <Controls></Controls>
        <xsl:apply-templates select="node()[self::GroupBox | self::GroupArea]" />
    </xsl:template>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>


text:
Q: Using #define for text replacement in the code Apparently, I can set
#define LIMIT 50

to say that LIMIT, wherever it occurs in the code, is replaced by 50.
Is it possible to use
#define ui "unsigned int"

to define my variables in such a way?
ui foo = 42
ui bar = 99

A: Using the preprocessor for replacement is not recommended and can lead to unexpected problems.
For your use-case there is the typedef or using statement:
Use:
using ui = unsigned int;

Or:
typedef unsigned int ui;

A: There are two problems with
#define ui "unsigned int"

The first is that the macro replacement is a string and not a type.
The second is that such macros (and even type-aliases) tend to make the code harder to read, understand and maintain.

A: MACRO just does text replacement, so with:
#define ui "unsigned int"
ui foo = 42;
ui bar = 99;

you got, after substitution

"unsigned int" foo = 42;
"unsigned int" bar = 99;

which is invalid.
Syntax would be:
#define ui unsigned int

But better to use typedef here (so scope and type are respected):
old school:
typedef unsigned int ui;

modern way:
using ui = unsigned int;


text:
Q: create db from share from different role in reader account Snowflake I have a share(i.e. shareTest_share) in accountAdmin role in one of my reader accounts in snowflake.
Now I want to create a database from this, but from sysAdmin role.
The statement for creating database is:
CREATE or replace DATABASE shareTest_db FROM SHARE mukulanalytics.shareTest_share

This is giving permission issue since I am trying to execute it from the sysAdmin role instead of accountAdmin role which has the access to shareTest_share share.
Error:
SQL access control error: Insufficient privileges to operate on foreign share 'SHARETEST_SHARE'

How can I create a database from share in a different role with share in another role?

A: the privileges required to achieve this are described here: https://docs.snowflake.com/en/user-guide/security-access-privileges-shares.html

A: You will have to grant the IMPORT SHARE privilege to SYSADMIN/any other users
use role accountadmin
grant import share on account to sysadmin
use role sysadmin
create database TEST from share <>
https://docs.snowflake.com/en/user-guide/security-access-privileges-shares.html


text:
Q: saving arraylists to internal storage I am writing a program which calculates and shows Installed program's data usage.
I want to save My variables and reload them.
I have checked other questions about this but i didn't find my answer.
I have 5 Arraylists in my code to save these items:
"Application Name","Application Icon","Received Data","Sent Data" and "Total Data".
I get these informations and convert Arraylists to String arrays whith "for loop" and show them with my custom Adapter and a listview.
My problem is that my application force stops when i run it on my phone.
I save some variables with SharedPreferences and save Arraylists into internal storage.
I have also tried to save Arraylists with SharedPreferences and i could save them. but when i want to reload and set them to arraylists, i get error.
Here is my "onCreate" method code:
public class MainActivity extends AppCompatActivity  {

private static final String MyPREFERENCES="MyPrefs";
private SharedPreferences myPrefs;
int first;
List<String> list=new ArrayList<>();
List<String> s=new ArrayList<>();
List<String> r=new ArrayList<>();
List<String> t=new ArrayList<>();
List<Drawable> ic=new ArrayList<>();
List<Double> StartRx=new ArrayList<>();
List<Double> StartTx=new ArrayList<>();
private long StartTotal;
private long TotalDataUsage;
private long prevData;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    ListView listView1=(ListView)findViewById(R.id.mainListView1);
    registerForContextMenu(listView1);

    myPrefs=getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
    first=myPrefs.getInt("FirstCall",0);
    StartTotal=myPrefs.getLong("StartData",0);
    TotalDataUsage=myPrefs.getLong("TotalData",0);
    prevData=myPrefs.getLong("prevData",0);
    try {
        list=(ArrayList<String>) InternalStorage.readObject(this,"NamesList");
        r=(ArrayList<String>) InternalStorage.readObject(this,"ReceivedData");
        s=(ArrayList<String>) InternalStorage.readObject(this,"SentData");
        t=(ArrayList<String>) InternalStorage.readObject(this,"TotalData");
        ic=(ArrayList<Drawable>) InternalStorage.readObject(this,"IconsList");
    } catch (IOException | ClassNotFoundException e) {
        e.printStackTrace();***
    }
    DataUsage();
    int l=list.size();
    if (l>0) {
        String[] Names = new String[l];
        String[] DReceived = new String[l];
        String[] DSent = new String[l];
        String[] DTotal = new String[l];
        Drawable[] icons = new Drawable[l];
        for (int i = 0; i < l; i++) {
            Names[i] = list.get(i);
            DReceived[i] = r.get(i);
            DSent[i] = s.get(i);
            DTotal[i] = t.get(i);
            icons[i] = ic.get(i);
        }
        assert listView1 != null;
        listView1.setAdapter(new CustomAdapter(this, Names, DReceived, DSent, DTotal, icons));
    }
}

and "onResume" method code is:
protected void onPause() {
    super.onPause();
    try {
        InternalStorage.writeObject(this,"NamesList",list);
        InternalStorage.writeObject(this,"ReceivedData",r);
        InternalStorage.writeObject(this,"SentData",s);
        InternalStorage.writeObject(this,"TotalData",t);
        InternalStorage.writeObject(this,"IconsList",ic);
    } catch (IOException e) {
        e.printStackTrace();
    }
    SharedPreferences.Editor edit = myPrefs.edit();
    edit.putInt("FirstCall", first);
    edit.putLong("TotalData",TotalDataUsage);
    edit.putLong("StartData", StartTotal);
    edit.putLong("prevData", prevData);
    edit.commit();
}

and the "InternalStorage" class is:
public final class InternalStorage {
private InternalStorage() {}
public static void writeObject(Context context,String fileName,Object object) throws IOException {
    FileOutputStream fos=context.openFileOutput(fileName,Context.MODE_PRIVATE);
    ObjectOutputStream oos=new ObjectOutputStream(fos);
    oos.writeObject(object);
    oos.close();
    fos.close();
}
public static Object readObject(Context context,String fileName) throws IOException, ClassNotFoundException {
    FileInputStream fis=context.openFileInput(fileName);
    ObjectInputStream ois=new ObjectInputStream(fis);
    return ois.readObject();
}

}
I didn't get any error from android studio.
I know that the problem is with below codes because when i delete them, it works!
try {
        list=(ArrayList<String>) InternalStorage.readObject(this,"NamesList");
        r=(ArrayList<String>) InternalStorage.readObject(this,"ReceivedData");
        s=(ArrayList<String>) InternalStorage.readObject(this,"SentData");
        t=(ArrayList<String>) InternalStorage.readObject(this,"TotalData");
        ic=(ArrayList<Drawable>) InternalStorage.readObject(this,"IconsList");
    } catch (IOException | ClassNotFoundException e) {
        e.printStackTrace();
    }

and this code:
try {
        InternalStorage.writeObject(this,"NamesList",list);
        InternalStorage.writeObject(this,"ReceivedData",r);
        InternalStorage.writeObject(this,"SentData",s);
        InternalStorage.writeObject(this,"TotalData",t);
        InternalStorage.writeObject(this,"IconsList",ic);
    } catch (IOException e) {
        e.printStackTrace();
    }

CAN ANYONE HELP ME PLEASE?!!


text:
Q: laplace of $e^{2t+3}U\left(t-2\right)$ I can't get my mind around this problem, I always have issues canceling out "e" values and doing laplace transform of step units
$$e^{2t+3}U\left(t-2\right)$$
Also, is there an online calculator for this type of problems? I found this site:
https://www.symbolab.com/solver/laplace-calculator/
But it gives me an error anytime unit step is used


text:
Q: How to Get Self Signed Certificate in Ec2 I am working in Ec2 instance. I have connected my php files like http://13.57.220.172/phpinsert.php. But it is not secured site.  So i want to convert http into https://13.57.220.172.
I have cloudflare ssl. When i try to add ssl certificate. It shows
com.amazonaws.pki.acm.exceptions.external.ValidationException: Provided certificate is not a valid self signed. Please provide either a valid self-signed certificate or certificate chain. Choose Previous button below and fix it.
i have enclose the image with it.
So how can i get the self signed certificate. is there any online tool available.

A: I think the error message your seeing has to do with this sentence:

If your certificate is signed by a CA, you must include the
  certificate chain when you import your certificate.

from https://docs.aws.amazon.com/acm/latest/userguide/import-certificate-prerequisites.html.
Since it sounds like you're not yet in "production" mode, I'm guessing you're not particularly attached to your existing certificate, but just want a certificate to be able to do HTTPS on your web server (and don't really care if it's self-signed).
If you want to use AWS Certificate Manager, I think it would be easier to just let them (AWS) issue you a certificate instead of trying to import one from somewhere else. AWS doesn't charge anything for certificates. https://docs.aws.amazon.com/acm/latest/userguide/acm-billing.html
Even if you get the certificate setup in AWS Certificate Manager, that's not going to be installed directly on your EC2 instance, but rather (most likely) on a load balancer in front of your web server, which will add a little complexity to your setup. https://docs.aws.amazon.com/acm/latest/userguide/acm-services.html
If all you want to do is use HTTPS on your web server, Let's Encrypt (also free) is probably a simpler option. If you are using AWS Linux 2, there are instructions for getting a certificate here - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html

A: Well, add to the points which @jefftrotman has already mentioned.
If your expectation is to just secure your IP address using HTTPS you can achieve that using the below approaches:

*

*A SELF SIGNED certificate that you can create using OpenSSL.

*You can also get an SSL certificate from a trust signing authority like (GoDaddy or VeriSign) or Let's encrypt.
The only requirement in the second point is that for getting a certificate from a valid signing authority you need to have a domain name like "myphpapp.com" and then use this domain to get the SSL certificate.
The below details are in case you want to use AWS ACM(Amazon Certificate Manager)

*

*If you prefer ACM, you can get the free Public SSL certificate which you can map to the IP address and your web application will be secured.

*If your requirement is to add SSL certificates (like PEM files) to a web server like
NGINX or Apache then you first need to create a Private CA using in ACM and then you using this CA you will be able to create Private SSL certificates. After creating those you can export the files and add those files to the configuration file. (try to use Amazon Linux 2) ec2 image for ease.


text:
Q: regex for multiple strings I have two strings that I'm trying to match in a file and return just that line.
The first string will match what I'm looking for always but not completely.
Example:
I might be looking for Matcht in Matchthisstring so I match but not the entire string.
String 1 might come before or after string 2 and it might start with an uppercase or lower case letter.
Example:
I might be looking for actually but have Actually.
But it together and I have things like Matchthisstring.Actually or actually.Matchthisstring or Matchthisstring.someotherjunkIdon'tcareabout.actually any other combinations like that.
I'm having problems using the two search strings together and getting the reggae to work.
Here's an example of some code that works:
 my @matches;
   while (<$in_fh>) {
     #push @matches, $_ if / \Q$wanted\E .* \Q$prefix\E /x;
     #push @matches, $_ if / \Q^*(.*)$wanted\s*(.*)\E .* \Q^*(.*)$prefix\s*(.*)\E /x;
     push @matches, $_ if / \Q$wanted\E /x;
   }

what I really want to work is one of the other options that's commented out.  I don't think I'm joining the two searches into one string together properly.
Thanks in advance for the assistance.

A: Sounds like you want
push @matches, $_ if /\Q$wanted\E/ and /\Q$prefix\E/;

Demo:
$ perl -ne 'use strict; use warnings; use vars qw($wanted $prefix @matches);
>    BEGIN {  $wanted = "/donate"; $prefix = "lghfound"; }
>    push @matches, $_ if /\Q$wanted\E/ and /\Q$prefix\E/; print @matches' <<'HERE'
> http://www.google.com/donate
> http://lghfoundation.com/pages/donate.html
> http://example.com
> HERE
http://lghfoundation.com/pages/donate.html
http://lghfoundation.com/pages/donate.html


text:
Q: Stress testing a 64bit CPU with 32bit software (mprime) When I stress test a CPU there are three things I'm looking for:

*

*Power consumption at peak load (can the PSU handle this CPU?)

*Heat disipation under heavy load (is it well cooled?)

*Reliability and stability under heavy load for a prolonged period of time

I believe Prime95 (mprime) takes care of all three points and then some.
If I run the 32bit binary of mprime in a 64bit CPU, will the test be as effective?
Is it possible that there is a problem with the CPU that mprime will only detect if I'm running the 64 bit binary?


text:
Q: Force thread to context switch I have a function foo in which I want to create and start a thread but delay it running to completion until foo returns.
I have achieved this by introducing a delay into the new thread, using a call to sleep, effectively (I think) causing a context switch.
String foo()
{
    // do some stuff

    Runnable task1 = () ->
    {
        Thread.sleep(100);

        // do some stuff
    };

    // start the thread
    new Thread(task1).start();

    return "bar";
}

It seems to work - i.e. foo always returns before task1 does its stuff.
Is the use of sleep the correct way to do this? Or is there a better way?

A: You can use a Semaphore to control it all properly.
String foo() {
    Semaphore waitUntilWeReturn = new Semaphore(-1);
    Runnable task1 = new Runnable() {
        @Override
        public void run() {
            awaitPermissionToProceed();
            // do some stuff

        }

        private void awaitPermissionToProceed() {
            try {
                waitUntilWeReturn.acquire();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    };

    // start the thread
    new Thread(task1).start();

    waitUntilWeReturn.release();
    return "bar";
}


text:
Q: Websphere application server - don't redirect to https I have a WAS on my local computer installed and I am trying to integrate some custom logic with websphere business monitor.
I need to send xml messages for processing to specified rest interface.
In my code I am using jersey api for rest to simplify creating the connections.
Here is a link containing some information about this rest interface
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/index.jsp?topic=/com.ibm.bspace.620.help.api.rest.doc/apis/eventemitter/index.htm
I can send events if I use the https://localhost:9443 url and if I "disable" ssl security on my client jvm side.
I know that someday I will need to generate the certificates and all of that, but for now I just wanted to access this interface using normal http like http://localhost:9080.
The thing is, if I use this URL I am getting 302 return code and I am redircted to the old one.
My question is, what do I need to change so there won't be any redirection to https version?
The thing I noticed is that this "interface" is not listed in Services->Rest Services, but there exists an application IBM_WBM_EMITTER_SERVICES so I was suspecting that there may be something that I need to change in this application settings so it can "accept" plain old http connections.


text:
Q: When using dataframes as params for .fillna(), is identical shape required? According to the Docs, you can use a Dataframe as the value parameter for .fillna()
http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.fillna.html
But does the dataframe need to be identical shape?  If so, why does the first example give me the desired output?
Using this df:
mukey   hzdept_r    hzdepb_r    sandtotal_r silttotal_r
425897      0         61
425897      61        152          5.3         44.7
425911      0         30           30.1        54.9
425911      30        74           17.7        49.8
425911      74        84

I can run:
df = pd.read_clipboard()
df1 = df.set_index('mukey')
df1.fillna(df.groupby('mukey').mean(),inplace=True)

and df1 results in the desired df:
        hzdept_r  hzdepb_r  sandtotal_r  silttotal_r
mukey
425897         0        61          5.3        44.70
425897        61       152          5.3        44.70
425911         0        30         30.1        54.90
425911        30        74         17.7        49.80
425911        74        84         23.9        52.35

However, when I try to run the same code on a larger df, it breaks with InvalidIndexError.
df = pd.read_csv('www004.csv')
df1 = df.set_index('mukey')
df1.fillna(df.groupby('mukey').mean(),inplace=True)

Error:
InvalidIndexError                         Traceback (most recent call last)
<ipython-input-126-a1038ea351c9> in <module>()
----> 1 df1.fillna(df.groupby('mukey').mean(),inplace=True)

/Users/liamfoley/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in fillna(self, value, method, axis, inplace, limit, downcast)
   2410                                              downcast=downcast)
   2411             elif isinstance(value, DataFrame) and self.ndim == 2:
-> 2412                 new_data = self.where(self.notnull(), value)
   2413             else:
   2414                 raise ValueError("invalid fill value with a %s" % type(value))

/Users/liamfoley/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in where(self, cond, other, inplace, axis, level, try_cast, raise_on_error)
   3306                         not all([other._get_axis(i).equals(ax)
   3307                                  for i, ax in enumerate(self.axes)])):
-> 3308                     raise InvalidIndexError
   3309
   3310             # slice me out of the other

InvalidIndexError:

I can get around that by creating a means_df that has identical shape.
import pandas as pd
df = pd.read_csv('www004.csv').set_index('mukey')
means = df.groupby(level=0).mean()
means_df = pd.merge(pd.DataFrame(df.index),means,
                    left_on='mukey',right_index=True,how='left').set_index('mukey')
df1 = df.fillna(means_df)

That gives me the desired result:
 df.ix[426184]
        hzdept_r  hzdepb_r  sandtotal_r  silttotal_r  claytotal_r  om_r
mukey
426184         0        18         30.1         54.9           15   3.5
426184        18        46         58.2         17.8           24   NaN
426184        46       152          NaN          NaN            5   NaN

df1.ix[426184]
        hzdept_r  hzdepb_r  sandtotal_r  silttotal_r  claytotal_r  om_r
mukey
426184         0        18        30.10        54.90           15   3.5
426184        18        46        58.20        17.80           24   3.5
426184        46       152        44.15        36.35            5   3.5

Related:
Pandas fill missing values in dataframe from another dataframe
Fill in missing row values in pandas dataframe
In Pandas, how can I patch a dataframe with missing values with values from another dataframe given a similar index?

A: A workaround for this could be to use a transform (rather than an aggregating) groupby method:
df1.fillna(df1.groupby(level=0).transform("mean"))

It's unclear to me whether this is a bug in pandas, I recommend posting an issue on Github (it may be a nice feature)!


text:
Q: Json, linq and SQL multiple row inserts same row Iam trying to get a JSON array into a MSSQL table using linq. I almost got it to work but with the current code, it inserts the first row for the duration of the for at the list part. the table looks like this after the insert. This is my code:
List<insertmultiapiwhitelist> thelist = new List<insertmultiapiwhitelist>();
        string json = "[{'naam':'Default Web Site','webid':1,'verbruik':0,'datum':'2016-12-05 00:00:00'}]";
//json above has 150 items, purged to keep it clean.
        dynamic jsondata = JsonConvert.DeserializeObject(json);

        foreach (var jsonitem in jsondata)
        {
            thelist.Add(new insertmultiapiwhitelist()
            {
                naam = jsondata[0].naam,
                webid = jsondata[1].webid,
                verbruik = jsondata[2].verbruik,
                datum = jsondata[3].datum
            });
        }

        foreach(var listgebruik in thelist)
        {
            webfarm_data dbtoevoegingen = new webfarm_data();
            dbtoevoegingen.naam = listgebruik.naam;
            dbtoevoegingen.webid = listgebruik.webid;
            dbtoevoegingen.verbruik = listgebruik.verbruik;
            dbtoevoegingen.datum = DateTime.Parse(listgebruik.datum);
            DeDB.webfarm_data.Add(dbtoevoegingen);
        }

        var updateantwoord = new insertmultiapiwhitelist { antwoord = "Niets ontvangen" };
        try
        {
            DeDB.SaveChanges();
            updateantwoord = new insertmultiapiwhitelist { antwoord = "Insert voltooid" };
        }
        catch (Exception e)
        {
            var foutmelding = e.ToString();
            updateantwoord = new insertmultiapiwhitelist { antwoord = foutmelding };
        }
        return View(updateantwoord);

A: I think you first foreach should look like this:
 foreach (var jsonitem in jsondata)
    {
        thelist.Add(new insertmultiapiwhitelist()
        {
            naam = jsonitem.naam,
            webid = jsonitem.webid,
            verbruik = jsonitem.verbruik,
            datum = jsonitem.datum
        });
    }

A: So if I understand your question correctly you mean that it inserts the first row instead of each individual one? I think your mistake is here:
    foreach (var jsonitem in jsondata)
    {
        thelist.Add(new insertmultiapiwhitelist()
        {
            naam = jsondata[0].naam,
            webid = jsondata[1].webid,
            verbruik = jsondata[2].verbruik,
            datum = jsondata[3].datum
        });
    }

Shouldn't it be this:
    foreach (var jsonitem in jsondata)
    {
        thelist.Add(new insertmultiapiwhitelist()
        {
            naam = jsonitem.naam,
            webid = jsonitem.webid,
            verbruik = jsonitem.verbruik,
            datum = jsonitem.datum
        });
    }

You are basically saying "For each item in my list, insert the 0th element's name and its 1th element webid" which is exactly the same each loop. You should use jsonitem instead of jsondata ;-)


text:
Q: Can't install nvidia-experimental-310 i went using the gui at first (software sources -> additional drivers), it installed without any problem, but when restarting and running sudo lshw -C display i still get this:
*-display
   descripción: VGA compatible controller
   producto: G96 [GeForce 9500 GT]
   fabricante: NVIDIA Corporation
   id físico: 0
   información del bus: pci@0000:01:00.0
   versión: a1
   anchura: 64 bits
   reloj: 33MHz
   capacidades: pm msi pciexpress vga_controller bus_master cap_list rom
   configuración: driver=nouveau latency=0
   recursos: irq:16 memoria:a2000000-a2ffffff memoria:80000000-9fffffff memoria:a0000000-a1ffffff ioport:2000(size=128)

Notice the driver=nouveau part, i tried uninstalling the nvidia driver and reinstalling it on the console (using sudo apt-get install nvidia-experimental-310) and it installed sucessfull but again after rebooting and checking the nouveau drivers keeps coming... any help?
EDIT: i managed to install them properly... but then after rebooting i got stuck at 640x680 res, unity was glitchy and got a black bar at the left of the screen... i tried with nvidia-experimental-310, nvidia-experimental-304, nvidia-current and nvidia-current-updates with the same result.

A: I actually JUST redid this and got it working with snyaptics.  Went smooth as could be. Make sure you select not only the driver itself but also the management console as well.
Packages are
nvidia-experimental-310-dev
nvidia-settings-experimental-310
Give that a shot.


text:
Q: C# .NET VLC AXVLC Plugin - Can't play file from network share In my windows form i can't get the VLC plugin to play files which are located on a network share.
This works:
string fileToPlay = "d:\\test.MXF";
vlc.addTarget( "file:///" + fileToPlay , null, AXVLC.VLCPlaylistMode.VLCPlayListReplaceAndGo, 0);
vlc.play();

Not working:
string fileToPlay = this.serverIP + "\\" + this.xdcamCopyTargetDir + this.targetDirectory + @"\Clip\" + item;

The Network Path looks like this:
192.168.168.19\video\disk-title-2016-05-13\Clip\C0001.MXF

The network path is correct. I check it all the time using a textbox. I also tried using backslashes before the ip address. The server is also accessible because i copy those files in an earlier step to the generated network path. If i browse to the network path using Explorer and double click the same file VLC (installed Version) opens the file without any problem.
How can i get the AXVLC Plugin in my Windows Form to play videos from a network address?


text:
Q: Adjective or noun for "uses rules that are commonly accepted even if not consistent" I'm working on defining technical terms to explain three ways to calculate the length of time between two points in time despite the oddities of Daylight Saving Time (DST):

*

*Always use real-world elapsed time (like a stopwatch). This will be called "absolute".

*Always use clock time, even if the clock time did weird things during the period like skipped an hour (because Daylight Saving Time started) or repeated an hour (because Daylight Saving Time stopped). This will be called "local".

*Use a mix of the two strategies that matches how normal, non-technical people would think about it. For example, from 5:00PM on the day before Daylight Saving Time ends or starts to 5:00PM the next day should be "one day", not "one day and one hour" or "23 hours." But a time period that starts an hour before DST starts and ends an hour after DST starts should be "2 hours" even though the clock is 3 hours ahead.

What should I name #3?
The connotation I'm looking for is something that's intuitive and works well, despite not being technically consistent.  A word that means "rules that are commonly accepted and good enough for most purposes" is what I'm looking for. Alternatively, I'd be happy with a word that means "Do something different on one side than is done on the other, for good reasons even if those reasons seem a little arbitrary."
Ideally the word would be:

*

*relatively short (under 10 letters)

*a common-enough word that most college-educated, non-native English speakers will know it

*easy to pronounce for non-native english speakers

*easy to spell

*single word is very strongly preferred

*preferably an adjective, but the right noun could be OK

*non-judgemental, so if someone chooses another of the 3 terms, #3's antonym won't make the user feel like we're criticizing their choice

The closest word that I've found so far is "common" in the sense of "common law". But I think that meaning of "common" is too obscure so I'm hoping to find a better term.
Here's some other words I've considered and reasons why I rejected them:

*

*normal - too generic

*everyday - too generic

*expected - some users may not actually expect this behavior, so I don't think this works

*standard - in my industry (software) this has the connotation of "laws" or "regulations" which is not what I'm trying to convey

*customary - close, but feels a little to vague to me

*colloquial - this is the closest I've found, but the word is probably too obscure and hard to spell for our global audience

*quirky - emphasizes weirdness, which is the opposite of the connotation I'm looking for.

*pragmatic - very close to what I'm looking for, but pragmatic implies "making the best of things" while this term should be closer to "how people usually talk"

*best fit / best effort - not bad, but 2 words is not ideal

*idiomatic - close, but too obscure

*divergent - too much emphasizing difference vs. sensibility

*sensible - too opinionated; don't want to imply that users who chose another option are not sensible

*parallel - not exactly right because parallel implies doing things separately, but I'm more looking for a collaborative connotation, e.g. date and time working differently but in harmony.

*split - same problems as parallel

*blend - too much emphasis on the mixture, not enough on "what just seems right"

*compromise - implies too much mixed, muddled

*evolved - emphasizes too much about the process of how we got there, instead of "what we have now is fine"

A: *

*For elapsed time, you've got absolute. (Although I think elapsed itself might actually be better.)

*For clock time, you've got local. (Although I think adjusted might actually be better.)
For what people would consider to be a "a day" (5:00 p.m. to 5:00 p.m.), despite a time change either way that results in that not being 24 hours, I would use the word effective:

[Merriam-Webster]
1 a : producing a decided, decisive, or desired effect
        // an effective policy
2 : being in effect : OPERATIVE
       // the tax becomes effective next year

In some ways, this works better with the adverb effectively (although I understand you might need the adjective for classification):

[Merriam-Webster]
1 : in an effective manner
      // dealt with the problem effectively
2 : in effect : VIRTUALLY
     // by withholding further funds they effectively killed the project

In short:

At 5:00 p.m. tomorrow, a day will have effectively passed.

You can look up synonyms for effective and effectively. When I think of these words in this sense, I mostly think of practical and acceptably. Or essentially, which isn't actually listed at Merriam-Webster, even though that's a personal association of mine.

A: You are looking for a word which means: "rules that are commonly accepted and good enough for most purposes."  These are conventional practices.
From Merriam-Webster unabridged:
adjective

*

*according with, sanctioned by, conforming to, or based on convention, custom, or traditional usages or attitudes

*commonly encountered, observed, or performed : commonplace, ordinary, usual

It is customary and common practice to count time in hour increments. However, when this count is punctuated by a sunset and sunrise, or by an extended period of sleep, it is our convention to begin referring to segments along this span in terms of today, yesterday, or "in the course of the past day" to refer to the whole. We could just as well be more precise by enumerating the actual hours elapsed, but that is not our convention.

A:
Use a mix of the two strategies that matches how normal, non-technical people would think about it.

Given you mean "What people usually do", I think "empirical" would suit your purpose:
OED

4. Guided by or derived from previous experience or unsystematic observation, without a basis in formal learning or an understanding of underlying principles;
1843   Standard 26 Oct. 2/6   We are now relying entirely for future discoveries on..the empirical method of advancing agricultural science, and are neglecting the scientific.
1921   S. Klyce Universe 132/2   The empirical farmer who plants by the moon's phases is not wholly superstitious, although it is likely that his rules of thumb are now excessively inaccurate.
2008   B. Donegan War in Eng. 1642–9 (2010) v. 84   The good artilleryman..was an empirical practitioner of a variable art, rather than the operator of a precisely accurate machine.
2008 P. Tregoning, Dynamic Planet: In the empirical approach the correlation functions and variances are computed using the observed data, instead.


text:
Q: Deleting the core data entity I am doing a project which involves a good use of core data. I have been using it since few months now. I have a small problem. I have two different entities a entity named Student and another named Courses. The relationship between Student and Courses is one to many. I am frequently updating the entities from the remote json. So, sometimes there are dangling pointer in the Courses entity which do not have relationship to the Student entity. This type of the entities need to be deleted. How is it better to delete such objects ?
              Courses(points to student) <------------- Student ----------------> Course (Points to student)
                                                           |
                                                           |
                                                           |
                                                           |
                                                Course (Points to student)

                       Course(has no pointer to student, no foreign key to relate with student)

A: Are you sure you need to delete a course when it has no students? Course may be valid though. I think you should nullify the relations, so when you delete a student, all courses pointing to it just would stop referencing that student.
You probably need to check your relationship delete rules so that they should be nullify in my opinion.

A: The simple way to do this is to create a fetch request and query against Courses. Obviously you need to use a NSPredicate to remove the Courses with no students.
If your Courses has an inverse rel to Student, called coursesToStudent, you could set up the following predicate.
[NSPredicate predicateWithFormat:@"coursesToStudent == nil"];

Here I suppose that Courses has a one-to-one rel with Student.
In this way the fetch request results will have Courses without a student. With the result, call deleteObject and you have done.
For info about setting a fetch request with a predicate see Filter NSFetchedResultsController for nil value?.
About your model I would set up another one. For example use three entities:
Student
Course
Enroll

where
Student
- attributes you want
- toEnroll [one-to-many rel to Enroll with cascade rule]

Course
- attributes you want
- toEnroll [one-to-many rel to Enroll with cascade rule]

Enroll
- attributes you want
- toStudent [one-to-one rel to Student with nullify rule]
- toCourse [one-to-one rel to Course with nullify rule]

Hope that helps.


text:
Q: php preg_match_all preg_replace array issue I'm working on a bb-code replacement function when a user wants to post a smiley.
The problem is, that if someone uses a bb-code smiley that doesn't exists, it results in an empty post because the browser will not display the (non-existing) emoticon.
Here's my code so far:
// DO [:smiley:]
  $convert_smiley = preg_match_all('/\[:(.*?):\]/i', $string, $matches);

  if( $convert_smiley )
  {
    $string = preg_replace('/\[:(.*?):\]/i', "", $string, $convert_smiley);
  }

  return $string;

The bb-code for a smiley usually looks like [:smile:] or like [:sad:] or like [:happy:] and so on.
The code above is working well, until someone post a bb-code that doesn't exists, so what I am asking for is a fix for non existing smileys.
Is there a possibility, in example to create an array, like array('smile', 'sad', 'happy') and only bb-code that matches one or more in this array will be converted?
So, after the fix, posting [:test:] or just [::] should not be converted and should be posted as original text while [:happy:] will be converted.
Any ideas? Thanks!

A: A simple workaround:
$string ="[:clap:]";

$convert_smiley = preg_match_all('/\[:(.*?):\]/i', $string, $matches);

$emoticons = array("smile","clap","sad"); //array of supported smileys

if(in_array($matches[1][0],$emoticons)){
    //smily  exists
    $string = preg_replace('/\[:(.*?):\]/i', "", $string, $convert_smiley);
}
else{
  //smily doesn't exist
}

A: Well, the first issue is you are setting $convert_smiley to the true/false value of the preg_match_all() instead of parsing the results. Here is how I reworked your code:
// Test strings.
$string = ' [:happy:] [:frown:] [:smile:] [:foobar:]';

// Set a list of valid smileys.
$valid_smileys = array('smile', 'sad', 'happy');

// Do a `preg_match_all` against the smiley's
preg_match_all('/\[:(.*?):\]/i', $string, $matches);

// Check if there are matches.
if (count($matches) > 0) {
  // Loop through the results
  foreach ($matches[1] as $smiley_value) {
    // Validate them against the valid smiley list.
    $pattern = $replacement = '';
    if (in_array($smiley_value, $valid_smileys)) {
      $pattern = sprintf('/\[:%s:\]/i', $smiley_value);
      $replacement = sprintf("", $smiley_value);
      $string = preg_replace($pattern, $replacement, $string);
    }
  }
}

echo 'Test Output:';
echo htmlentities($string);

Just note that I chose to use sprintf() for the formatting of content & set $pattern and $replacement as variables. I also chose to use htmlentities() so the HTML DOM elements can easily be read for debugging.

A: I put your possible smiley's in non-grouping parentheses with or symbol in a regexp:
<?php
$string = 'looks like [:smile:] or like [:sad:] or like [:happy:] [:bad-smiley:]';
$string = preg_replace('/\[:((?:smile)|(?:sad)|(?:happy)):\]/i', "", $string);

print $string;

Output:
looks like  or like  or like  [:bad-smiley:]

[:bad-smiley:] is ignored.


text:
Q: Elasticsearch 6.3.2 - how to search part-words using all fields on this index?
*

*Do you have any idea for create search request? multi-match + part words searching.

 {
      "shop_index": {
          "settings": {
              "index": {
                  "number_of_shards": "5",
                  "provided_name": "shop_index",
                  "creation_date": "1534235625279",
                  "analysis": {
                      "filter": {
                          "nGram_filter": {
                              "token_chars": [
                                  "letter",
                                  "digit",
                                  "punctuation",
                                  "symbol"
                              ],
                              "min_gram": "2",
                              "type": "nGram",
                              "max_gram": "20"
                          }
                      },
                      "analyzer": {
                          "nGram_analyzer": {
                              "filter": [
                                  "lowercase",
                                  "asciifolding",
                                  "nGram_filter"
                              ],
                              "type": "custom",
                              "tokenizer": "whitespace"
                          },
                          "whitespace_analyzer": {
                              "filter": [
                                  "lowercase",
                                  "asciifolding"
                              ],
                              "type": "custom",
                              "tokenizer": "whitespace"
                          }
                      }
                  },
                  "number_of_replicas": "1",
                  "uuid": "SBB9u344RVGm1QQUo-rVMg",
                  "version": {
                      "created": "6030299"
                  }
              }
          }
      }
    }

*

*mapping

{
      "shop_index": {
          "mappings": {
              "products": {
                  "properties": {
                      "html_keywords": {
                          "type": "text"
                      },
                      "html_title": {
                          "type": "text"
                      },
                      "name": {
                          "type": "text"
                      }
                  }
              }
          }
      }
    }

*I would want to search phrase like -> searching "HOUSE"

*

*typing -> "ho" -> show me "HOUSE"

*typing -> "hou" -> show me "HOUSE"

*typing -> "use" -> show me "HOUSE

*typing -> "se"  -> show me "HOUSE"

A: You can achieve it by using Fuzzy query - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html. Also  consider combining it with slop (how far apart terms are allowed) and use multi_match to search in multiple fields.
Sample query:
{
    "query":
    {
        "multi_match":
        {
            "fields": ["field1", "field2"],
            "query": "hous",
            "slop": 3,
            "fuzziness": "AUTO"
        }
    }
}