text:
Q: Corrupt NTFS folders java I have more than 80 thousand folders. Each of these folder contains 4 sub-folders an 1 file. I need to list all or some of these 80 thousand folders to get the sub-folders and then list sub-folders to get the list of files inside sub-folders. For this I developed a Java program which works fine on most of these folders. On some specific folders the program freezes. After killing the program, When I double-click these folders to open them a message pops up saying the folder is corrupt and no longer accessible. These folders are on an NTFS volume for which CHKDSK in read-only mode reports errors. Is there any way I can know in in advance that a specific folder is corrupt and ignore processing it?

A: You can run CHKDSK from Java, read it's output and skip those files/directories. This would slow down your application but might be better than stopping on a bad sector etc.  Or you could upgrade your OS to one which doesn't do this. ;)
You are better off fixing your filesystem. Java assumes your sub-systems work as that is their job.


text:
Q: Finding functions address on the fly My goal is to hook C functions with no symbol in stripped binaries on ARM platform. As the addresses of these functions may changed (ie. with an update of the binary), I want my interposing dynamic library itself to find the addresses.
Moreover, these functions, at some point, uses an C-string which never changes through updates. With this in mind, here are the 3 steps to find the functions address:
1) find the address of the C-string itself ( by analyzing the __cstring section inside the __TEXT segment.
2) find the address of the reference to the string.
3) Starting from the xref address, go backwards until I find a function prologue.
I could implement step 1) and 3), but I'm a bit lost for 2). What is exactly an xref ? How can I identify the one corresponding to the C-string ? No code is needed, just some theory.
Thanks !

A: You would have to disassemble all the code, determining what code reads from memory. You would have to decode the address of those instructions that read from memory (not sure if ARM is relative or absolute). Furthermore, in order to properly disassemble everything you would need to start at a known entry point and follow all the calls to find out where functions start (I'm assuming ARM has variable sized instructions, i.e. instructions with immediates). This is not a simple thing to do, cross-reference analysis is a rather significant feature of reverse engineering software (like IDA Pro for instance). Furthermore, if the memory is not accessed directly you would have to analyze all indirect memory accesses (accesses through registers).

A: What you can do instead of the search of the string and its xref (LDR R5, = 0xnnnnnn) is to make an byte array containing the epilogue of the function and search for that. The more bytes you're taking for search the more the  uniqueness increases. To go by the (C/ASCII) string isn't well and only for manually (by hand in IDA) working
Otherwise you have to implement a disassembler engine (like that which decodes the instructions in IDA, comparable to those on x86 platform) and to parse each instruction.

redpajama_set_name: RedPajamaStackExchange


text:
Q: bash code in rc.local not executing after bootup Does anyone know why a system would not execute the script code within rc.local on bootup?  I have a post configuration bash script that I want to run after the initial install of VMware ESX (Red Hat), and for some reason it doesn't seem to execute.  I have the setup to log its start of execution and even its progress so that I can see how far it gets in case it fails at some point, but even when I look at that log, I am finding that didn't even started the execution of the script code.  I already checked to see that script has execution permissions (755), what else should I be looking at?
Here is the first few lines of my code:
#!/bin/sh
echo >> /tmp/configLog ""
echo >> /tmp/configLog "Entering maintenance mode"

A: So, does /tmp/configLog exist?  If so, your script is firing, and it's just dying somewhere.
Start with the basics:

*

*Put a simple, one-liner in /etc/rc.local, like this. touch /tmp/itworked
Did that work?  After rebooting, does /tmp/itworked exist?  If so, then rc.local is being executed.

*Another common gotcha is that if your script is a daemon it either needs to handle forking to the background, or it needs to be backgrounded in rc.local.  If your script is /bin/myscript, then rc.local should have:/bin/myscript & in it.  Does it take a long time to run?  There may be a timeout somewhere in the init scripts to prevent users from halting the boot process - backgrounding the process will get you around that if it exists.

*If the 'touch' works, and you're backgrounding, it has to be in your script somewhere.  What does it do when you run /bin/sh /etc/rc.local from the command line?

*Like Jason said, check dmesg, as well as /var/log/messages for any clues.

*When the script is ran from rc.local, it will not have the full set of environment variables that your root user has when logged in - e.g. $PATH may be different.  Don't rely on $PATH.  You can also test your script by scheduling an 'at' job which will come close to simulating the environment.

A: It's not something simple like a typo is it? Should this:

#!/bin/hash

Really be:

#!/bin/bash

?
(Just like CK said in comment, now that I look)

A: Are you sure your system supports rc.local? If it isn't documented, you will need to follow all of the init scripts. You start at /etc/inittab. (You may find that from there you go to /etc/rc.d/rc)
On some systems, /etc/rc.d/rc.local is supported via a symlink /etc/rc.d/rcX.d/S99local. (where X is the appropriate runlevel).
If you're using RedHat, there's no real reason to not create your own init script, add it to /etc/rc.d/init.d, chkconfig --add the script, and chkconfig on the script. This will make the correct symlinks into the /etc/rc.d/rcX.d directories, and makes init scripts easy to deploy or disable.
Making use of the obsolete rc.local is fine for a quick hack if your system does support it, but it's not really appropriate for something important or permanent.

A: Not sure if processing of init scripts on linux is sequential or parallel, but Solaris systems launch the scripts sequentially. If an earlier init script hasn't yet finished (I see this sometimes due to sendmail/DNS dependency) the later ones don't get launched  as quickly as you'd assume.
Use ps to see if an earlier init script is still running.

A: Perhaps there is a syntax error in the rc.local script.  If you try to manually run it from the command line after the system has booted, does it execute correctly?

A: Have you checked the permissions on the directory which contains the rc.local file?

A: Shouldn't your code look more like this? 3 changes here:
#!/bin/bash
echo "" >> /tmp/configLog
echo "Entering maintenance mode" >> /tmp/configLog

A: rc.local was the BSD way of running startup scripts. Although many Linux versions do support having a file called "rc.local" which is run at startup, as I recall these required a bunch of symlinks and other glue to work, as Linux followed the Solaris way of handling startup scripts.

A: SELinux.
Try getenforce to see if selinux is switched on.
It will return 1 or enforcing if it is turned on.
Then if it is check dmesg to see if there is an selinux related error that looks like it might be to do with your script.

A: If that first line really does say #!/bin/hash then you will get an error similar to this:
-bash: ./test.sh: /bin/hash: bad interpreter: No such file or directory

when it runs.
You might also want to check that the script has execute permissions.


text:
Q: How to implement route path with @ symbol How to implement route path http://test.com/@alex222 using react-router-dom?
Such route doesn't work:
<Route path={'@:userName'} element={<UserPage />} />

Everything ok if it hasn't @ symbol.

A: It works, but deal was with wrapped Route:
 <Routes location={state?.backgroundLocation || location}>
          <Route>
            <Route index element={<MainPage />} />
            <Route path='feed' element={<FeedPage />} />
            <Route
              path='profile'
              element={
                <RequireAuth>
                  <ProfilePage />
                </RequireAuth>
              }
            />
            <Route path={'@:userName'} element={<UserPage />} />
            <Route path='*' element={<NoMatchPage />} />
          </Route>
        </Routes>

Thanks, Drew Reese!


text:
Q: Is it possible to pass netlist via command line to ngspice instead of using input file? Is there a way to use ngspice command line without providing a circuit file? ex: passing the circuit as a string within the command line ?
EDIT
Currently the only way I could use ngspice in command line is by providing an input file.. I could not find an example of using pipe mode though to pass netlist directly via command line without have to use a file to read from.

A: In the interactive shell you can input the netlist line by line using "circbyline". Remember, the first line you always enter is a title, the last line needs to be ".end".
e.g., you can save a file codebyline.cir as follows:
circbyline Example Listing
circbyline R1 1 0 1k
circbyline C1 1 0 1m
circbyline V1 1 0 pulse(0 1 0 1n 1n 1u 2u)
circbyline .tran 0.1n 2u
circbyline .end

And then:
cat codebyline.cir | ngspice

Instead of reading out from a file, any other program can generate the netlist and you can pipe it to ngspice. "circbyline" has to prepend every statement.

A: As commented before, the Window GUI version of ngspice will not work with pipes due to a Windows specific I/O handling.
Maybe you could try finding a workaround.
I think you should have the GUI write the netlist to a file called e.g. "circuit.cir" and have the code of the GUI execute ngspice circuit.cir.
Another option having the GUI making a string based on the netlist and using a batch file which parses the netlist string, writes it to (e.g.) "circuit.cir" and lastly, executes ngspice circuit.cir.
Make sure you seperate each line of the netlist with a unique character (e.g. ¶ or § or whatever) when making one big string of it.


text:
Q: Error when converting bash code to snakefile I want to generate genome index by using STAR. The bash code works in the terminal but I want to convert it to snakefile.
This is the bash code:
STAR --runThreadN 4 --runMode genomeGenerate --genomeDir star --genomeFastaFiles Drosophila_melanogaster.BDGP6.22.dna.toplevel.fa --sjdbGTFfile bdgp6/Drosophila_melanogaster.BDGP6.95.gtf

After running the bash code it generates more then one file in the star directory. One of the files is called genomeParameters.txt, I need this file for further use.
In snakemake:
rule index:
    input:
       fasta = "Drosophila_melanogaster.BDGP6.22.dna.toplevel.fa"
       gtf = "bdgp6/Drosophila_melanogaster.BDGP6.95.gtf"

    output:
        "star"
    shell:
        " STAR --runThreadN 4 --runMode genomeGenerate --genomeDir {output} --genomeFastaFiles {input.fasta} --sjdbGTFfile {input.gtf}"

The ERROR:
SyntaxError in line 10 of /data/storix2/student/Thema11/dme/projectThema11/generateGenomeIndex:
Command must be given as string after the shell keyword. (generateGenomeIndex, line 10)

A: You need a comma after the first input file:
input:
   fasta = "Drosophila_melanogaster.BDGP6.22.dna.toplevel.fa",
   gtf = "bdgp6/Drosophila_melanogaster.BDGP6.95.gtf"

However, the error you are seeing isn't the error I usually get when that comma is missing. I wonder if the space at the beginning of the command is causing the problem. You could also try removing it:
shell:
    "STAR --runThreadN 4 --runMode genomeGenerate --genomeDir {output} --genomeFastaFiles {input.fasta} --sjdbGTFfile {input.gtf}"


text:
Q: Login loop after disabling secure boot I tried disabling the secure boot (to solve an error message from VirtualBox) with sudo mokutil --disable-validation(as per method 2 on the Ubuntu wiki). After rebooting I am stuck in a login loop. If I try the wrong password I have the expected "something went wrong, please try again" message. I wanted to turn the secure boot on again in the BIOS but there I see that secure boot is still enabled (though it's possibly a different thing?)
I have Dell Vostro 14 5459 with Ubuntu 18.04. Thanks in advance for any help!
EDIT: I tried and failed to log in using the tty, neither my account name nor the name in the terminal seem to be correct...
EDIT2: I just had to enter my name in all lowercase, so I'm in tty. However, I've checked for what seem to be the most common causes of a login loop (.Xauthority and/or tmp permissions), and everything's alright there.
EDIT3: startx shows black screen and then the shell again. sudo apt update && apt upgrade did not help either.

A: Finally realized that I could use sudo mokutil --enable-validation which allowed me to log in after the reboot! Still have this pesky VirtualBox problem.


text:
Q: Another evening, another meta-tag: 'alternative' alternative seems to be a great way to find shopping questions.
There are over 300. Should we attempt to close them out, or just call Trogdor on the tag?

A: I would rather close the questions that need to be closed. Once the tag is burninated, there is no track of it, and it is not possible to know which questions had it.
Actually, not all the questions using that tag are shopping questions; there are questions that are about alternative methods for doing something (or alternative code to use). For sure, there are some questions that are not so good, and that could be closed, even if they are not shopping questions.
Once the questions to close are closed, the tag can be burninated.

A: Please note, before burninating this tag, that it has a valid use in reference to something specifically named Alternative, which is defined in Haskell's core library--"core" in the sense that versions of this library are inextricably tied to a specific compiler version, despite being treated as a regular library most of the time.
That said, there appear to be only two questions with both alternative and haskell so the utility of the tag is minimal.


text:
Q: Maven ignoring local repository location changes Im trying to change the location of Mavens local repository, but it didnt work for me so far.
Im currently doing the tutorial of quarkus: https://quarkus.io/guides/getting-started
I changed the localRepository setting in the settings.xml to
 <localRepository>D:\Zubehoer\Maven\repository</localRepository>
and also copied that settings.xml to the .m2 folder in my user home.
When I do mvn compile quarkus:dev as shown in linked tutorial the dependencys get downloaded to the default repository instead of the location I changed the local repository to.
Lastly the pom of the project:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.acme</groupId>
  <artifactId>getting-started</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus-plugin.version>1.5.2.Final</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.5.2.Final</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>${quarkus.platform.artifact-id}</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>

Edit:
Relevenat image of  maven debug output

A: So by default the <localRepository></localRepository> property of mavens settings.xml is inside a comment:
<!-- localRepository** | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> -->
As I only changed the value of the localRepository property, but did not move the property outside of the comment it didnt work.


text:
Q: android jacoco coverage empty with gradle I'm trying to make jacoco create a code coverage report for my android test project. I have the following in build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
...
jacoco {
    toolVersion = "0.7.1.201405082137"
}
...
android {
    buildTypes {
        release {
        }
        debug {
            testCoverageEnabled true
        }
    }
}

when I run gradlew -i createDebugCoverageReport, I get a coverage report, but it's empty. the end of the gradle execution is as follows:
:androidTest:connectedAndroidTest (Thread[main,5,main]) completed. Took 2 mins 36.951 secs.
:androidTest:createDebugCoverageReport (Thread[main,5,main]) started.
:androidTest:createDebugCoverageReport
Executing task ':androidTest:createDebugCoverageReport' (up-to-date check took 0.006 secs) due to:
  Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug has changed.
  Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug/index.html has been removed.
  Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug/.resources/package.gif has been removed.
[ant:reportWithJacoco] Loading execution data file /home/akos/src/androidTest/build/outputs/code-coverage/connected/coverage.ec
[ant:reportWithJacoco] Writing bundle 'debug' with 3 classes
:androidTest:createDebugCoverageReport (Thread[main,5,main]) completed. Took 0.215 secs.

BUILD SUCCESSFUL

Total time: 4 mins 53.467 secs

and indeed, the coverage.ec file referenced above is empty (of 0 length)
in the directory build/intermediates/coverage-instrumented-classes/  , I seem to have the instrumented class files
this is with gradle 2.1
what am I doing wrong?

A: Try to generate the debug coverage report using Nexus device (5 or 5x), it will works perfectly. I was facing same issue with Samsung devices (coverage.ec is empty) but after that I run it with Nexus 5x and everything was working fine.

A: I use same gradle.build and just enter the command below to terminal. It gave me coverage report and test result as a html page.

$./gradlew createDebugCoverageReport

Another suggestion is ; enter terminal

$./gradlew --gui

it opens a gui window and you can find the correct command.

A: There's a problem in the Android Gradle Plugin 0.14.0 that generates an empty coverage.ec file. It's known and was fixed in a branch but doesn't seem to have made it out to the public yet:
https://code.google.com/p/android/issues/detail?id=78556
On the other hand, a lovely workaround template project for Android Studio can be found here using Jacoco and RoboElectric:
https://github.com/nenick/android-gradle-template
So you can wait for Google to fix it or use someone else's build library repository, but Android Studio 1.0.0's gradle plugin is useless.

A: Jacoco should be inside of the android closure and the jacoco plugin declaration is not necessary:
apply plugin: 'com.android.application'
...
android {
    buildTypes {
        release {
        }
        debug {
            testCoverageEnabled true
        }
    }
    jacoco {
        toolVersion = "0.7.1.201405082137"
    }
}

A: I found a solution to same problem from Jacoco code coverage in Android Studio with flavors. It has example what to do in case coverage.ec is generated instead of testDebug.exec.

*

*I created the jacocoTestReport task.

*I executed $./gradlew createDebugCoverageReport which generates the coverage.ec file

*After that I executed $./gradlew jacocoTestReport and that creates the HTML.

A: Sometimes due to some security restrictions on the underlying hardware you are unable to get coverage reports. In my case I was using android:sharedUserId="android.uid.system" and due to this it was not picking up any coverage and was giving me an empty file.
So I agree naran that you should try running it on different devices and make sure your app is not using android:sharedUserId="android.uid.system".

A: I made an interesting observation. I had the same problem, with the coverage.ec File having a size of 0 bytes. I tried all the answers here as well as these ones:
https://code.google.com/p/android/issues/detail?id=170607
It didn't change anything. My build.gradle file has only these settings to let jacoco work:
apply plugin: 'com.android.application'
apply plugin: 'jacoco'

android {
    ...
buildTypes {
   ...
    debug {
        testCoverageEnabled true
    }
}

...
}

My Android Studio Version is 1.2.2. I have the following gradle settings in "File -> Project Structure":

*

*Gradle version: 2.2.1

*Android Plugin Version: 1.2.3

I tried to run the instrumentation tests with gradlew cC on an Motorola Moto G 4G LTE - Android 4.4.4 with correctly ran the instrumentation tests but with a coverage.ec file having 0 bytes. Today I tried another device: LG Spirit 4G LTE - Android 5.0 and now code coverage works!!! The coverage.ec file has 322 bytes and I see correct html coverage reports.
What I think is that sometimes running gradle with gradlew cC --debug shows that coverage.ec cannot be found on the device and sometimes it shows the file being pulled. But maybe in both situations it cannot be found on the device. So choosing another device can fix the problem. Good luck!

A: Now (Oct 2015) you can use it as android team has fixed the bug.
android {
    ...
    buildTypes {
        debug {
            testCoverageEnabled true
        }
    }
    ...
    dependencies{
        androidTestCompile 'com.android.support.test:runner:0.4.1'
        // Set this dependency to use JUnit 4 rules
        androidTestCompile 'com.android.support.test:rules:0.4.1'
        // Set this dependency to build and run Espresso tests
        androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
        // Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource
        androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'
    }
}

Then just use ./gradlew createDebugCoverageReport.


text:
Q: Inserting Item Collection in Asp.net I am trying to insert some words that i keep as an item .My project is asp.net web project.I would like to generate id for each word and keep 4 field null.There are 6 fields in my word table in database.id word length fr Boolean weight.
When I run the project I get this error.

ExecuteNonQuery requires an open and available Connection. The
  connection's current state is closed.

Here the code,
 using (con){
    con.Open();

    foreach (var item in results) {//here trying to insert word its id and some other informations but for now they can stay null(yes,null allowed for them)
        id++;
        SqlCommand cmd= con.CreateCommand();
        cmd.CommandText= "insert into word values('"+id+"','"+item.Word+"','"+0+"','"+0+"','"+0+"','"+0+"')";

        cmd.ExecuteNonQuery();
        con.Close();
    }

Edit:
I have moved the con.Close out of iteration loop but here now I got this error;

Server Error in '/' Application.
Incorrect syntax near 's'. Unclosed quotation mark after the character
  string ')'.

 using (con){
        con.Open();

        foreach (var item in results) {//here trying to insert word its id and some other informations but for now they can stay null(yes,null allowed for them)
            id++;
            SqlCommand cmd= con.CreateCommand();
            cmd.CommandText= "insert into word values('"+id+"','"+item.Word+"','"+0+"','"+0+"','"+0+"','"+0+"')";

            cmd.ExecuteNonQuery();

        }  con.Close();
}   }

A: In your code:
using (con){
    con.Open();

    foreach (var item in results) {
        //here trying to insert word its id and some other informations but for now they can stay null(yes,null allowed for them)
        id++;
        SqlCommand cmd= con.CreateCommand();
        cmd.CommandText= "insert into word values('"+id+"','"+item.Word+"','"+0+"','"+0+"','"+0+"','"+0+"')";

        cmd.ExecuteNonQuery();
        con.Close();
    }

You have written con.Close() in the foreach, so at the end of the first loop you close your connection.
So move the con.Close() after the close bracket of your foreach like this:
using (con){
con.Open();

foreach (var item in results) {//here trying to insert word its id and some other informations but for now they can stay null(yes,null allowed for them)
    id++;
    SqlCommand cmd= con.CreateCommand();
    cmd.CommandText= "insert into word values('"+id+"','"+item.Word+"','"+0+"','"+0+"','"+0+"','"+0+"')";

    cmd.ExecuteNonQuery();
}
con.Close();

A: on first iteration your'e closing the SQL Connection.
move the line: "con.Close();" outside of the loop.
For your second problem, make sure you escape quatation mark in word property
and try using string format to create insert string
string word = String.Replace(item.Word,"'","''")
cmd.CommandText = string.Format("insert into word values('{0}','{1}','{2}','{3}','{4}','{5}')", id, word, 0, 0, 0, 0);

A: Move con.Close();  outside foreach (){}

A: You have to be sure that every word (item.Word) has no quotation char, maybe
String.Replace(item.Word,"'","''")

resolve your problem.


text:
Q: What is GLIBC? What is it used for? I was searching for the source code of the C standard libraries. What I mean with it is, for example, how are cos, abs, printf, scanf, fopen, and all the other standard C functions written, I mean to see their source code.
So while searching for this, I came across with GLIBC, but I don't know what it actually is. It is GNU C Library, and it contains some source codes, but what are they actually, are they the source code of the standard functions or are they something else? And what is it used for?

A: Its the implementation of Standard C library described in C standards plus some extra useful stuffs which are not strictly standard but used frequently.
Its main contents are :
1) C library described in ANSI,c99,c11 standards. It includes macros, symbols, function implementations etc.(printf(),malloc() etc)
2) POSIX standard library. The "userland" glue of system calls. (open(),read() etc. Actually glibc does not "implement" system calls. kernel does it. But glibc provides the user land interface to the services provided by kernel so that user application can use a system call just like a ordinary function.
3) Also some nonstandard but useful stuff.
"use the force, read the source "
$git clone git://sourceware.org/git/glibc.git

(I was recently pretty enlightened when i looked through malloc.c in glibc)

A: Yes, It's the implementation of standard library functions.
More specifically, it is the implementation for all GNU systems and in almost all *NIX systems that use the Linux kernel.

A: Here are a few "hands-on" points of view:

*

*it implements the POSIX C API on top of the Linux kernel: What is the meaning of "POSIX"?

*it contains several assembly hand-optimized versions of ANSI C functions for several different architectures, e.g. strlen:

*

*sysdeps/x86_64/strlen.S

*sysdeps/aarch64/strlen.S

*how to modify its source, recompile and use it understand it better: How to compile my own glibc C standard library from source and use it?

*how to GDB step debug it with QEMU and Buildroot: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/9693c23fe6b2ae1409010a1a29ff0c1b7bd4b39e#gdbserver-libc

A: There are several implementations of the standard. Glibc is the implementation that most Linuxes use, but there are others. Glibc also contains (as Aftnix states) the glue functions which set up the scene for jumps into the kernel (also known as system calls). So many of glibc's 'functions' don't do the actual work but only delegate to the kernel.
To read the source of Glibc, just google for it. There are myriad sites which carry it, and also several variations.
Windows uses Microsoft's own implementation, which I believe is called MSVCR.DLL. I doubt that you will find the source code to that library anywhere. Also note that some functions which a Linux hacker might think of as 'standard', simply don't exist on Windows (notably fork). The reverse is also true.
Other systems will have their own libc.

A: The glibc package contains standard libraries which are used by multiple programs on the system. In order to save disk space and memory, as well as to make upgrading easier, common system code iskept in one place and shared between programs. This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function. The glibc package also contains national language (locale) support.


text:
Q: Missing module error: nvsql.ole The following error message pops up at 10:29 AM every day, and has done so consistently for about six months:
There was a problem starting C:\Users\xxxxx\AppData\Roaming\wupdate\nvsql.ole

The specified module could not be found.

I'd like to do at least one of these two things, if not both:

*

*I would like to get rid of the error message.

*I would like to know what nvsql.ole is and how to get the program/service that depends on it working again. I'm guessing this is a corrupt installation, but I've been completely unable to determine what it is that has been corrupted.

A: In general, when you are receiving mysterious error messages, and especially in your case where you can't find any information by googling the file path in the error message, there are some lower level steps you can take to attempt to diagnose the problem.
Here is what I would do in your shoes, in order of difficulty / expertise required:

*

*Go to Start -> Run, or alternatively, type Windows Key + r, and then type taskschd.msc and click OK.

*

*In the "Task Scheduler" that pops up, look under the "Active Tasks" pane for any tasks that are scheduled to run at or around the time you receive the message.

*Keep in mind that the program that's scheduled to run may have to execute an action for several seconds/minutes/hours before it displays that error message, so if you don't see 10:29 AM, don't assume that the task isn't there.

*Look for almost anything that runs on a daily basis around-ish that time.

*Once you identify something interesting-looking, double-click on the entry for it in the Active Tasks pane, and observe the properties of the task.

*Under the "Actions" pane, you may see an action such as "Start a program", with a path given to the program that's being invoked. Once you get the name of this executable, you can either google the .exe name, or look at other files that reside in the same folder as the executable and attempt to determine what it is.

*The executable name is very likely to have some documentation on it in Google, unless it's an in-house thing that your company developed.

*If Task Scheduler doesn't have anything in it that looks relevant, you can use Process Monitor from SysInternals (now part of Microsoft) to get more information about exactly what's going on on your system. Process Monitor requires administrative privileges to be maximally useful.

*

*Download and install it, obtain admin rights from your system administrator if you're in a corporate IT environment, then start Process Monitor around 10:25 AM or so, and let it capture stuff (file reads/writes, etc).

*Try not to do anything with your computer while Process Monitor is running. Don't browse the web, don't edit documents, don't check email, don't do anything! Close as many background programs as you possibly can. This will minimize the amount of "noise" you get when Process Monitor captures system activity, thus making it easier for you to find the real culprit when 10:29 AM rolls around.

*Examine the file and registry accesses that occur exactly at 10:29 AM. You may see that a program is being launched, and that files from the \AppData\Roaming\wupdate folder are being accessed. It will tell you the name of the process that accessed (or attempted to access) that file. You can then google the name of the process, or ask Process Monitor to tell you the file path of the process, and then see if the folder name gives any details about the company that developed the program.

*You can also right-click on the executable itself in Windows Explorer, go to Properties, then look at the details and see if the executable has any information about what the program is -- company, program name, etc.

Once you've used one of these methods to identify what the program is, then you can start to take some meaningful steps to fixing it:

*

*If you're sure you know what the program is, you can uninstall and reinstall the program to see if it fixes it. Or, if you don't need the program, just remove it.

*If you don't know what the program is, and you don't want it to keep running, you can remove its Task Scheduler entry (if one exists; it's not absolutely required that any periodically running program must use Task Scheduler; it could be using anything to do its timing...) or try to delete the program / .exe that launches at 10:29 AM.

*If you can identify the vendor and product name of the program, you can try contacting the vendor, quoting the error message and asking if there's a way to resolve it.

*You can try renaming the entire "wupdate" folder in your Roaming folder to something else. This will make the program fail to find that folder at all. Some programs, if the data in there isn't critical to your work, will just re-create the folder and any requisite files inside... maybe if it's just some kind of a cache, you don't care, and the program will stop complaining?

*As a last-ditch effort, you can try reinstalling Windows, then install your programs one by one, and if the message starts occurring again, then you know that one of the programs you normally use is causing it.

These steps can be difficult or impossible in a corporate IT environment where you don't have admin rights, so if that is the case, tread lightly and be sure to work on this in cooperation with your local IT staff, instead of trying to get around them or go behind their back.


text:
Q: Can I archive a RAID NAS by removing and storing the drives? We have a netgear readynas pro with 6 drives.  It's configured using netgear's X-RAID2 format, which is (I think) similar to RAID 5.  The NAS is almost completely full, and needs to be cleaned up and archived, so we are asking our lab members to copy all their data off the drive and archive what they aren't actively using.
We're then going to back up the NAS and wipe it, and let people put the data they are still actively using back on.
Instead of copying the data from the NAS onto drives (using e.g. rsync), I am wondering if I can just label the drives and put them in a box, then install new drives in the NAS.  This would also allow us to expand the capacity, and I would hope that if we needed to access the old data, we could just put the old drives back in a readynas shell.
My concern is I don't know how sensitive this would be to "something changing"  Could we put the disks back in any readynas pro shell, or would it have to be the one we originally took them out of?  If we updated the firmware, would this prevent us from accessing the data again?

A: Personally, I wouldn't trust hard disk drives for any type of long-term archiving. The "something changing" concern is certainly reasonable, but I'd also be concerned that hard disk drives aren't designed to be a long-term archival storage medium.
If I was going to archive data on disks I would want the data stored in the least-proprietary format possible. Something like a simple ext3 volume would make me reasonably comfortable that I would be able to read it in the future. I'd also make two copies, store them in different locations, and plan on making copies onto new media 2 or 3 years down the road.

A: If you are going to take the existing drives and "put them in a box", then I strongly urge you to also store the NAS device with them. The problem with proprietary RAID solutions is that there's no guarantee that future devices will be backward compatible with the format used on your particular drives. Let's say 5-10 years from now, when your NAS device dies and you replace it, will your new device be able to read your old boxed drives? Who knows?
Furthermore, what are you going to do tomorrow if you discover that---oh, crap!---we need to get something off our old NAS drives! Are you going to shut down the existing NAS array in order to load the old drives to do the restore, and thus create downtime for users of the existing array? Not good.
In summary, if you do need to keep a backup, it is probably best to put it on media that are specifically designed for long-term backup/archive. These days, that means tape. If tape is too expensive or otherwise infeasible, then the next best thing is probably to box up the entire array---device and drives together---and store them in a cool, dry place.


text:
Q: How do I use comparison symbols with input in python I'm trying to make a program that will respond to someones age but I can't figure out how to use the comparison symbols. Here is the code I'm trying to run,
age = input('How old are you? \n >>')
if (age < 20):
    print('Hey you are pretty young.')
if (age > 20):
    print('wow you are pretty old')

But when I try to run this I get this Error,
Traceback (most recent call last):
  File "C:/Users/Daniel/Desktop/Computer science/week 6/age.py", line 2, in <module>
    if (age < 20):
TypeError: '<' not supported between instances of 'str' and 'int'

A: What you get as input is a string, you need to cast it to an int before you can compare it:
age = int(input('How old are you? \n >>'))

Better yet, add some error handling, e.g.:
try:
    age = int(input('How old are you? \n >>'))

except ValueError as ex:
    print("Not a valid age.")


text:
Q: move_uploaded_file() not working with valid ['tmp_name'] This baffles me. For some weird reason, move_uploaded_file() doesn't put the file into the directory, yet it returns a valid tmp_name and name. So in this case $file always = to false.
Anyway, can anyone point some problems with this code? It would be greatly appreciated.
    <?php
include 'realtydevkit.php';
session_start();
$name = $_FILES['yourlogo']['name'];
$tmpname = $_FILES['yourlogo']['tmp_name'];

if ($name) {
    $directory = $name;
    $userid = $_SESSION['userid'];
    $type = "logo";

    $file = move_uploaded_file($tmpname, $directory);

    if ($file == true) {
    mysql_query("INSERT INTO usercontent
    (`userid`, `type`, `url`) VALUES
    ('$userid', '$type', '$directory')");
    echo 'Uploaded';
    echo "";
    } else {
    echo 'There was an error moving the file.';
    }
}

?>

A: You're not checking $_FILES['yourlogo']['error'], either.
Here is what you check with an uploaded file:

*

*Check $_FILES['yourlogo']['error']. If it is UPLOAD_ERR_OK (0), then proceed.

*Check is_uploaded_file($_FILES['yourlogo']['tmp_name']). If this fails, PHP doesn't know what went wrong, but it doesn't trust the file.

*Assemble the destination path.

*Use move_uploaded_file().

If move_uploaded_file() errors, then PHP can't write the file at the destination. This is usually an invalid path or it doesn't have permissions.
Note that $_FILES['yourlogo']['name'] is the name the file had on the uploader's PC. It shouldn't have any path information.

A: <?php
include 'realtydevkit.php';
session_start();
$name = $_FILES['yourlogo']['name'];
$tmpname = $_FILES['yourlogo']['tmp_name'];
if ($name) {
    $directory = $name;
    $userid = $_SESSION['userid'];
    $type = "logo";
    $file = move_uploaded_file($tmpname, "path of ur directore/".$directory);
    if ($file == true) {
    mysql_query("INSERT INTO usercontent
    (`userid`, `type`, `url`) VALUES
    ('$userid', '$type', '$directory')");
    echo 'Uploaded';
    echo "";
    }
   else
   {
    echo 'There was an error moving the file.';
    }
}

?>


text:
Q: Beyond CVS Eclipse Plug-In Problem I have installed the Beyond CVS Eclipse Plug-In version 0.8.9
I use eclipse 3.6.2 (Helios), windows 7 64 bit, beyond compare 3, subclipse.
I configured the external Diff/Merge tool:

But when I compare:

I get the following error:

The path specified for beyond compare in the first screenshot exists, there are no problems there. But for somewhat reason, the error says otherwise. I can't figure out what is the problem.

A: The UI you show for setting the external diff/merge is a Subclipse feature.  It only applies to launching an external tool for resolving conflicts after update or merge.  The BeyondCompare plugin perhaps has some UI in Eclipse to tell it where the executable is located.

A: Check your error log; maybe an exception was logged which tells you more.


text:
Q: Microsoft Visual Studio 2013: Unable to invoke command "Format Document" During Format Document command in razor cshtml file, I am getting the following message in Visual Studio 2013:

Index and length must refer to a location within the string.

Anyone having similar issue? Is there a known workaround for that?


text:
Q: Simple Java Applet Not Displaying in Browser When I view my Applet using AppletViewer, it looks fine. However, when I try to run it in Safari, it doesn't show up. Same problem with Chrome, Firefox, and Opera.
Here's my Java code:
import java.awt.*;
import javax.swing.JApplet;

public class WelcomeApplet extends JApplet
{
    public void paint(Graphics g)
    {
        super.paint(g);
        //setSize(500, 190);

        g.setColor(Color.red);
        g.drawString("Welcome to Java applet programming!", 30, 30);

        g.setFont(new Font("Courier", Font.BOLD, 24));
        g.drawString("Courier bold 24pt font", 30, 36);

        g.setFont(new Font("Arial", Font.PLAIN, 30));
        g.drawString("Arial plain 30pt font", 30, 70);

        g.setFont(new Font("Dialog", Font.BOLD + Font.ITALIC, 36));
        g.drawString("Dialog italic bold 36pt font", 30, 110);

        g.setFont(new Font("Serif", Font.ITALIC, 42));
        g.drawString("Serif italic 42pt font", 30, 156);
    }
}

And here's my HTML:
<HTML>
    <HEAD>
        <TITLE>Welcome Applet</TITLE>
    </HEAD>
    <BODY>
        <OBJECT CODE="WelcomeApplet.class" WIDTH="440" HEIGHT="50">
        </OBJECT>
    </BODY>
</HTML>

Everything compiles fine. All of my files are in the same directory on my computer. There's nothing showing up in the Java console.
Thanks for any help!
EDIT: Suggested question does not address problem


text:
Q: Isomorphism between $M/I^nM$ and $\hat{M}/\hat{I}^n\hat{M}$ For a ring $A$, an ideal $I\subset A$ and an $A$-module $M$, let $\hat{M}$ denote the $I$-adic completion of $M$.
I'm trying to prove that $M/I^nM\simeq\hat{M}/\hat{I}^n\hat{M}$.
The map $f:M/I^nM\to\hat{M}/\hat{I}^n\hat{M}$ is given by $[m]\mapsto[(m,m,...)]$, which I've checked to be well-defined.
I've found in many places that the inverse map $f^{-1}$ is a "naturally" defined map, but it's definitely not natural for me yet.
I've realized that if $(x_i)_{i\geq 1}\in\hat{M}$, then for $m\geq 1$ large enough, we get $[(x_i)_{i\geq 1}]=[(x_1,...,x_m,x_m,...)]$ in $\hat{M}/(\hat{I})^n\hat{M}$, so I've tried to define $f^{-1}([(x_i)_{i\geq 1}]):=[x_m]$, and I've checked that $f^{-1}\circ f=id$, but couldn't prove that $f\circ f^{-1}=id$, because by applying $f^{-1}$ we lose the information about the first terms in the sequence.
Then how should I define $f^{-1}$?

A: I think you're confusing yourself because you're representing elements of quotients of $M$ by elements of $M$ and forgetting that there's an equivalence relation on them.  In particular, if $(x_1,x_2,\dots)$ is an element of $\hat{M}$ where each $x_i$ is an element of $M$, there is an equivalence relation on such sequences since we only actually care about the image of $x_i$ in $M/I^iM$ (that is, an element of $\hat{M}$ should really be a sequence where the $i$th term is an element of $M/I^iM$).  In particular, this means that $$(x_1,x_2,\dots,x_m,x_{m+1},\dots)$$ is the exact same element of $\hat{M}$ as $$(x_m,x_m,\dots,x_m,x_{m+1},\dots).$$  The compatibility conditions required for the first sequence to be an element of $\hat{M}$ to begin with say that the image of $x_m$ in $M/I^iM$ for $i\leq m$ must be equal to the image of $x_i$, so that these two sequences are the same when we think of the $i$th term as being in $M/I^iM$ rather than in $M$.  This is exactly what you need for $f\circ f^{-1}$ to be the identity.


text:
Q: Repeat values down a grouping column using R I have the following data.frame:
df <- data.frame(value = 1:23)

df |>
  mutate(group = case_when(value < 4 ~ "A",
                           value >= 4 &  value < 18 ~ "B",
                           value >= 18 & value <= 23 ~ "C"))

I want to add two more columns using mutate. The first that repeats the pattern c("white", "black") n times, for each group
Desired outcome:
   value group  color
1      1     A  white
2      2     A  black
3      3     A  white
4      4     B  white
5      5     B  black
6      6     B  white
7      7     B  ...
8      8     B
9      9     B
10    10     B
11    11     B
12    12     B
13    13     B
14    14     B
15    15     B
16    16     B
17    17     B
18    18     C  white
19    19     C  black
20    20     C  white
21    21     C  ...
22    22     C
23    23     C

The second column repeats the pattern 1:nrows twice for each group.
   value group  color distance
1      1     A  white 1
2      2     A  black 1
3      3     A  white 2
4      4     B  white 1
5      5     B  black 1
6      6     B  white 2
7      7     B  ...   2
8      8     B        3
9      9     B        3
10    10     B        4
11    11     B        4
12    12     B        5
13    13     B        5
14    14     B        6
15    15     B        6
16    16     B        7
17    17     B        7
18    18     C  white 1
19    19     C  black 1
20    20     C  white 2
21    21     C  ...   2
22    22     C        3
23    23     C        3

A: You may want to use the following:
library(dplyr)

df <- data.frame(value = 1:23)

df %>%
  mutate(group = case_when(value < 4 ~ "A",
                           value >= 4 &  value < 18 ~ "B",
                           value >= 18 & value <= 23 ~ "C")) %>%
  group_by(group) %>%
  mutate(color = if_else(row_number() %% 2 == 1, "white", "black"),
         distance = rep(1:n(), each =2)[1:n()]) %>%
  ungroup

#> # A tibble: 23 × 4
#>    value group color distance
#>    <int> <chr> <chr>    <int>
#>  1     1 A     white        1
#>  2     2 A     black        1
#>  3     3 A     white        2
#>  4     4 B     white        1
#>  5     5 B     black        1
#>  6     6 B     white        2
#>  7     7 B     black        2
#>  8     8 B     white        3
#>  9     9 B     black        3
#> 10    10 B     white        4
#> # … with 13 more rows


text:
Q: Hamiltonian Mechanics and the Symplectic Category Are canonical transformations (in the sense of Hamiltonian mechanics) morphisms for a certain category?
They seem to fit the archetypal description of morphisms being "structure-preserving maps".
Are canonical transformations equivalent to symplectomorphisms? (The canonical equations seem to suggest as much.) I.e. is "canonical transformation" the physicist jargon for what a mathematician would call a symplectomorphism?
If so, then does that mean that canonical transformations are just the morphisms of the symplectic category? (Called the Weinstein symplectic category in nLab.)
Do we lose any generality by only considering symplectic manifolds, or are those implicitly the only objects under study in Hamiltonian mechanics?
https://ncatlab.org/nlab/show/Weinstein+symplectic+category

A: Yes, canonical transformations (which are defined on the phase space $T^*\Bbb R^n$) are the same as symplectomorphisms - usually a canonical transformation is a diffeomorphism of $T^*\Bbb R^n$ that pulls back the canonical 1-form $\sum p_i dq_i$ to itself plus some exact 1-form. This is entirely equivalent (because $H^1(T^*\Bbb R^n) = 0$) to saying that it pulls back the symplectic form $\sum dp_i \wedge dq_i$ to itself - that is, that it's a symplectomorphism. For reinforcement, see page 18 of McDuff-Salamon: there they say "In the classical literature on Hamiltonian mechanics, symplectomorphisms are sometimes called canonical transformations."
But you should be warned about thinking about a "symplectic category". The first naive notion of such an object is as you say, manifolds and symplectomorphisms; but this doesn't allow interesting maps between different symplectic manifolds - this category is what's called a groupoid. (All morphisms are isomorphisms.) A second attempt might be to take symplectic manifolds and morphisms $f: (M,\omega) \to (N,\omega')$ if $f^*\omega' = \omega$. But this is again very restrictive: these maps are always immersions, for instance, and therefore cannot decrease dimension, or plenty of other interesting things one might like to do.
You somehow want a way of going between legitimately different symplectic manifolds, especially for the purposes of symplectic field theory, which assigns an object (the Fukaya category) to each manifold; you'd like a way to go between these objects for different symplectic manifolds in an interesting way. You do this by Lagrangian correspondences. This is inspired by the fact that given a symplectomorphism $(M,\omega_1) \to (M',\omega_2)$, the graph is a Lagrangian submanifold of $(M \times M', \pi_1^* \omega_1 - \pi_2^*\omega_2)$. So you define a morphism to always be a Lagrangian submanifold of this product. These don't compose, so Wehrheim-Woodward generalized them to the inspirationally named "generalized Lagrangian correspondence". But these are much more general than symplectomorphisms.


text:
Q: Apparently no causes for the error "TypeError: Cannot read properties of undefined " I have to show in the layout some data I take from a database. Here is the code I use to fetch the data:
    const [array, setArray] = useState([])
    const collectionRef = collection(db, "Collection")
    const q = query(collectionRef, orderBy("Order", "desc"))

    useEffect(() => {
      auth.onAuthStateChanged(function (user) {
      if (user) {
             onSnapshot(q, (data) =>
             setArray(data.docs.map((doc) => ({ ...doc.data(), id: doc.id })))
         );
      }
    })
   }, [auth]);

Below is the html

{array[0].Name}

What baffles me most is that the error does not always show up, sometimes everything works and sometimes it stops working without apparent causes. If I do console.log of the array sometimes it prints the data and everything works, sometimes it prints an empty array and does nothing.
I state that that array is never modified, it is loaded at the beginning of the code and the data is only read.

A: array is empty for the first render and for all the other renders until the data is returned. Try something like:

{array.length && array[0].Name}


text:
Q: How to print a control hierarchy in Cocoa? Carbon had a useful function called DebugPrintControlHierarchy.
Is there something similar for NSView or NSWindow?

A: Here's the guts of an NSView category I built awhile back:
+ (NSString *)hierarchicalDescriptionOfView:(NSView *)view
                                      level:(NSUInteger)level
{

  // Ready the description string for this level
  NSMutableString * builtHierarchicalString = [NSMutableString string];

  // Build the tab string for the current level's indentation
  NSMutableString * tabString = [NSMutableString string];
  for (NSUInteger i = 0; i <= level; i++)
    [tabString appendString:@"\t"];

  // Get the view's title string if it has one
  NSString * titleString = ([view respondsToSelector:@selector(title)]) ? [NSString stringWithFormat:@"%@", [NSString stringWithFormat:@"\"%@\" ", [(NSButton *)view title]]] : @"";

  // Append our own description at this level
  [builtHierarchicalString appendFormat:@"\n%@<%@: %p> %@(%li subviews)", tabString, [view className], view, titleString, [[view subviews] count]];

  // Recurse for each subview ...
  for (NSView * subview in [view subviews])
    [builtHierarchicalString appendString:[NSView hierarchicalDescriptionOfView:subview
                                                                          level:(level + 1)]];

  return builtHierarchicalString;
}

- (void)logHierarchy
{
  NSLog(@"%@", [NSView hierarchicalDescriptionOfView:self
                                               level:0]);
}

Usage
Dump this into an NSView category, dump this in it. Include the category header wherever you want to use it, then call [myView logHierarchy]; and watch it go.

A: I don't know what exactly DebugPrintControlHierarchy printed, but NSView has a useful method call _subtreeDescription which returns a string describing the entire hierarchy beneath the receiver, include classes, frames, and other useful information.
Don't be scared about the leading _ underscore. It's not public API, but it is sanctioned for public use in gdb. You can see it mentioned in the AppKit release notes along with some sample output.

A: Swift 4.
macOS:
extension NSView {

   // Prints results of internal Apple API method `_subtreeDescription` to console.
   public func dump() {
      Swift.print(perform(Selector(("_subtreeDescription"))))
   }
}

iOS:
extension UIView {

   // Prints results of internal Apple API method `recursiveDescription` to console.
   public func dump() {
      Swift.print(perform(Selector(("recursiveDescription"))))
   }
}

Usage (in debugger): po myView.dump()


text:
Q: How to pull FieldPermission & ClassAcces from an Org without SourceTracking enabled I recently started a project, which has a OLD Sandbox, where development was going on, now we need to start using GIT, which is causing huge problem, because we are not able to pull FieldPermissions & ClassAccess for Profiles means we will not be able to set CI/CD.
Do any one have solution how we can enable SourceTracking on existing Sandboxes once it is enabled in Prod.

A:
Do any one have solution how we can enable SourceTracking on existing
Sandboxes once it is enabled in Prod.

No. You have to refresh the sandbox from production (which you've enabled it in) to have SourceTracking in the sandbox. It's highlighted in Enable Source Tracking in Sandboxes

To enable Source Tracking in Sandboxes:

*

*Log in to your production org.

*From Setup, in the Quick Find Box,
enter Dev Hub and select Dev Hub.

If you don't see Dev Hub in the
Setup menu, make sure that your org is one of the supported editions.
Dev Hub is available in Enterprise, Performance, and Unlimited
Editions.

*Select Enable Source Tracking in Developer and Developer Pro
Sandboxes.

After you enable this setting, Developer and Developer Pro
Sandboxes that are created or refreshed have Source Tracking enabled.
For information about how to use source tracking in sandboxes, see the
Salesforce DX Developer Guide.

In terms of profiles, there's nothing stopping you from pulling the relevant metadata in a sandbox even if it's less efficient. Profiles return information only when your retrieval/request contains the related metadata

The content of a profile returned by Metadata API depends on the
content requested in the RetrieveRequest message. For example,
profiles only include field-level security for fields included in
custom objects returned in the same RetrieveRequest as the profiles.

As such, to get FieldPermissions and ClassAccess, you will need to make sure you're retrieving all your Objects and Apex Classes when retrieving
sfdx force:source:retrieve -m "CustomObject,ApexClass,Profile"
However, the big caveat is that the above will pull all custom objects/fields, but not the standard objects. Noted in sample package.xml manifest files,

Note how you work with the standard Account object by specifying it as
a member of a CustomObject type. However, you can't use an asterisk
wildcard to work with all standard objects; each standard object must
be specified by name.

As such, you'll have to specify each standard object as a member of a CustomObject type as well as the wildcard for all custom objects.
sfdx force:source:retrieve -m CustomObject:Account,Contact,....
Since the list will be long, it's easier to create a package.xml to reference in your command
sfdx force:source:retrieve -x path/to/package.xml
Below is a list from my developer org and may not contain all the ones you may have:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>*</members>
    <members>Account</members>
    <members>AccountBrand</members>
    <members>AccountContactRole</members>
    <members>AccountTeamMember</members>
    <members>ActiveScratchOrg</members>
    <members>Activity</members>
    <members>AlternativePaymentMethod</members>
    <members>Asset</members>
    <members>AssetRelationship</members>
    <members>AssistantProgress</members>
    <members>AuthorizationForm</members>
    <members>AuthorizationFormConsent</members>
    <members>AuthorizationFormDataUse</members>
    <members>AuthorizationFormText</members>
    <members>Campaign</members>
    <members>CardPaymentMethod</members>
    <members>Case</members>
    <members>ChannelProgram</members>
    <members>ChannelProgramLevel</members>
    <members>ChannelProgramMember</members>
    <members>CommSubscription</members>
    <members>CommSubscriptionChannelType</members>
    <members>CommSubscriptionConsent</members>
    <members>CommSubscriptionTiming</members>
    <members>Contact</members>
    <members>ContactPointAddress</members>
    <members>ContactPointConsent</members>
    <members>ContactPointEmail</members>
    <members>ContactPointPhone</members>
    <members>ContactPointTypeConsent</members>
    <members>ContactRequest</members>
    <members>Contract</members>
    <members>DataUseLegalBasis</members>
    <members>DataUsePurpose</members>
    <members>DelegatedAccount</members>
    <members>DigitalWallet</members>
    <members>DuplicateRecordItem</members>
    <members>DuplicateRecordSet</members>
    <members>EngagementChannelType</members>
    <members>Event</members>
    <members>ExchangeUserMapping</members>
    <members>ExpressionFilter</members>
    <members>ExpressionFilterCriteria</members>
    <members>Idea</members>
    <members>Image</members>
    <members>Lead</members>
    <members>LiveAgentSession</members>
    <members>LiveChatTranscript</members>
    <members>LiveChatTranscriptEvent</members>
    <members>LiveChatTranscriptSkill</members>
    <members>LiveChatVisitor</members>
    <members>Macro</members>
    <members>MacroAction</members>
    <members>MacroInstruction</members>
    <members>MacroUsage</members>
    <members>NamespaceRegistry</members>
    <members>NetworkMember</members>
    <members>Opportunity</members>
    <members>Order</members>
    <members>OrgMetricScanResult</members>
    <members>OrgMetricScanSummary</members>
    <members>PartnerFundAllocation</members>
    <members>PartnerFundClaim</members>
    <members>PartnerFundRequest</members>
    <members>PartnerMarketingBudget</members>
    <members>PartyConsent</members>
    <members>PaymentAuthorization</members>
    <members>Pricebook2</members>
    <members>ProcessException</members>
    <members>Product2</members>
    <members>PromptAction</members>
    <members>QuickText</members>
    <members>QuickTextUsage</members>
    <members>Recommendation</members>
    <members>RecordAction</members>
    <members>RecordMergeHistory</members>
    <members>RequestsForAccessSIQ</members>
    <members>Scorecard</members>
    <members>ScorecardAssociation</members>
    <members>ScorecardMetric</members>
    <members>ScratchOrgInfo</members>
    <members>SocialPersona</members>
    <members>Solution</members>
    <members>StreamActivityAccess</members>
    <members>StreamingChannel</members>
    <members>Task</members>
    <members>User</members>
    <members>UserProvisioningRequest</members>
    <name>CustomObject</name>
  </types>
<version>51.0</version>
</Package>

For that initial pain, Salesforce Package.xml Generator Extension for VS Code could make it easier to generate the package.xml. Once you have it, it's a matter of re-using it to pull in your changes.
However, as mentioned above, profiles will only return what you retrieve with it. As such, if you retrieve profiles, apex classes, and object you will be missing a lot of other dependent metadata depending on what you have set on it (profiles will be incomplete).

*

*Apex Class

*Apex Pages

*Custom Applications

*Custom Objects

*Custom Permission

*Custom Tab

*External Data Sources

*Flow Definition

*Layout

*Profile Password Policy

*Profile Session Setting

Using git will be helpful to double check what you're changing when you retrieve as the only changes should make sense (new access for your project related objects/classes).


text:
Q: FrameSet and HTML5 Video on iPad / iPhone - Video breaks out of frame? I'm using an HTML5 <video> player on a page that is displayed withing a frame. My player breaks out of the frame and is visible on top of the other frames. Any ways of fixing this issue?
I've made a "screenshot" of the problem:

A: The frame element is no longer valid in HTML5. The recommendation is to use the iframe element instead. If you must.


text:
Q: JQuery table filter - AND condition I have a very large table I want to filter with more than 5000 rows
the table has 5 columns

hitting the FILTER button top right transforms the headers into input fields

that works ... well partially ... with this code I found on the web:
/*
Please consider that the JS part isn't production ready at all, I just code it to show the concept of merging filters and titles together !
V1.3 By Prakhar Srivastava
*/
function checkval() {
    1 == $("tbody tr:visible").length && "No result found" == $("tbody tr:visible td").html() ? $("#rowcount").html("0") : $("#rowcount").html($("tr:visible").length - 1)
}
$(document).ready(function() {
    $("#rowcount").html($(".filterable tr").length - 1), $(".filterable .btn-filter").click(function() {
        var t = $(this).parents(".filterable"),
            e = t.find(".filters input"),
            l = t.find(".table tbody");
        1 == e.prop("disabled") ? (e.prop("disabled", !1), e.first().focus()) : (e.val("").prop("disabled", !0), l.find(".no-result").remove(), l.find("tr").show()), $("#rowcount").html($(".filterable tr").length - 1)
    }), $(".filterable .filters input").keyup(function(t) {
        if ("9" != (t.keyCode || t.which)) {
            var e = $(this),
                l = e.val().toLowerCase(),
                n = e.parents(".filterable"),
                i = n.find(".filters th").index(e.parents("th")),
                r = n.find(".table"),
                o = r.find("tbody tr"),
                d = o.filter(function() {
                    return -1 === $(this).find("td").eq(i).text().toLowerCase().indexOf(l)
                });
            r.find("tbody .no-result").remove(), o.show(), d.hide(), d.length === o.length && r.find("tbody").prepend($('
Keine Ergebnisse gefunden.
'))
        }
        $("#rowcount").html($("tr:visible").length - 1), checkval()
    })
});

the html looks like this

Anzahl Bilder:

    <button class="btn btn-default btn-filter">FILTER</button>

            <input type="text" class="form-control" placeholder="Name" disabled>
            <input type="text" class="form-control" placeholder="Größe" disabled>
            <input type="text" class="form-control" placeholder="Wochentag" disabled>
            <input type="text" class="form-control" placeholder="Datum" disabled>
            <input type="text" class="form-control" placeholder="Uhrzeit" disabled>

                    Bild_20210102-235000.jpg

                    81 kb

                    Samstag

                    02.01.2021

                    23:50:03

it filters the table by the last filter entered and than the whole list gets the filter of the last column-filter applied/changed.
but I cannot figure out how to include an AND condition for at least the columns 2-5, so that only rows are shown, that match ALL filter values entered/applied.


text:
Q: Spring ReloadableResourceBundleMessageSource configuration I develop a simple Spring application which is my university task. There are 3 configuration files: web.xml, core-context.xml, dispatcher-servlet.xml and 1 file with default properties which is called messages.properties and is located in /WEB-INF/ folder.
In my application I have the following configuration of ReloadableResourceBundleMessageSource and it works fine:
core-context.xml
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  <property name="basenames" value="/WEB-INF/messages" />
  <property name="useCodeAsDefaultMessage" value="true" />
</bean>

web.xml
<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath*:core-context.xml</param-value>
</context-param>
<servlet>
  <servlet-name>dispatcher</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>

But it turned out that my task instruction says that I should configure ReloadableResourceBundleMessageSource bean in dispatcher-servlet.xml. The problem is that whenever I remove the above configuration from core-context.xml and put it in dispatcher-servlet.xml my locals are no longer displayed.
Could you explain to me why the problem occurs?
What is a difference between putting bean configuration inside core-context.xml and dispatcher-servlet.xml?

A: You have not posted your dispatcher-servlet.xml but I believe it is not being initialized by the spring container because it is not declared anywhere. If you must have another file called dispatcher-servlet.xml as you specify then you can just import it in your core-context.xml. This should solve your problem.


text:
Q: I want to have 2 desktops with 2 keyboards and mouses set up with 1 machine I have a Windows machine running an i7 processor that supports up to 4 graphics cards.
I want to find a solution where I can connect 4  keyboards and mouse and make 3 maybe 4 separate machines for office use. We basically have to use word and Dreamweaver with a little browsing. Is there any solution, hardware or software, for this?

A: You can do this with Windows MultiPoint Server, provided you have the appropriate volume licensing. You can also purchase a machine from an OEM, but I'm guessing you want to keep your existing computer rather than purchase one.
Windows MultiPoint Server http://www.microsoft.com/windows/multipoint/default.aspx
A hardware option would be something from NComputing (http://www.ncomputing.com/).

A: First off, the plural of mouse is mice.
Second, your title says 2, but your description says 4 keyboards. (consistency!)
Third, you sure did ask a mouthful
Simply put, no this is not possible on any Windows platform. This is both a limitation of licensing and technological programming.
The only realistic way you can do this is in Linux, it is called Hot-Seating or a Hydra system. If you want an easy solution that costs a bit of money check out userful at: http://www2.userful.com/products/userful-multiseat-linux
The reality is that you can do this with any distribution of Linux FOR FREE, but to build it from scratch (ala, not using userful software) you will need to get dirty in X11 with X11 programming.
Now I'm actually in the stage of learning how to do this, so I can't guide you to do it manually. Even if I could, the process is so complex I would not guide you here how to do it.


text:
Q: why location change whenever i start my app from same location hey can anyone tell me while working on google maps why sometimes it happens sometimes i get  my current place and sometimes different one like 900 meters aways from my current location ?? As am beginner so not getting why this happening so . i will be very thankful to you

A: Well first of all you will need to take a look on how the GPS position is returned in the first place: through your network so the difference in current location and the margin is mostly dependent on network coverage. therefor the lagg could be generated bij lack of connection.
Also the gps location is send through your network device but even when the network coverage is optimized there might still be a small margin between your current position and the indicated position. this has to do with various elements in both connection and server/gps status.

A: Some code explaining how you are setting this up is required, as well as the environment you are in (indoors, out doors stationary, moving etc)
Androids location providers are basically the GPS or the Network (cell towers) and sometimes wifi spots.
You can request to use one of more provider types, and when the location changes the system tells you which provider is giving you the information, and what the accuracy is.
You can also ask Android to give you the "Best" provider by giving it a set of criteria, this has a lot of issues dependent on device though and you might end up with the network when you think you should be getting GPS, so it's best to specifically manage both of them yourselves and not let android/device decide for you.
You can also specify minimum frequency and a geo fence (how far you have moved) before you get an update which will also effect accuracy/power usage if you are moving.
All of these factors have to be taken into account, in general if you are using just GPS and you are stationary then you can get some wonky fixes right out of the gate until accuracy settles down, after which it should progressively get better until it peaks, then you will see accuracy and fixes bounce around a little.
On the other hand if you are driving, and the terrain is changing (hills, buildings, etc) then you need to check the accuracy of the provider and make some best guesses about which to use etc.
If you are inside then signals can degrade, bounce, and do all kinds of interesting things but again the cure is to use the most accurate signal you can get.
If you are letting google maps black box the location stuff then most likely it's environmental or a device "best" provider glitch.
Hope that helps explain things a bit


text:
Q: NSViewControllers and NSViews are not getting restoration API calls in Apple's documentation they say that in case of document-based apps you should get restoration calls (restoreStateWithCoder: and encodeRestorableStateWithCoder:) to NSApplication, NSWindow, NSWindowController and then the whole responder chain (here).
I want to implement this, but I'm getting the restoration calls  only in NSWindowController/NSDocument subclass, not the NSViews or NSViewControllers.
I created a new document-based app to test this (here), but I get the restoration calls only in the NSDocument subclass but not the NSViewController or NSView.
Code from the test project:
NSDocument subclass (restoration works):
class Document: NSDocument {

  override func restoreState(with coder: NSCoder) {
    super.restoreState(with: coder)
    // Gets called after reopening the app
  }

  override func encodeRestorableState(with coder: NSCoder) {
    super.encodeRestorableState(with: coder)
    // Gets called when leaving the window for the first time
  }

}

NSViewController subclass (restoration doesn't work):
class ViewController: NSViewController {

  override func restoreState(with coder: NSCoder) {
    super.restoreState(with: coder)
    // Not called
  }

  override func encodeRestorableState(with coder: NSCoder) {
    super.encodeRestorableState(with: coder)
    // Not called
  }

}

NSView subclass (restoration doesn't work):
class MyView: NSView {

  override func restoreState(with coder: NSCoder) {
    super.restoreState(with: coder)
    // Not called
  }

  override func encodeRestorableState(with coder: NSCoder) {
    super.encodeRestorableState(with: coder)
    // Not called
  }
}

A: I just ran into the same problem. It seems the state preservation system uses the identifier property to determine whether to encode/restore the state of an object.
According to the documentation, the identifier is automatically populated when an object is loaded from a NIB file. However, it needs to be set manually if an object is created programmatically.


text:
Q: pm2 change dotenv/config path pm2 start --node-args="-r dotenv/config" node_modules/react-scripts/bin/react-scripts.js --name app -- start dotenv_config_path=.env.$NODE_ENV

this script works
i want this one to work as well:
pm2 start ecosystem.json --env env_development

where the dotenv_config_path is inside the env variables inside the ecosystem file.
tried adding the dotenv_config_path inside the env variables and setting the env variables using --env env_development

A: Try adding node_args to your ecosystem file. For example:
{
    "apps": [{
        "name": "development",
        "script": "./src/bin/index.js",
        "node_args": '-r dotenv/config dotenv_config_path=.env.dev',
    }]
}

That might work for you.


text:
Q: How to get LastAccessed For SharePoint Site in SharePoint Online? I want do some analysis of a rather large Site Collection in SharePoint Online.
I want to figure out what has value and could be considered for migration vs old data that is not used.
I have been asked for last accessed date and last modified date.
This is because people may still be looking at data even if its old and has not been modified in a while.
Ideally I would like to report against every object in every site of the site collection.
Could anyone share a powershell script or other method they are using for this?

A: I would recommend ShareGate, as it's site reporting features are pretty good.
As for last accessed date, you may need to delve in to the SharePoint audit logs to find this data.
Update: You can also use Microsoft Purview to inspect audit logs.

A: This article might help too:
SPO Site LastContentModifiedDate vs LastItemModifiedDate vs LastItemUserModifiedDate vs Graph LastModifiedDateTime


text:
Q: Robot Framework: Getting build error for missing Jar I have started learning Robot Framework (with Java & selenium lib) and was trying to write a simple test case in it. Could you please help me with it.
I have copied tools jar in the mentioned lib and also in the dependancy
But still did not work
Following is the error
Failed to execute goal org.robotframework:robotframework-maven-plugin:1.4.6:run (default-cli) on project JavaRobot: Execution default-cli of goal org.robotframework:robotframework-maven-plugin:1.4.6:run failed: Plugin org.robotframework:robotframework-maven-plugin:1.4.6 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:6 at specified path C:\Program Files\Java\jre1.8.0_101/../lib/tools.jar -> [Help 1]
Here is my POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.test.Robot</groupId>
  <artifactId>JavaRobot</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>JavaRobot</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

      <dependency>
      <groupId>org.robotframework</groupId>
      <artifactId>robotframework</artifactId>
      <version>2.8.4</version>
      <scope>test</scope>
    </dependency>

    <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.6</version>
   <scope>system</scope>
   <systemPath>C:\Program Files\Java\jdk1.8.0_101\lib\tools.jar</systemPath>
 </dependency>

     <dependency>
      <groupId>com.github.markusbernhardt</groupId>
      <artifactId>robotframework-selenium2library-java</artifactId>
      <version>1.4.0.8</version>
      <scope>test</scope>
    </dependency>
   </dependencies>

   <build>
        <plugins>
            <plugin>
                <groupId>org.robotframework</groupId>
                <artifactId>robotframework-maven-plugin</artifactId>
                <version>1.4.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
   </build>
</project>

A: Try to add the exclusion , I think it will fix your problem.
Example:
<dependency>
<groupId>com.github.markusbernhardt</groupId>
<artifactId>robotframework-selenium2library-java</artifactId>
<version>1.4.0.7</version>
<scope>test</scope>
<exclusions>
    <exclusion>
        <artifactId>tools</artifactId>
        <groupId>com.sun</groupId>
    </exclusion>
</exclusions>


text:
Q: how can I populate and retrieve table of record using java Package, in which I declared my Data Types
create or replace package pkg_var is
 type array_table is table of varchar2(50);
 type array_int is table of number;
 type p_arr_rec is record(p_no number,p_val varchar2(50));
 type array_record is table of p_arr_rec;
 end pkg_var;
 /

My procedure to populate record
create or replace procedure proc1(p_array in pkg_var.array_table,
arr_int in pkg_var.array_int,len out number,arr_rec out
pkg_var.array_record)
as
v_count number;
begin
len := p_array.count;
v_count :=0;
for i in 1..p_array.count
loop
--dbms_output.put_line(p_array(i));
arr_rec(i).p_no := arr_int(i);
arr_rec(i).p_val := p_array(i);
v_count := v_count+1;
end loop;
end;
/

This is my class to call the above procedure to populate array into table of record
public class TestDatabase {

    public static void passArray()
    {
        try{
            dbcon conn = new dbcon();
            Connection con = conn.dbstate().getConnection();

            String str_array[] = {"one", "two", "three","four"};
            int int_array[] = {1, 2, 4,8};
            ArrayDescriptor str_des = ArrayDescriptor.createDescriptor("SCOTT.PKG_VAR.ARRAY_TABLE", con);
            ARRAY arr_str = new ARRAY(str_des,con,str_array);
            ArrayDescriptor des = ArrayDescriptor.createDescriptor("SCOTT.PKG_VAR.ARRAY_INT", con);
            ARRAY arr_int = new ARRAY(des,con,int_array);

            CallableStatement st = con.prepareCall("call SCOTT.proc1(?,?,?)");

            // Passing an array to the procedure -
            st.setArray(1, arr_str);
            st.setArray(2, arr_int);
            st.registerOutParameter(3, Types.INTEGER);
            st.registerOutParameter(4,OracleTypes.ARRAY,"SCOTT.PKG_VAR.ARRAY_RECORD");
            st.execute();

            System.out.println("size : "+st.getInt(3));

            // Retrieving array from the resultset of the procedure after execution -
            ARRAY arr = ((OracleCallableStatement)st).getARRAY(4);
             BigDecimal[] recievedArray = (BigDecimal[])(arr.getArray());

            for(int i=0;i<recievedArray.length;i++)
                System.out.println("element" + i + ":" + recievedArray[i] + "\n");

        } catch(Exception e) {
            System.out.println(e);
        }
    }

    public static void main(String args[]){
        passArray();
    }
}

I'm getting java.sql.SQLException: invalid name pattern: SCOTT.PKG_VAR.ARRAY_TABLE Exception, anyone help me to solve this exception.
One more question how do I retrieve table of record of SQL in Java ? My second question is for this code
ARRAY arr = ((OracleCallableStatement)st).getARRAY(4);
Is it a valid code to get table of record ?

A: I don't think you can do what you want with PLSQL array types, you need to create 'Array Types' on the database, eg:
create or replace type rectype as object(col1 varchar2(10),col2 varchar2(10));
/
create or replace type rectypetab as table of rectype;
/

I describe how to use all this with Java here: http://betteratoracle.com/posts/32-passing-arrays-of-record-types-between-oracle-and-java


text:
Q: Redux Dev Tools doesn't show state change, action.payload is { } I am trying to figure out why Redux-Devtools does not show state change because it shows that action={
  type: 'GET_LOCATION_SUCCESS',
  payload: {}
}, while debugger and console.log() shows that action.payload is n.
I am using

*

*redux-observable

*rxjs

*typesafe-actions
This is my action creator:
import { createAsyncAction } from 'typesafe-actions';
import { GET_LOCATION_BEGIN, GET_LOCATION_FAILURE, GET_LOCATION_SUCCESS } from './constants';

export const getMyLocation = createAsyncAction(
    GET_LOCATION_BEGIN,
    GET_LOCATION_SUCCESS,
    GET_LOCATION_FAILURE
)<undefined, Position, string>();

This is my reducer:
import { RootAction } from 'MyTypes';
import { combineReducers } from 'redux';
import { getType } from 'typesafe-actions';

import {getMyLocation} from '../actions/locationActions';

export type locationState = {
    position: Position;
    error: boolean;
};

export const locationReducer = combineReducers<locationState, RootAction>({
    position: (state = {} as Position, action) => {
        switch(action.type){
            case getType(getMyLocation.success):
                return action.payload;
            default:
                return state;
        }
    },
    error: (state = false, action) => {
        switch(action.type){
            case getType(getMyLocation.failure):
                return true;
            default:
                return state;
        }
    }
})

And this is my epic: [EDIT v.1]
   export const getMyLocationEpic: Epic<RootAction, RootAction, RootState, Services> = (action$, state$, {geoLocation}) =>
  action$.pipe(
    filter(isActionOf(getMyLocation.request)),
    switchMap( () => geoLocation.getGeoLocation(options).pipe(
        take(1),
        mergeMap( (data : Position) => of(
          // Dispatch action with my location data and then dispatch action to request weather from API. It runs fetchWeatherEpic
          getMyLocation.success(data),
          fetchWeather.request(data)
          )
        ),
        catchError(err => of(getMyLocation.failure(err)))
      )
    )
  );

I am wondering what might be the reason of not showing state update, it works as it should in console.log() but it doesn't work in devtools.


text:
Q: Problem with SQL Server Reporting Services Friends I have a problem with SQL Server Reporting Services ..!!!
I have some reports that show no data, the reports are on a separate server from the server that contains the database, the Data Sources of the reports is well configured.
Stored procedures are executed while the server (display data)
users have the necessary permissions.
What is the problem ..? Thanks

A: You should be able to access the Database on a server separate from the report server.  That all sounds good.  When you run the Reports in Visual Studio Preview mode....do you see any data?

A: Also, look at reporting services logs.  they all end in .log, and begin with Report.  I forget where they are on the server, but am pretty sure they are under the program files directory for mssql, just as you would find logs for sql server.

A: It sounds as though the definition of your data sources in production may be different from that in development. Have you tried redeploying your data sources?


text:
Q: How can I have the text-align in the middle for 0% in bootstrap? I currently have a progress bar that looks like this which I've achieved with bootstrap.
For some reason the 0/0 goes to the left and text-align: center; isn't working to make the text go to the middle.
It's interesting to note that also 0/0 is not displaying but instead I'm getting 0 even though when I look in the console I can see that 0/0 is there.
Does anyone have any ideas how to fix this so the 0/0 appears in the center?

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />

☹

        0 / 7

test_number percentage is equal to 0% if 0 or 100% if 7
test_number is either 0 or 7 depending on the bar.

A: I hope it'll helps you:

.left {
      padding-right: 0;
      text-align: right;
    }
    .right{
      padding-left: 0;
    }
    .justify-content-center {
      margin-top: 20px;
    }
    .progress{
      margin-bottom: 0;
      color:black;
      text-align: center;
      position: relative;
    }
    .progress_text {
      position: absolute;
      left: 0;
      right: 0;
      color: #fff;
      z-index: 1;
    }

    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

                test_number / 7

And when you have 7/7 it shows you:

    .left {
      padding-right: 0;
      text-align: right;
    }
    .right{
      padding-left: 0;
    }
    .justify-content-center {
      margin-top: 20px;
    }
    .progress{
      margin-bottom: 0;
      color:black;
      text-align: center;
      position: relative;
    }
    .progress_text {
      position: absolute;
      left: 0;
      right: 0;
      color: #fff;
      z-index: 1;
    }

    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

                7 / 7

A: you are putting the text inside the progress-bar div but you have to put it on the progress div

☹

            test_number / 7

https://jsfiddle.net/99azq2ay/1/


text:
Q: Tree grid ajax does not refresh in extjs I have been working on a project where i have used extjs to display some service plans. i am able to populate it in the beginning. then i want a button onclick of which new data is to be populated in the grid.
I am able to make a successful call to the function in my tree service but the data is not displayed.
my treegrid button code is:
{
                xtype: 'button',
                text: 'Search',
                listeners: {
                    click: function () {
                      //  Ext.getCmp('tree').getView().refresh();
                        Ext.Ajax.request({
                            method: 'GET',
                            extend: 'Ext.data.Model',
                            fields: ['planid', 'id', 'text', 'startdate', 'enddate', 'iconCls', 'expanded', 'leaf'],
                            params: {
                                serviceplanid: serviceplanid,
                                userid: userid,
                                // startdate: startdate,
                                // stopdate: stopdate,
                                initialstate: initialstate,
                                fonttype: fonttype,
                                fonttypeex: fonttypeex
                            },
                            url : '/BloomMatrix2/TreeService2.svc/getfulldata',
        reader: new Ext.ux.aspNetJsonReader({ root: 'children'
        }),

        success: function (response) {
                                //console.log(response);
                                //swapStrore();
                            }
                        });
                    }
                }
            },

and my service reads functions:
[WebGet()]
[OperationContract]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string getdata(String serviceplanid,String userid, String initialstate,String fonttype, String fonttypeex)
 {

    System.Diagnostics.Debug.WriteLine("IN GETDATA"+initialstate);
    SqlConnection Conn = new SqlConnection(CommonFunctions.GetConnectionString("YourConnection"));
    Conn.Open();

    SqlCommand cmd = new SqlCommand("[dbo].[VMResults_GetCategoriesTree]", Conn);
    cmd.Parameters.Add("@UserId", SqlDbType.BigInt).Value = 1;
    cmd.Parameters.Add("@ServicePlanCurrent", SqlDbType.Char).Value = "N";

    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
    DataSet ds1 = new DataSet();
    adapter.Fill(ds1);
    String ret=makeJSON(ds1,initialstate,fonttype,fonttypeex);
    return ret;
}

[WebGet()]
[OperationContract]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string getfulldata(String serviceplanid, String userid, String initialstate, String fonttype, String fonttypeex)
{

    System.Diagnostics.Debug.WriteLine("IN GETDATA" + initialstate);
    SqlConnection Conn = new SqlConnection(CommonFunctions.GetConnectionString("YourConnection"));
    Conn.Open();

    SqlCommand cmd = new SqlCommand("[dbo].[VMResults_GetCategoriesTree]", Conn);
    cmd.Parameters.Add("@UserId", SqlDbType.BigInt).Value = 1;
    cmd.Parameters.Add("@ServicePlanCurrent", SqlDbType.Char).Value = "Y";

    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
    String ret = makeJSON(ds, initialstate, fonttype, fonttypeex);
    return ret;
}

i have to call the latter one onclick of the button..thanks in advance

A: You need a store definition on the tree with the proxy that talks to the server. See Sencha examples.
Alternatively if you want to run your own AJAX request as you have in your code than you need to create NodeInterface objects out of the manually parsed data in your success block and add them one by one to the tree panel - not going to be pretty.


text:
Q: Validity of algorithm for creation of a non self-intersecting polygon As an extension and partial answer to my thread I wrote a simple algorithm that given a set of points(with xy coordinates) can form a non self-intersecting polygon.

Claim: Given an arbitrary set of points with different coordinates it is always possible to construct a regular or irregular, non self-intersecting polygon.
The algorithm:
Assume there is a set V containing all the vertices
1) Sort all vertices in V by x-coordinate
2) Imagine a straight line (we'll call that "the divider") parallel to the x-axis which starting from the first node expands to infinity and divides/splits the vertices into two sets.
3) Now consider the two sets:
A = The set of all vertices above or on the divider line
B = The set of all remaining vertices
4) Starting at the leftmost vertex of A connect all vertices in A until you get to the rightmost
5) If the rightmost vertex of the sorted set V (the vertex with the biggest x coordinate) is not in A connect that last vertex (rightmost of A) with it.
6) Work backwards and starting from the rightmost vertex of the sorted set V (the vertex with the biggest x coordinate) connect all the vertices that are in B
7)Connect the first (leftmost vertex of B) vertex of B with the leftmost vertex of A

I think that the algorithm is correct and can't find a test that it would fail but maybe I'm missing something.
I would appreciate it if you could have a look and give me an example that wouldn't work if there is any(which I'm sure there must be).

A: Here is a counterexample. When step 5 does not draw a line, it is possible to self intersect.

A: I'm not sure I understand correctly what you're trying to do. In the other thread, and in the corresponding thread at math.SE (which brought me here), you said you had a polygon and were trying to find its center of gravity. Here you say you have a set of points and you want to construct a non-intersecting polygon from it. Those are two quite different things. As I mentioned at math.SE, if the polygons are not known to be convex, a set of points doesn't uniquely define a polygon -- so the algorithm you propose here may construct some arbitrary non-self-intersecting polygon (I haven't checked whether it successfully does that) but that may or may not bear any relation to the polygon you were originally interested in. Or did I misunderstand your question at math.SE and you actually only have some points and want to construct just any non-self-intersecting polygon from them and don't care that there may be several inequivalent solutions for this?

A: I think I have a simpler algorithm that creates such a polygon. May be harder to implement in software but is much easier to describe in words.

*

*Pick any point in the set as your start. Create a line at 0 angle starting from it.

*start rotating the line around the point. The moment it meets any other point, draw an edge from the starting point to the newly found point.

*continue rotating around the starting point, connecting any newly-found point with the last found.

*at finish of the rotation, close the shape by meeting the start point.

In case of multiple finds on one direction, connect them picking one direction (say, starting with inner-most ending with outer-most)
The shape will be usually somewhat star-like, but fulfilling the requirements.
Computational execution would be like:

*

*translate all points to coordinate set with origin[0,0] in one of the points.

*convert all points to polar coordinate set

*sort by: angle ascending, radius ascending.

*connect all points in the sort order.

*connect last to the first ([0,0]) point.

A: I would prove it slightly differently by setting the "divider line" as a connection between left-most and right-most points, rather than parallel to x axis. It could happen that there are no points below or above the parallel-to-x line and that could cause trouble to your proof.
Also, connection (5) could lead to some self-intersections with the connections generated in point (6)
There is also a special case when all points are colinear and your polygon is degraded to a line.
We assume that the set V of vertices is finite ;)
Other than that - I believe your claim is true.

A: I had the same problem in javascript and OpenLayers library. So this is my solution for detecting validity of a polygon in 'vectors' layer as a OpenLayers.Layer.Vector:
var ps = vectors.features[0].geometry.getVertices(), i, j, inx, x1, x2, x3, x4, y1, y2, y3, y4, x43, x21, y21, y43, y31, maxx12, maxx34, minx12, minx34;
ps.push(ps[0]);
for(i = 0; i < ps.length -1 ; i++ ) {
  x1 = ps[i].x; x2 = ps[i+1].x;
  y1 = ps[i].y; y2 = ps[i+1].y;
  for(j = i + 2; j < ps.length -1 ; j++ ) {
    x3 = ps[j].x; x4 = ps[j+1].x;
    y3 = ps[j].y; y4 = ps[j+1].y;
    x43 = x4 - x3; x21 = x2 - x1; y21 = y2 - y1; y43 = y4 - y3; y31 = y3 - y1;
    inx = ( x43*y21*x1 - x21*y43*x3 + y31*x21*x43 )/( x43*y21 - x21*y43 );
    if( x1 < x2 ){
      minx12 = x1; maxx12 = x2;
    } else {
      minx12 = x2; maxx12 = x1;
    }
    if( x3 < x4 ){
      minx34 = x3; maxx34 = x4;
    } else {
      minx34 = x4; maxx34 = x3;
    }
    if (minx12 < inx && inx < maxx12 && minx34 < inx && inx < maxx34 ){
      console.log('intersected!'+' ,x1: '+x1+' ,x2: '+x2+' ,inx: '+inx+' ,i: '+i+' ,j: '+j);

      return;
    }
  }
}

hope you enjoy it!!


text:
Q: Package incompatible in UWP The UWP app I'm working on suddenly throws these errors. However, even with these errors project builds successfully. I just need to know what happens here.

A: I found the solution to my case. I had several projects in my solution and all of them were using

Microsoft.NETCore.UniversalWindowsPlatform V 5.2.3

except for one project. It was using

Microsoft.NETCore.UniversalWindowsPlatform V 5.0.0

When I update the 5.0.0 to 5.2.3 all the errors went away.