text:
Q: Broken Python installation on CentOS 5.8 I already searched for solution to my problem via Google and serverfault's search facility, but haven't found anything related specifically to my case.
Here's the problem: I needed python 2.7.3 on CentOS 5.8 machine which has only python 2.4.3 preinstalled. Also neither there's the suitable version in it's repositories nor I can upgrade installed version. That's why I decided to build python from source code. But I've made a mistake: instead of make altinstall I did make install thus changing default version of the current installation. It was before I found this article - How to install Python 2.7.3 on CentOS 6.2 . I guess 5.8 and 6.2 versions aren't different to the extent this article is inapplicable. After installation of new python version I installed pip, but once I tried to invoke it, I got "No module named pkg_resources" error. In order to solve this issue I installed setuptools from repository. But it had only led to another error: "Distribution Not Found". My final step was to follow the guide I posted the link to, but I was unable to perform last step: easy_install-2.7 virtualenv command threw "-bash: /usr/local/bin/easy_install-2.7: .: bad interpreter: Permission denied" error. Now when I try to invoke pip or pip-2.7 both commands raise the same error with different names of binaries after "-bash:".
Is there any way to fix this problem, so I could install new python version (2.7.3) alongside with the preinstalled one (2.4.3) according to the guide? Any help will be appreciated.
P.S.: yum is working fine, although it needs python to function, so I hope the damage I unknowingly caused isn't very severe. Also I'm not a native English speaker, so I apologize for possible occasional grammatical and/or spelling errors.

A: First I'd try going back to the directory you ran the initial make install and attempt a:
make uninstall.
If that doesn't work you are going to need to remove it manually. You can figure out what path it took by looking at the make file or by: make -n install > logfile 2>&1 Then you need to find the python package: rpm -qa | grep python and remove it rpm -e -nodeps <package>. To re-install it: rpm -ivh --force <package>.
Of course this is probably more work than just re-installing the OS, not easy, and not guaranteed to work...


text:
Q: Is it possible to schedule the execution of daily macros in MS Access? There are a couple of macros that need to be executed everyday at a fixed time. I am not an expert of MS Access but have been assigned to do this task. I was told that it can be done using SSIS Packages built in Visual studio. Can someone please tell me ways to do this?

A: The usual way to do this is to create an Access database, add a form that is loaded when the database is opened, and use the "OnOpen" event to run the assorted pieces of code required before exiting the database using Application.Quit.
This database should be placed on a server, as it will be on 24/7.
You would then use Windows Task scheduler on the server to create a recurring task to open this database (which then causes the code to run).
You may want to include some logging/reporting/email notification in the code to allow you to keep track of whether the actions have failed or not.
Regards,

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I check in itemadded event whether itemupdated event will fire after or not? I need to skip my code in itemadded event if itemupdated event will fire after it. Is there any common solution for this?

A: Just remove itemadded then. Itempupdated is always triggered even when the item is just created. So I don't see why you need ItemAdded.

*

*If you create an item --> ItemAdded --> ItemUpdated

*If you update an item --> ItemUpdated


text:
Q: json appending to table breaking adaptive height panel I'm using this: https://codepen.io/Lewitje/pen/doJRBX
This is a nice responsive panel, I have a table inside this panel.
Now I have JSON appending to this table which is causing the table/panel to grow, unfortunatly it grows over the footer.
Heres my javascript:
$(document)
    .ready(function() {
        // Variables
        var clickedTab = $(".tabs > .active");
        var tabWrapper = $(".tab__content");
         var activeTab = tabWrapper.find(".active");
         var activeTabHeight = activeTab.outerHeight();
        // Show tab on page load
        activeTab.show();
        // Set height of wrapper on page load
         tabWrapper.height(activeTabHeight);
        $(".tabs > li")
            .on("click", function() {
                // Remove class from active tab
                $(".tabs > li")
                    .removeClass("active");
                // Add class active to clicked tab
                $(this)
                    .addClass("active");
                // Update clickedTab variable
                clickedTab = $(".tabs .active");
                // fade out active tab
                activeTab.fadeOut(250, function() {
                    // Remove active class all tabs
                    $(".tab__content > li")
                        .removeClass("active");
                    // Get index of clicked tab
                    var clickedTabIndex = clickedTab.index();
                    // Add class active to corresponding tab
                    $(".tab__content > li")
                        .eq(clickedTabIndex)
                        .addClass("active");
                    // update new active tab
                    activeTab = $(".tab__content > .active");
                    // Update variable
                    activeTabHeight = activeTab.outerHeight();
                    // Animate height of wrapper to new tab height
                    tabWrapper.stop()
                        .delay(50)
                        .animate({
                            height: activeTabHeight
                        }, 500, function() {
                            // Fade in active tab
                            activeTab.delay(50)
                                .fadeIn(250);
                        });
                });
            });
    });
$(document)
    .ready(function() {
        // Variables
        var clickedTab = $(".prices__tabs > .active");
        var tabWrapper = $(".prices__tab__content");
        var activeTab = tabWrapper.find(".active");
        var activeTabHeight = activeTab.outerHeight();
        // Show tab on page load
        activeTab.show();
        // Set height of wrapper on page load
        tabWrapper.height(activeTabHeight);
        $(".prices__tabs > li")
            .on("click", function() {
                // Remove class from active tab
                $(".prices__tabs > li")
                    .removeClass("active");
                // Add class active to clicked tab
                $(this)
                    .addClass("active");
                // Update clickedTab variable
                clickedTab = $(".prices__tabs .active");
                // fade out active tab
                activeTab.fadeOut(250, function() {
                    // Remove active class all tabs
                    $(".prices__tab__content > li")
                        .removeClass("active");
                    // Get index of clicked tab
                    var clickedTabIndex = clickedTab.index();
                    // Add class active to corresponding tab
                    $(".prices__tab__content > li")
                        .eq(clickedTabIndex)
                        .addClass("active");
                    // update new active tab
                    activeTab = $(
                        ".prices__tab__content > .active"
                    );
                    // Update variable
                    activeTabHeight = activeTab.outerHeight();
                    // Animate height of wrapper to new tab height
                    tabWrapper.stop()
                        .delay(50)
                        .animate({
                            height: activeTabHeight
                        }, 500, function() {
                            // Fade in active tab
                            activeTab.delay(50)
                                .fadeIn(250);
                        });
                });
            });
    });

I'm wondering if its something i can do with the activeTab in my other JS file after the prepend.
Any ideas?


text:
Q: Code for prime numbers, why only with "sqrt()" I wrote a program for finding prime numbers, my problem is that the code only will run correctly, only if I take the square root of the tested number (on the marked line).
When I have int i = input the code wont run.
I know that sqrt() is helpful here but i thought it should work without as well.

#include<stdio.h>
#include<stdbool.h>
#include<math.h>

bool primeNumber(int input)
{
    for(int i = sqrt(input); i > 1; i--)                   // <------- sqrt()
    {
        if(input % i == 0)
        {
            return false;
        }
    } return true;
}

int main()
{
    int input;
    printf("Pls type in a positive number: ");
    scanf("%d",&input);

    for(int i = input; i > 1; i--)
    {
        bool prime = primeNumber(i);
        if(prime)
        {
            printf("%d is a prime number\n",i);
        }
    }
    return 0;
}

A: Every positive integer has itself as a factor. A number is prime if its only factors are itself and one. If you consider a number non-prime because it has itself as a factor, then you will consider no numbers to be prime.

A: For starters the function is incorrect. It returns true for example for the number equal to 1 though 1 is not a prime number. Also as the function parameter has the signed integer type int then the user can pass to the function a negative number.
Also you should write a more general function that can work with any unsigned integer type.
As for your question

When I have int i = input the code wont run.

then each number is divisible by itself.
The function can be more efficient and written without using the function sqrt. Except the even number 2 all other prime numbers are odd. So there is no sense to check whether an even number except 2 is a prime number.
bool primeNumber( unsigned long long int input )
{
    bool prime = number % 2 == 0 ? number == 2 : number != 1;

    for ( unsigned long long int i = 3; prime && i <= number / i; i += 2 )
    {
        prime = number % i != 0;
    }

    return prime;
}

And in main you should write
unsigned int input;

printf( "Pls type in a non-negative number: ");
scanf("%u",&input);

for( unsigned int i = input; i > 0; i-- )
{
    bool prime = primeNumber(i);
    if(prime)
    {
        printf("%u is a prime number\n",i);
    }
}


text:
Q: Why is Maven (under Netbeans) not compiling for target JDK 1.6? I would like to use https://github.com/fmmfonseca/completely in an Android project and as far as I can tell that means it should be compiled to target JDK 1.8
I am using Netbeans 11 and I have set the target to 1.8
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
  <parent>
    <artifactId>completely</artifactId>
    <groupId>com.miguelfonseca.completely</groupId>
    <version>0.9.0</version>
  </parent>
  <artifactId>completely-core</artifactId>
  <name>completely-core</name>
  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.6.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
<pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
          <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>

            </configuration>
        </plugin>
        <plugin>
            <!-- Build an executable JAR -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>

                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                        <mainClass>Main</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

and yet when I compile and check the newly created .class files, eg.
AutoCompleteLibrary\core\target\classes\com\miguelfonseca\completely\AutocompleteEngine.class
I see in hex
CA FE BA BE 00 00 00 37

the 37 means the class file is compiled to language level 55 or JDK 11.
I have tried every way possible to set the target JDK in the pom but nothing works.
Here's the Maven (v3) log.  Which I notice has   <release>11</release> in it, not sure why.
=== PROJECT BUILD PLAN ================================================
Project:       com.miguelfonseca.completely:completely-core:0.9.0
Dependencies (collect): []
Dependencies (resolve): [compile, runtime, test]
Repositories (dependencies): [central (https://repo.maven.apache.org/maven2, default, releases)]
Repositories (plugins)     : [central (https://repo.maven.apache.org/maven2, default, releases)]
-----------------------------------------------------------------------
Goal:          org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean)
Style:         Regular
Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <directory default-value="${project.build.directory}"/>
  <excludeDefaultDirectories default-value="false">${clean.excludeDefaultDirectories}</excludeDefaultDirectories>
  <failOnError default-value="true">${maven.clean.failOnError}</failOnError>
  <followSymLinks default-value="false">${clean.followSymLinks}</followSymLinks>
  <outputDirectory default-value="${project.build.outputDirectory}"/>
  <reportDirectory default-value="${project.reporting.outputDirectory}"/>
  <retryOnError default-value="true">${maven.clean.retryOnError}</retryOnError>
  <skip default-value="false">${clean.skip}</skip>
  <testOutputDirectory default-value="${project.build.testOutputDirectory}"/>
  <verbose>${clean.verbose}</verbose>
</configuration>
-----------------------------------------------------------------------
Goal:          org.jacoco:jacoco-maven-plugin:0.8.5:prepare-agent (default)
Style:         Regular
Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <address>${jacoco.address}</address>
  <append>${jacoco.append}</append>
  <classDumpDir>${jacoco.classDumpDir}</classDumpDir>
  <destFile default-value="${project.build.directory}/jacoco.exec">${jacoco.destFile}</destFile>
  <dumpOnExit>${jacoco.dumpOnExit}</dumpOnExit>
  <exclClassLoaders>${jacoco.exclClassLoaders}</exclClassLoaders>
  <inclBootstrapClasses>${jacoco.inclBootstrapClasses}</inclBootstrapClasses>
  <inclNoLocationClasses>${jacoco.inclNoLocationClasses}</inclNoLocationClasses>
  <jmx>${jacoco.jmx}</jmx>
  <output>${jacoco.output}</output>
  <pluginArtifactMap>${plugin.artifactMap}</pluginArtifactMap>
  <port>${jacoco.port}</port>
  <project>${project}</project>
  <propertyName>${jacoco.propertyName}</propertyName>
  <sessionId>${jacoco.sessionId}</sessionId>
  <skip default-value="false">${jacoco.skip}</skip>
</configuration>
-----------------------------------------------------------------------
Goal:          org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources)
Style:         Regular
Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <buildFilters default-value="${project.build.filters}"/>
  <encoding default-value="${project.build.sourceEncoding}">${encoding}</encoding>
  <escapeString>${maven.resources.escapeString}</escapeString>
  <escapeWindowsPaths default-value="true">${maven.resources.escapeWindowsPaths}</escapeWindowsPaths>
  <includeEmptyDirs default-value="false">${maven.resources.includeEmptyDirs}</includeEmptyDirs>
  <outputDirectory default-value="${project.build.outputDirectory}"/>
  <overwrite default-value="false">${maven.resources.overwrite}</overwrite>
  <project default-value="${project}"/>
  <resources default-value="${project.resources}"/>
  <session default-value="${session}"/>
  <supportMultiLineFiltering default-value="false">${maven.resources.supportMultiLineFiltering}</supportMultiLineFiltering>
  <useBuildFilters default-value="true"/>
  <useDefaultDelimiters default-value="true"/>
</configuration>
-----------------------------------------------------------------------
Goal:          org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)
Style:         Regular
Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <basedir default-value="${basedir}"/>
  <buildDirectory default-value="${project.build.directory}"/>
  <compilePath default-value="${project.compileClasspathElements}"/>
  <compileSourceRoots default-value="${project.compileSourceRoots}"/>
  <compilerArgs>
    <arg>-Xlint</arg>
  </compilerArgs>
  <compilerId default-value="javac">${maven.compiler.compilerId}</compilerId>
  <compilerReuseStrategy default-value="${reuseCreated}">${maven.compiler.compilerReuseStrategy}</compilerReuseStrategy>
  <compilerVersion>${maven.compiler.compilerVersion}</compilerVersion>
  <debug default-value="true">${maven.compiler.debug}</debug>
  <debuglevel>${maven.compiler.debuglevel}</debuglevel>
  <encoding default-value="${project.build.sourceEncoding}">${encoding}</encoding>
  <executable>${maven.compiler.executable}</executable>
  <failOnError default-value="true">${maven.compiler.failOnError}</failOnError>
  <failOnWarning default-value="false">${maven.compiler.failOnWarning}</failOnWarning>
  <forceJavacCompilerUse default-value="false">${maven.compiler.forceJavacCompilerUse}</forceJavacCompilerUse>
  <fork default-value="false">${maven.compiler.fork}</fork>
  <generatedSourcesDirectory default-value="${project.build.directory}/generated-sources/annotations"/>
  <maxmem>${maven.compiler.maxmem}</maxmem>
  <meminitial>${maven.compiler.meminitial}</meminitial>
  <mojoExecution default-value="${mojoExecution}"/>
  <optimize default-value="false">${maven.compiler.optimize}</optimize>
  <outputDirectory default-value="${project.build.outputDirectory}"/>
  <parameters default-value="false">${maven.compiler.parameters}</parameters>
  <project default-value="${project}"/>
  <projectArtifact default-value="${project.artifact}"/>
  <release>11</release>
  <session default-value="${session}"/>
  <showDeprecation default-value="false">${maven.compiler.showDeprecation}</showDeprecation>
  <showWarnings default-value="false">${maven.compiler.showWarnings}</showWarnings>
  <skipMain>${maven.main.skip}</skipMain>
  <skipMultiThreadWarning default-value="false">${maven.compiler.skipMultiThreadWarning}</skipMultiThreadWarning>
  <source default-value="1.6">${maven.compiler.source}</source>
  <staleMillis default-value="0">${lastModGranularityMs}</staleMillis>
  <target default-value="1.6">${maven.compiler.target}</target>
  <useIncrementalCompilation default-value="true">${maven.compiler.useIncrementalCompilation}</useIncrementalCompilation>
  <verbose default-value="false">${maven.compiler.verbose}</verbose>
</configuration>
....

--- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ completely-core ---
Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@c387f44]
Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile' with basic configurator -->
  (f) basedir = c:\AutoCompleteLibrary\core
  (f) buildDirectory = c:\AutoCompleteLibrary\core\target
  (f) compilePath = [c:\AutoCompleteLibrary\core\target\classes, C:\Users\jdlwr\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar]
  (f) compileSourceRoots = [c:\AutoCompleteLibrary\core\src\test\java]
  (f) compilerArgs = [-Xlint]
  (f) compilerId = javac
  (f) debug = true
  (f) encoding = utf-8
  (f) failOnError = true
  (f) failOnWarning = false
  (f) forceJavacCompilerUse = false
  (f) fork = false
  (f) generatedTestSourcesDirectory = c:\AutoCompleteLibrary\core\target\generated-test-sources\test-annotations
  (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile {execution: default-testCompile}
  (f) optimize = false
  (f) outputDirectory = c:\AutoCompleteLibrary\core\target\test-classes
  (f) parameters = false
  (f) project = MavenProject: com.miguelfonseca.completely:completely-core:0.9.0 @ c:\AutoCompleteLibrary\core\pom.xml
  (s) release = 11
  (f) session = org.apache.maven.execution.MavenSession@2e3f79a2
  (f) showDeprecation = false
  (f) showWarnings = false
  (f) skipMultiThreadWarning = false
  (f) source = 1.8
  (f) staleMillis = 0
  (s) target = 1.8
  (f) testPath = [c:\AutoCompleteLibrary\core\target\test-classes, c:\AutoCompleteLibrary\core\target\classes, C:\Users\jdlwr\.m2\repository\org\junit\jupiter\junit-jupiter\5.6.2\junit-jupiter-5.6.2.jar, C:\Users\jdlwr\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.6.2\junit-jupiter-api-5.6.2.jar, C:\Users\jdlwr\.m2\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar, C:\Users\jdlwr\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar, C:\Users\jdlwr\.m2\repository\org\junit\platform\junit-platform-commons\1.6.2\junit-platform-commons-1.6.2.jar, C:\Users\jdlwr\.m2\repository\org\junit\jupiter\junit-jupiter-params\5.6.2\junit-jupiter-params-5.6.2.jar, C:\Users\jdlwr\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.6.2\junit-jupiter-engine-5.6.2.jar, C:\Users\jdlwr\.m2\repository\org\junit\platform\junit-platform-engine\1.6.2\junit-platform-engine-1.6.2.jar, C:\Users\jdlwr\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar]
  (f) useIncrementalCompilation = true
  (f) verbose = false

The thing I don't understand in the last part is that it has both
(s) release = 11
(s) target = 1.8

A: The setting for <release>11</release> is coming from your parent POM:
https://search.maven.org/artifact/com.miguelfonseca.completely/completely/0.9.0/pom
I guess that it takes precedence over your source and target settings. Try to override the release configuration.

A: Try setting the version directly for the compiler plugin:
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
         <source>1.8</source>
         <target>1.8</target>
    </configuration>
</plugin>


text:
Q: Change tracking for sans serif font I want to change the tracking (space between the characters) for a sans serif font. I found that I can use the microtype package to change the tracking of the smallcaps font (\textsc{foo}), but I can't figure out how to make \textsc{} a sans serif font.

A: Do you mean, you want to 'set tracking' only for your sans serif font? (Because I hope you don't want to 'make' small caps be sans serif ... rather you should choose a sans serif that contains a small caps schape, as in the below example.)
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}

\usepackage[tracking=true]{microtype}
\DeclareMicrotypeSet*[tracking]{my}
  { encoding = *,
    font = */sf*/*/*/*,
}
\SetTracking[
%  spacing = {500*,166, }
]{
  encoding = *,
  family = sf*,
}{ 500 }
\SetTracking[]{encoding = *, family = rm* }{ 10 }
\SetTracking[]{encoding = *, shape = sc }{ 100 }

\def\test{I want to change the tracking (space between the characters)
  for a sans serif font. I found that I can use the microtype package
  to change the tracking of the smallcaps font
  ({\ttfamily\textbackslash textsc\{foo\}}), but I can't figure out
  how to make {\ttfamily\textbackslash textsc{}} a sans serif font.}

\begin{document}
\parskip 12pt
\parindent 0pt

RM:

\test

SF:

{\sffamily\test}

SC (RM):

{\scshape\test}

SF+SC:

{\sffamily\scshape\test}

TT:

{\ttfamily\test}

\end{document}


text:
Q: Construction JSON value dynamically in C# My below code works fine if I repace my "temp" with any other hard-coded string value. But I am not sure How can I pass the temp value each time in the JSON I am creating. How can I fix this?
I need to have my json something like {"device1": 24, "device2": 25, "device3": 26}
for (int i = 1; i <= numOfEvents; i++)
            {
                string temp = (i + 23).ToString();
                dynamic foo = JObject.FromObject(new { Hello = "{ \"device\" : temp }" });

A: if you want to use JObject
    var numOfEvents = 3;
    JObject jo = new JObject();
    for (int i = 1; i <= numOfEvents; i++)
        jo.Add("device" + i.ToString(), i + 23);

    JObject jsonObject = new JObject();
    jsonObject["Hello"] = jo;

result
{ "Hello": {"device1" : 24,"device2" : 25,"device3" : 26}}

Some people are getting furious when they see a string builder, although it is not so heavy as a serializer with libraries. So if you want to put into json only several items,  you can just use a string. Create a json string manually  is very handy if  for some reasons you don't wont to install a a heavy weight json serializer libraries since you just need to create a short string.
    numOfEvents = 2;
    var json = string.Empty;
    for (int i = 1; i <= numOfEvents; i++)
    {
        string temp = (i + 23).ToString();
        json += $",\"device{i}\" : {temp}";
    }
    json = "{ \"Hello\": {" + json.Substring(1) + "}}";

but in some casses when you need a lot of items (for testing for example) it is better to use a string builder
    var numOfEvents = 3;
    StringBuilder sb= new ();
    for (int i = 1; i <= numOfEvents; i++)
    {
        string temp = (i + 23).ToString();
         sb.Append( $",\"device{i}\" : {temp}");
    }

    var json="{ \"Hello\": {"+ sb.ToString().Substring(1)+ "}}";

    var jsonObject = JObject.Parse(json);

result
{ "Hello" : { "device1" : 24,"device2" : 25,"device3" : 26 }


text:
Q: Sort and search vectors by different criteria Class
class Player{
    std::string name;
    int score;
    int id;
};

I thought about how to write a code to sort and search vector of these classes by three criteria: name, id, and score.
The search what I want is to output the previous value and next value of the found element.
The code that I thought of
// v is a vector which the Player is randomly placed

sort(v.begin(), v.end(), [](Player& a, Player& b) {return a.getID() < b.getID(); });
std::vector<Player> ID_sorted_v = v;
sort(v.begin(), v.end(), [](Player& a, Player& b) {return a.getName() < b.getName(); });
std::vector<Player> Name_sorted_v = v;
sort(v.begin(), v.end(), [](Player& a, Player& b) {return a.getScore() < b.getScore(); });
std::vector<Player> Score_sorted_v = v;

std::cin >> input   // input is ID

for (vector<Player>::iterator search =
    find_if(ID_sorted_v.begin(), ID_sorted_v.end(),
        [input](Player& p) {
            return (p.getID() == input);
        });
    search != ID_sorted_v.end();
            search = find_if(++search, ID_sorted_v.end(), [input](Player& p) {
            return (p.getID() == input);
                }
            ))
{
    cout << *(search - 1) << endl << *search << endl << *(search + 1) << endl << endl;
}

for (vector<Player>::iterator search =
    find_if(Name_sorted_v .begin(), Name_sorted_v .end(),
        [input](Player& p) {
            return (p.getID() == input);
        });
    search != Name_sorted_v .end();
            search = find_if(++search, Name_sorted_v .end(), [input](Player& p) {
            return (p.getID() == input);
                }
            ))
{
    cout << *(search - 1) << endl << *search << endl << *(search + 1) << endl << endl;
}

for (vector<Player>::iterator search =
    find_if(Score_sorted_v.begin(), Score_sorted_v.end(),
        [input](Player& p) {
            return (p.getID() == input);
        });
    search != Score_sorted_v.end();
            search = find_if(++search, Score_sorted_v.end(), [input](Player& p) {
            return (p.getID() == input);
                }
            ))
{
    cout << *(search - 1) << endl << *search << endl << *(search + 1) << endl << endl;
}

Desired Results

// Player's <<Operator is overloaded
id
name:dpygiewhuodfkfu, id:27        , score:206835634
name:jcawlfye       , id:30        , score:534327206
name:nwwffdkgvnegzio, id:31        , score:244395501

name
name:jcawcytbtbc    , id:1535712   , score:552239646
name:jcawlfye       , id:30        , score:534327206
name:jcawuqyvbttcrpq, id:559488    , score:495512171

score
name:kawuzofo       , id:1030200   , score:534327131
name:jcawlfye       , id:30        , score:534327206
name:intny          , id:1770826   , score:534328056

I think the code is problematic in that it requires too much memory to prepare search.
How can I make this code easier and simpler? I thought about it for many hours, but I couldn't think of a better way.
Is that an impossible question?


text:
Q: Using unmanaged code to check for presence of .net runtime I want to create a mixed managed/unmanaged DLL that can be loaded by rundll32, and which checks for the presence of the .Net runtime library before attempting to run any managed code, thusly:
using namespace System;

void SomeManagedCode()
{
    Diagnostics::Debug::WriteLine("Hello managed code!");
}

#pragma managed(push,off)

bool isRuntimeInstalled()
{
    // check for runtime using some *unmanaged* code

    return true;
}

extern "C" __declspec(dllexport) void _stdcall RunDllEntryPoint(
            HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int nCmdShow)
{
    if (isRuntimeInstalled())
    {
        SomeManagedCode();
    }
    else
    {
        OutputDebugString(L".net framework not installed");
    }
}

#pragma managed(pop)

To achieve this, I tried to /DELAYLOAD the CLR (mscoree.dll etc) so that it is only loaded when SomeManagedCode() is called and not before. However, the CLR is still loaded even before RunDllEntryPoint() is called (I can see mscoree.dll in the list of loaded modules). I believe this is because the compiler is linking in code which calls _CorDllMain(), which must force the runtime to load before my own entrypoint is called.
I know there are ways I could repackage this to make it work e.g. split the managed code into a separate DLL, but I'm interested if there's any way to make the above work code in a single DLL.
Is it possible to truly delay-load the CLR dlls, and if so, how?

A: Could it be the existence of the function call "SomeManagedCode()" in your RunDllEntryPoint that's triggering it?  Would it fix things by adding a layer of indirection?
#pragma managed
void SomeManagedCode()
{
    Diagnostics::Debug::WriteLine("Hello managed code!");
}
#pragma unmanaged
void CallSomeManagedCode()
{
    SomeManagedCode();
}
extern "C" __declspec(dllexport) void _stdcall RunDllEntryPoint(
        HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int nCmdShow)
{
    if (isRuntimeInstalled())
    {
        CallSomeManagedCode();
    }
    else
    {
        OutputDebugString(L".net framework not installed");
    }
}

I was in a similar situation, trying to prevent .NET from loading from the wrong thread, and by adding layers of indirection, i.e. never directly call any managed code or managed classes from the native entry point, I was able to push off the .NET loading until later (in my case, until I could do it from a different thread).


text:
Q: Python Launcher preferences in mac OSX not allowing selection of python 3.6 interpreter This problem is that when I run my python programs through python launcher python launcher tries to run it in python 2.7, causing the print command(?) to have brackets around them and numerous other broken things.
I downloaded Python Launcher with python 3.6 from the python.org website.
When opening Python Launcher > Preferences, the 'interpreter' drop-down field has the following options:
/usr/local/bin/pythonw
/usr/local/bin/python
/usr/bin/pythonw
/usr/bin/python
/sw/bin/pythonw
I don't know what the difference between python or pythonw is, or even what any of them mean, but no matter which one I select it always tries to run in python 2.7.
What makes it even more baffling to me is when choosing to open my script in IDLE it says right at the top: (python 3.6.3) and runs a window called 'Python 3.6.3 shell'
How can I get the program to run using python 3.6.3 through Python Launcher?

A: I had the same issue, and this is what I did to solve it.
First, go to Python Launcher > Preferences and check the box where it says "Allow override with #! in script". This way, you can specify in every script what is the python version you want to run the scripts you open with Python launcher.
Then, add this line as the first line of every python script you write:
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6

This line will tell Python Launcher that the script should run in Python 3.6. That should solve your problem.
Also, I'm new to Python, so I don't know if there are any problems with this solution, or if there's a simpler way to solve it.

A: None of the above worked for me with Python 3.7 installed on OS X Mojave. But simply changing the Interpreter to "python3" in the Python Launcher preferences solved the problem.


text:
Q: Stuck with writing a regex in python I am a beginner and stuck with writing a regex in python. I wrote this regex to check if there is match in the given input. Here is the code snippet in file named regexs:
regexp = '[-]?\d+(\.\d+)?[\', ][-]?\d+(\.\d\d+)?'
num = re.compile(regexp, re.IGNORECASE)

I am using this regex to be  tested in a test file :
def full_match(regex, text):
    """
    Gives a list of all complete matches
    """
    ans = []
    for match in regex.finditer(text):
        ans.append(match.group(0))

    return ans

tn = full_match(num, text)
print(
    'num:',
    '5,9' in tn,
    '5.0, 9.0' in tn,
    '-7.4159265 1110' in tn,
    '3.4.5, 1' not in tn,
    '1 2' not in tn,
    '3 - 4' not in tn
)
for match in regexs.num.finditer(text):
    if match.group(0) == '5,9':
        print(' match1:', '5' in match.groups(), '9' in match.groups())
    if match.group(0) == '-7.4159265 1110':
        print(' match2:', '-7.4159265' in match.groups(), '1110' in match.groups())

Output I get on executing the above code is:

num: True False True True True True
match1: False False
match2: False False

Problem is I need to get True as the output for all cases. But My regex fails in certain cases .
Kindly help to resolve this.
TIA.

A: First of all, if you specify a regex with backslashes inside,
use a raw string (r'...'). Otherwise you have to double
the backslashes.
To match all your cases use the following regex:
-?\d+(?:\.\d+)* ?[\',-]? ?\d+(?:\.\d+)?

Differences to your regex:

*

*Change initial [-] to plain -. Square parentheses are needed when you
attempt to match any of provided chars (not a single one).

*Add ?: after (, in 2 places. I think, there is no need to match
these "dot-digits" blocks as capturing groups.

*Change ? after the first (...) to *. This way you will match
such string as 3.4.5 (two "dot-digits" blocks).

*Change the "central part" to: ?[\',-]? ? (optional space, then
either an apostrophe, a comma or a minus (also optional) and again
optional space).

*Delete \d before \d+.

Note that - at the last (or first) position between [ and ] represents
itself, so there is no need to escape it with a backslash.
Additional simplification: If you define the regex string as r"..." (delimiting
it with double quotes), you don't need to escape the apostrophe.
Then the regex can be:
r"-?\d+(?:\.\d+)* ?[',-]? ?\d+(?:\.\d+)?"


text:
Q: Cannot Assign a value of type [AnyObject] tp a value of type NSMutableArray I am trying to get the result of a search using NSPredicate however it conflicts when I try to use filteredArrayUsingPredicate since it returns AnyObject. I've commented out the method I attempted since it's not returning the proper results.
var contacts: NSMutableArray = []
var filteredContacts: NSMutableArray = []

func newFilteringPredicateWithText(text: String) -> NSPredicate {
    return NSPredicate(format:"SELF contains[cd] %@", text);
}
func contactPickerTextViewDidChange(textViewText: String!) {

    if (textViewText == "") {
        self.filteredContacts = self.contacts;
    }
    else {
        var predicate: NSPredicate = self.newFilteringPredicateWithText(textViewText)
        self.filteredContacts = self.contacts.filteredArrayUsingPredicate(predicate)
        //var temp = NSMutableArray(array: self.contacts.filteredArrayUsingPredicate(predicate))
        //self.filteredContacts = temp
    }
    self.tableView.reloadData()
}

A: NSMutableArray and AnyObject are not related therefore you can't easily downcast the type.
I'd suggest a native Swift solution
var contacts: Array<String> = []
var filteredContacts: Array<String> = []

func contactPickerTextViewDidChange(textViewText: String!) {

  if textViewText.isEmpty {
    filteredContacts = contacts
  }
  else {
    filteredContacts = contacts.filter {$0.rangeOfString(textViewText, options: [.CaseInsensitiveSearch, .DiacriticInsensitiveSearch]) != nil }
  }
  tableView.reloadData()
}


text:
Q: How to find and remove repeated words from sentence in PowerPoint using VBA? How do I find and remove repeated words from sentences in PowerPoint?
As a grammar check I want to find double words which are typed by mistake. For example:

Stackoverflow is a a greate site

In this example, one "a" would be removed.

A: My friend, you are embarking on a dangerous mission if you are trying to re-invent automatic grammar checking. Natural language is filled with exceptions guaranteed to evade whatever small set of rules you think will do the job.
Anyhow, below is a lucidly naive stab at it. Now, this code works for the example you gave. It will remove that extra "a". But please be aware that not every repeated word should be removed if you care about preserving grammar, syntax and semantics. Automatically removing repeated "that"s will work wonders on this:

I love that that site.

but it will alter the writer's intent on this by taking the grammar down to a very informal level:

She said that that is a great site.

and removing repeats will ruin absolutely everything here:

That that is is that that is not is not that that is that that is is not true is not true.

not to mention this:

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.

Be prepared for disaster! But anyway, the code works for your example (and more) and provides a framework for you to build upon and to fine-tune such that it works in the majority of cases relevant to you.
Dim shp As Shape
Dim str As String
Dim wordArr() As String
Dim words As Collection
Dim iWord As Long
Dim thisWord As String
Dim nextWord As String
Dim newText As String

For Each shp In ActivePresentation.Slides(1).Shapes
    If shp.HasTextFrame Then
        'Get the text
        str = shp.TextFrame.TextRange.Text
        'Split it into an array of words
        wordArr = Split(str, " ")

        'Transfer to a Collection, easier to deal with than array.
        Set words = New Collection
        For iWord = LBound(wordArr) To UBound(wordArr)
            words.Add wordArr(iWord)
        Next iWord

        'Look for repeats.
        For iWord = words.Count - 1 To 1 Step -1
            thisWord = words.Item(iWord)
            nextWord = words.Item(iWord + 1)

            'Make sure commas don't get in the way of a comparison
            'e.g. "This is a great, great site" is fine
            'but "This site is great great, and I love it" is not.
            nextWord = Replace(nextWord, ",", "")
            'Add whatever other filtering you feel is appropriate.
            'e.g. period, case sensitivity, etc.

            If LCase(thisWord) = LCase(nextWord) Then
                If LCase(thisWord) = "that" Then
                    'Do nothing. "He said that that was great." is ok.
                    'This is just an example. "had" is another.
                    'Add more filtering here.
                Else
                    words.Remove iWord + 1
                End If
            End If
        Next iWord

        'Assemble the text with repeats removed.
        newText = ""
        For iWord = 1 To words.Count
            newText = newText & words.Item(iWord) & " "
        Next iWord

        'Finally, put it back on the slide.
        shp.TextFrame.TextRange.Text = newText
    End If
Next shp

A: This is a classic RegExp application that can remove all repeated words in a single shot (rather than looping word by word) using backreferences.
Note if you want detailed help in accessing the underlying PPT text then you will need to provide more information as to where in the slide(s) the text occurs
Sub TestString()
    MsgBox ReducedText("stackoverflow stackoverflow Stackoverflow is a a great site")
End Sub

Function ReducedText(strIn As String) As String
    Dim objRegex As Object
    Set objRegex = CreateObject("vbscript.regexp")
    With objRegex
        .IgnoreCase = True
        .Global = True
        .Pattern = "\b(\w+)\b(\s+\1\b)+"
        ReducedText = .Replace(strIn, "$1")
    End With
End Function

A: regular expression makes this nice and easy
Function remove_duplicates()

    txt = "Stackoverflow is a a greate site"

    Set word_match = CreateObject("vbscript.regexp")
    word_match.IgnoreCase = True
    word_match.Global = True

    For Each wrd In Split(txt, " ")
        word_match.Pattern = wrd & " " & wrd
        txt = word_match.Replace(txt, wrd)
    Next

    MsgBox txt

End Function


text:
Q: Is there a way to add two values of an array? I am trying to make a vernam cypher using html and js, I started by giving each letter a value  like (a = 0, b = 1, c = 2, … z = 25). Made two inputs so user can enter the world, and the key. Next I transformed the string from the input to an array, using Array.from(). But now I can't add the values to each others, I cannot find the right loop for it.
This is a link that says what is vernam cypher so you can understand what I am trying to do: https://www.geeksforgeeks.org/vernam-cipher-in-cryptography/


text:
Q: Showing the uncountable well-ordered set with a largest element is compact. I'm having some trouble proving what is said above. My work is as follows:
Let $Q$ be the uncountable well-ordered set and let $\Omega$ be such that $\Omega > q$ for all $q \in Q$. I am trying to show that $Q^* = Q \cup \Omega$ is compact. To start, assume that $Q^*$ is not compact and that $O$ is an open cover of $Q^*$ that has no finite subcover. For each $q \in Q^*$, let $T_q = \{p \in Q^* \ | \ p \le q\}$. Let $C = \{p \in Q^* \ | \ T_p \text{ cannot be covered by finitely many sets from }O\}$.  $C$ is nonempty by assumption, and so let $m$ be the minimal element of $C$ (which cannot be the minimal element of $Q$). $T_m$ is the smallest section that cannot be covered by finitely many intervals, but for all $q < m$ $T_q$ can be covered by finitely many subcovers of $O$. I am struggling here at this final step. If $O_q$ is a finite subcover of $O$ that covers $T_q$, how can I construct a finite subcover of $T_m$ and show a contradiction? Initially, I went with $O_q \cup [q,c')$, for $c'$ the successor of $c$, but there's no guarantee that this open set is a set of $O$. Any hints would be appreciated.
Edit: I am not asking for a proof of the aforementioned statement, but commentary/criticism on my partial proof above (otherwise I would not have included it). That is, how do we construct a finite subcover of $T_m$ given the material above? If we cannot, why?

A: A well ordered set with a maxinum element is a complete linear order.
Showing your set is compact is a result of showing complete linear orders with the order topology are compact.
To prove that, the Alexandroff subbase theorem is used, namely:
if every cover of a space S by subbase sets has a finite subcover, then S is compact.
Let S be a complete linear order.
Since S is complete it has a top t, and bottom b, element.
B = { [b,x), (x,t] : x in S }, the collection of all sets of the form [b,x) and (x,t] is a subbase for the order topology of S.
Now if C subset B is a cover of S, let
u = inf{ x : (x,t] in C }.
As C covers S, exists y with u in [b,y) and [b,y) in B.
Thus { [b,y), (u,t] } is a finite subcover of C.
Consequently, by the subbase theorem, S is compact.

A: An ordered space $X$ in the order topology is compact iff $\sup(A)$ exists for all $A \subseteq X$.
Now let $X$ be non-empty well-ordered with $M=\max(X)$.
If $A\subseteq X$, the set $U(A)$ of uperbounds of $A$ is non-empty (e.g. $M$ is in it) and then $\min(U(B))= \sup(A)$ exists by well-orderedness. So $X$ is compact in the order topology.

A: Another answer to address the proof the OP proposed.
To set the stage:
So we have the set $X=\Omega \cup \{\Omega\}$ where $\Omega$ is the smallest uncountable ordinal. $\Omega \in X$ is the maximum of $X$. $X$ has the order topology, which has as a base all sets of the following forms

*

*$[0,x), x \in X$ (the only basic open sets that contain $0$),

*$(x,y): x < y \in X$,

*$(x,\Omega], x \in X$ (the only basic open sets that contain $\Omega$).

Now let $\mathcal{U}$ be an open cover of $X$. Suppose that it does not have a finite subcover (striving for a contradiction). Define $$M = \{x: [0,x] \text{ does not have a finite subcover by } \mathcal{U}\}$$
and note that, as $\Omega \in M$, $ M \neq \emptyset$, so $m=\min(M) \in X$ exists. Also $0 \notin M$, clearly.
First case: $m=\Omega$. Then as we have a cover of $X$ some $U_0 \in \mathcal{U}$ exists with $\Omega \in U_0$, and so there is some $x_0 \in X$ such that $(x_0,\Omega] \subseteq U_0$. As $x_0 < m=\min(M)$, $[0,x_0]$ has a finite subcover by elements from $\mathcal{U}$ (else it would contradict the minimality of $m$) and adding $U_0$ to these, shows that we also have a finite subcover for $[0,m]$, a contradiction, as then $m \notin M$ at all.
Second case (really the same) $m < \Omega$ (or equivalently $0< m \in \Omega$): then again we find $U_0$ from $\mathcal{U}$ such that $m \in U_0$ and a basic $(x_0, x_1)$ with $m \in (x_0, x_1) \subseteq U_0$. Again we have a finite subcover for $[0,x_0]$ and we add $U_0$ to cover $[0,m]$ again by a finite subcover and so $m \notin M$ contradiction.
We could have combined the above two cases by a priori showing that in a well-order the order topology has as a base all sets of the form $(x,y], x < y \in X$ and use only sets of that form in our argument.
But the minimality argument is a valid one. The max is needed for non-emptyness of $M$, that's why the argument fails for the non-compact space $\Omega$ itself. This clearly has a cover $\{[0,x): x \in \Omega\}$ without even a countable subcover (as all countable subsets of $\Omega$ have an upperbound in $\Omega$).


text:
Q: XKeysymToKeycode and keyboard layout I'm trying to use the function XKeysymToKeycode to send keystrokes to the active x11 applicaiton.
The function works but it is using the english keyboard.
My pc is localized as italian. Now I have to send for example the character "à", defined in the italian keyboard.
How can I do in order to send it?

A: I've been struggling with the same issue. It seems that:

*

*The multiple layouts feature is implemented as groups and your IT layout is partially in group 1 for characters that differ from the US keyboard and in group 0 for some invariant keys (return/enter for example).

*XKeysymToKeycode doesn't care about groups, it just picks the first match.

You can either do the work manually as the clutter guys did. Or use a combination of gdk and X:
//char *oksym ="KP_Enter";
char *oksym ="at";
gboolean orv;
guint okeyval;
GdkKeymapKey *okeys;
gint on_keys;
GdkKeymap *okeymap;
GdkDisplay *odisplay;

XkbGetState(display, XkbUseCoreKbd, &xkbState);
printf("Active group would be %d\n",xkbState.group);

odisplay = gdk_display_get_default();
okeymap = gdk_keymap_get_for_display(odisplay);
okeyval = gdk_keyval_from_name(oksym);
if(okeyval == GDK_KEY_VoidSymbol){
    printf("GDK keyval GDK_KEY_%s is unknown\n",oksym);
    exit(-1);
}
orv = gdk_keymap_get_entries_for_keyval(okeymap, okeyval, &okeys, &on_keys);
printf("The following hardware keys will produce keyval GDK_KEY_%s(%d):\n",oksym,okeyval);
for(int i = 0; i < on_keys; i++){
    /*Groups seems to be used to manage multiple keyboard layouts (at least using MATE)
     * instead/on top of their orignal meaning. Getting the active layout seems to be
     * acheivable using XkbGetState. Some keys seems to be shared/stay on group 0, example
     * Return/Enter. So if there is more than one key bound to a keyval, we'll take the one
     * that matches the active group. If there is only one (i.e Enter/Return) we'll just take
     * it regardless of its group.
     * */
    if( okeys[i].group == xkbState.group || on_keys == 1)
        printf("\tkeycode: %d, group: %d, level: %d\n",okeys[i].keycode,okeys[i].group,okeys[i].level);
}


text:
Q: Kivy-Python error after releasing VideoCapture(0) and setting kivy camera.play = True     import numpy as np
import cv2
import time
import datetime
import math
from scipy.spatial import distance as dist

import os
import image_processing as imp

import kivy
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.camera import Camera

class NoteCutterGrid(GridLayout):
    __mode = 1
    __auto_find = True
    __show_settings = False
    __sharpness = 30
    __grayscale = 0

    def take_photo(self):
        self.ids['camera'].play = False
        cap = cv2.VideoCapture(0)
        ret, frame = cap.read()
        cap.release()
        if ret:
            res = imp.image_processing(frame, (self.__mode - 1), self.__grayscale, self.__sharpness)
            for image in res:
                imp.save_image(image)
        self.ids['camera'].play = True

If I don't write self.ids['camera'].play = True, it do function image_processing, but camera in the app still be freezed. I want to unfreeze it after saving images taken from VideoCapture, but it returns an ERROR many times:

[ERROR  ] [OpenCV      ] Couldn't get image from Camera
Traceback (most recent call last):
File "C:\Users\Tioma\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\core\camera\camera_opencv.py", line 139, in _update
self._buffer = frame.imageData
AttributeError: 'NoneType' object has no attribute 'imageData'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Tioma\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\core\camera\camera_opencv.py", line 143, in _update
self._buffer = frame.tostring()
AttributeError: 'NoneType' object has no attribute 'tostring'


text:
Q: App Distribution Provisioning Profile and Signing Issues I've been trying to publish my app (on ios for the first time) for a few days now. Every time I try to submit, I usually get an error in the application loader telling me that the provisioning profile doesn't line up with the signing identity. I can't figure this out! Here is what I've done:

*

*created an iOS Distibution signing identity via Xcode account management

*created an App ID (wildcard) via apple dev portal

*created an app store (distribution) provisioning profile (associated with said App ID and iOS signing ID) and installed it on my mac

*Using RoboVM tools, I generate an IPA with said signing identity and distribution provisioning profile. (Because this is a LibGdx game)

*created an App in itunes connect (bundle ID being that of the one used for my app ID)

When I try to send to itunes connect via application loader, I get an error reading "The executable must be signed with the certificate that is contained in the provisioning profile." This is driving me insane so I thought I would see if I could find help here. Thanks in advance!
EDIT: Turns out my mac was mixing up delicately named signing identities. I deleted them all and redid the process. works now!

A: Check the following things:

*

*Do you select the right certificate in the profile?

*Do you select the right profile in the Xcode?

*Certificate and profile are valid.


text:
Q: Highcharts chart redraw while exporting i am facing an issue in the highcharts export. We have a custom download button and on click of that we are calling the Highchart exportChart which is redrawing the chart and is messing the chart . Can you please let us know how we can stop the redrawing of the chart while doing export ?

A: This happens because of your load function in event.

A: You may have specified some events like "load" in highcharts option, so that events may be called when you export a chart. This may cause problems. Disabling the events while exporting chart, solve the problem.
Official Docs
chart.exportChart({type: 'image/png', filename: 'file-name'},{
    chart:{
        events:null
    }
});


text:
Q: firebase-php error: Call to a member function get() on null I'm trying to read my firebase database' data using the firebase-php library.
I'm initializing the library using this script, the X's are placeholders, obviously.
require_once "vendor/autoload.php";
define('DEFAULT_URL', 'https://XXXXXXXXXXXXXX.firebaseio.com');
define('DEFAULT_TOKEN', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
define('DEFAULT_PATH', '/firebase/orders');

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

But I'm getting an error running $firebase->get(DEFAULT_PATH);

Fatal error: Call to a member function get() on null in
  index.php on line 76

Since $firebase is null there is obviously going something wrong during initializing, but I can't seem to find what causes this.


text:
Q: Material component tab bar bottom navigation How can I create a material component tab bar bottom navigation? The docs describe
that I have to implement positionForBar: and return UIBarPositionBottom to configure the tab bar as a bottom navigation bar. The bar will automatically update with the appropriate styling. How ever it looks like it doesn't work -example:
ViewController.h
...
@interface ViewController : MDCCollectionViewController <MDCTabBarDelegate>

ViewController.m
- (void)viewDidLoad {
 [super viewDidLoad];
 self.styler.cellStyle = MDCCollectionViewCellStyleCard;
// Do any additional setup after loading the view, typically from a nib.

self.appBar = [[MDCAppBar alloc] init];
[self addChildViewController:self.appBar.headerViewController];
self.appBar.headerViewController.headerView.backgroundColor = [UIColor colorWithRed:120.0/255 green:144.0/255 blue:156.0/255 alpha:1.0];//rgba(38,50,56 ,1)
self.appBar.headerViewController.headerView.trackingScrollView = self.collectionView;
self.appBar.navigationBar.tintColor = [UIColor blackColor];
[self.appBar addSubviewsToParent];

self.title = @"W0rX";

MDCTabBar *tabBar =  [[MDCTabBar alloc] initWithFrame:self.view.bounds];
tabBar.items = @[
                 [[UITabBarItem alloc] initWithTitle:@"Recents" image:[UIImage imageNamed:@"phone"] tag:0],
                 [[UITabBarItem alloc] initWithTitle:@"Favorites" image:[UIImage imageNamed:@"heart"] tag:0],
                 ];
tabBar.itemAppearance = MDCTabBarItemAppearanceTitledImages;
tabBar.delegate = self;

tabBar.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
[tabBar sizeToFit];
[self.view addSubview:tabBar];
}

- (UIBarPosition)positionForBar:(id <UIBarPositioning>)bar {
NSLog(@"######## UIBarPositionBottom");
return UIBarPositionBottom;
}

A: Thanks for using MDC-iOS.
Looks like your code is almost there!
What's missing is setting the frame of the tab bar to the bottom of the screen. See BottomNavigationBarExample for an example of how to do that. In that example view controller, the tab bar is placed at the bottom of the screen in viewWillLayoutSubviews:
barFrame.origin.y = CGRectGetMaxY(bounds) - barFrame.size.height

I know you just put a snippet of code here but I don't see you setting the origin except when you instantiate the tab bar. Your line
MDCTabBar *tabBar =  [[MDCTabBar alloc] initWithFrame:self.view.bounds];

puts the top-left corner as the origin for the tab bar (0,0) to start with. Which is fine. But you'll need to move it down to the bottom of the view eventually.
BTW: Also take a look at MDCTabBarViewController which is a lot like a UITabBarViewController. It may work for you depending on what you're trying to do.


text:
Q: maven build jar with dependencies I'm working in a Maven Swing application and I'm having some issues with the building.
The environment
I'm developing my app using Netbeans 8.2 as my IDE and Jasper Reports library to generate some PDF reports based on compiled .jasper files, which are being generated separately using Jaspersoft Studio 6.3.1 and then are being used as a resource in my project.
The pom for my project is as follows (expert with relevant info):
<project>
    <!-- Needed for jasperreports-functions -->
    <repositories>
        <repository>
            <id>jr-ce-releases</id>
            <url>http://jaspersoft.artifactoryonline.com/jaspersoft/jr-ce-releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.4.0</version>
        </dependency>

        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports-functions</artifactId>
            <version>5.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.12</version>
        </dependency>

        <!-- The driver I need for connecting to my DB -->
        <dependency>
            <groupId>com.ibm.informix</groupId>
            <artifactId>jdbc</artifactId>
            <version>4.10.8.1</version>
        </dependency>

        <!-- some other test dependencies -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>ar.edu.unt.gui.MainFrame</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>

        <!-- I exclude the Jasper XML as I only need .jasper files in my project -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>*.jrxml</exclude>
                </excludes>
            </resource>
        </resources>
    </build>
</project>

The problem
With this configuration, I can run the project from Netbeans by doing Right click on project -> Clean and Build option, which is equivalent to mvn clean install. The application compiles without errors and I can run it from the IDE with the Run -> Run project option from the menu and it is executed successfully. The packaged jar contains the following:

As you can see, the dependencies aren't being packaged within the jar. This is not desirable because I need the application to be standalone, i.e. I need to copy the jar in another computer and I must be able to run it.
To make a test I tried to run the application from the console: I moved to target/ folder and from there I run
java -jar certificado-titulos-unt-1.0.jar

And got the error
java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException
    at ar.edu.unt.gui.MainFrame.<init>(MainFrame.java:45)
    ...
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    ...

As I expected, this doesn't work as I'm outside the development environment and the dependencies are not being packaged in the jar. This is the problem
Solution attempt
I found this answer and added the maven-assembly-plugin configuration as suggested there and obtained a single jar. Apparently containing the dependencies as I didn't had the ClasNotFoundError. The problem is that with this build my code wasn't able to get some resources files conexion.properties, so this approach wasn't useful. Also, with this configuration, I wasn't able to see the package's content nor uncompress it, at least with my unzip utility.
Summarize
So, to summarize, I wasn't able to configure maven to package all my dependencies (basically, jasper-reports and groovy with transitive dependencies) within my application to overcome the ClassNotFoundError. Any help with this is highly appreciated.
Thanks in advance for your answers

A: The Shade Plugin provides the capability to create uber jars.  That is, jars that contains the project's classes as well as the classes from the project's runtime dependencies.
The basic usage of the plugin is enabled by declaring the plugin in the POM's build section tying it to the package build phase:
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</artifactId>
      <version>3.0.0</version>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>shade</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

To build the uber jar, run maven with the package target
mvn package

On success, the final jar in the target directory will be the uber jar.


text:
Q: fetch record in combobox2 if index of combobox1 is changed i.e do it without pressing button (if index of other combobox is changed) using PHP I'm working on a project in which I have 2 combobox (drop down lists) I want to display record in combobox2 as the index of combobox1 is changed.
Example
<select name = "semester">
<option value = "1st">1st</option>
<option value = "2nd">2nd</option>
<option value = "3rd">3rd</option>
</select>
<select name = "course">
<?php
require "con.php";
$query = mysql_query(select courses from course_tbl where semester = ".$_POST['semester']);
while($row = mysql_fetch_row($query))
{
  echo "<option value = '$row[0]'>$row[0]</option>";
}
?>
</select>

means load all courses of the semester that user selects. means if index of semester is changed then immediately load all courses in other combobox. Please help.


text:
Q: wpa_supplicant reply to any command with UNKNOWN COMMAND While sending a command to wpa_supplicant ( with wpa_cli for instance ) I got UNKNOWN COMMAND all times.
root@rk3399_box:/system/bin # wpa_cli
wpa_cli v2.5-devel-6.0.1
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

Using interface 'wlan0'

Interactive mode

> scan
UNKNOWN COMMAND

And then if I specify the IFNAME it works
> IFNAME=wlan0 scan
OK
IFNAME=wlan0 <3>CTRL-EVENT-STATE-CHANGE id=-1 state=3 BSSID=00:00:00:00:00:00 SSID=
IFNAME=wlan0 <3>CTRL-EVENT-STATE-CHANGE id=-1 state=0 BSSID=00:00:00:00:00:00 SSID=

That's an issue, as I can't just send the IFNAME as Android SDK is just setting it while it's a p2p interface but not with the others: https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/refs/tags/android-6.0.1_r74/service/java/com/android/server/wifi/WifiNative.java#129
I've another device that's almost the same, that works properly sending commands without the IFNAME parameters.
What makes this fail?


text:
Q: using the group clause and aggregate functions to operate on row data This is a snippet of table tableA:
station     code    persons    childLabour    DrinkingWater
staA         01     isaac      No              Yes
staB         05     Jane       Yes              Yes
staA         03     Jeff       No               No
staB         05     Saleh      No               Yes
staC         03     Henry      Yes              No
staA         01     Gera       No               No
staB         05     zoltan    Yes               Yes
staA         01     Allen      No               Yes
staC         04     Billy      No               Yes
staA         01     Jean       Yes              Yes

I am trying to formulate a query on that table that gives me a result as shown below:
Explanation of the query result:
Based on the station and code,calculate the number of persons whose ChildLabour value = yes and display result. Also calculate the number of persons whose DrinkingWater value is Yes and display result --for each station and corresponding code.
station       code     ChildLabour         DrinkingWater
staA           01       3                    4
staA           03       2                    1
staB           05       5                    10

So, my query thus far looks like this:
select distinct station,code,
       (select count(persons) from `tableA`
        where childLabour='Yes'
        group by `station,code`) as `childLabour`
from `tableA` order by code `asc`;

but it generates the wrong result as shown below:
The query displays the same value(total of all persons whose childLabour value = Yes) in the entire column.
station code ChildLabour  DrinkingWater
staA     01     3           4
staA     03     3           4
staB     05     3           4

How do I get around this problem, I am sure its not a major problem!

A: Could try using SUM and only sum the values that are valid - equals yes:
SELECT station, code, SUM(IF(childLabour = 'Yes', 1, 0)), SUM(IF(DrinkingWater = 'Yes', 1, 0))
FROM tableA
GROUP BY station, code

Results:
staA    01  1   3
staA    03  0   0
staB    05  2   3
staC    03  1   0
staC    04  0   1

Explanation:
station     code    persons    childLabour    DrinkingWater
staA         01     isaac      No               Yes
staA         01     Gera       No               No
staA         01     Allen      No               Yes
staA         01     Jean       Yes              Yes
                                1               3
staA         03     Jeff       No               No
                                0               0
staB         05     Saleh      No               Yes
staB         05     Jane       Yes              Yes
staB         05     zoltan     Yes              Yes
                                2               3
staC         03     Henry      Yes              Nn
                                1               0
staC         04     Billy      No               Yes
                                0               1

These are the results and why i am getting them.
SqlFiddle


text:
Q: Returning user data for forms that have errors in when using ModelForms forms.py
from django.forms import ModelForm
from client.models import ClientDetails, ClientAddress, ClientPhone
from snippets.UKPhoneNumberForm import UKPhoneNumberField

class ClientDetailsForm(ModelForm):
    class Meta:
        model = ClientDetails

class ClientAddressForm(ModelForm):
    class Meta:
        model = ClientAddress

class ClientPhoneForm(ModelForm):
    number = UKPhoneNumberField()

    class Meta:
        model = ClientPhone

views.py
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from client.forms import ClientDetailsForm, ClientAddressForm, ClientPhoneForm

def new_client_view(request):
    formDetails = ClientDetailsForm(initial={'marital_status':'u'})
    formAddress = ClientAddressForm()
    formHomePhone = ClientPhoneForm(initial={'phone_type':'home'})
    formWorkPhone = ClientPhoneForm(initial={'phone_type':'work'})
    formMobilePhone = ClientPhoneForm(initial={'phone_type':'mobi'})
    return render_to_response('client/new_client.html', {'formDetails': formDetails, 'formAddress': formAddress, 'formHomePhone': formHomePhone, 'formWorkPhone': formWorkPhone, 'formMobilePhone': formMobilePhone}, context_instance=RequestContext(request))

new_client.html
<form action="." method="POST">

                    {{ formDetails.as_table }}
                    {{ formAddress.as_table }}

                    {{ formHomePhone.as_table }}
                    {{ formWorkPhone.as_table }}
                    {{ formMobilePhone.as_table }}

    <input type="submit" value="Submit">
</form>

How should I write views.py so that if the user's data raises an error, instead of showing them the form again with the errors in but none of their original data, it shows them the form again with the errors AND their original data?

A: As MYYN says, look here: http://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
ModelForms are Forms too and using them is no different.
if request.method == 'POST': # If the form has been submitted...
    form = ContactForm(request.POST) # A form bound to the POST data
    # now your form contains the values submitted
else:
    form = ContactForm() # empty form

The django forms should always return the errors AND their originally submitted data.
The only way you would get errors and not their data is if you did something like passing an empty dictionary to the form.
Your example would never show any errors as you are never passing it data to validate against. It would always show an empty form.
Initial is not the place to pass in user submitted data
f = Form(initial={'foo':'bar'})
f.is_valid()
False
f.errors # will not validate or show you errors

Pass in the POST dictionary instead
f = Form({'foo':'bar'})
f.is_valid()
False
f.errors
{'baz': [u'This field is required.']}


text:
Q: Замокать(Moq) вспомогательный метод в классе Есть класс(и его интерфейс) у него есть два метода А и B. Метод B выполняет вспомогательную функцию т.е он вызывается только из метода А. Нужно создать Moq объект что бы вспомогательный метод всегда возвращал только true.
Делаю так:
var mock = new Mock<IA>();
mock.Setup(w => w.Ab(It.IsAny<short>()))
    .Returns(true);

, но он сейчас выполняет свою функцию т.е обрабатывает данные не хочет возвращать всегда true. Возможно ли создать moq метода и вызвать его из этого же класса?


text:
Q: What does the . do in Haskell?
Possible Duplicate:
What does a fullstop or period or dot (.) mean in Haskell?

This is such a general question, but I actually don't know why it's there. If you have like: sort.function    what does the . actually do? or mean?

A: Function composition.
(f . g) x is the same as f (g x)


text:
Q: vuejs object with spaces syntax Unfortunately I have to work with an object that has spaces in the labels.
I can loop through the object with the following:
v-for="index in $data['wins Lane 1'].player2.pts"

"Lane 1" is a variable called "item.lane" I am trying to pass in but I can't figure out the correct syntax.  The following doesn't not work:
v-for="index in $data['wins ' + item.lane].player2.pts"

Help!

A: Not sure if it works, you can try using javascript template literals
v-for="index in $data[`wins ${item.lane}`].player2.pts"

A: This syntax was correct.
v-for="index in $data['wins ' + item.lane].player2.pts"

The issue was the component trying to render while item.lane was undefined.


text:
Q: When running .lp files using clingo on MacOS, I got this error: : error: file cannot be opened For the same file, if I set the extension to .lp, it cannot be opened; however, changing the extension to .txt solves the problem. The function of running .lp files should be standard for Clingo, right? I also tried installing the package clingo-lp and clingo-lpx, none of them solved my problem yet.
I am wondering why, is it because the OS I use? Haven't tried it on Windows.
When I type in this:
% clingo /Users/lingxiaozhao/Documents/queens.lp -c n=8 0,

it should return all the stable models for the .lp file, but instead it returned:
clingo version 5.6.2
Reading from ...ingxiaozhao/Documents/queens.lp
<cmd>: error: file could not be opened:
  /Users/lingxiaozhao/Documents/queens.lp

*** ERROR: (clingo): parsing failed
UNKNOWN

Models       : 0+
Calls        : 1
Time         : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.001s

I tried installing the package clingo-lp and clingo-lpx, none of them solved the problem.


text:
Q: How to parse tree from TFS Test Plan Good day!
I try to parse tree on test plan tfs 2010.
So, i can get Test Plan:
var planOld = helperOldProject.GetTestPlan("TestProject", 10); // 10- id of test plan
ITestManagementTeamProject project1 = helperNewProject.GetProject(sourceserverurl,    sourceproject);

Then i create new Test Plan Programmatically:
//Create a Test Plan Programmatically
 ITestPlan planNew = project1.TestPlans.Create();
        planNew.Name = planOld.Name;
        planNew.StartDate = DateTime.Now;
        planNew.EndDate = DateTime.Now.AddMonths(2);
        planNew.AreaPath = "TestArea";
        planNew.Description = planOld.Description;
        planNew.State = planOld.State;
        // other attributes: plan.AreaPath, plan.Description,plan.State
        planNew.Save();

        And then i need to parse RootSuite tree:

        var suiteOld = planOld.RootSuite;

        // Parse Root:

        IStaticTestSuite suiteNew = project1.TestSuites.CreateStatic();
         suiteNew.Title = suiteOld.Title;
         planNew.RootSuite.Entries.Add(suiteNew);

         foreach (var tcc in suiteOld.TestCases)
         {
             var tc = helperOldProject.teamProject.TestCases.Find(tcc.Id);
             var tc2 = helperNewProject.teamProject.TestCases.Create();

             tc2.Description = tc.Description;
             tc2.Owner = tc.Owner;
             tc2.Title = tc.Title;
             tc2.Save();
             suiteNew0.Entries.Add(tc2);
             planNew.Save();
         }

And then i need to parse SubTree:
          CreateSubTree(ref project1,ref planOld,ref planNew,ref helperOldProject,ref helperNewProject);

           public static void CreateSubTree(ref ITestManagementTeamProject project1,ref ITestPlan planOld,
       ref ITestPlan planNew,ref Helper helperOldProject,ref Helper helperNewProject)
    {

        Console.WriteLine("SubSuites.Count: " + planOld.RootSuite.SubSuites.Count);
        foreach (ITestSuiteBase suiteOld in planOld.RootSuite.SubSuites)
        {
            IStaticTestSuite suiteNew = project1.TestSuites.CreateStatic();

            // planNew.RootSuite.SubSuites.Add(suiteNew);

            IStaticTestSuite staticSuiteOld = suiteOld as IStaticTestSuite;

            foreach (ITestSuiteEntry tccOld in staticSuiteOld.TestCases)
            {
                suiteNew.Title = suiteOld.Title;
                planNew.RootSuite.Entries.Add(suiteNew);

                //planNew.RootSuite.SubSuites.Add(suiteNew);

                var tc = helperOldProject.teamProject.TestCases.Find(tccOld.Id);
                var tc2 = helperNewProject.teamProject.TestCases.Create();

                tc2.Description = tc.Description;
                tc2.Owner = tc.Owner;
                tc2.Title = tc.Title;
                tc2.Save();
                suiteNew.Entries.Add(tc2);

            }

            Console.WriteLine(suiteOld.TestSuiteEntry);
        }
    }

So, i parse new one subtree element, but i know,that after that node i have another one node.Like this:
Root:  element1,element2,element3 ...
--- Node1:element1,element2....
-------- Node2: element1,element2...
But  planOld.RootSuite.SubSuites.Count==1; And i see elements only of Root and Node1.
And another problem is to create new sub tree:
This code doesnt works:
planNew.RootSuite.SubSuites.Add(suiteNew);  // cannot add,remove item  error.

Please, help me to parse it!
And why i cannot add sub node at tree?
Thank you!

A: This is how you can create a new test suite under a test plan
        ITestManagementTeamProject teamProject = testManagementService.GetTeamProject(projectId);
        ITestPlan testplan= teamProject.TestPlans.Find(testplanId);
        IStaticTestSuite newSuite = teamProject.TestSuites.CreateStatic();
        newSuite.Title = "new title";

        testplan.RootSuite.Entries.Add(newSuite);
        testplan.Save();

For the first question I dont really understand maybe you can explain more.


text:
Q: Schedule Primefaces looks bad I'm using a template with three sections, top, left (sliding menu) and content. In all my pages this works fine because the content looks right beside the left section. But with the schedule just the header is in the right section or displays fine but the body's schedule is way down, after the section of the left.

thanks for the help.

A: I had the same issue and I've found it. You need to add position: relative; top: -220px; to the Css of the calendar rendering in my calendar.css  Hope this helped!


text:
Q: MySQL multi-step GROUP BY without subquery I'm working on improving some queries I inherited, and was curious if it was possible to do the following - given a table the_table that looks like this:
  id   uri
  ---+-------------------------
   1   /foo/bar/x
   1   /foo/bar/y
   1   /foo/boo
   2   /alpha/beta/carotine
   2   /alpha/delic/ipa
   3   /plastik/man/spastik
   3   /plastik/man/krakpot
   3   /plastik/man/helikopter

As an implicit intermediate step I'd like to group these by the 1st + 2nd tuple of uri.  The results of that step would look like:
  id   base
  ---+---------------
   1   /foo/bar
   1   /foo/boo
   2   /alpha/beta
   2   /alpha/delic
   3   /plastik/man

And the final result would reflect the number of unique tuple1 + tuple2 values, per unique id:
  id   cnt
  ---+-----
   1   2
   2   2
   3   1

I can achieve these results, but not without doing a subquery (to get the results of the implicit step mentioned above), and then select/grouping out of that.  Something like:
SELECT
  id,
  count(base) cnt
FROM (
  SELECT
    id,
    substring_index(uri, '/', 3) AS base
  FROM the_table
  GROUP BY id, base
)
GROUP BY id;

My reason for wanting to avoid the subquery is that I'm working with a fairly large (20M rows) data set, and the subquery gets very expensive.  Gut tells me it's not doable, but figured I'd ask SO...

A: There's no need for a subquery -- you can use count with distinct to achieve the same result:
SELECT
    id,
    count(distinct substring_index(uri, '/', 3)) AS base
FROM the_table
GROUP BY id

*

*SQL Fiddle Demo
BTW -- this returns count of 1 for id 3 -- I assume that was a typo in your posting.


text:
Q: Oracle Apex Interactive Grid - LOV Cascade I have an Interactive Grid with 2 Select List columns (LOV):
Type_of_food    Product

As per customer request both have their own independent table like this:
Type_of_food    type_of_food_Id
Fruit           123
Vegetable       456
Snack           789

Product         Product_Id   type_of_food_Id
Apple           ABC          123
Banana          DEF          123
Onion           GHI          456
Kale            JKL          456
Cookies         MNO          789

So basically, when the user selects Fruit from the drop down, the next column (Product) will be updated with the Products belonging to this category.
My Type_of_food column query is:
select distinct
type_of_food d,
type_of_food r
from type_of_food_table

While my Product column query is:
select distinct
Product r,
Product g
from Product_table
left join type_of_food_table on type_of_food_table.type_of_food_id =
Product_table.type_of_food_id

Both LOV show Type_of_food and Product Items and when I select a Type_of_food the Product Column gets refreshed. Issue is, it doesn't get refreshed with the proper values (e.g. If I select Fruits it will show all Products regardless of Type).
My Product column has the 'Cascading List of Values' turned on with 'Parent Column(s)' = 'Type_of_food'.
Anyone knows what I'm doing wrong?
Thanks

A: Found the solution, added this to the Product query:
select distinct
Product r,
Product g
from Product_table
left join type_of_food_table on type_of_food_table.type_of_food_id =
Product_table.type_of_food_id
--getting the select list column (product) value:
where type_of_food_table.type_of_food = v('type_of_food_select_list_column')


text:
Q: Retaining svn copy history when converting to git using kde svn2git tool My question is very similar to Retaining svn copy history when converting to git except that I am using the free kde svn2git tool
To summarize:
I'm trying to convert a single SVN repo over to a single git repo.
After migration of the svn repository to git I have noticed that git does not seem to follow svn copy operations so the resulting history is much briefer than I expect. Suppose my SVN repo looked like this:
root

*

*a

*b

*c

*parent project

*

*b

*c
Projects b and c were recently copied under parent-proj as part of a restructuring effort with the intention of eventually deleting them from their old locations under root. After migration the resulting git repo is missing all of the history that originated from /b and /c before the move.
I am using the kde svn2git tool which can be found at https://github.com/svn-all-fast-export/svn2git
I tried to look at the sample rules files and documentation for this tool but could not find any information on how to achieve this using this tool.

A: In my experience the situation you describe is a frequent occurance in SVN. People create an 'arbitrary trunk'.
Ideally projects should follow the Subversion conventions. That means that each project will have a subfolder called 'trunk, branches, tags'. Then when migrating with svn2git all you need is a rule for those three folders:
create repository fw
end repository

match /Project/trunk/
  repository fw
  branch master
end match

match /Project/branches/([^/]+)/
  repository fw
  branch \1
end match

match /Project/tags/([^/]+)/
  repository fw
  branch refs/tags/\1
end match

Unfortunately, if you are migrating a repository which didn't strictly follow the convention, then you can have arbitrary trunks, which means a completely separate history. So you need a separate rule, for example you might have a rule like this:
match /Project/trunk/subdir1/subdir2/myproj/trunk
  repository fw
  branch master
end match

You may need to write a script examine the svn paths, which generate rules based on paths discovered.


text:
Q: How do I move this image/link in css Im trying to move this image in css but it just wont move no mater how many times I test it, what am I doing wrong?

#yahoo1 {
  position: absolute;
  top: 100px;
  left: 800px;
}

A: #yahoo1 {
  position: relative;
}

#yahoo1 a {
  position: absolute;
  top: 100px;
  left: 800px;
}

#yahoo1 img {
  display: block;
}


text:
Q: add class after wait and add another class I'm trying to add a class to an element. After that I want to wait 5 seconds and add another class to the same element.
But it just adds the first class "bigEntrance" to the element, and doesn't add the second class to the same element.
How can I do that?

$(window).scroll(function() {

  $('#page__about__left__logo').each(function() {
    var imagePos = $(this).offset().top;

    var topOfWindow = $(window).scrollTop();
    if (imagePos < topOfWindow + 400) {

      $(this).addClass("bigEntrance", function () {

        $(this).addClass("floating");

      });

    }

  });
});

A: Nothing in the addClass documentation says it accepts a second argument, and nothing in your code tells anything to wait five seconds.
To do what you're doing, just add the class and use setTimeout to add the next class five seconds later:
var $this = $(this);
$this.addClass("bigEntrance");
setTimeout(function() {
    $this.addClass("floating");
}, 5000);


text:
Q: How i use AsyncTask to populate an ListView with Adapter consuming WebService? i'm developing a project to complete my technical course in Android-java. In my application I have a part where it consumes the WebService an ArrayList which lists all database Users with an image using a ArrayAdapter. The problem is that I am not able to use this ArrayAdapter and populates the list using AsyncTask, studying on the Internet i am having a bit of trouble to learn how it really works this function. If it were possible i would like to help me to make that call and how to populate the ListView with an Adapter using the Async task . Below will parts of my code:
frmListarEstudios.class
public class frmListarEstudios extends AppCompatActivity {
private ListView listEstudio;
private List<Estudio> ests;
private EstudioDAO dao;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listar_estudios);

    dao = new EstudioDAO();
    ests = dao.buscarTodosEstudios();
    listEstudio = (ListView) findViewById(R.id.listEstudios);
    EstudioAdapter estAdp = new EstudioAdapter(this, ests);
    listEstudio.setAdapter(estAdp);
}

Here are my Adapter.class and some ridiculous unsuccessfully trys:
public class EstudioAdapter extends BaseAdapter {
private List<Estudio> ests;
private Context context;

public EstudioAdapter(Context context, List<Estudio> ests){
    this.ests = ests;
    this.context = context;

}

@Override
public int getCount() {
    return ests.size();
}

@Override
public Object getItem(int arg0) {
    return ests.get(arg0);
}

@Override
public long getItemId(int arg0) {
    return ests.get(arg0).getID_ESTUDIO();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View rootView = LayoutInflater.from(context).inflate(R.layout.lista_estudios, parent, false);

    ImageView imgLogoEstudio = (ImageView) rootView.findViewById(R.id.imgLogoEstudio);
    TextView txtNomeEstudio = (TextView) rootView.findViewById(R.id.txtNomeEstudio);
    TextView txtCidadeEstudio = (TextView) rootView.findViewById(R.id.txtCidadeEstudio);
    TextView txtSiteEstudio = (TextView) rootView.findViewById(R.id.txtSiteEstudio);
    TextView txtFoneEstudio = (TextView) rootView.findViewById(R.id.txtFoneEstudio);

    Estudio estudioDaVez = ests.get(position);

    txtNomeEstudio.setText(estudioDaVez.getNOME_FANTASIA_ESTUDIO());
    txtCidadeEstudio.setText(estudioDaVez.getCIDADE_ESTUDIO() + "-" + estudioDaVez.getESTADO_ESTUDIO());
    txtSiteEstudio.setText(estudioDaVez.getSITE_ESTUDIO());
    txtFoneEstudio.setText(estudioDaVez.getTELEFONE_ESTUDIO());

    Bitmap bitmap = BitmapFactory.decodeByteArray(estudioDaVez.getLOGO_ESTUDIO(), 0, estudioDaVez.getLOGO_ESTUDIO().length);
    imgLogoEstudio.setImageBitmap(bitmap);

    chamarPegarImagem(estudioDaVez);
    return rootView;
}

private void chamarPegarImagem(Estudio position){
    pegarImagem imagem = new pegarImagem();
    Log.i("AsyncTask", "AsyncTask senado chamado Thread: " + Thread.currentThread().getName());
    imagem.execute(position);
}

private class pegarImagem extends AsyncTask<Estudio, Void, Bitmap> {
    private View view;
    private Bitmap bitmap = null;

    @Override
    protected Bitmap doInBackground(Estudio... params) {
        Bitmap bitmap = BitmapFactory.decodeByteArray(params[0].getLOGO_ESTUDIO(), 0, params[0].getLOGO_ESTUDIO().length);
        Log.d("merda", String.valueOf(bitmap));

        return bitmap;
    }

    protected void onPostExecute(Bitmap bitmap){
        if(bitmap!=null) {

            //getView(imgLogoEstudio.setImageBitmap(bitmap));
            Log.i("AsyncTask", "Exibindo Bitmap Thread: " + Thread.currentThread().getName());
        }else{
            Log.i("AsyncTask", "Erro ao baixar a imagem " + Thread.currentThread().getName());
        }
        Log.i("AsyncTask", "Tirando ProgressDialog da tela Thread: " + Thread.currentThread().getName());
    }
}

And here are my DAO Object:
public class EstudioDAO {

private static final String URL = "http://192.168.1.2:8080/photoprintws/services/EstudioDAO?wsdl";
private static final String NAMESPACE = "http://ws.photoprint.com.br";

private static final String BUSCAR_TODOS = "buscarTodosEstudios";

public List<Estudio> buscarTodosEstudios() {

    List<Estudio> listaEst = new ArrayList<Estudio>();

    SoapObject buscarEstudios = new SoapObject(NAMESPACE, BUSCAR_TODOS);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.setOutputSoapObject(buscarEstudios);

    envelope.implicitTypes = true;

    HttpTransportSE http = new HttpTransportSE(URL);

    try {
        //USAR ISSO ABAIXO PARA EVITAR QUE O KSOAP NÃO FAÇA CONEXÃO E RETORNE VALOR NULO
        //ISSO VAI EVITAR CRASH NO APP!

        ArrayList<HeaderProperty> headerPropertyArrayList = new ArrayList<HeaderProperty>();
        headerPropertyArrayList.add(new HeaderProperty("Connection", "close"));

        http.call("urn:" + BUSCAR_TODOS, envelope, headerPropertyArrayList);

        if (envelope.getResponse() instanceof SoapObject) {
            SoapObject resposta = (SoapObject) envelope.getResponse();

            Estudio est = new Estudio();

            est.setID_ESTUDIO(Integer.parseInt(resposta.getProperty("ID_ESTUDIO").toString()));
            est.setRAZAO_SOCIAL_ESTUDIO(resposta.getProperty("RAZAO_SOCIAL_ESTUDIO").toString());
            est.setNOME_FANTASIA_ESTUDIO(resposta.getProperty("NOME_FANTASIA_ESTUDIO").toString());
            est.setCNPJ_ESTUDIO(resposta.getProperty("CNPJ_ESTUDIO").toString());
            est.setSENHA_ESTUDIO(resposta.getProperty("SENHA_ESTUDIO").toString());
            est.setESTADO_ESTUDIO(resposta.getProperty("ESTADO_ESTUDIO").toString());
            est.setCIDADE_ESTUDIO(resposta.getProperty("CIDADE_ESTUDIO").toString());
            est.setBAIRRO_ESTUDIO(resposta.getProperty("BAIRRO_ESTUDIO").toString());
            est.setRUA_ESTUDIO(resposta.getProperty("RUA_ESTUDIO").toString());
            est.setCEP_ESTUDIO(resposta.getProperty("CEP_ESTUDIO").toString());
            est.setCOMPLEMENTO_ESTUDIO(resposta.getProperty("COMPLEMENTO_ESTUDIO").toString());
            est.setTELEFONE_ESTUDIO(resposta.getProperty("TELEFONE_ESTUDIO").toString());
            est.setEMAIL_ESTUDIO(resposta.getProperty("EMAIL_ESTUDIO").toString());
            est.setSITE_ESTUDIO(resposta.getProperty("SITE_ESTUDIO").toString());
            est.setSALDO_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_ESTUDIO").toString()));
            est.setSALDO_PENDENTE_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_PENDENTE_ESTUDIO").toString()));
            est.setSALDO_BLOQUEADO_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_BLOQUEADO_ESTUDIO").toString()));
            est.setSTATUS_ESTUDIO(Integer.parseInt(resposta.getProperty("STATUS_ESTUDIO").toString()));

            String logoEstudio = resposta.getProperty("LOGO_ESTUDIO").toString();

            byte[] bt = Base64.decode(logoEstudio, Base64.DEFAULT);
            est.setLOGO_ESTUDIO(bt);

            listaEst.add(est);
        } else {
            Vector<SoapObject> retorno = (Vector<SoapObject>) envelope.getResponse();

            for (SoapObject resposta : retorno) {

                Estudio est = new Estudio();

                est.setID_ESTUDIO(Integer.parseInt(resposta.getProperty("ID_ESTUDIO").toString()));
                est.setRAZAO_SOCIAL_ESTUDIO(resposta.getProperty("RAZAO_SOCIAL_ESTUDIO").toString());
                est.setNOME_FANTASIA_ESTUDIO(resposta.getProperty("NOME_FANTASIA_ESTUDIO").toString());
                est.setCNPJ_ESTUDIO(resposta.getProperty("CNPJ_ESTUDIO").toString());
                est.setSENHA_ESTUDIO(resposta.getProperty("SENHA_ESTUDIO").toString());
                est.setESTADO_ESTUDIO(resposta.getProperty("ESTADO_ESTUDIO").toString());
                est.setCIDADE_ESTUDIO(resposta.getProperty("CIDADE_ESTUDIO").toString());
                est.setBAIRRO_ESTUDIO(resposta.getProperty("BAIRRO_ESTUDIO").toString());
                est.setRUA_ESTUDIO(resposta.getProperty("RUA_ESTUDIO").toString());
                est.setCEP_ESTUDIO(resposta.getProperty("CEP_ESTUDIO").toString());
                est.setCOMPLEMENTO_ESTUDIO(resposta.getProperty("COMPLEMENTO_ESTUDIO").toString());
                est.setTELEFONE_ESTUDIO(resposta.getProperty("TELEFONE_ESTUDIO").toString());
                est.setEMAIL_ESTUDIO(resposta.getProperty("EMAIL_ESTUDIO").toString());
                est.setSITE_ESTUDIO(resposta.getProperty("SITE_ESTUDIO").toString());
                est.setSALDO_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_ESTUDIO").toString()));
                est.setSALDO_PENDENTE_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_PENDENTE_ESTUDIO").toString()));
                est.setSALDO_BLOQUEADO_ESTUDIO(Float.parseFloat(resposta.getProperty("SALDO_BLOQUEADO_ESTUDIO").toString()));
                est.setSTATUS_ESTUDIO(Integer.parseInt(resposta.getProperty("STATUS_ESTUDIO").toString()));

                String logoEstudio = resposta.getProperty("LOGO_ESTUDIO").toString();

                byte[] bt = Base64.decode(logoEstudio, Base64.DEFAULT);
                est.setLOGO_ESTUDIO(bt);

                listaEst.add(est);
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

    return listaEst;
}


text:
Q: Matplotlib's Basemap raises ProjError exception when creating a perfectly normal bsemap I'm trying to create a Basemap instance of the mpl_toolkits.basemap library. However, I get an unexpected exception when doing so with what I believe are perfectly normal parameters. I have come up with a minimal example code that reproduces the issue.
from __future__ import print_function
from mpl_toolkits.basemap import Basemap
import pyproj
import sys

print("pyproj version", pyproj.__version__)
print("python version", sys.version)

class AREA():
    def __init__(self):
        self.LLCRNRLON = -8.1
        self.LLCRNRLAT = 38.2
        self.URCRNRLON = -0.4
        self.URCRNRLAT = 43.2
        self.projection  = 'lcc'
        self.LAT_1 = 40.0
        self.LAT_2 = 40.0
        self.LAT_0 = 40.0
        self.LON_0 = -2.5
        self.RESOLUTION = 'h'
        self.AREA_THRESH = 10

self = AREA()

Basemap( llcrnrlon   = self.LLCRNRLON,
    llcrnrlat   = self.LLCRNRLAT,
    urcrnrlon   = self.URCRNRLON,
    urcrnrlat   = self.URCRNRLAT,
    projection  = 'lcc',
    lat_1       = self.LAT_1,
    lat_2       = self.LAT_2,
    lat_0       = self.LAT_0,
    lon_0       = self.LON_0,
    resolution  = self.RESOLUTION,
    area_thresh = self.AREA_THRESH
    )

When executed with a Python3 (actually 3.8.8) interpreter, and pyproj version  3.0.0.post1, it raises the following execption:
Traceback (most recent call last):
  File "test.py", line 26, in <module>
    Basemap( llcrnrlon   = self.LLCRNRLON,
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/mpl_toolkits/basemap/__init__.py", line 1132, in __init__
    self._readboundarydata('gshhs',as_polygons=False)
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/mpl_toolkits/basemap/__init__.py", line 1413, in _readboundarydata
    bx, by = self(blons, blats)
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/mpl_toolkits/basemap/__init__.py", line 1193, in __call__
    xout,yout = self.projtran(x,y,inverse=inverse)
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/mpl_toolkits/basemap/proj.py", line 293, in __call__
    outx,outy = self._proj4(x, y, inverse=inverse)
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/pyproj/proj.py", line 182, in __call__
    return self.transform(
  File "/usr/local/apps/python3/3.8.8-01/lib/python3.8/site-packages/pyproj/transformer.py", line 488, in transform
    self._transformer._transform(
  File "pyproj/_transformer.pyx", line 477, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: x, y, z, and time must be same size

However this code used to work perfectly, and indeed it runs smoothly on Python 2 (actually  2.7.9) and prproj version 1.9.4.
Is there anything wrong with these parameters? Is it possible that this is a bug? Is there a way to workaround this problem? Updating to other versions of python/pyproj is not a useful solution as it would break countless other parts of the application.


text:
Q: Speed up real time from Chrono for simulation purposes Is there a way to speed up the clock in chrono for simulation/testing purposes? I have a large project that measures the time from chrono::system_clock::now() and uses milliseconds since Epoch to compare internally how long time has passed.
Changing all checks, constants, and limits to a factor is not really viable, unfortunately.
Edit to add: The clock is ofcourse mocked in tests to set a specific time. I want to achieve the same behaviour but sped up by a factor. I dont know how to achieve this since it would require some connection to the real time


text:
Q: How do I avoid update checks for third party software (cobook), dont want to "update" by mistake I have an app that I bought, unfortunately the company was also bought and the new version is seriously worse.
Hiding is not possible for third party software.
Removing MAS receipt makes the software "damaged".
Setting softwareupdate ignore cobook, does not work either.
There has to be some hack available, I don't want to "update" by mistake, and it bugs me to see the red "1", since I usually keep my software updated.
This would however be a downdate.

A: The MAS receipt is designed just so you can't do that - otherwise you could hand the app to all your friends without them having to buy it ;-)
Did you try telling App Store to "Ignore Updates" - right click in empty space to the right of the App name… though I've heard reports this is no longer working in Yosemite; I've no updates to test on right now.