text:
Q: Using Python regex to ignore `:` from string I am new to the world of regex. Hence, I'm sorry if this might sound basic. I have finished reading regex community and Lopez's book on Mastering regex for Python to ensure that I am not posting beginner-level question.
I have scraped data from a wiki (for learning), and I am trying to extract strings
a) that start with \wiki
b) that don't contain :
Here's the text:
/wiki/Template:Kevin_Bacon
/wiki/Category:Best_Miniseries_or_Television_Movie_Actor_Golden_Globe_winners
/wiki/Al_Pacino
/wiki/Paul_Giamatti
/wiki/Kevin_Costner
/wiki/Kevin_Costner
/wiki/Michael_Douglas
/wiki/Mark_Ruffalo
/wiki/Idris_Elba
/wiki/Bryan_Cranston
/wiki/Alexander_Skarsg%C3%A5rd
/wiki/Biblioteca_Nacional_de_Espa%C3%B1a
/wiki/Template:Kevin_Bacon
https://hy.wikipedia.org/wiki/%D5%94%D6%87%D5%AB%D5%B6_%D4%B2%D5%A5%D5%B5%D6%84%D5%B8%D5%B6

The output must be grouped i.e. I should get a list (or tuple) of these strings:
/wiki/Al_Pacino
/wiki/Paul_Giamatti
/wiki/Kevin_Costner
/wiki/Kevin_Costner
/wiki/Michael_Douglas
/wiki/Mark_Ruffalo
/wiki/Idris_Elba
/wiki/Bryan_Cranston
/wiki/Alexander_Skarsg%C3%A5rd
/wiki/Biblioteca_Nacional_de_Espa%C3%B1a

Here are my attempts at extracting the strings:
a) Using negative look-ahead:
The idea is to not select string that is followed by :
r^/wiki/.*(?!:).*
However, above code still selects strings with : i.e. /wiki/Template:Kevin_Bacon
b) Force regex to not select :
^/wiki/.*[^:].*
However, above code still selects strings with : i.e. /wiki/Template:Kevin_Bacon
c) Use quantifier to specify that : should occur zero times
^/wiki/.*:{0}.*$
However, above code still selects strings with : i.e. /wiki/Template:Kevin_Bacon
I have two questions:
a) I really like regex. Can someone please explain what's wrong with above tries?
b) How can I solve the problem using above approaches?
I am going to use regex module in python. As per SO's guidelines, I tried to debug regex on regex101 website. Here's the link: https://regex101.com/r/Wt40Cz/1
I'd sincerely appreciate any help. Thanks in advance.

A: Your regular expression is wrong.
^/wiki/.*[^:].*

is parsed as follows:

*

*^: match the start of the line

*/wiki/: match the literal sequence /wiki/

*.*: match zero or more of any character

*[^:]: match anything that isn't a :

*.*: match zero or more of any character

So it

*

*matches the start of the line (ok)

*matches the literal /wiki/ (ok)

*matches the entire rest of the line (uh-oh)

*backtracks a character and matches "anything that isn't a :", as long as the last character isn't : (hmm...)

*matches nothing, i.e. zero or more of any character

So your regex ends up matching the entire line because of .*, never even checking the : except at the end.
Now look at what the correct expression does
^\/wiki\/[^:]+$

*

*^: match the start of the line

*/wiki/: match the literal sequence /wiki/

*[^:]+: match one or more of anything that isn't a :

*$: match the end of the line

*

*matches the start of the line (ok)

*matches the literal /wiki/ (ok)

*matches the entire rest of the line, unless it contains a : in which case it fails

*matches the end of the line

Hopefully that helps you break things down better. I highly recommend https://www.regex101.com for building and testing regular expressions (it has a Python-compatible regex mode), since it also includes an explanation of what the regex engine is doing step by step.
Edit: to answer your second question, I don't see another sane way to construct this expression. Don't use lookaheads or quantifiers, that's not what this is for.

A: Try regex ^\/wiki\/[^:]*?$
It will match the string that start with /wiki/ and then this [^:]*? will match the characters without : until the end $
In your regex , ^/wiki/.*[^:].*$, there were two .* so the : will escape with any one of the .*.So, [^:]* will be enough to capture everything
Regex


text:
Q: Cannot get parse relation I have two objects, User and Category with a many-many relationship.  Users have a relation column with Categories.  There is a user that has a relationship with the Art category.  I am trying to retrieve all users with a relationship with the Art category:
var filterByCategory = function(category){
    var RelatedUser = Parse.Object.extend("User");
    var query = new Parse.Query(RelatedUser);
    query.equalTo("categories", category);
    query.ascending("username");
    query.find({
        success: function (results) {
            $scope.relatedUsers = results;
            $scope.$apply();
        },
        failure: function (results) {
            $scope.relatedUsers = [];
            $scope.apply();
        }
    });
}

category is retrieved from here:

        {{category.attributes.categoryName}}

There are no results coming back from this request.  All users come back if I remove this line:

query.equalTo("categories", category);

The object being sent is definitely a category from my Parse app (I have tested it by specifically pulling the Art category from the "database").

A: Relations should be queried by 'relation' method
var relation = user.relation("categories");
relation.query().equalTo('', '').find(...)

But it implies you have to have user object already fetched. I am not sure if you can just query 'by relation' :| for all users connected with specific category.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How come jobParameters cannot be found in ItemProcessor using annotations? I am having issues using the job parameters in my item processor. At this time, the code is basically setup like: How to get Job parameteres in to item processor using spring Batch annotation but I am receiving an error at runtime. Also, please note that my example code does use some spring integration for processing.
[ERROR] [restartedMain] o.s.b.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimFileMessageToJobRequest': Unsatisfied dependency expressed through field 'job': Error creating bean with name 'importClaimJob' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method 'importClaimJob' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimStep1' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimJob' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method 'importClaimJob' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimStep1' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at com.healthcloud.batch.Application.main(Application.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimJob' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method 'importClaimJob' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimStep1' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
    ... 22 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method 'importClaimJob' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimStep1' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 35 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importClaimStep1' defined in class path resource [com/healthcloud/batch/config/ClaimBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.importClaimStep1(<generated>)
    at com.healthcloud.batch.config.ClaimBatchConfiguration.importClaimJob(ClaimBatchConfiguration.java:185)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.CGLIB$importClaimJob$6(<generated>)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8$$FastClassBySpringCGLIB$$ecf5444c.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.importClaimJob(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 36 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'importClaimStep1' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 57 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'claimLineItemProcessor': Unsatisfied dependency expressed through field 'clientName': Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.claimLineItemProcessor(<generated>)
    at com.healthcloud.batch.config.ClaimBatchConfiguration.importClaimStep1(ClaimBatchConfiguration.java:196)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.CGLIB$importClaimStep1$7(<generated>)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8$$FastClassBySpringCGLIB$$ecf5444c.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.healthcloud.batch.config.ClaimBatchConfiguration$$EnhancerBySpringCGLIB$$2b3b47e8.importClaimStep1(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 58 common frames omitted
Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:164)
    at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1418)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1041)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
    ... 80 common frames omitted
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224)
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94)
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81)
    at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51)
    at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87)
    at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120)
    at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:242)
    at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:161)
    ... 84 common frames omitted

Using the example at How to get Job parameteres in to item processor using spring Batch annotation, I have the following code. One would think this would be a simple cut and paste and then be on my way. I am using jobParameters elsewhere just fine, but it definitely fails in the ItemProcessor.
ClaimBatchConfiguration:
...
@Configuration
@EnableBatchProcessing
public class ClaimBatchConfiguration {

...

    @Bean
    public ClaimLineItemProcessor claimLineItemProcessor() {
            return new ClaimLineItemProcessor();
    }

    @Bean
    public Job importClaimJob() {
        return claimJobBuilderFactory.get("importClaimJob").incrementer(new RunIdIncrementer())
                .listener(claimListener()).flow(importClaimStep1()).end().build();
    }

    @Bean
    public Step importClaimStep1() {
        return claimStepBuilderFactory.get("importClaimStep1").<ClaimLine, ClaimLine> chunk(1)
                .reader(claimFileReader(OVERRIDDEN_BY_EXPRESSION)).processor(claimLineItemProcessor())
                .writer(claimLineWriter()).faultTolerant().retryLimit(retryLimit)
                .retry(DeadlockLoserDataAccessException.class).skipLimit(1) // default is 0
                .skip(Exception.class).build();
    }

ClaimFileMessagetoJobRequest.java:
...
@Component
public class ClaimFileMessageToJobRequest implements ApplicationContextAware {
...

    @Transformer(inputChannel = "claimInputChannel", outputChannel = "commonJobGateway")
    public JobLaunchRequest messageToRequest(Message<File> message) {
        logger.info("Load Claim Started at " + DateFormat.getCurrentDateTime());

        String[] fileNameParts = message.getPayload().getName().split("[_]");

       // handle error
        JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();

        jobParametersBuilder.addString("clientName", fileNameParts[1]);

        logger.debug("Job Paramaters: " + jobParametersBuilder.toJobParameters());

        JobLaunchRequest request = new JobLaunchRequest(job, jobParametersBuilder.toJobParameters());

        return request;
    }

...
}

ClaimLineItemProcessor.java:
@Scope("step")
public class ClaimLineItemProcessor implements ItemProcessor<ClaimLine, ClaimLine> {

    @Value("#{jobParameters['clientName']}")
    private String clientName;

    // client name getter and setter here

    @Override
    public ClaimLine process(ClaimLine claimline) throws Exception {
    logger.debug("Current Client Name" + clientName);

    // bunch or work to really do
        return claimline;
    }
}

A: The @Scope("step") should be on the bean definition (in the ClaimBatchConfiguration), not on the class itself.  Also, as an FYI, you can use @StepScope as a short cut (also on the bean definition).


text:
Q: Trying to open packages with Anaconda 3 I've installed the FPDF package with the command line, see a confirmation message:

C:\Users\Usuario>pip install fpdf
Requirement already satisfied: fpdf in c:\users\usuario\appdata\local\programs\python\python39\lib\site-packages (1.7.2)

The problem here is that when I open Anaconda and I try to import the package I get an error message:

ModuleNotFoundError: No module named 'fpdf'

Any idea about how to move all packages to Anadonda in order to avoid this issues?


text:
Q: Python - Group categories I have 56 categories of data that sometimes occur together and other times do not. I quantified this using the conditional probability of having data in category A given that I have data in category B (P(A|B)) and created a 56x56 matrix of these probabilities. I want to combine these categories into groups that are likely to occur together; however, I'm having a hard time figuring out how to do this.
I tried making a cut-off of co-occurring 95% and grouping by these by sorting on whether data co-occurs; however, the results do not look completely finished to me.
Is there a way to perform the grouping on the probabilities or better perform the binned grouping task shown below?
import pandas as pd, seaborn as sns

df2.head(10)
sns.heatmap(df2)

for _ in range(100):
    df2 = df2.reindex(index=df2.sort_values(df2.index.to_list(), ascending=False).index.to_list())
    df2 = df2[df2.sort_values(df2.columns.to_list()).columns.to_list()]

sns.heatmap(df2)


text:
Q: Is there any event to tell me a process is waiting for an input? I am processing a Tex file by starting a Process like this one:
process p1 = new Process();
p1.StartInfo.FileName = "C:\\texlive\\2012\\bin\\win32\\pdflatex.exe";
p1.StartInfo.Arguments = FileName;
p1.consuleProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p1.consuleProcess.StartInfo.CreateNoWindow = true;
p1.consuleProcess.StartInfo.RedirectStandardOutput = true;
p1.consuleProcess.StartInfo.UseShellExecute = false;
p1.consuleProcess.StartInfo.RedirectStandardInput = true;
p1.Start();
p1.consuleProcess.BeginOutputReadLine();
p1.consuleProcess.OutputDataReceived += new DataReceivedEventHandler(p1_OutputDataReceived);

I display the output strings in a TextBox by handling OutputDataReceived event.
If there were an error in the Tex file, a line should be written in StandardInput. I think there is no event that can tell me, when the process is waiting for an input; So I thought, I can check OutputDataReceived event to see when the condition: e.Data == "?" is true. But, the problem is that the StandardInput needs an input, just before firing OutputDataReceived  event with e.Data=="?"
So, what can I do to see when the process is waiting for an input?
thanks.

A: Not sure if this is what you mean but are you after something like
p1.WaitForInputIdle(NumberofMilisecondstoWait)

Update:
Maybe something like this
  public void test()
        {
            p1.OutputDataReceived += new DataReceivedEventHandler(p1_OutputDataReceived);
        }

        void p1_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }


text:
Q: How get IntelliSense hints for 3rd party classes as you type in Visual Studio 2019? Currently, I get no IntelliSense hints for classes that are in 3rd party packages that I have not yet imported with using.
For example, if i type ConnectionMul I get no hints, so I have to instead type the entire classname (ConnectionMultiplexer) and then type Alt+Enter and only then does it suggest using StackExhange.Redis.
I'm used to IntelliJ's hinting with Java. When I have dependencies added to the project, I can just type Con and it will already have suggestions including the 3rd party classes. Is there a way to do this in Visual Studio?

A: If you've already referenced the type in your project (via assembly or NuGet package), it should show up as a lightbulb action when you've typed a partial match:

However, it seems that this requires at least 5 charactes typed - when I try it with JObj I don't get the suggestion, but with JObje I do.
There are also (for completeness) options under the C# language that suggest using statements from NuGet or the local reference assemblies path once you've typed out the type name:

When this is turned on and you use a type not referenced in your project, you'll see a suggestion like this:


text:
Q: The best practice to avoid out of memory exception I need to convert tif to webp and I am using wep wrapper class from this project - https://github.com/JosePineiro/WebP-wrapper/blob/master/WebPTest/WebPWrapper.cs
If I use regular for loop everything seems to be working correctly but I need to sped up the process and that is why I am using  parallel for each to execute this method. I am getting out of memory exception in some cases. How can I avoid that? I was reading that I can use long memorySize = currentProcess.PrivateMemorySize64
Is this the best practice? I have never used this approach.
And I am looping it like:
Parallel.ForEach(MyList, (row) =>
{
    byte[] rawWebP;
    Image image = Image.FromFile(row.linkToImage);
    Bitmap bmp = (Bitmap)image;
    using (WebP webp = new WebP())
    rawWebP = webp.EncodeLossless(bmp, row.linkToImage);
});


text:
Q: ECSlidingViewController Zoom Animation I'm trying to set my sliding transition with Zoom Animation in ECSLidingViewController2.
Like in the TransitionFun example (https://github.com/ECSlidingViewController/ECSlidingViewController/blob/master/Examples/TransitionFun/TransitionFun/METransitionsViewController.m), I'm doing this in viewDidLoad of my topView NavigationController:
id<ECSlidingViewControllerDelegate> transition = [[MEZoomAnimationController alloc] init];
self.slidingViewController.delegate = transition;

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

I'm adopting the ECSlidingViewControllerDelegate protocol in the NavigationController header file.
But it crashes in the ECSlidingViewController.m, at the first if condition of this method I get an EXC_BAD_ACCESS(1) error:
- (CGRect)frameFromDelegateForViewController:(UIViewController *)viewController
                         topViewPosition:(ECSlidingViewControllerTopViewPosition)topViewPosition {
     CGRect frame = CGRectInfinite;

     if ([(NSObject *)self.delegate respondsToSelector:@selector(slidingViewController:layoutControllerForTopViewPosition:)]) {
    id<ECSlidingViewControllerLayout> layoutController = [self.delegate slidingViewController:self
                                                           layoutControllerForTopViewPosition:topViewPosition];

    if (layoutController) {
        frame = [layoutController slidingViewController:self
                                 frameForViewController:viewController
                                        topViewPosition:topViewPosition];
    }
}

return frame;

}
Anyone having the same issue?
thx

A: This is what i do in the viewDidLoad: method of my view controller and it works great:
id<ECSlidingViewControllerDelegate> transition = self.zoomAnimationController;
self.slidingViewController.delegate = transition;
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

If, like me, you aren't trying to implement the dynamic transition, you should get rid of the line you have that says:
[self.navigationController.viewremoveGestureRecognizer:self.dynamicTransitionPanGesture];

IMHO its what could be causing your EXC_BAD_ACCESS(1) error since you haven't actually set the dynamicTransitionPanGesture gesture recognizer.


text:
Q: send text from UITextField to sms in swift I have a UITextField in which the user inputs some text. I want that text to be sent as sms when I hit the send button. The code I wrote is giving me problems. This is what I have so far.
import UIKit
import MessageUI

class ViewController: UIViewController,  MFMessageComposeViewControllerDelegate {

@IBOutlet weak var message: UITextField!

override func viewDidLoad() {
    super.viewDidLoad()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

}

func canSendText() -> Bool {
    return MFMessageComposeViewController.canSendText()
}

func configuredMessageComposeViewController() -> MFMessageComposeViewController {

    let messageComposeVC = MFMessageComposeViewController()

    messageComposeVC.messageComposeDelegate = self
    messageComposeVC.body = message.text // This line doesn't work.
    return messageComposeVC
}

func messageComposeViewController(controller: MFMessageComposeViewController!, didFinishWithResult result: MessageComposeResult) {
    controller.dismissViewControllerAnimated(true, completion: nil)
}

@IBAction func sendtext(sender: AnyObject) {

    let messageComposer = ViewController()

        // Make sure the device can send text messages
        if (self.canSendText()) {
            // Obtain a configured MFMessageComposeViewController
            let messageComposeVC = messageComposer.configuredMessageComposeViewController()

            var vc = self.view?.window?.rootViewController

            vc?.presentViewController(messageComposeVC, animated: true, completion: nil)

        } else {
            // Let the user know if his/her device isn't able to send text messages
            let errorAlert = UIAlertView(title: "Cannot Send Text Message", message: "Your device is not able to send text messages.", delegate: self, cancelButtonTitle: "OK")
            errorAlert.show()
        }

}

}

Is there a way to copy all the contents of UITextField and paste in messageComposeVC.body? Any help is appreciated. Thanks!

A: Try changing the line
let messageComposeVC = messageComposer.configuredMessageComposeViewController()

to
let messageComposeVC = self.configuredMessageComposeViewController()

messageComposer is a new instance of your ViewController which doesn't have the message set. You are creating a new instance of ViewController in the line
var messageComposer = ViewController()

This has a new instance of the message textField which does not contain the text you entered.


text:
Q: ipython notebook is NOT printing until the whole program is finished import time

print 1
time.sleep(5)

I ran the code above in IPython notebook and normal script separately.
In IPython Notebook, it doesn't print the number '1' until time.sleep(5) is finished, while in normal script it DOES print out number '1' first and go into time.sleep(5). What would that happen?
This example is just to illustrate my problem: I use print to print out some text at every stage in my code, which takes a long time to finish, so that I can know where the programme has got to. I found this works fine when executing the script, but in IPython Notebook print often lags behind and everything is printed out when the whole program is finished.
Is there any way to solve this in IPython Notebook?

A: It is a buffering issue. Add sys.stdout.flush() after the print, to see the output immediately. You could also use python -u command or set PYTHONUNBUFFERED envvar. See Disable output buffering.
python uses line-buffering if it is run interactively (in a terminal) and block buffering (e.g., ~4K bytes buffers) if the output is redirected. Compare:
$ python your_script.py

And
$ python your_script.py | cat

The output is delayed in the second case.
See the second reason in Q: Why not just use a pipe (popen())?


text:
Q: scheduling one task after another BUT with sessions on board Swift Trying to understand how I can schedule one task behind the other, looked at GCD and NSOperations, but both seem to be at an abstraction to far removed from the core code; part of which executes on its very own thread!
I tried this code which was the most obvious I could find...
    let date = NSDate()
    print("getting Links \(date)")

    let operationQueue: NSOperationQueue = NSOperationQueue.mainQueue()
    let completionBlockOperation: NSBlockOperation = NSBlockOperation.init(
        block: {
            self.reportFini()
        }
    )

    let workerBlockOperation:NSBlockOperation = NSBlockOperation.init(
        block: {
            self.getLinks()
        }
    )
    completionBlockOperation.addDependency(workerBlockOperation)
    operationQueue.addOperation(workerBlockOperation)
    operationQueue.addOperation(completionBlockOperation)

Now reportFini does next to nothing ...
func reportFini() {
    let date = NSDate()
    print("got Links \(date)")
}

But getLinks is more complex, using sessions... in nutshell it runs
    let request = NSMutableURLRequest(URL: NSURL(string: "https://blah")!)
    let session = NSURLSession.sharedSession()
    request.HTTPMethod = "POST"

    request.addValue("application/json",forHTTPHeaderField: "Content-Type")
    request.addValue("path", forHTTPHeaderField: lePath)
    request.addValue("settings", forHTTPHeaderField: "requested_visibility\": \"public\"}")

    var nodeA:NSMutableDictionary? = ["path":lePath]
    let nodeB:NSMutableDictionary? = ["requested_visibility":"public"]
    nodeA!.setValue(nodeB, forKey: "settings")

    do {
        let jsonData = try NSJSONSerialization.dataWithJSONObject(nodeA!, options: [])
        request.HTTPBody = jsonData
    } catch {
        completion(string: nil, error: error)
    }
    var string2Return = ""
    var stringPath = ""
    let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
        if let error = error {
            completion(string: nil, error: error)
            return
        }
        let strData = NSString(data: data!, encoding: NSUTF8StringEncoding)
        print("Body: \(strData)\n\n")
        do {
            let jsonResult = try NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers);
            self.jsonParser(jsonResult,field2file: "ignore")

            if let stringPath = (self.parsedJson["url"] as? String) {
                string2Return = stringPath
            } else {
                string2Return = (self.parsedJson["error_summary"] as? String)!
            }
            completion(string: string2Return, error: error)
        } catch {
            completion(string: nil, error: error)
        }
    })
    task.resume()

}
Now, getLinks and reportFini both execute @ the same time; basically get links goes off on its own thread! and immediately returns... BUT I need/want to be notified when it is finished, cause I got something else to do.
It get more complicated, since I need to run 10 sessions (fetching 10 links) concurrently, so in parallel; and want to be notified when they're all finished.
--- UPDATE ---
Tried GCD enclosing my sessions code in
    let workerQueue = dispatch_queue_create("getLinks", DISPATCH_QUEUE_CONCURRENT)
    let getLinksGroup = dispatch_group_create()

    dispatch_group_notify(getLinksGroup, dispatch_get_main_queue()) {
        print("All Links Downloaded")
    }

    dispatch_group_enter(getLinksGroup)
    dispatch_group_async(getLinksGroup, workerQueue) {

exiting with ...
    dispatch_group_leave(getLinksGroup)

Unfortunately it doesn't work; as I had already seen the sessions launch their own thread and I get notified almost immediately that the code has completed, clearly before it actually finishes the URL data download tasks.
Going to try with KVO ...

A: Managed to solve this; using GCD & KVO, but not to manage the sessions; to manage a counter, and than throw a trigger by changing a monitored KVO value. A good solution, you tell me.
public class SynchronizedInt<T> {
private var blob:Int = 0
private let accessQueue = dispatch_queue_create("SynchronizedIntAccess", DISPATCH_QUEUE_SERIAL)

public func pending(queue2go:T)  {
    dispatch_sync(self.accessQueue) {
        self.blob = queue2go as! Int
    }
}

public func fulfilled() -> Bool {
    dispatch_sync(self.accessQueue) {
        self.blob = self.blob - 1
    }
    if self.blob == 0 {
        return true
    } else {
        return false
    }
}

public func copy() -> Int {
    return self.blob
}

}

Which I am using to keep track of the sessions launched, so I can notified when they all complete. The completion I track in the completion blocks, each of which checks to see if it was the final one. Beyond that I used a KVO of sorts based on the first Swifty solution presented here.
http://blog.scottlogic.com/2015/02/11/swift-kvo-alternatives.html


text:
Q: Understanding Entity framework's Many to Many relationships. Why does my code crash once I try to add more data to it? I am trying to create a join table that combines the Employee and Tractor table to record each time an Employee is assigned/unassigned a truck. I am able to record an initial employeeID and truckId but the code crashes once I try to record  second of employeeID and truckID on a different time and Day. Thus, the Datetime object is always unique.
This is the error it shows:

SqlException: Violation of PRIMARY KEY constraint 'PK_DriverTractorsAssignmentHistory'. Cannot insert duplicate key in object 'dbo.DriverTractorsAssignmentHistory'. The duplicate key value is (1, 2).
  The statement has been terminated.

Using a Many to many relationship was the one solution I could think of to capture each time an employee is assigned a truck. Pls show me a better solution if you have one
 public class Employee
 {
    public int EmployeeID { get; set; }
    public string FirstName { get; set; }
    public string MiddleName { get; set; }
    public string LastName { get; set; }

    public int? TractorID { get; set; }
    public virtual Tractor Tractor { get; set; }
    public virtual List<DriverTractorAssignmentHistory>DriverTractorAssignmentHistories { get; set; }
 }

public class Tractor
{
    public int TractorID { get; set; }
    public string TruckNumber {get; set;}
    public string Status { get; set; }
    public virtual Employee Employee { get; set; }
    public virtual List<DriverTractorAssignmentHistory> DriverTractorAssignmentHistories { get; set; }

    public Tractor()
    {
        Status = "Available";
    }
}

public class TrailerOrderDbContext:DbContext
{
    public DbSet<Employee> Employees { get; set; }
    public DbSet<DriverTractorAssignmentHistory> DriverTractorsAssignmentHistory { get; set; }
    public DbSet<Tractor> Tractors { get; set; }

    public TrailerOrderDbContext(DbContextOptions<TrailerOrderDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<DriverTractorAssignmentHistory>().HasKey(co => new { co.EmployeeId, co.TractorId });

        modelBuilder.Entity<DriverTractorAssignmentHistory>()
        .HasOne(e => e.Driver)
        .WithMany(c => c.DriverTractorAssignmentHistories)
        .HasForeignKey(trac => trac.TractorId);

        modelBuilder.Entity<DriverTractorAssignmentHistory>()
        .HasOne(trac => trac.Tractor)
        .WithMany(c => c.DriverTractorAssignmentHistories)
        .HasForeignKey(e => e.EmployeeId);
 }

 }

A: Remove this line of code in OnModelCreating(ModelBuilder modelBuilder)beause this line of code prevents duplicate data entry and prevents many-to-many mapping:
    modelBuilder.Entity<DriverTractorAssignmentHistory>()
        .HasKey(co => new { co.EmployeeId, co.TractorId });

Or modify as below if in case unique key is needed:
    modelBuilder.Entity<DriverTractorAssignmentHistory>()
      .HasKey(co => new { co.EmployeeId, co.TractorId, co.AssignTimestamp };


text:
Q: When is it wrong to flag a link-only answer? I'm getting very confused about flagging link-only answers as it seems that the policy has changed over time and doesn't seem to be consistent (at least to me).
When I come across an answer that would be no use if the link was dead, I flag it.
Generally, these flags are accepted.
However, today I flagged this answer and my flag was declined with the following message:

Did I do something wrong or is this just a symptom of different moderators having slightly different policies? I really just want to know if I should continue flagging or not? Should I have flagged and left a comment? Should I have just moved on? Or something else?
For what it's worth, I thought the fact that the answer had been accepted somehow made it less permissible to be link-only.

A:
When I come across an answer that would be no use if the link was dead, I flag it.

If the link isn't dead now, then the answer is still useful. You can either comment to ask the author of the post to include the relevant information from the linked article, or edit to add it yourself.  There's no need for a moderator to take action on this post yet.

A: You should just have commented the answer asking the person to add informations that will make the answer be good. Flagging it wasn't necessary as it is a good answer but needs to be self-sufficient.


text:
Q: Gdx.net: NPE in libgdx code with RoboVM I'm having a problem with a Android/IOs app: the library code (libgdx?) throws a NPE, but debugging in RoboVM is not supported. When run in Android, it works as expected and reeaches the handleHttpResponse() method. When run in IOs, it reaches the failed(Throwable t) method with t being a NullPointerException. I've created a sample app to show the issue, maybe it's my fault, so here is the code:
public class Npe extends ApplicationAdapter {
  SpriteBatch batch;
  Texture img;

  @Override
  public void create () {
    batch = new SpriteBatch();
    img = new Texture("badlogic.jpg");
    loadHttps("https://www.google.it");
  }

  @Override
  public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    batch.draw(img, 0, 0);
    batch.end();
  }

  private static void loadHttps(String url) {
    HttpRequest httpGet = new HttpRequest(HttpMethods.GET);

    httpGet.setUrl(url);

    Gdx.net.sendHttpRequest(httpGet, new HttpResponseListener() {
      @Override
      public void handleHttpResponse(HttpResponse httpResponse) {
        String res = httpResponse.getResultAsString();
        System.err.println("res = \"" + res + "\"");
      }

      @Override
      public void failed(Throwable t) {
        System.err.println("On IOs we reach this point");
        t.printStackTrace(); // and t is a NPE
      }

      @Override
      public void cancelled()
      {
      }
    });
  }
}

and my robovm.xml:
<config>
  <executableName>${app.executable}</executableName>
  <mainClass>${app.mainclass}</mainClass>
  <os>ios</os>
  <arch>thumbv7</arch>
  <target>ios</target>
  <iosInfoPList>Info.plist.xml</iosInfoPList>
  <resources>
    <resource>
      <directory>../android/assets</directory>
      <includes>
        <include>**</include>
      </includes>
      <skipPngCrush>true</skipPngCrush>
    </resource>
    <resource>
      <directory>data</directory>
    </resource>
  </resources>
  <forceLinkClasses>

    <pattern>org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl</pattern>

    <pattern>com.android.org.conscrypt.JSSEProvider</pattern>
    <pattern>com.android.org.conscrypt.OpenSSLProvider</pattern>
    <pattern>com.android.org.conscrypt.OpenSSLSocketFactoryImpl</pattern>
    <pattern>com.android.okhttp.HttpsHandler</pattern>

    <pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
    <pattern>org.apache.harmony.xnet.provider.jsse.OpenSSLProvider</pattern>
    <pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
    <pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
    <pattern>org.apache.harmony.xnet.provider.jsse.JSSEProvider</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.JDKKeyStore</pattern>
    <pattern>org.apache.harmony.security.provider.cert.X509CertFactoryImpl</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
    <pattern>org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$MD5</pattern>
  </forceLinkClasses>
  <libs>
    <lib>build/libs/ios/libgdx-box2d.a</lib>
    <lib>build/libs/ios/libgdx-bullet.a</lib>
    <lib>build/libs/ios/libgdx-freetype.a</lib>
    <lib>build/libs/ios/libgdx.a</lib>
    <lib>build/libs/ios/libObjectAL.a</lib>
  </libs>
  <frameworks>
    <framework>UIKit</framework>
    <framework>OpenGLES</framework>
    <framework>QuartzCore</framework>
    <framework>CoreGraphics</framework>
    <framework>OpenAL</framework>
    <framework>AudioToolbox</framework>
    <framework>AVFoundation</framework>
  </frameworks>
</config>

A: Assuming you are using the latest 0.0.14 release of RoboVM I believe your problem is that you haven't forced linked the proper classes for HTTPS support. Please try to change your <forceLinkClasses> section to look like this:
<forceLinkClasses>
    <pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>

    <!-- For http: support in URLConnection -->
    <pattern>com.android.okhttp.HttpHandler</pattern>

    <!-- For https: support in URLConnection -->
    <pattern>com.android.okhttp.HttpsHandler</pattern>
    <!-- OpenSSL is preferred over BouncyCastle. This pulls in full OpenSSL support. -->
    <pattern>com.android.org.conscrypt.**</pattern>
    <!-- We still need KeyStore.BKS and CertPathValidator.PKIX from BouncyCastle -->
    <pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
    <!-- Use AndroidDigestFactoryOpenSSL as AndroidDigestFactory implementation -->
    <pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
</forceLinkClasses>

If that doesn't work please try to add <pattern>**</pattern> to your <forceLinkClasses>. That pattern will pull in everything on your classpath. If that makes your app work at least you know that it is on or more missing classes that are causing the problem.


text:
Q: Python string formatting - combine named placeholder and float formatter for the same argument? In Python is possible to combine 2 followings concepts - named arguments and float formatting?
'{0:.2f}'.format(pi)
and
'{first} {last}'.format(first='Hodor', last='Hodor!')
https://stackoverflow.com/a/8940627/2230844
https://pyformat.info/#named_placeholders

A: '{value:.2f}'.format(value=pi)

A: >>> pi=3.14159
>>> print('{number:.2f}'.format(number=pi))
3.14
>>>

A: Also worth mentioning is the fstrings answer: print(f'{pi:.2f}')


text:
Q: How to check html snippets in my JS code? I have html snippets as template literals in my JavaScript code. As the snippets are spread over multiple files and can be quite large and complex in structure and nesting, it can happen that some closing tags are mistakenly omitted or nesting is wrong.
Is there a way to automate checking of these html pieces for correct nesting and balance of opening and closing tags?

A: Try to go with best IDE like Netbeans, VScode or sublime where you can easy track the HTML tags opening and closing , Code Syntax(PHP,JS,CSS etc).

A: You can surely opt for an IDE, otherwise you can use a html validator in gulp task and verify your html files. Gulp task will first remove literals from the file(temporarily) and then stream the output to the validator.


text:
Q: Compare input values using jQuery I have a form with 3 input file fields.  I want to make sure that they do not upload the same document twice.  Right now my code is as follows:
$(':input.File').each(function() {
    if ($(this).val() == T) {
        $this.after('
Duplicate');
    }
})

The code works but my issue is that it always throws the error because it is comparing against itself.  It identifies all file fields when I want it to compare all file fields but itself.
Is there a way to exclude the field being compared against? Essentially I want to check all the file field value except for the $(this) field.

A: If you know there is always going to be at least one duplicate, why not just allow one duplicate?
i = 0;
$(':input.File').each(function() {
    if ($(this).val() == T && i != 0) {
        $this.after('
Duplicate');
    }

    i++;
})

A: Make an empty array, then go through each field and check if that field is in the array if not add it.
var arr = [];

$(':input.File').each(function(){
    if(arr.indexOf($(this).val()) > -1){
        $(this).after("
Duplicate ");
    }else{
        arr.push($(this).val());
    }
})

A: You can use a map to keep track of what values exist
(function(){
  var exists = {};
  $(':input.File').each(function() {
    if(exists[$(this).val()]){
      $this.after("
Duplicate ");
    } else {
      exists[$(this).val()] = true;
    }
  });
})()

A: I have a feeling this is what you are looking for:
jQuery: exclude $(this) from selector
In order to give you a more specific answer, I'd need a bit more code context.  (IE. what is T, how it that code reached, etc.)

A: For a checkup after each user action:
$('input[type=file]').change(function(){
     $('input[type=file][value="'+$(this).val()+'"]').not(this).after("
Duplicate ");
});


text:
Q: dynamic file compilation with gcc in c I'm trying to find a method to, from a program, check the presence of one or more ".c" files and load one or more functions of it.
Basically, I would have a "main" program which will check if the "script.c" file exists, and will launch (if it exists) the main() function of this one.
Here is the content of my "main" program before compilation:
int main(int argc, char *argv[]){
    ...
    if(argc == 1){
        FILE *file;
        if((file = fopen("script.c", "r"))){
            printf("file script.c loaded.");
            // to compile the script.c file and modify on it the "main()" function to "_main()" (in order to be able to recompile it with the main library) before restarting the program
            int ret = system("gcc -c script.c && objcopy --redefine-sym main=_main script.o && gcc main script.o -o main && ./main -l script.o");
            printf("ret(0)=%d\n", ret);
        }
        else{
            int ret = system("./main -l");
            printf("ret(1)=%d\n", ret);
        }
    }
    else{
        if(argc == 3 && strcmp(argv[2], "script.o") == 0){
            _main(argc, argv);
        }
        else{
            printf("no file found.\n");
        }
    }
    ...
}

He is the content of my "script.c" file:
int main(int argc, char *argv[]){
    ...
    printf("main() function in script.c loaded.\n");
    ...
}

If the script.c file exists, running main should give:
file script.c loaded.
ret(0)=0
main() function in script.c loaded.

If the script.c file does not exist, running main should give:
file script.c loaded.
ret(1)=0
no file found.

Obviously, this does not work for several reasons.

*

*It is impossible to use the "main" program to recompile the script.o file (especially since this is supposed to be in use)

*It is impossible to compile my "main" program with a _main() function that does not exist (on the 1st launch, and potentially on the second too if script.c dont found)

Do you have an idea for me to achieve my goal ?
So from a single executable program (here "main") to be able to check the presence of an external file (here "script.c") and launch one or more functions from it...
PS: Having already seen it in other projects, I know it's possible, but I can't find the solution.
PS2: Only the executable file (main) and potentially the script.c file must be present (therefore no main.c...which therefore perhaps suggests that a "main" file should be merged with the "main.o" associated which would be unpacked and executed)

A:
So from a single executable program (here "main") to be able to check the presence of an external file (here "script.c") and launch one or more functions from it...

I'm going to make an assumption that the main function you mentioned is not the most important and show how you can, from within your program, compile collections of functions into shared libraries that you load and then execute functions (other than main) in.
A simple driver could look like this:
// driver.c
#include <dlfcn.h> // to be able to dynamically load shared libraries

#include <stdio.h>
#include <stdlib.h>

// the signature of the `start` function you decide to have in all the files:
typedef void(*start_func_t)(void);

int main(int argc, char *argv[]){
    char sys[1024];

    for(int i = 1; i < argc; ++i) { // loop through all the arguments
        // try to compile the argument into an object file
        // (use a safer version than sprintf in real code)
        sprintf(sys, "gcc -fPIC -c -o %s.o %s", argv[i], argv[i]);
        if(system(sys)) {
            printf("%d failed\n", sys);
            exit(1);
        }

        // try to create a shared library from the object file
        sprintf(sys, "gcc -shared -o libcurrent.so %s.o", argv[i]);
        if(system(sys)) {
            printf("%d failed\n", sys);
            exit(1);
        }

        // load the shared library you just created
        (void)dlerror();
        void *handle = dlopen("./libcurrent.so", RTLD_NOW | RTLD_LOCAL);
        if(!handle) {
            puts(dlerror());
            exit(1);
        }

        // lookup the "start" symbol in the shared library:
        start_func_t start = dlsym(handle, "start");
        if(!start) {
            puts(dlerror());
            exit(1);
        }

        // call the loaded function:
        start();

        dlclose(handle); // close the library
    }
}

You need to link the above program with the dl library, so something like this should work:
gcc -o driver driver.c -ldl

Now, if you create some example files:
// t1.c
#include <stdio.h>
void start(void) { puts("Hello world"); }

// t2.c
#include <stdio.h>
void start(void) { puts("another file"); }

and then run:
./driver t1.c t2.c

It should produce this output if everything works out:
Hello world
another file

I also made a test to see how this works out if I put main in the library. That is, change the start_func_t signature to:
typedef int(*start_func_t)(int argc, char *argv[]);

and load and call main instead:
        start_func_t start = dlsym(handle, "main");
        if(!start) {
            puts(dlerror());
            exit(1);
        }

        // call the loaded function with some example arguments:
        char *cargv[] = {
            "foo", "hello", "world", NULL
        };
        start(3, cargv);

and change the test programs slightly:
// t1.c
#include <stdio.h>
int main(int argc, char *argv[]) {
    for(int i = 0; i < argc; ++i) {
        printf("t1: %s\n", argv[i]);
    }
}

// t2.c
#include <stdio.h>
int main(int argc, char *argv[]) {
    for(int i = 0; i < argc; ++i) {
        printf("t2: %s\n", argv[i]);
    }
}

and this worked fine too. However, main is a bit special and I'm not sure if this violates any rules.


text:
Q: Django how to dynamically select between __gt and __range I have an html form in one of my django templates where a user can optionally select the range of an object's price and also a range of its real value price. However he is not required to.
<select name="minimum_price">
    <option value="1">1</option>
    <option value="2">2</option>
</select>

<select name="maximum_price">
    <option value="1">1</option>
    <option value="2">2</option>
</select>

<select name="min_real_value">
    <option value="1">1</option>
    <option value="2">2</option>
</select>

<select name="max_real_value">
    <option value="1">1</option>
    <option value="2">2</option>
</select>

I've read most of django's docs for that matter including the following enlightening post: Q Class. However I haven't yet figured out how to dynamically construct a query for my model given that a user may select any possible combination from these 4 select boxes.
The real problem arises when Django's __range has to be replaced with __gt or __lt when only one of the select boxes of each 'category' is selected.
This is what I've done so far:
myList = MyObjectsCost.objects.filter(price__range=(minimum_price, maximum_price),
                                   real_value__range=(min_real_value, max_real_value),
                                   **kwargs)

However this fails if one of the 4 variables is missing...
Thanks in advance.

A: You could do something clever with kwargs here, but it's probably easier if you just reflect that range is simply a combination of gt and lt anyway. So you can just build up the query dynamically:
my_list = MyObjectsCost.objects.all()
if minimum_price:
    my_list.filter(price__gt=minimum_price)
if maximum_price:
    my_list.filter(price__lt=maximum_price)
if min_real_value:
    my_list.filter(real_value__gt=min_real_value)
if max_real_value:
    my_list.filter(real_value__lt=max_real_value)

A: The "clever" way Daniel Roseman is talking about, is to construct filters by strings, I assume?
It goes something like this:
method = MyObjectsCost.objects.filter
qs = method(**{'%s__%s' % (field_name, lookup_type): value})

Giving the right values for your situation you can build something like:
field_name = 'real_value'
lookup_type = 'gt'
value = 'min_real_value'

which would construct a 'real_value__gt=min_real_value' string that is passed to the filter method. So you can create filters based on strings. This can come in handy, but could also end up being ugly hacky code. So use carefully, but this concept could help you constructing your filters.
In case you like 3rd party apps look at https://github.com/alex/django-filter which gives you more flexibility with your filters too.
But never forget to keep it simple.


text:
Q: How to set an option true/false with mat-select (multiselect) Angular Material I used a multiple selection from Angular Material .
<mat-form-field>
  <mat-select placeholder="Toppings" [formControl]="toppings" multiple>
    <mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping}}</mat-option>
  </mat-select>
</mat-form-field>

I want to put some options on true or false as I want and I don't know how.
before

after

A: Since the response would be coming from an API, you would receive the response asynchronously.
In that case, you can call the setValue method on your FormControl instance or FormGroup instance in order to set the values by default.
Something like this:
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { DataService } from './data.service';

@Component({
  selector: 'select-multiple-example',
  templateUrl: 'select-multiple-example.html',
  styleUrls: ['select-multiple-example.css'],
})
export class SelectMultipleExample {
  toppingList: string[] = [
    'Extra cheese',
    'Mushroom',
    'Onion',
    'Pepperoni',
    'Sausage',
    'Tomato'
  ];
  selectedByDefault;
  toppings: FormControl;

  constructor(private dataService: DataService) {}

  ngOnInit() {
    this.toppings = new FormControl(this.selectedByDefault);
    this.dataService.selectedValues$
      .subscribe(values => this.toppings.setValue(values));
  }

}

Here's a Working Sample StackBlitz for your ref.

A: This is a simple matter of defaulting your form values. When initializing your FormGroup, just pass in which values you'd like to show as "checked", making sure to match the values exactly.
Working stackblitz --> https://angular-r2y6gk.stackblitz.io


text:
Q: How can I undo a local file replace mistake, I was using git but hadn't staged it before it was gone I've made a booboo! I've been coding up a file for 1 hr, which I was about to add to staging but that file got replaced. And deleted. Is there anyway back in the past where I can get that file back?
I'm using Ubuntu, with git and Atom is my text editor.
What do I do? Code it up again? :-(


text:
Q: How to expand input to take remaining room in a div I would like to create a dropdown that drops down a custom panel (div) instead of a list of options. That panel is irrelevant because it is not tied to the layout I am asking about. For the basic drop-down look I have the following:

        <input type="text" class="folder-selection" />
        <button type="button" class="dropdown-button">...</button>

Now I know the float and width 100% are not right, but I have a container div, with an input on the left and a button on the right. The button must remain fixed to the right of the input. If the container is narrow, the input must be narrow, and vice versa, but I want to achieve this without knowing at design time the width of the container.
The container should fit into any width and the input's width should adjust accordingly. Just like a normal select element, where the text portion always fills all the space not taken by the dropdown icon/button at its right.

A: Below example will help you. Let me know, if you don't want fixed width icon in right so I'll update this code accordingly.

#container {
 position: relative;
 border: 1px solid #ccc;
 padding: 5px 40px 5px 5px;
 margin: 0 0 10px;
}
.folder-selection {
 width: 100%;
 padding: 5px;
 border: none;
 box-sizing: border-box;
 height: 30px;
}
.dropdown-button {
 position: absolute;
 top: 5px;
 right: 5px;
 height: 30px;
}

 <input type="text" class="folder-selection" />
 <button type="button" class="dropdown-button">...</button>

A:

    <input type="text" class="folder-selection" /><button type="button" class="dropdown-button">...</button>

You don't really have to set the width of the button as long as you know its width on runtime.

A: This code will help you to position your elements as you expected.

* {
  box-sizing: border-box;
}

.dropdown-container {
  width: 500px;
  display: table;
  background: orange;
}

.dropdown-container .input-container {
  display: table-cell;
}

.dropdown-container .input-container input {
  width: 100%;
  padding-right: 10px;
}

.dropdown-container .button-container {
  display: table-cell;
  width: 150px;
}

.dropdown-container .button-container button {
  width: 100%;
}

    <input type="text" class="folder-selection" />

    <button type="button" class="dropdown-button">Drop</button>


text:
Q: delete query not working in php/mysql? I tried everything I could find online to get it to work, I tried casting $employeeid to int after retrieving it from the link (even though they say mysql does it for you), i tried using nested single quotes, escape quotes... the print line happens to work, and employeeid shows up as a number in the hyperlink when delete is clicked, but it never deletes. what could I be doing wrong?
also, I could've sworn the onclick="return confirm("")" in the hyperlink was supposed to cause a pop up to appear, but it didnt, am I forgetting something here as well or is it a syntax issue?
this is my php link that calls it:
Delete

and this is the code section that is supposed to handle it:
if(isset($_GET['delete']))
{
    $temp = $_GET['$employeeid'];
    print "teseting delete

";
    $query = "DELETE FROM employees WHERE employeeid = ".$temp;
    mysqli_query($link, $query); //link query to database
    print "Employee Updated"; // print confirmation

}

A: href andonclick are separate attributes, you have them combined into one.
Delete

A: Try this:
PHP
if(isset($_GET['delete']))
{
    $temp = $_GET['employeeid']; <<=== remove the $ sign
    print "teseting delete

";
    $query = "DELETE FROM employees WHERE employeeid = ".$temp;
    mysqli_query($link, $query); //link query to database
    print "Employee Updated"; // print confirmation
}

And on your link:

     Delete

Take note on the href attribute, it is enclosed in double quotes since you are putting PHP variables in your link

A: Make sure the Variable in GET Method that you are using $employeeid, May be it is employeeid
$temp = $_GET['employeeid'];

A: check your table name , field name ,user permission in mysql and relation with other table . if u use foreign key of employeeId in another table then also you not able to delete

A: $query = mysqli_query($link,"DELETE FROM employees WHERE employeeid ='$temp'");

A: Try this I hope this may helpful
if(isset($_GET['delete']))
{
    $temp = $_GET['employeeid'];
    print "teseting delete

";
    $query = "DELETE FROM employees WHERE employeeid = ".$temp;
    mysqli_query($link, $query); //link query to database
    print "Employee Updated"; // print confirmation
}
<a href="test.php?delete=yes&employeeid=<?=$employeeid;?>" onclick= 'return confirm("Are you sure")'>Delete


text:
Q: App crashing when pressing a button behind keyboard The app I'm creating is crashing whenever a button is pressed that is behind the keyboard.
I have the following view:
struct LoginSheetView: View {
 // Variables Here
    var body: some View {
        SwiftyHUDView(isShowing: self.$isLoading) {
            VStack{
                Text("Login")
                    .font(.largeTitle)
                    .fontWeight(.semibold)
                    .padding(.bottom, 20)
                TextField("Username", text: self.$username)
                    .padding(.bottom, 20)
                    .autocapitalization(.none)
                    .textContentType(UITextContentType.username)
                SecureField("Password", text: self.$password)
                    .padding(.bottom, 20)
                    .textContentType(UITextContentType.password)
                Button(action: {
                    self.isLoading = true
                    if(!self.username.isEmpty  && !self.password.isEmpty){
                        self.databaseCalls.login(username: self.username, password: self.password){ b in
                            self.isLoading = false
                            print("is loading: \(self.isLoading)")
                            if(b){
                                self.loginStatus = true
                                self.presentationMode.wrappedValue.dismiss()
                            }else{
                                self.showingAlert = true
                            }
                        }

                    }

                }){
                    Text("Login")
                        .frame(width: 220, height: 60)
                        .cornerRadius(15.0)
                }
            }
            .alert(isPresented: self.$showingAlert) {
                Alert(title: Text("Loging failed"), message: Text("Wrong username or password"), dismissButton: .default(Text("Got it!")))
            }
            .padding()

        }

    }
}

Which looks like this:

Whenever I press the button Login while the keyboard is up I get the following error in the file AppDelegate:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
This error does not happen if I press return on the keyboard then press the Login button.
Any ideas on what's causing the error ?
NOTE:
I removed some code (variables declarations, padding, colors etc) to make it easier to digest

A: I've added:
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to:nil, from:nil, for:nil)
inside the button action and it has fixed the problem. Does anyone know if this is the correct way of approaching the issue ?


text:
Q: Recovering a GPT damaged partition Problem: 4TB drive can't be mounted. The drive is visible in GParted and gdisk, but the GPT partition is reported as damaged.
Background information: Initially my setup consisted of 2 storage devices. My primary drive is an SSD with Windows 10. My secondary drive is a 4TB HDD.This setup worked well. I wanted to run Linux on occasion so I installed another HDD. When installing Linux I removed the SATA and power from the Windows SSD and plugged them into the new HDD. I removed only the SATA cable from the 4TB HDD. I then proceed to installing CentOS. Finally reconnected the 4TB HDD, the SSD, and installed a new SATA cable and connected it to the new HDD. Using the boot menu I am able to switch between my Windows 10 and Linux installations. At this point I noticed that the 4TB HDD was not appearing in Windows or Linux.
Technical Information: I can't see the 4TB HDD in Windows using disk partition. I can see the drive in Linux using gpart GUI and gdisk on the command line. 2 partitions are seen by the drive in gdisk and GParted.
Using Gparted:
When the drive is scanned by I get a prompt titled "Libparted Bug Found!" with text that reads "end of file while reading /dev/sda". Options are to retry, cancel, or ignore.
When I press ignore I get a prompt titled "Libparted Bug Found!" with text that reads "The primary GPT table is corrupt, but the backup appears OK, so that will be used." Options OK or cancel.
Using gdisk:
    GPT fdisk (gdisk) version 0.8.6
Type device filename, or press <Enter> to exit: /dev/sda
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help): p
Disk /dev/sda: 7814037168 sectors, 3.6 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 07A40EF7-3F5A-42B8-BE06-6BC4D40492ED
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 8-sector boundaries
Total free space is 3693 sectors (1.8 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34          262177   128.0 MiB   0C01  Microsoft reserved part
   2          264192      7814035455   3.6 TiB     0700  Basic data partition

Command (? for help): i
Partition number (1-2): 1
Partition GUID code: E3C9E316-0B5C-4DB8-817D-F92DF00215AE (Microsoft reserved)
Partition unique GUID: 07987030-5C4E-4936-9BCD-129C622C99DF
First sector: 34 (at 17.0 KiB)
Last sector: 262177 (at 128.0 MiB)
Partition size: 262144 sectors (128.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'Microsoft reserved partition'

Command (? for help): i
Partition number (1-2): 2
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
Partition unique GUID: 9A23AFCE-2382-4C1C-AC0B-F25E6428E4C4
First sector: 264192 (at 129.0 MiB)
Last sector: 7814035455 (at 3.6 TiB)
Partition size: 7813771264 sectors (3.6 TiB)
Attribute flags: 0000000000000000
Partition name: 'Basic data partition'

Command (? for help): v

Caution: Partition 1 doesn't begin on a 8-sector boundary. This may
result in degraded performance on some modern (2009 and later) hard disks.

Consult http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
for information on disk alignment.

No problems found. 3693 free sectors (1.8 MiB) available in 2
segments, the largest of which is 2014 (1007.0 KiB) in size.

How should gdisk or GParted be used in order to fix the damaged GPT partition without destroying the data on the drive?


text:
Q: Thread not moving to notify after wait is being called I have this below piece of code, I want to my thread to wait untill either of the callback functions are called.
Issue my code hits the line where i am making the synchObj wait but after that it just vanishes it doesn't move anywhere.
If after wait its not gonna move ahead how the notify will be called?
iGPlaceApi.getStreams(new Callback<mGooglePlacesApiResponse>() {

    @Override
    public void failure(RetrofitError retrofitError) {
        String serverResponse = retrofitError.toString();
        synchronized (synchObj) {
            synchObj.notify();
            //synchObj.notifyAll();
        }
    }

    @Override
    public void success(mGooglePlacesApiResponse googlePlacesObj, Response arg1){
        nearbyPlaces = new String[googlePlacesObj.results.size()][4];
        for (int i = 0; i < googlePlacesObj.results.size(); i++) {
            mGooglePlaces.place place = googlePlacesObj.results.get(i);
            nearbyPlaces[i][0] = place.icon;
            nearbyPlaces[i][1] = place.name;
            nearbyPlaces[i][2] = String.valueOf(place.geometry.location.lat);
            nearbyPlaces[i][3] = String.valueOf(place.geometry.location.lng);
        }
        synchronized (synchObj) {
            synchObj.notify();
            //synchObj.notifyAll();
        }
    }

});

synchronized (synchObj) {
    synchObj.wait();
}

Handler handler=new Handler();
            Runnable thr = new Runnable() {
                public void run() {
                    iGPlaceApi.getStreams(new Callback<mGooglePlacesApiResponse>() {

                        @Override
                        public void failure(RetrofitError retrofitError) {
                            String serverResponse = retrofitError.toString();
                            synchronized (synchObj) {
                                synchObj.notifyAll();
                            }
                        }

                        @Override
                        public void success(mGooglePlacesApiResponse googlePlacesObj, Response arg1) {
                            nearbyPlaces = new String[googlePlacesObj.results.size()][4];
                            for (int i = 0; i < googlePlacesObj.results.size(); i++) {
                                mGooglePlaces.place place = googlePlacesObj.results.get(i);
                                nearbyPlaces[i][0] = place.icon;
                                nearbyPlaces[i][1] = place.name;
                                nearbyPlaces[i][2] = String.valueOf(place.geometry.location.lat);
                                nearbyPlaces[i][3] = String.valueOf(place.geometry.location.lng);
                            }
                            synchronized (synchObj) {
                                synchObj.notifyAll();
                            }

                        }

                    });
                }
            };
            handler.post(thr);

            synchronized (synchObj) {
                synchObj.wait();
            }

A: You can't do that. The callbacks are going to be called on the same thread that is calling the getStreams method.
The callbacks cannot be called until your calling method returns. You probably need to call getStreams in yet another thread.

A: You are doing it wrong. Handler task will be executed on the same thread so in your case it will never be executed. If you want to wait for your task to be done you should use Thread like this:
// defined somewhere
boolean done = false;
Thread thr=new Thread(Runnable() {
    public void run() {
        iGPlaceApi.getStreams(new Callback<mGooglePlacesApiResponse>() {
            @Override
            public void failure(RetrofitError retrofitError) {
                String serverResponse = retrofitError.toString();
                        synchronized (synchObj) {
                            done = true;
                            synchObj.notifyAll();
                        }
                    }

                    @Override
                    public void success(mGooglePlacesApiResponse googlePlacesObj, Response arg1) {
                        nearbyPlaces = new String[googlePlacesObj.results.size()][4];
                        for (int i = 0; i < googlePlacesObj.results.size(); i++) {
                            mGooglePlaces.place place = googlePlacesObj.results.get(i);
                            nearbyPlaces[i][0] = place.icon;
                            nearbyPlaces[i][1] = place.name;
                            nearbyPlaces[i][2] = String.valueOf(place.geometry.location.lat);
                            nearbyPlaces[i][3] = String.valueOf(place.geometry.location.lng);
                        }
                        synchronized (synchObj) {
                            done = true;
                            synchObj.notifyAll();
                        }

                    }

                });
            }
        });
        thr.start();

        synchronized (synchObj) {
            while (!done) {
                synchObj.wait();
            }
        }

Note that instead of just runnable I'm using Thread, and done variable which indicates task status which is neccesary since wait call can spontaneously wake up and you have to call it again if the task has not been finished yet.


text:
Q: samples from binomial distribution with varying n I have a set of measurements from hypothesized binomial distributions with the same p but with different n values. Given the data, I'd like to assess how confident I should be that the p value is indeed the same for all measurements.
If it helps, the actual data is

*

*314 successes out of 5334 trials

*613 successes out of 8219 trials

*923 successes out of 9785 trials

*822 successes out of 8387 trials

*461 successes out of 7628 trials

*360 successes out of 4787 trials

*454 successes out of 8007 trials

*636 successes out of 8258 trials

*526 successes out of 9313 trials

A: You can't tell they are the same, only sometimes that they're different. (What if all the p's differ by miniscule amounts?)
Failure to reject doesn't mean the null is exactly true.
That said, those are obviously not a consistent set of proportions, you can tell just by looking at the numbers - the $x$'s (counts) are many $\sqrt{x}$'s apart (which for small proportions of large total counts will be relatively close to the standard deviation of the expected count).
If you must do a test anyway, I'd suggest a chi-squared test or a G-test for homogeneity of proportions - effectively a test of independence (they'll give very similar results), but personally I'd just display the proportions $\pm$ one standard error (for which a few instances of no overlap would be a fairly good indication of differences; this will obviously be what happens):

... and we see that's the case. They're fairly similar (all in the same ballpark) but they're not consistent with equality of proportions


text:
Q: Windows 10 not detecting on installshield Have requirement to detect windows 10 or greater version on install time. for that I have create following function.
It gives me 603 (AS VersionNT value) in windows 10 and windows 8.1. That is wrong.
Is there any other way to achieve this?
function BOOL isWindows10OrGreater()
 STRING svWindowsValue;
 NUMBER nWindowsValue;
 NUMBER nBuffer;
begin
     try
       nBuffer = 256;
       MsiGetProperty(ISMSI_HANDLE,"VersionNT",svWindowsValue,nBuffer);
       StrToNum(nWindowsValue,svWindowsValue);
       return (nWindowsValue >= 603);
     catch
       return FALSE;
    endcatch;
 end;

A: Windows 10 - A Version Oddity

Disclaimer: this information is to the best of my knowledge as of now (check last edit date). This issue is sort of a "moving target" - things seem to change slightly for every OS release.

This is news to me as well, but it seems detecting Windows 10 is now a rather peculiar affair due to how core Win32 calls no longer are guaranteed to report the actual Windows version - and neither do VersionNT or VersionNT64 on my box. They both report 603 (which is Win 8 SP1). The explanation is here: VersionNT value for Windows 10 and Windows Server 2016.
Manifests & Versions: Whether your application is manifested or not is crucial here. Rather than repeating the explanation, I will link to this one (essential reading): C++ How to detect Windows 10.
"Evergreen Versionlessness": On the Microsoft rationale to do this (fight version checks - link to specific comment): Getting Windows OS version programmatically. So I suppose the question is if you should do such a version check at all - or so they want use to believe.

Installshield 2015 / 2018
I don't have Installshield available to test these features:

*

*The 2015 Installshield help file has a blurb on Windows 10 detection in its what's new section.

*

*SYSINFO.WINNT.bWin10 - with a note stating "This member is applicable to event-based InstallScript code; it is not applicable to InstallScript custom actions."

*ISOSL_WIN10 (scroll down until you see the entry highlighted. Same for above link).

*I assume this means that these structures and features only work in Installscript projects.

Workarounds?
I want to emphasize that these are workarounds and nothing else. We are supposed to check functionality these days and not OS versions. Test thoroughly please. I want to cross-link a similar answer with some "intel": VersionNT MSI property on Windows 10.

*

*OS File Version: MSDN suggests getting the version of a key OS file to determine if you are on Windows 10: Getting the system version. There seems to be an implementation of this in the bottom function here (untested).

*WindowsBuild property: It looks like the WindowsBuild property might be useable. It reports 9600 on my Windows 10 system. MSDN documentation for WindowsBuild with the different values for different OS versions. Remember that this value will increment with new releases, so you can't do an equal compare condition. You must do equal or higher. This is all to the best of my knowledge as of now.

*Registry: Maybe it is also an option to read these new registry values in order to determine if you are on Window 10 or not? Heaven knows what they will do with these keys in the future though? Are they "stable"?

*

*HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\

*

*CurrentMajorVersionNumber = 10

*CurrentMinorVersionNumber = 0

*Reliable way to get Windows Version from registry

*WMI: I see suggestions to use WMI (not properly tested by me - just listing all possible options for those who have the test machines available to verify).

Links
Here are some further links. They are not recommendations, as much as a bunch of links used to assemble the above information - so they are here for "safekeeping". I will leave them as they are. There may be some inaccuracies here and there:

*

*VersionNT MSI property on Windows 10

*C++ How to detect Windows 10

*https://blogs.msdn.microsoft.com/oldnewthing/20170112-00/?p=95175

*C++ Check if Windows 10

*Detecting Windows 10 version

*https://www.advancedinstaller.com/forums/viewtopic.php?t=34212

*https://msdn.microsoft.com/en-us/library/windows/desktop/dn424972(v=vs.85).aspx

*https://msdn.microsoft.com/en-us/library/windows/desktop/dn905474(v=vs.85).aspx

*https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003.aspx

*How to ScheduleReboot in wix only if several sessions are opened


text:
Q: Sticky menu wordpress I want to disable the sticky menu of my wordpress site, i'm using the theme swimmingpool & SPA and when I want to customize my theme there is nos customization about the header, i've tried some CSS and it's still not working...
i've tried this :
header .container_wrap_menu {
 position: relative !important;
}

.master_header {
 position: absolute;
}

If anyone got any solution i'll be very happy.
Thx in advance

A: If im correct this might help, so go to your css directory , find swimmingpool.css the open it.
Search the file for .topclass.topclass-shrink and remove position: fixed; which keeps it on top for scroll..
(the class might be called something else than .topclass.topclass-shrink point is to remove fixed from the css file, dont overwrite it with !important its really bad practice, rather comment out the styling and add new styling to it )
comment out = //position: fixed
comment in = position: relative
Tip: just look at your mobile version im not sure what styling or functionality you have going on since there is not really much provided to work with but just make sure your burger menu shows if you want the menu for mobile. Might want to add a media query and display attribute.

A: Probleme solved if anyone has the same problem here is the solution :
SP Options -> Misc Settings -> Enable Sticky Header
SET TO OF