text:
Q: posicionar div en el centro(Reactjs +Tailwind)             <IconContext.Provider value={{ size:'2rem'}}>

                <Link to={{ pathname: "../public/index.html" }}>

                </Link>

                    <BsFillChatDotsFill className='hover:text-green-700'/>
                    <BsFillPersonFill className='hover:text-green-700'/>

                    <TiShoppingCart onClick ={()=> setModalPrice (!ModalPrice)} className='hover:text-green-700'/>
                    {ModalPrice ? (

                    ): null }

            </IconContext.Provider>

lo que intento hacer es que el logo junto a los iconos que ven en la imagen quiero que a medida la pantalla vaya teniendo mas width se vaya posicionando siempre en el centro
un ejemplo del caso a emular
https://i.imgur.com/VZ1D3hn.mp4


text:
Q: sort() in Python using cmp I am trying to sort a list, move all 0 to the end of list.
example: [0,1,0,2,3,0,4]->[1,2,3,4,0,0,0]
and I see someone code it in 1 line
list.sort(cmp=lambda a,b:-1 if b==0 else 0)

But I don't understand what inside the parentheses mean.
Could anyone tell me?  Thank you.

A: Preface:
Sort a list according to the normal comparison:
some_list.sort()

Supply a custom comparator:
some_list.sort(cmp=my_comparator)

A lambda function:
x = lambda a, b: a - b
# is roughly the same as
def x(a, b):
    return a - b

An if-else-expression:
value = truthy_case if condition else otherwise
# is roughly the same as
if condition:
    value = truthy_case
else:
    value = otherwise

The line list.sort(cmp=lambda a,b:-1 if b==0 else 0) itself:
Now, the condition in the comparator is whether b==0, if so indicate that b has a bigger value than a (the sign of the result is negative), otherwise indicate that the values compare the same (the sign is zero).
Whilst Python's list.sort() is stable, this code is not sane, because the comparator needs to test a, too, not only b. A proper implementation would use the key argument:
some_list.sort(key=lambda a: 0 if a == 0 else -1)

Fixed list.sort(cmp=...) implementation:
If you want to use list.sort(cmp=...) (you don't) or if you are just curious, this is a sane implementation:
some_list.sort(cmp=lambda a, b: 0 if a == b else
                               +1 if a == 0 else
                               -1 if b == 0 else 0)

But notice:

In Py3.0, the cmp parameter was removed entirely (as part of a larger effort to simplify and unify the language, eliminating the conflict between rich comparisons and the __cmp__ methods).

An alternative:
Sorting a list is in O( log ). I do not know if for this simple problem the code runs faster, but I wouldn't think so. An O() solution is filtering:
new_list = [x for x in some_list if x != 0]
new_list.extend([0] * (len(some_list) - len(new_list)))

The difference will probably only matter for quite long lists, though.

A: >>> sorted(l, key=lambda x:str(x) if x == 0 else x)
[1, 3, 4, 8, 0, 0, 0]

Guess what's happening here? I am exploiting the fact that, as a preference, python will pick up integers first, then strings. SO I converted 0 into '0'.
Here's the proof.
>>> ll = [3,2,3, '1', '3', '0']
>>> sorted(ll)
[2, 3, 3, '0', '1', '3']

A: You should answer yourself and this is plan:

The ternary expression description is available here:
https://docs.python.org/3/reference/expressions.html?highlight=ternary%20operator#conditional-expressions
You can find a lot of expression description in that document:
https://docs.python.org/3/reference/expressions.html

Q: What does lambda mean?
Please spend just 5 days and read a Tutorial about Python language, which is a fork of the original Gvinno Van Rossum book.
https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions

redpajama_set_name: RedPajamaStackExchange


text:
Q: Registering Services in a module and including dependent modules in jasmine Started to write unit test cases using jasmine.But Stuck in the middle
I have a module called "app" it is declared in  one js file with config and run blocks,,,in the same file, while creating a module, i mention its dependeny modules as well...
app.js
   var app; ------> it is declared as a global variable
   app=angular.module('app,['ngSanitize','Deepak']);
app.run(['$rootScope', '$window', '$anchorScroll', '$timeout', 'resources', function($rootScope, $window, $anchorScroll, $timeout, resources)

Then in other js files where controllers,factory,services and directives are created,below lines were used
angular.module('app').factory
angular.module('app').controller
angular.module('app').service
angular.module('app').filter

So it means am adding the controller,filter,factory and service to the existing module called 'app'
Now am going to create a unit test case, am loading the module as below
DemoToTheTeam.js
beforeEach(function () {
angular.module('app');
});

Does the above line means, it also loading 'Deepak' and 'ngSanitize' module as well(As it was declared as a dependency earlier at the top)
And no matter how many times i run giving the relative paths of all the js files in my application after angular-mock files in the karma.conf.js..It is still not able to inject the factory service
It simply shows Unknown provider with the service name..Along with declaration error as below
 Error: [$injector:unpr] Unknown provider: InformationServiceProvider <- InformationService
 http://errors.angularjs.org/1.5.6/$injector/unpr?p0=ServiceProvider%20%3C-%20InformationService
     at C:/jasmine/project/node_modules/angular/angular.js:68:12
     at C:/jasmine/project/node_modules/angular/angular.js:4501:19
     at Object.getService [as get] (C:/jasmine/project/node_modules/angular/angular.js:4654:39)
     at C:/jasmine/project/node_modules/angular/angular.js:4506:45
     at Object.getService [as get] (C:/jasmine/project/node_modules/angular/angular.js:4654:39)
     at Object.<anonymous> (C:/jasmine/project/tests/DemoToTheTeam.js:79:25)
     at Object.invoke (C:/jasmine/project/node_modules/angular/angular.js:4708:19)
     at Object.workFn (C:/jasmine/project/node_modules/angular-mocks/angular-mocks.js:3071:20)
 Error: Declaration Location
     at window.inject.angular.mock.inject (C:/jasmine/project/node_modules/angular-mocks/angular-mocks.js:3033:25)
     at Suite.<anonymous> (C:/jasmine/project/tests/DemoToTheTeam.js:78:12)
     at C:/jasmine/project/tests/DemoToTheTeam.js:2:1

Am confused on why my service is not recognized and mocked??? Does any1 have any clue on why this is happening, even though i specify the correct relative path of the js files in karma file ??
In some posts , i have seen that even the services,controller and directives that are loaded in the test case can be printed in console
angular.module('app')['_invokeQueue'].forEach(function(value){
console.log(value[1] + ": " + value[2][0]);
})

But i see only a few services that loaded and not all services are loaded, but all are created with angular.module('app').factory syntax -->created in existing module..couldn't figure out why certain services are not loaded even though i have declared its relative path in the karma file
This is my factory service(LanguagesService .js)
angular.module('app').factory('LanguagesService', function(){
  var lng = {},
    _languages = ['en', 'es', 'fr'];

  lng.get = function() {
    return _languages;
  }

  return lng;
});

Am creating the above factory service in a existing module
spec file
describe('Test LanguagesService ', function () {

var mockService;

beforeEach(function () {

    angular.module('app');

});

beforeEach(inject(function ($injector) {

    mockService = $injector.get('LanguagesService');

}));

it('Should call foo fn', function() {

    mockService.getmessages();
  });

});

A: Q. - Does the above line means, it also loading 'Deepak' and 'ngSanitize' module as well(As it was declared as a dependency earlier at the top)
Ans. - Yes. It will load all these modules automatically. The problem is, you haven't injected the service InformationService in the test spec file for which you're writing the test cases. That's what the error is telling.
I suggest you have a look at this answer for the appropriate syntax.
UPDATE:
As far as your spec file is concerned, try this syntax.
describe('Service: InformationService', function () {

    var InformationService;
    beforeEach(module('app'));

    beforeEach(inject(function (_InformationService_) {
        InformationService = _InformationService_;
    }));

    it('Should call foo fn', function() {
        InformationService.getmessages();
    });
});


text:
Q: Multiple slf4j bindings even after pom exclusion? I have read as much as I can on this and tried the solutions proffered here on stackoverflow and the slf4j faq, but no success.
Here is my console log:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/david/.m2/repository/de/ruedigermoeller/kontraktor-http/3.28/kontraktor-http-3.28.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/david/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.0/log4j-slf4j-impl-2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getLoggerFactoryClassStr()Ljava/lang/String;
at org.slf4j.LoggerFactory.reportActualBinding(LoggerFactory.java:263)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:131)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
at org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:29)
at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:33)
at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:28)
at org.jboss.logging.Logger.getLogger(Logger.java:2163)
at org.jboss.logging.Logger$1.run(Logger.java:2263)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
at org.xnio._private.Messages.<clinit>(Messages.java:56)
at org.xnio.Xnio.<clinit>(Xnio.java:93)
at io.undertow.Undertow.start(Undertow.java:97)
at org.nustaq.kontraktor.remoting.http.Http4K.getServer(Http4K.java:94)
at org.nustaq.kontraktor.remoting.http.builder.BldFourK.build(BldFourK.java:115)

Here is my mvn dependency:tree output
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ quokka ---
[INFO] uk.co.example:jar:0.1-SNAPSHOT
[INFO] +- de.ruedigermoeller:kontraktor:jar:3.28:compile
[INFO] |  \- org.jctools:jctools-core:jar:1.0:compile
[INFO] +- de.ruedigermoeller:kontraktor-http:jar:3.28:compile
[INFO] |  +- io.github.lukehutch:fast-classpath-scanner:jar:1.2.3:compile
[INFO] |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.4.1:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  +- javax.websocket:javax.websocket-api:jar:1.1:compile
[INFO] |  +- io.undertow:undertow-core:jar:1.2.8.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.1.4.GA:compile
[INFO] |  |  +- org.jboss.xnio:xnio-api:jar:3.3.1.Final:compile
[INFO] |  |  \- org.jboss.xnio:xnio-nio:jar:3.3.1.Final:runtime
[INFO] |  +- io.undertow:undertow-websockets-jsr:jar:1.2.8.Final:compile
[INFO] |  |  +- io.undertow:undertow-servlet:jar:1.2.8.Final:compile
[INFO] |  |  |  +- org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar:1.0.0.Final:compile
[INFO] |  |  |  \- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  |  \- org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:jar:1.1.0.Final:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] |  \- org.jsoup:jsoup:jar:1.8.2:compile
[INFO] +- de.ruedigermoeller:fst:jar:2.44:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] |  +- org.javassist:javassist:jar:3.19.0-GA:compile
[INFO] |  \- org.objenesis:objenesis:jar:2.1:compile
[INFO] +- org.kie:kie-api:jar:6.3.0.Final:compile
[INFO] +- org.drools:drools-compiler:jar:6.3.0.Final:compile
[INFO] |  +- org.drools:drools-core:jar:6.3.0.Final:compile
[INFO] |  +- org.kie:kie-internal:jar:6.3.0.Final:compile
[INFO] |  +- org.antlr:antlr-runtime:jar:3.5:compile
[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:4.3.1:compile
[INFO] |  +- org.mvel:mvel2:jar:2.2.6.Final:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.4.7:compile
[INFO] |  |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  \- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] +- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.5:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.5:compile
[INFO] +- com.datastax.cassandra:cassandra-driver-dse:jar:2.2.0-rc2:compile
[INFO] |  \- com.datastax.cassandra:cassandra-driver-core:jar:2.2.0-rc2:compile
[INFO] |     +- io.netty:netty-handler:jar:4.0.27.Final:compile
[INFO] |     |  +- io.netty:netty-buffer:jar:4.0.27.Final:compile
[INFO] |     |  |  \- io.netty:netty-common:jar:4.0.27.Final:compile
[INFO] |     |  +- io.netty:netty-transport:jar:4.0.27.Final:compile
[INFO] |     |  \- io.netty:netty-codec:jar:4.0.27.Final:compile
[INFO] |     \- com.codahale.metrics:metrics-core:jar:3.0.2:compile
[INFO] +- com.valchkou.datastax:cassandra-driver-mapping:jar:2.0.1:compile
[INFO] |  \- org.eclipse.persistence:javax.persistence:jar:2.1.0:compile
[INFO] +- net.openhft:zero-allocation-hashing:jar:0.6:compile

Here is my pom.xml, well the relevant part anyway:
    <dependencies>
    <dependency>
        <groupId>de.ruedigermoeller</groupId>
        <artifactId>kontraktor</artifactId>
        <version>${kontraktor.version}</version>
    </dependency>
    <dependency>
        <groupId>de.ruedigermoeller</groupId>
        <artifactId>kontraktor-http</artifactId>
        <version>${kontraktor.version}</version>
    </dependency>
    <dependency>
        <groupId>de.ruedigermoeller</groupId>
        <artifactId>fst</artifactId>
        <version>${fst.version}</version>
    </dependency>
    <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
        <version>${drools.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
        <version>${drools.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${log4j.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-dse</artifactId>
        <version>${cassandra}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.valchkou.datastax</groupId>
        <artifactId>cassandra-driver-mapping</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>zero-allocation-hashing</artifactId>
        <version>0.6</version>
    </dependency>
    <dependency>
        <groupId>uk.co.creditswift</groupId>
        <artifactId>creditswift.domain</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
</dependencies>

I have tried excluding lots more jars as well, but the dual bindings with different version that cause the NoSuchMethodError always appear. You can see I explicitly exclude the jar from log4j-core and log4j-api and yet it appears in the trace as being there? log4j-slf4j-impl does not even appear in the dependency tree, so no idea how it is loaded.
I'm out of ideas. Anybody understand this (it reminds me of the version problems in the DLL hell days, yes I am that old).


text:
Q: Прозрачность в css При создании прямоугольника с сделал обводку, хотел изменить прозрачность середины, но чтобы обводка не была прозрачной
[![123][1]][1]

A:

body {
  background-color: #000000;
}

.block {
  width: 200px;
  height: 100px;
  border-radius: 20px;
  border: 1px solid #fff908;
  background-color: rgba(255, 249, 8, 0.1);
}

background-color: rgba(255, 249, 8, 0.1); - последний параметр 0.1 это значение прозрачности, устанавливается от 0 до 1. Подробнее

A: Используйте rgba для background-color: rgba(0, 0, 0, 0.1).
Последний параметр - альфа-канал (от 0 до 1).
А вы наверное используете opacity (для всего элемента).


text:
Q: is there a RFC for msg file formats to save tasks of exchange online? Basically, I'm attempting to work with MSG files and I want to know if these files are pretty standard across different mail servers... basically, is there an RFC on MSG files just like there is one for email addresses and other topics?
So options that I have figured it out are:
msg file format
icalendar format

I guess I can be a bit more specific to get a better understanding of what I need. I am scanning an Exchange mailbox and saving out the tasks. So which format I should choose to download my tasks data from the backup so that I can directly export it to my exchange online and office 365 client.
For mails, I have used eml files format(.eml files are usually stored in rfc822 format)
For contacts, I have used Vcard to save data of contacts
For Calendar events, I have used ics format (icalendar).

Above all are not specific to microsoft.

So what should be the appropriate format for saving my Tasks so that I
  can export them directly into my account without much information loss
  of task.

A: MSG file format is documented at https://msdn.microsoft.com/en-us/library/cc463912%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
If you are moving items between Exchange servers, consider the Fast Transfer Stream (FTS) format - use ExportItems and UploadItems EWS operations.


text:
Q: Parse derived scientific notation I'm working on FORTRAN formatted text and I get decimal numbers with the following format : 1.2345+67 1.2345678-12
In fact this notation is just a derived form of the scientific notation :
1.2345+67 = 1.2345e67.
I would like to parse these numbers into double. Is there a simple way for parsing these types of decimal numbers ?
I already thought about implementing a simple method which adds an E or e before the Double.parseDouble call. However the loop which contains the Double.parseDouble is called 10e11 times, is it viable ?


text:
Q: Displaying data from multiple databases on a webpage I am attempting to create an information screen so that people can have a quick glance at it and be able to read the information from it with ease, this entails displaying certain pieces of data from different database tables in one database. Possibly 4 or 5 different tables. these will be then be displayed in a table on the web page for people to see.
What would you recommend is the best way? i could just use a select statement for every piece but if I am taking 3 bits of data from one table and 4 bits from another, surely there is an easier way to gather this data and display it?

A: If the data is truly in entirely separate SQL databases, then  you will have to connect to each one, run your query, and disconnect. You can compile all the data using PHP and display it to the user.
If you meant the data is in separate database tables (not separate databases) then you can probably compile one query to pull it all -- if the data is related to each other -- or run the 4 or 5 queries needed to pull that data.
You will need to be more specific and share code if you want further help.


text:
Q: How to deal with multiple input fields in React and TypeScript I have React + TypeScript code with multiple input fields. I need to refactor the code so that it is a bit cleaner, because there will be a lot more input fields (20+) in the final code.
Basically what the code does, it shows a form with multiple input fields. The user enters numbers to the fields, clicks a count-button and after this it shows a sum of all of the values (+ some other stuff I left out here because it's not relevant).
So I have this InputFields component with all of the input fields (there are more fields in the final code, but all of the fields are similar with just different labels):
const InputFields = (props) => {
    return (

            Label for field 1:
            <input
              placeholder="Add number"
              type="number"
              name="field1"
              id="field1"
              value={props.field1}
              onChange={(e) => props.setField1(parseInt(e.target.value, 10))}
            />

            Label for field 2:
            <input
              placeholder="Add number"
              type="number"
              name="field2"
              id="field2"
              value={props.field2}
              onChange={(e) => props.setField2(parseInt(e.target.value, 10))}
            />

            Label for field 3:
            <input
              placeholder="Add number"
              type="number"
              name="field3"
              id="field3"
              value={props.field3}
              onChange={(e) => props.setField3(parseInt(e.target.value, 10))}
            />

    )
  }

export default InputFields

Then on another file I get the states (I need a cleaner way to do this for the fields):
  const [field1, setField1] = useState<number>(0);
  const [field2, setField2] = useState<number>(0);
  const [field3, setField3] = useState<number>(0);

  const [sum, setSum] = useState(0);

I calculate the sum (also probably not a very effective way to do this with a lot of fields):
  function calculateSum() {
    setSum(field1 + field2 + field3);
  }

I also need to get an array of the all the field values and labels for other purposes. Is there a better way to do this?
  const fields = [
    { value: field1, label: 'Label for field 1' },
    { value: field2, label: 'Label for field 2' },
    { value: field3, label: 'Label for field 3' },
  ];

This handles the form submit and calculates the sum on button click:
  const handleSubmit = (event) => {
    event.preventDefault()
    calculateSum();
  }

This is the return:
  return (

        <form onSubmit={handleSubmit}>
          <InputFields
            field1={field1}
            field2={field2}
            field3={field3}
            setField1={setField1}
            setField2={setField2}
            setField3={setField3}
          />
        <button type='submit'>Count</button>
        </form>

Sum: {sum || "0"}

  )

So basically I need to clean up the code where I set the states, calculate the sum, get the array of field values and labels, and passing the props, but I haven't found a proper way to do this without breaking anything.


text:
Q: 'id' is always undefined (Leap motion) I have just started to develop for Leap motion, and i have general question Here is my code:
    Leap.loop(function(obj) {
       var hands = obj.hands.map(function(d) {
        return {
          id: d.id,
          length: d.length,
          palmPositionX: d.palmPosition[0],
          palmPositionY: d.palmPosition[1],
          palmPositionZ: d.palmPosition[2]
        }

      });
 console.log(hands.length); //Work fine
 console.log(hands.id); //undefined!

     //handParcoords.data(hands).render(); //This works - It takes all parameters and render a chart

    });

Am I missing something? Why does the length work when the id and palmPositionX or palmPositionY don't?

A: hands is an array so you'll have to reference an element in the array then get its id
console.log(hands[0].id);


text:
Q: No mapping found for HTTP request with URI I recently started to learn spring mvc and I got stuck at the beginning.
I have a newbie question but I didn't find any solution yet, or in other worlds; none of found solution worked.
So, I try to make my first simple spring mvc application that prints some text after clicking the link but when i run application i get http 404 and in glassfish logs; No mapping found for HTTP request with URI [/testApp/] in DispatcherServlet with name 'example'
I think that I messed something with configuration but I cannot figure out what ;/
Here is my web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<servlet>
    <servlet-name>example</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>example</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

example-servlet.xml;
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan
    base-package="controller" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/jsp/" />
    <property name="suffix" value=".jsp" />
</bean>

and HelloWorldController class;
@Controller
public class HelloWorldController {

    @RequestMapping("/hello")
    public ModelAndView helloWorld() {
        String message = "Hello world spring";
        return new ModelAndView("hello", "message", message);
    }
}

I have hello.jsp inside WEB-INF/jsp and index.jsp, web.xml and example-servlet.xml inside WEB-INF.
I would much appreciate for any help.
thank you from advance.
@EDIT:
Request mapping works like charm but still welcome page isn't working.
My project structure looks like this:
-webapp
-WEB-INF
--jsp
---hello.jsp
--example-servlet.xml
--web.xml
-index.jsp

tl;dr
I have my welcome page index.jsp in webapp directory and rest in WEB-INF and WEB-INF/jsp
I have added welcome-page to web.xml:
 <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

And still after typing http://localhost:8080/testApp/ get http 404.
@EDIT:
When I request http://localhost:8080/testApp/index.jsp everything works ok.

A: You're missing
<mvc:annotation-driven />

and its appropriate namespace declarations from your context configuration. Without it, Spring won't register your controllers (among other things).
Also, your controller handler method is mapped to
@RequestMapping("/hello")

so the request should go to
/your-context-path/hello

A: if someone is struggling with my problem (welcome page isn't displaying) I found some solution.
If you have view resolver configured like this:
<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/jsp/" />
    <property name="suffix" value=".jsp" />
</bean>

create your index.jsp in WEB-INF/jsp directory and create controller class for it like below:
@Controller
public class IndexController {

    @RequestMapping("/")
    public String index() {
        return "index";
    }
}

now If you call http://address/yourapp/ index.jsp will be mapped.


text:
Q: Listview items are not displayed after Button I have added my code below. Listview items are not displayed after the Sync Button. I am using RelativeLayout
<Button
    android:id="@+id/button_sync"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_sync" />

<ListView
    android:id="@+id/company_factory_truck_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/button_sync"
    android:divider="@android:color/transparent"
    android:dividerHeight="10.0sp"
    >

</ListView>

</android.widget.RelativeLayout>

A: This code displays both button and listview
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:id="@+id/button_sync"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_sync" />

    <ListView
        android:id="@+id/company_factory_truck_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/button_sync"
        android:divider="@android:color/transparent"
        android:dividerHeight="10.0sp"
        >

    </ListView>

</RelativeLayout>

[This pic shows the output][1]

  [1]: https://i.stack.imgur.com/7yaTb.png


text:
Q: Accessing shared outlook inbox in python I have a shared inbox in outlook and I want to write some code that would get me the emails from the shared inbox. Right now I can get the emails from my main inbox, but I want to do it for another inbox.
This is the code so far:
import os
import win32com.client

outlook = win32com.client.Dispatch('Outlook.Application').GetNamespace('MAPI')
inbox = outlook.GetDefaultFolder(6).Folders('Some Magic Folder')
messages = inbox.Items

My guess is that I shouldn't be looking at the GetDefaultFolder method but something else, but I'm not quite sure where to look at.

A: The GetSharedDefaultFolder method of the Namespace class returns a Folder object that represents the specified default folder for the specified user.
Sub ResolveName()
  Dim myNamespace As Outlook.NameSpace
  Dim myRecipient As Outlook.Recipient
  Dim CalendarFolder As Outlook.Folder
  Set myNamespace = Application.GetNamespace("MAPI")
  Set myRecipient = myNamespace.CreateRecipient("Eugene Astafiev")
  myRecipient.Resolve
  If myRecipient.Resolved Then
    Call ShowCalendar(myNamespace, myRecipient)
  End If
End Sub

Sub ShowCalendar(myNamespace, myRecipient)
  Dim CalendarFolder As Outlook.Folder
  Set CalendarFolder = _
  myNamespace.GetSharedDefaultFolder _
  (myRecipient, olFolderCalendar)
  CalendarFolder.Display
End Sub


text:
Q: access to a variable inside the function in JavaScript For example I have this JavaScript function:
function createCroppie() {
  var crop = new Croppie(document.getElementById('js-image-editor'), {
      enableExif: true,
      showZoomer: true,
      viewport: { width: y, height: y, type: 'square'},
      boundary: { width: x, height: x}
  });
}

now I need to access to the "crop" variable for using in these codes:
  $('.fa-save').on('click', function (ev) {
       crop.result ({
        type: 'canvas',
        size: 'viewport'
      }).then(function () {
        console.log('upload image complete');
      });
    });

Since the second block of code that I wrote here is not in the same function, how can I access to the "crop" variable in createCroppie function?

A: Assuming that you initialize Croppie before the click event, you can do the following
var myCroppie;

function createCroppie() {
   myCroppie = new Croppie(document.getElementById('js-image-editor'), {
      enableExif: true,
      showZoomer: true,
      viewport: { width: y, height: y, type: 'square'},
      boundary: { width: x, height: x}
   });
}

 createCroppie();

 $('.fa-save').on('click', function (ev) {
     myCroppie.result ({
       type: 'canvas',
       size: 'viewport'
     }).then(function () {
        console.log('upload image complete');
     });
 });

A: Function variables are scoped within the function, unless closure is used. As Senal pointed out the first solution is to use a global scope for the variable.
To rewrite using closure:
function createCroppie() {
  var crop = new Croppie(document.getElementById('js-image-editor'), {
      enableExif: true,
      showZoomer: true,
      viewport: { width: y, height: y, type: 'square'},
      boundary: { width: x, height: x}
  }
  return crop;
// or return this;
// this being the elements of the function as an object.
  );
}

crop = createCroppie();

Looking up Croppie documentation it is based on creating a closure to return a object with its variables. No need to wrap a function around it.
var myCroppie = new Croppie(document.getElementById('js-image-editor'), {
          enableExif: true,
          showZoomer: true,
          viewport: { width: y, height: y, type: 'square'},
          boundary: { width: x, height: x}
      };

However, you could use closure to extend the library.
function createCroppie() {
  var crop = new Croppie(document.getElementById('js-image-editor'), {
      enableExif: true,
      showZoomer: true,
      viewport: { width: y, height: y, type: 'square'},
      boundary: { width: x, height: x}
  }
  function say(message) {
       console.log(message);
       return this;
  }
  return this;
  );
}

crop = createCroppie();

Now crop is a new croppie with a log function, and this, (this being the following not the elements of the object of the function), works.
  $('.fa-save').on('click', function (ev) {
       crop.log('clicked').result ({
        type: 'canvas',
        size: 'viewport'
      }).then(function () {
        console.log('upload image complete');
      });
    });

Note, the say function of the closure function needs to return "this", (Javascript this), so as to include the .result function allowing crop.log.result() to exist.


text:
Q: Узнать, начался ли автоповтор Пишу программу, работающую без операционной системы. Нужно узнать, начался ли автоповтор нажатия клавиш PS/2 клавиатуры. Некоторое оборудование не посылает скан-код отпускания клавиши до окончания режима автоповтора, тогда всё просто, но некоторое (эмулятор Bochs) последовательно посылает скан-коды нажатия и отпускания. Вариант — следить за частотой появления символов и сравнивать с частотой автоповтора, но непонятно, как получить эту частоту автоповтора, разве что установить свою. Может, есть ещё варианты?
Ещё забыл упомянуть, что у меня в обработчике прерывания клавиатуры стоит большая задержка, то есть вариант со слежением за частотой будет работать не очень хорошо...


text:
Q: Reload asterisk server after saving extension details from my application I am developing a web application using ASP.NET MVC. I wrote add functionality in my application to add extension details into asterisk database using asterisk realtime database configuration. But after saving extension details to asterisk database, it needs reload. So how can I reload remotely located asterisk server from my application?

A: You should use asterisk REALTIME architecture, it not require reload.
Reload can be done by using AMI interface, but if you need it you probably did something wrong.

A: I have resolved this issue by self. Following code is required for reload asterisk after store all of your configuration in asterisk databases:
        using (var cSSH = new SshClient("asterisk server ip", "username", "secret"))
        {
            cSSH.Connect();
            SshCommand sc = cSSH.CreateCommand("/var/lib/asterisk/bin/retrieve_conf");
            sc.Execute();
            sc = cSSH.CreateCommand("asterisk -rx 'core reload'");
            sc.Execute();
            cSSH.Disconnect();
        }


text:
Q: Display a translucent selection highlight around an image I have a rectangle with no background and I want to give it a translucent background when the user hovers their mouse over it, and then remove it when the mouse leaves the rectangle.
Is there any sample C# code that shows me how to do this?
I am basically doing an Windows Explorer style image viewer and looking for an identical method of highlighting the image that the mouse is currently hovering over.
Thanks.


text:
Q: Prevent mousemove event on touch devices I'm listening to the mousemove event to give a button a nice effect based on the mouse position. On mobile however, if I touch the button the event is fired aswell making the button jump to the position. I'd rather have the button ignore the event when it's done by touch but I'm struggling to understand how this can be achieved?
// The function is just a helper of mine (it ads addEventListener to the matched events
createEventListener('.hoverable', 'mousemove', function(e) {
  // stripped out some calculations for simplicity reasons
  const deltaX = 50;
  const deltaY = 50;

  const transformString = `translate3d(${deltaX}px, ${deltaY}px, 0)`;

  this.style.mozTransform = transformString;
  this.style.webkitTransform = transformString;
  this.style.transform = transformString;
});

A: You could possibly add the CSS style: touch-action to your elements.
style="touch-action: none;"

or maybe add/remove events and cancel the action of that event:
So the order of events fired is: 1) touchstart 2) touchmove 3) touchend 4) mousemove 5) mousedown 6) mouseup 7) click.
Maybe something like this:
function handleTouch(e) {
  e.preventDefault();
}
document.getElementsByClassName("hoverable").addEventListener('touchstart', handleTouch, false);

document.getElementsByClassName("hoverable").removeEventListener('touchstart', handleTouch);


text:
Q: Change an double type value from a variable to String/text output in JavaFX? I have a double type value that I call from another class named Account, and this value holds the balance, of a user. Everytime a user click a button, I want to put it on display. Something like this :

The value (taken from class Account) should be located and presented below Your current balance(RM):. But when I use the code below here, it won't even run the code.
Label balanceInfo = new Label("Your current balance (RM) :"+Double.toString(user[currentIndex].getBalance()));

The code only runs when I delete this part of the line : +Double.toString(user[currentIndex].getBalance())
I have also tried using +user[currentIndex].getBalance() , and the code won't run.
So how do I make it so that it can show the value like 290.00 (double type) below the Label text Your current balance(RM): ?

A: If user.getBalance() returns a primitive double or a Double, then the following should work :
Label balanceInfo = new Label("Your current balance (RM) :" + user[currentIndex].getBalance());

As pointed out in the comment, you should not use double to store a currency, but for example a BigDecimal. With BigDecimal the code above will still work, or to format really as a currency:
Label balanceInfo = new Label("Your current balance (RM) :" +
    NumberFormat.getCurrencyInstance().format(user[currentIndex].getBalance()));

Example:
BigDecimal money = new BigDecimal(2345.856);
Label label = new Label("Your balance: " + NumberFormat.getCurrencyInstance().format(money));

will produce a Label like:

A: Use DecimalFormat class.
DecimalFormat df = new DecimalFormat("#.00");
System.out.print(df.format(user[currentIndex].getBalance()));


text:
Q: How does degree theory imply that this mapping $f$ is locally onto? Let $f: \mathbb{R}^n \rightarrow \mathbb{R}^n$ be a smooth vector field ($\mathcal{C}^1$ mapping). Let $0$ be a critical point of $f$, i.e. $H f(0) = 0$.
Assume that the index of $f$ at $0$ is positive: $\text{ind}(f,0) >0$.
Please explain the following statement (I've found on a paper):

"From Degree Theory, the mapping $f$ is locally onto."

Is this implied by the Browder-Minty Theorem?

A: First of all, I would suggest that you find yourself a copy of Topology from the differentiable viewpoint by J. Milnor. There you will find all the relevant definitions.
Briefly, the index $\mathrm{ind}(f,0)$ of a vectorfield $f:\mathbb{R}^n\to\mathbb{R}^n$ around a fixed point $f(0)=0$ such that $f$ vanishes only in $0$, is the topological degree of the map
$$g_r(x)=\frac{f(x)}{\|f(x)\|}$$
$g_r:S_r\to\mathbb{S}^n$, where $S_r=\{x\ :\ \|x\|=r\}$. The degree of the map $g_r$ is constant for small values of $r$.
By degree theory, the degree is an homotopy invariant and a non-surjective map is homotopic to a constant (which has degree $0$), thereofre a map with positive degree has to be surjective, so every $g_r$ is surjective. This means that $f(S_r)$ surrounds $0$ for every $r$ small enough, meaning that $0$ is in the bounded component of $\mathbb{R}^n\setminus f(S_r)$. (remember that $0$ was an isolated critical point, therefore $f$ is a local embedding outside $0$).
$r\mapsto f(S_r)$ is continuous and $\mathrm{dist}(0, f(S_r))\to0$ when $r\to0$, therefore if there were a sequence of points staying outside of the range of $f$ on every ball surrounding $0$, this sequence would have to pass from the inside of $f(S_r)$ to the outside of some other $f(S_\rho)$, with a continuous motion, without being on the boundary of any $f(S_s)$ with $\rho\leq s\leq r$ (otherwise it would be in the range of $f$). But this is absurd.
Therefore $f$ is surjective.
NB: Probably there are shorter ways of proving this, but this is, I think, the most visual one.

A: Just a small answer! If $f$ is not onto, then $\exists y_0\in\mathbb{R}^n$, such that $f^{-1}(y_0)=\varnothing$ and therefore $\mathrm{deg}(f,y_0)=0$. Since $y\mapsto\mathrm{deg}(f,y_0)$ is locally constant and $\mathbb{R}^n$ connected, then the degree of $f$ is identically zero. $\mathrm{deg}(f,y)=0$, $\forall y\in\mathbb{R}^n$.


text:
Q: The curious case of "if" in Java While working on something, I stumbled upon this piece of code:
if(true) {
    String message = "Assignment possible";
}

if(true)
    String message = "Time to leave earth";  // error!

Why is there a compilation error in the second case when it is possible to write 'if' conditions in java without the braces?
The error message doesn't seem to give a proper info:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
Syntax error, insert "AssignmentOperator Expression" to complete Assignment
Syntax error, insert ";" to complete Statement
String cannot be resolved to a variable
message cannot be resolved to a variable

Am I missing something obvious here? Can someone explain this?

A: You can't declare a variable inside an if statement unless you surround the declaration with curly braces, since the declaration must have a scope.
This would work, since the variable is declared outside the if statement :
String message;
if(true)
    message = "Assignment possible";
System.out.println(message)

This doesn't pass compilation, since the variable would be declared in the same scope as the surrounding code, but it would only be declared if the condition is true, so System.out.println(message) will not have a message variable to print in all cases :
if(some condition)
    String message = "Time to leave earth";
System.out.println(message);

The fact that your condition is always true doesn't make a difference, since the compiler must support all outcomes of any if condition.
Now, when you surround the declaration with curly braces, you restrict your declared variable to a new scope :
if(some condition) {
    String message = "Time to leave earth";
    System.out.println(message); // this will pass compilation since message
                                 // is guaranteed to be found in this scope
}
System.out.println(message); // this won't pass compilation, since message is not
                             // found in this scope

A: The controlled-statement of an if statement is either a single statement or a block. A single statement cannot be a declaration-statement.


text:
Q: Tkinter Click Button in One Window and Update Value in Another Python noob here. I'm building a basic sports scoreboard application that has two windows: one for the scoring console (contains all of the buttons needed to update the scoreboard's values) and one for the scoreboard itself.
I am able to open both windows from the main window with the click of the "Open System" button. Both of these are tk.TopLevel windows and I was under the impression that if both were TopLevel, I should be able to click the buttons to increment/decrement in one window and see the changes reflected in the other.
However, while I am able to click the buttons, I don't see the changes to the home and visitor values until I reload the TopLevel windows from the main window. How do I fix this?
import tkinter as tk

home: int = 0
visitor: int = 0

class ScoreViewer(tk.Toplevel):
    def __init__(self, parent):
        super().__init__(parent)
        global home, visitor
        self.geometry('800x800')
        self.title('Scoreboard')

        self.homeScoreLabel = tk.Label(self, text=home)
        self.visitorScoreLabel = tk.Label(self, text=visitor)

        self.homeScoreLabel.pack()
        self.visitorScoreLabel.pack()

        tk.Button(self, text='Close', command=self.destroy).pack(expand=True)

class ScoreConsole(tk.Toplevel):
    def __init__(self, parent):
        super().__init__(parent)
        global home, visitor
        self.geometry('800x800')
        self.title('Scoreboard')
        self.homeScorePlus = tk.Button(self, text="Home Score +", command=lambda: self.changehomescore(1))
        self.homeScoreMinus = tk.Button(self, text="Home Score -", command=lambda: self.changehomescore(-1))
        self.visitorScorePlus = tk.Button(self, text="Visitor Score +", command=lambda: self.changevisitorscore(1))
        self.visitorScoreMinus = tk.Button(self, text="Visitor Score -", command=lambda: self.changevisitorscore(-1))

        self.homeScorePlus.pack()
        self.homeScoreMinus.pack()
        self.visitorScorePlus.pack()
        self.visitorScoreMinus.pack()

        self.mainloop()

    def changehomescore(self, amount):
        global home, visitor
        if not (amount == -1 and home == 0):
            home = home + amount

    def changevisitorscore(self, amount):
        global home, visitor
        if not (amount == -1 and visitor == 0):
            visitor = visitor + amount

class ScoreSystem(tk.Tk):
    def __init__(self):
        super().__init__()
        self.title("Console")
        self.geometry('500x500')

        tk.Button(self, text='Open System', command=self.opensystem).pack(expand=True)

    def opensystem(self):
        viewer = ScoreViewer(self)
        viewer.grab_set()
        console = ScoreConsole(self)
        console.grab_set()

if __name__ == "__main__":
    app = ScoreSystem()
    app.mainloop()

A: You're just changing variable. For the new values to appear in a window you must reconfigure the window. You also are calling mainloop twice. You should only call it once for the entire program.
First, you need to save references to the windows so each window can interact with the other:
class ScoreSystem(tk.Tk):
    ...
    def opensystem(self):
        self.viewer = ScoreViewer(self)
        self.viewer.grab_set()
        self.console = ScoreConsole(self)
        self.console.grab_set()

Next, you need to save the self parameter that is passed to the two windows, so you can use them later on.
class ScoreConsole(tk.Toplevel):
    def __init__(self, parent):
        ...
        self.parent = parent
        ...

Finally,  you need to directly update the score by referencing the other window via the parent attribute, and from there you can reference the label
class ScoreConsole(tk.Toplevel):
    ...
    def changehomescore(self, amount):
        global home, visitor
        if not (amount == -1 and home == 0):
            home = home + amount
            self.parent.viewer.homeScoreLabel.configure(text=home)

There are arguably better solutions, but this change requires the fewest lines of code. The takeaway here is that:

*

*you have to give the console a way to access the viewer. In this case we know that "parent" refers to the main window and the main window has references to the other windows. You could also just pass the instance of the viewer to the console at some point.

*you have to reconfigure the widget, you can't just update a normal python variable and expect a widget to know that it changed.


text:
Q: Does aptitude use safe-upgrade or full-upgrade in visual mode? Sometimes I use Aptitude in visual mode[1] to install and upgrade packages.
When I upgrade from the command line using apt or aptitude I often use full-upgrade instead of safe-upgrade[2] because I run the testing flavour of Debian, but which one is used in Aptitude visual mode?
Basically, what really happens when I press U?
If it's one way or another, is there a way to configure the default behaviour, or to decide manually which one to use?

[1] The GUI. Some call this a TUI.
[2] Formerly called upgrade and dist-upgrade respectively.

A: Neither.
When you press U, every package which can be upgraded is flagged for upgrade, except for packages that are held back or would be upgraded to a forbidden version. This isn't the same as either safe-upgrade or full-upgrade on the command line, because conflicts aren't resolved fully: the upgrade flagging can result in (tentatively) broken packages, which you'll see indicated by the number of broken packages, but Aptitude won't do anything about those breakages simply as a result of pressing U. You can resolve any conflicts manually, or you can ask Aptitude to show you the various resolution possibilities using e, . and , to navigate, and ! to apply a resolution.
In the code itself, the U handling is closer to safe-upgrade than to full-upgrade, because it ignores removals initially. But as mentioned above, it's not quite the same.


text:
Q: How to update div using Reimer ASP.NET control? I'm using Reimers ASP.NET control wich is great. But now I'm having a little  problem.
I add two pins on the map like you can see in the following code below. When I click those markers on the map, map_OverlayClick method is executed but it does not change the text in divTest. It could also be label, textbox or whatever. What can I do to update this div with the new text ?
I'm trying to do something similar to this with the Reimers control.
Reimers asp.net map control
Default.aspx:
<%@ Register Assembly="Reimers.Google.Map" Namespace="Reimers.Google.Map" TagPrefix="Reimers" %>
   <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
      <Reimers:Map ID="Map1" runat="server" Width="400" Height="400" DefaultMapType="Terrain">
   </Reimers:Map>
<div id="divTest" runat="server" />

Code behinde:
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            divTest.InnerHtml = "First div text...";
            LatLng laln = new LatLng();
            laln.Latitude = 65;
            laln.Longitude = -19;

            Marker marker = new Marker(65.4, -18.5);
            Map1.Overlays.Add(marker);

            Marker marker1 = new Marker(65.4, -18.3);
            Map1.Overlays.Add(marker1);

            Map1.Zoom = 7;
            Map1.Center = laln;
        }

        Map1.OverlayClick += map_OverlayClick;
    }

    void map_OverlayClick(object sender, OverlayEventArgs e)
    {
        divTest.InnerHtml = "Second div text..";
    }

A: If you have a look at this tutorial, then you will see that the pattern is to assign a JavaScript command to the MapCommand property of the event args (OverlayEventArgs).
In your case, what you want is to execute:
document.getElementById("divTest").innerHTML = "Second div";

So you have to assign that command to the MapCommand, like so:
e.MapCommand = "document.getElementById(\"divTest\").innerHTML = \"Second div\";";

If you use jQuery or some other clientside framework, you can of course reference that, since the map control simply executes the JavaScript you hand it from the server.
A better option is probably to set the command to the appropriate clientside handler  (dummy code: Marker.ClientsideHandlers.OnClick = "your JavaScript code") if you don't need any server processing.


text:
Q: Port Forwarding to IP not in LAN I am administering a SSH server and trying to configure port forwarding through my router for access outside of the subnet. The server is located at subnet IP address 192.168.86.97 however, when I try to configure the router to port forward to this IP or any IP other than 192.168.0.X, I get the error

Internal IP Address is not in LAN.

To solve this, I have tried assigning the device a static IP within the range 192.168.0.X using:
sudo ip address add 192.168.0.97/24 dev eno1

However, this IP address assignment does not appear to be reflected on any other machine but the server itself. That is, the server may ping itself at 192.168.0.97, but no other device on the subnet can ping 192.168.0.97. I want to solve this, and my questions are

*

*What does it mean that the Internal IP address 192.168.86.97 is not in LAN?

*How can I assign this machine an IP address in the range 192.168.0.X so that the port forwarding works correctly?

I tried changing the router's LAN to 192.168.86.X, but that just made all of the IP addresses on the network jump to 192.168.87.X. After doing that, here are the results from these commands
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 30:9c:23:df:3a:f9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.97/24 brd 192.168.0.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet 192.168.87.32/24 brd 192.168.87.255 scope global noprefixroute eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::d97d:409f:4793:c98e/64 scope link
       valid_lft forever preferred_lft forever
3: wlp26s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 30:24:32:b8:4d:6d brd ff:ff:ff:ff:ff:ff

ip route show
default via 192.168.87.1 dev eno1 proto dhcp src 192.168.87.32 metric 202
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.97
192.168.87.0/24 dev eno1 proto dhcp scope link src 192.168.87.32 metric 202

A: Check if there is another device between your router and server.
It turned out that there was a wireless signal extender between the router and server. The router was assigning IP addresses in the range 192.168.0.X, but the signal extender was assigning IPs in the range 192.168.86.X. Thats why device IPs weren't getting assigned into the router's LAN.
To solve the problem in it's entirety, I just configured the router to forward a port to the signal extender, then configure the signal extender to forward that port again to the server.


text:
Q: 'Prefix not set' error showing, when trying to install 12.04 When I tried to install and reboot to Ubuntu 12.04,  I  got an error as 'prefix not set' and if I choose the option normal mode it is showing me another error.
Please help me with this. I have tried to install both 32-bit and 64-bit also, but the result is same.

A: Verify that you have downloaded the correct ISO CD by using their MD5/SHA1 checksums. I know this is quite obvious, but is the source of trouble in most cases.


text:
Q: Using one cell to reference another database and combine the two in a query I am trying to figure out if there is a way to take the value in a cell and replace it with the text name of a user that that number refers to in another table.
I have looked through subqueries but I don't think that is what I want. So for example my query comes back now as userID, state, country. And there is another table that has userID, name. I want to query the first database but to have userID replaced with its corresponding name from the other table.
Is that doable? I am using mySQL Workbench to make my queries.

A: If I understand what you need you could try this (after a backup!!)
UPDATE table1 SET userID =
    (SELECT name FROM table2
     WHERE table2.userID = table1.userID)

If you just need to get results from two tables you could use
SELECT t2.name, t1.state, t1.country
FROM table1 t1 INNER JOIN table2 t2
ON t1.userID = t2.userID

A: Like this?
select u.username, l.logintime, l.logouttime
from loginouttable l
join usertable u on l.userid = u.userid


text:
Q: How to pass object from editor to property sheet in eclipse plugin development? I have an editor, this is suppose to interact with property sheet and outline views. I used Iselectionprovider interface to achieve this, but I am not able to do interaction between the editor and views.
Please give me some sample code snippets for this.

A: Type Alt+Shift+F1 right in the middle of your Java editor.
That will display the class of that editor:org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor
You will have then ton of example of listener between that editor and various other views, like that org.eclipse.jface.util.PropertyChangeEvent.
In short, Plug-in Spy is your friend for this kind of code exploration.


text:
Q: How does an interpreter use a DSL? I'm using an interpreter for my domain specific language rather than a compiler (despite the performance). I'm struggling to understand some of the concepts though:
Suppose I have a DSL (in XML style) for a game so that developers can make building objects easily:
<building>
  <name> hotel </name>
  <capacity> 10 </capacity>
</building>

The DSL script is parsed, then what happens?
Does it execute an existing method for creating a new building? As I understand it does not simply transform the DSL into a lower level language (as this would then need to be compiled).
Could someone please describe what an interpreter would do with the resulting parsed tree?
Thank you for your help.

A: Much depends on your specific application details. For example, are name and capacity required? I'm going to give a fairly generic answer, which might be a bit overkill.
Assumptions:

*

*All nested properties are optional

*There are many nested properties, possibly of varying depth

This invites 2 ideas: structuring your interpreter as a recursive descent parser and using some sort of builder for your objects. In your specific example, you'd have a BuildingBuilder that looks something like (in Java):
public class BuildingBuilder {
  public BuildingBuilder() { ... }
  public BuildingBuilder setName(String name) { ... return this; }
  public BuildingBuilder setCapacity(int capacity) { ... return this; }
  ...
  public Building build() { ... }
}

Now, when your parser encounters a building element, use the BuildingBuilder to build a building. Then add that object to whatever context the DSL applies to (city.addBuilding(building)).
Note that if the name and capacity are exhaustive and are always required, you can just create a building by passing the two parameters directly. You can also construct the building and set the properties directly as encountered instead of using the builder (the Builder Pattern is nice when you have many properties and said properties are both immutable and optional).
If this is in a non-object-oriented context, you'll end up implementing some sort of buildBuilding function that takes the current context and the inner xml of the building element. Effectively, you are building a recursive descent parser by hand with an xml library providing the actual parsing of individual elements.
However you implement it, you will probably appreciate having a direct semantic mapping between xml elements in your DSL and methods/objects in your interpreter.


text:
Q: The mouse hook event to detect mouse click anywhere on screen Below is the code I tried:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    [DllImport("user32.dll", CharSet = CharSet.Auto,
        CallingConvention = CallingConvention.StdCall)]
    public static extern int SetWindowsHookEx(int idHook, HookProc lpfn,
    IntPtr hInstance, int threadId);

    [DllImport("user32.dll", CharSet = CharSet.Auto,
     CallingConvention = CallingConvention.StdCall)]
    public static extern bool UnhookWindowsHookEx(int idHook);

    [DllImport("user32.dll", CharSet = CharSet.Auto,
     CallingConvention = CallingConvention.StdCall)]
    public static extern int CallNextHookEx(int idHook, int nCode,
    IntPtr wParam, IntPtr lParam);

    static int hHook = 0;
    public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
    HookProc MouseHookProcedure;
    public const int WH_MOUSE = 7;

    private void ActivateMouseHook_Click(object sender, System.EventArgs e)
    {
        if (hHook == 0)
        {
            MouseHookProcedure = new HookProc(Form1.MouseHookProc);
            hHook = SetWindowsHookEx(WH_MOUSE,
                             MouseHookProcedure,
                             (IntPtr)0,
                             AppDomain.GetCurrentThreadId());
        }
    }

    private void DeactivateMouseHook_Click(object sender, System.EventArgs e)
    {
        bool ret = UnhookWindowsHookEx(hHook);
    }

    [StructLayout(LayoutKind.Sequential)]
    public class POINT
    {
        public int x;
        public int y;
    }

    [StructLayout(LayoutKind.Sequential)]
    public class MouseHookStruct
    {
        public POINT pt;
        public int hwnd;
        public int wHitTestCode;
        public int dwExtraInfo;
    }

    enum MouseMessages
    {
        WM_LBUTTONDOWN = 0x0201,
        WM_LBUTTONUP = 0x0202,
    }

    public static int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)
    {
        MouseHookStruct MyMouseHookStruct = (MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseHookStruct));

        if (nCode >= 0 && MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam)
        {
            MessageBox.Show("Cool");
        }
        return CallNextHookEx(hHook, nCode, wParam, lParam);
    }
}

I'm trying to indicate the left mouse click by using the message "Cool". But seems like no message comes out. What's wrong with my coding?


text:
Q: Concatenate fields in SOQL queries in the WHERE clause (no Apex) I am trying to run SOQL statement in salesforce.schema tool of FORCE.COM the following query:
Select c.LastName, c.FirstName From Contact c
WHERE (FirstName+' '+LastName) In ('Good Name','Bad Name')

It produces an error.
Can I do this kind of things with SOQL ? If yes, then how I can concatenate fields in the query ?

A: So the answer is no rightaway .There is no concatenation function in SOQL.
The best is to create a formula field and use the same in your query or why dont you use Name field of contact directly .
Name field is anyways concatenation of FirstName and LastName .

A: SOQL does not support concatenation operation like SQL.
But here is work around for you.
Select c.LastName, c.FirstName From Contact c WHERE name In ('Good Name','Bad Name')

If above soql is for sample and you want to use this on some other fields then you can create formula field that will concatenate two fields and use that in your SOQL.


text:
Q: Android: Hiding view elements when Keypad comes up Although I am pretty sure this is doable, I just wanted to double check with you all.
I need to hide certain UI elements(like checkbox, lables etc) on the screen when User taps on the edittext field, just before Keypad comes up and take up half the screen. Same should be visible once Keypad is removed from the screen. I am thinking of using View.GONEon those UI elements, but I am not sure how to get them back once the Keypad is removed from the screen.
I want you help in knowing if this is possible, if so how can revert it when Keypad is no more on the screen.
Thanks,
SKU


text:
Q: JavaScript - How to extract data from HTML? Something like Jsoup in Java, but for JavaScript. I want to extract data from an unknown website and highlight important features to the user. To start with, I need to extract first. I need to work strictly on JavaScript. jQuery has some potential but requires a lot of hard work. Any good, stable JS library will be appreciated. I want to create a DOM tree structure from that unknown page so that I can get other elements by searching for id tags.

A: Did you try cheerio? It provides a similar API to jQuery but is designed to run in Node.js.


text:
Q: Fast Incremental Hash in Java I'm looking for a hash function to hash Strings. For my purposes (identifying changed objects during an import) it should have the following properties:

*

*fast

*can be used incremental, i.e. I can use it like this:
Hasher h = new Hasher();
h.add("somestring");
h.add("another part");
h.add("eveno more");
Long hash = h.create();

without compromising the other properties or keeping the strings in memory during the complete process.

*Secure against collisions. If I compare two hash values from different strings 1 million times per day for the rest of my life, the risk that I get a collision should be neglectable.
It does not have to be secure against malicious attempts to create collisions.
What algorithm can I use? An algorithm with an existent free implementation in Java is preferred.
Clarification

*

*The hash doesn't have to be a long. A String for example would be just fine.

*The data to be hashed will come from a file or a db, with many 10MB or up to a few GB of data, that will get distributed into different Hashes. So keeping the complete Strings in memory is not really an option.

A: Hashs are a sensible topic and it is hard to recommend any such hash based upon your question. You might want to ask this question on https://security.stackexchange.com/ to get expert opinions on the usability of hashs in certain usecases.
What I understood so far is that most hashs are implemented incrementally in the very core; the execution-timing on the other hand is not that easy to predict.
I present you two Hasher implementations which rely on "an existent free implementation in Java". Both implementations are constructed in a way that you can arbitrarily split your Strings before calling add() and get the same result as long as you do not change the order of the characters in them:
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;

/**
 * Created for https://stackoverflow.com/q/26928529/1266906.
 */
public class Hashs {

    public static class JavaHasher {
        private int hashCode;

        public JavaHasher() {
            hashCode = 0;
        }

        public void add(String value) {
            hashCode = 31 * hashCode + value.hashCode();
        }

        public int create() {
            return hashCode;
        }
    }

    public static class ShaHasher {
        public static final Charset UTF_8 = Charset.forName("UTF-8");
        private final MessageDigest messageDigest;

        public ShaHasher() throws NoSuchAlgorithmException {
            messageDigest = MessageDigest.getInstance("SHA-256");
        }

        public void add(String value) {
            messageDigest.update(value.getBytes(UTF_8));
        }

        public byte[] create() {
            return messageDigest.digest();
        }
    }

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

        try {
            shaHash();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();  // TODO: implement catch
        }
    }

    private static void javaHash() {
        JavaHasher h = new JavaHasher();
        h.add("somestring");
        h.add("another part");
        h.add("eveno more");
        int hash = h.create();
        System.out.println(hash);
    }

    private static void shaHash() throws NoSuchAlgorithmException {
        ShaHasher h = new ShaHasher();
        h.add("somestring");
        h.add("another part");
        h.add("eveno more");
        byte[] hash = h.create();
        System.out.println(Arrays.toString(hash));
        System.out.println(new BigInteger(1, hash));
    }
}

Here obviously "SHA-256" could be replaced with other common hash-algorithms; Java ships quite a few of them.
Now you called out for a Long as return-value which would imply you are looking for a 64bit-Hash. If this really was on purpose have a look at the answers to What is a good 64bit hash function in Java for textual strings?. The accepted answer is a slight variant of the JavaHasher as String.hashCode() does basically the same calculation, but with lower overflow-boundary:
    public static class Java64Hasher {
        private long hashCode;

        public Java64Hasher() {
            hashCode = 1125899906842597L;
        }

        public void add(CharSequence value) {
            final int len = value.length();

            for(int i = 0; i < len; i++) {
                hashCode = 31*hashCode + value.charAt(i);
            }
        }

        public long create() {
            return hashCode;
        }
    }

Unto your points:

*

*fast
With SHA-256 being slower than the other two I still would call all three presented approaches fast.

*can be used incremental without compromising the other properties or keeping the strings in memory during the complete process.
I can not guarantee that property for the ShaHasher as I understand it is block-based and I lack the source code.Still I would suggest that at most one block, the hash and some internal states are kept. The other two obviously only store the partial hash between calls to add()

*Secure against collisions. If I compare two hash values from different strings 1 million times per day for the rest of my life, the risk that I get a collision should be neglectable.
For every hash there are collisions. Given a good distribution the bit-size of the hash is the main factor on how often a collision happens. The JavaHasher is used in e.g. HashMaps and seems to be "collision-free" enough to distribute similar keys far apart each other. As for any deeper analysis: do your own tests or ask your local security engineer - sorry.
I hope this gives a good starting point, details are probably mainly opinion-based.

A: Not intended as an answer, just to demonstrate that hash collisions are much more likely than human intuition tends to assume.
The following tiny program generates 2^31 distinct strings and checks if any of their hashes collide. It does this by keeping a tracking bit per possible hash value (so you need >512MB heap to run it), to mark each hash value as "used" as they are encountered. It takes several minutes to complete.
public class TestStringHashCollisions {

    public static void main(String[] argv) {
        long collisions = 0;
        long testcount = 0;
        StringBuilder b = new StringBuilder(64);
        for (int i=0; i>=0; ++i) {
            // construct distinct string
            b.setLength(0);
            b.append("www.");
            b.append(Integer.toBinaryString(i));
            b.append(".com");

            // check for hash collision
            String s = b.toString();
            ++testcount;
            if (isColliding(s.hashCode()))
                ++collisions;

            // progress printing
            if ((i & 0xFFFFFF) == 0) {
                System.out.println("Tested: " + testcount + ", Collisions: " + collisions);
            }
        }
        System.out.println("Tested: " + testcount + ", Collisions: " + collisions);
        System.out.println("Collision ratio: " + (collisions / (double) testcount));
    }

    // storage for 2^32 bits in 2^27 ints
    static int[] bitSet = new int[1 << 27];

    // test if hash code has appeared before, mark hash as "used"
    static boolean isColliding(int hash) {
        int index = hash >>> 5;
        int bitMask = 1 << (hash & 31);
        if ((bitSet[index] & bitMask) != 0)
            return true;
        bitSet[index] |= bitMask;
        return false;
    }

}

You can adjust the string generation part easily to test different patterns.


text:
Q: Whats wrong with this function? .each related When I uncomment the alert the data is there... like:
{
      'Huishoudelijke hulp': 'Huishoudelijke hulp',
      'Verpleging thuis': 'Verpleging thuis',
      'Verzorging thuis': 'Verzorging thuis',
      '24 uurs zorg': '24 uurs zorg',
      'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
    }

But instead of populating the key and the value it takes the whole var and start to create a key and value pair for each character.
You can see this in action here:
http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php
create a task in the calendar and then try to edit the task by clicking on it.
It should populate the dropdown field properly.
When i create a static var with the same values the dropdown works.
static variable
var zvmlist = {
      'Huishoudelijke hulp': 'Huishoudelijke hulp',
      'Verpleging thuis': 'Verpleging thuis',
      'Verzorging thuis': 'Verzorging thuis',
      '24 uurs zorg': '24 uurs zorg',
      'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
    };

This is my function, anybody has a clue?
$.get('get_zorgvormen.php', function(zvmlist) {
        //alert("Data Loaded: " + zvmlist);

            $.each(zvmlist, function(key, value) {
              var selected='';
              if(key==eventdata.title){var selected='selected' }
              $('<option value="'+key+'" '+selected+'>'+value+'</option>').appendTo($('#calendar_edit_entry_form_title'));

            });

        });

A: Your server responds with Content-Type: text/html instead of application/json, so jQuery doesn't eval your object. You could specify the content type:
$.get('get_zorgvormen.php', function(zvmlist) {
    $.each(zvmlist, function(key, value) {
        var selected = '';
        if(key==eventdata.title) {
            selected = 'selected';
        }
        $('<option value="'+key+'" '+selected+'>'+value+'</option>')
            .appendTo($('#calendar_edit_entry_form_title'));
   });
}, 'json');

But I would recommend you to fix your server side script to send the correct content-type and jquery will automatically recognize the json format and eval the response of the server.

A: You dont tell Jquery to expect a json format.
From the documentation:
jQuery.get( url, [ data ], [ callback(data, textStatus, XMLHttpRequest) ], [ dataType ] )

urlA string containing the URL to which the request is sent.

dataA map or string that is sent to the server with the request.

callback(data, textStatus, XMLHttpRequest)A callback function that is executed if the request succeeds.

dataTypeThe type of data expected from the server.

source
Try to specify that you expect Json:
$.get('get_zorgvormen.php', function(zvmlist) {
        //alert("Data Loaded: " + zvmlist);

            $.each(zvmlist, function(key, value) {
              var selected='';
              if(key==eventdata.title){var selected='selected' }
              $('<option value="'+key+'" '+selected+'>'+value+'</option>').appendTo($('#calendar_edit_entry_form_title'));

            });

        }, 'json');

A: try this:
$.ajax({
    "url":"get_zorgvormen.php",
    "dataType":"json",
    "type":"get",
    "success":function(zvmlist){
        // should alert [Object object] or something similar
        alert(zvmlist);
    },
    "error":function(msg){
        alert(msg);
    }
});

A: David Murdock provided "the trick".
This is how my function looks now, and its working like a charm.
$.ajax({
        "url":"get_zorgvormen.php",
        "dataType":"json",
        "type":"get",
        "success":function(zvmlist){

            $.each(zvmlist, function(key, value) {
              var selected='';
              if(key==eventdata.title){selected='selected' }
              $('<option value="'+key+'" '+selected+'>'+value+'</option>').appendTo($('#calendar_edit_entry_form_title'));

            });
        },
        "error":function(msg){
            alert(msg);
        }
    });


text:
Q: invalidate session if user opens multiple tabs In my project, I want to invalidate the user session and redirect the user to logout page if the user is trying to open a window's url on another tab in the same browser. How can i achieve this?

A: Try using HTML 5 local storage to count the number of open instances. Or simply use cookies to keep track of open instances.


text:
Q: Producing symbols from HTML characters in FPDF I have a government client that requires the legal 'section symbol' (§) in their documents.  When creating the documents in a web page, this symbol is created with § or §.
I can not figure out how to get either of these to work in a pdf document created with FPDF.  I have tried the iconv and utf8_decode methods, but neither have worked. Any ideas?

A: You're looking for html_entity_decode().

A: There is an easier approach to do this:
You can generate a section symbol using FPDF with using ascii code: chr(167).
It's good practice to make this a constant. At the top of your script, add:
define('SECTION',chr(167));

Now you can use SECTION in your script to print the euro symbol.
For example:
echo SECTION.'1.1';

Will output: §1.1
Note: This will also work for other symbols with chr(ascii), where ascii is the ascii code of the symbol. You can find an overview of ascii codes on this page: http://www.atwebresults.com/ascii-codes.php?type=2


text:
Q: How to make a remove frame script in JavaScript? I am making websites I refer to from my site load up in a frame (similar to google images). But I also want to give users the ability to break out of that frame. Like with google image's "Remove Frame" link at the bottom right corner of their frame. How can I do this possiblyusing Javascript?

A: Like this:
top.location = "URL of framed page";

Alternatively, you can make a regular <a> tag with target="_top".


text:
Q: Two packages conflict in AppDelegate.m file I use https://github.com/devfd/react-native-google-signin and https://github.com/luisfcofv/react-native-deep-linking packages in my project. I did not solve the following part of the AppDelegate.m file so that the packages can work.
For this react-native-google-signin
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RNGoogleSignin application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation];
}

For this react-native-deep-linking
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation];
}

I'm not good at Objective-C. How do I return RNGoogleSignin and RCTLinkingManager with a single function?

A: Since both methods return a BOOL, you could try something like this:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
   BOOL success = [RNGoogleSignin application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation])
   if (!success)
       success = [RCTLinkingManager application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation];

   return success;
}

updated based on comments from @rmaddy.


text:
Q: The meaning of $G^H$ in group theory and/or field theory Quick question:
I've seen this notation in group theory and in Galois theory: $G^H$.
I don't know what it means, but I've seen it in a similar way and it's confusing. An example will be in this page from the Inverse Galois problem where it says A simple example: cyclic groups, the second paragraph.
Specifically, it says something like this:

The fundamental theorem of Galois theory implies that the corresponding fixed field, $F = \mathbb{Q}(μ)^H$, has Galois group $\mathbb{Z}/n \mathbb{Z}$ over $\mathbb {Q}$. By taking appropriate sums of conjugates of $\mu$, following the construction of Gaussian periods, one can find an element $\alpha$ of $F$ that generates $F$ over $\mathbb{Q}$ and compute its minimal polynomial.

What does it mean for the $\mathbb{Q}(μ)^H$ part? Or more generally $G^H$ (whatever that is)?


text:
Q: How to define multiple optional variables in the URL? In django doc proposed instead GET method use urlpatterns, and made convenient way to handle these variables. But if at least one of the variables is not necessary I'll have to write more lines in url.py. I like that I can avoid this?
Example:
If I want to take a sample of posts in a given year, in urlpatterns I should add something like this:
url(r'^articles/(?P<year>\d{4})/$', 'news.views.show_archive'),

url: .../articles/1994/

If I want to make the sample positions for a particular month a specific year, in urlpatterns I should add something like this:
url(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.show_archive'),

url: .../articles/2003/03/

But if I want to see the records of all the years created particular month of year I have to add also this line:
url(r'^articles/(?P<month>\d{2})/$', 'news.views.show_archive'),

url: .../articles/03/

But I would like to do only one line that specifies the maximum set of variables, but that would process any of these URL.
To be honest I'm not sure that this is possible.

A: regexps can have optional parts, and view functions can have optional arguments. Also, you can still use querystrings (through request.GET) for what has no business being part of the URL (like query terms for a "search" view, ordering and filtering for a listing view, etc).
The point of using urlpatterns instead of querystrings is to build clean "semantic" urls, ie /blog/posts/<post_id>/ instead of /blog/posts/?post_id=<post_id>.

A: you could try like this
url(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.show_archive'),

def show_archive(request,year=None,month=None):
    if year and month:
       .....................
    elif year:
       .....................
    elif month:
        ....................


text:
Q: div container with background-image position fixed I want to create a page like this: Page
I dont want to place the image as background. I want to create a div container and this div container have a background-image. And under this div should be a a other div. And if i scroll the div under the div with the background-image should go over the div with the background-image. I have something but it's crap.
Here my Page: 1
Here is the Code:
*{
    font-family: "Open Sans";
    margin: 0px;
    padding: 0px;
    font-size: 18px;
}
html {
    height: 100%;
}
body{
    height: 100%;
    background-image: url('http://cdn1.editmysite.com/uploads/3/8/9/4/38945355/background-images/748028443.png') !important;
    background-repeat: no-repeat !important;
    background-position: 50% 0 !important;
    background-size: auto !important;
    background-color: transparent !important;
    background: inherit;
}

nav{
   background: url("images/line-header.png") repeat-x scroll center bottom #4A525A;
   padding: 15px;
   position: fixed;
   top: 0px;
   width: 100%;
}

nav > ul{
    margin: 0px;
    padding: 0px;
    text-align: center;
}

nav ul > li{
    margin-left: 25px;
    display: inline-block;
    list-style-type: none;
}

nav ul li > a{
    display: block;
    text-decoration: none;
    color: black;
    color: #697683;
    transition: color 0.5s;
}

nav ul li > a:hover{
    color: #FFF;
}

.content{
    height: 1000px;
    margin-top: 500px;
    background-color: orange;
}

<!DOCTYPE html>

        <title></title>
        <link rel="stylesheet" href="index.css" >

        <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

Link 1

Link 1

Link 1

A: Just add another div and set the background-attachment as fixed
.background{
  background: url('http://cdn1.editmysite.com/uploads/3/8/9/4/38945355/background-images/748028443.png') no-repeat;
  background-attachment: fixed;
  background-size: cover;
  height: 500px; <------can make 500px instead of using margin-top: 500px on .content
}

.content{
  height: 1000px;
  background-color: orange;
  /*margin-top: 500px;*/ <-------------take out
}

FIDDLE

A: You might try this, add a image height of 700px and background-attachment: fixed;
*{
    font-family: "Open Sans";
    margin: 0px;
    padding: 0px;
    font-size: 18px;
}
html {
    height: 100%;
}
body{
    height: 700px;
    background-image:url('http://cdn1.editmysite.com/uploads/3/8/9/4/38945355/background-        images/748028443.png') !important;
    background-repeat: no-repeat !important;
    background-position: 50% 0 !important;
    background-size: auto !important;
    background-color: transparent !important;
    background-attachment: fixed;
}

nav{
   background: url("images/line-header.png") repeat-x scroll center bottom #4A525A;
   padding: 15px;
   position: fixed;
   top: 0px;
   width: 100%;
}

nav > ul{
    margin: 0px;
    padding: 0px;
    text-align: center;
}

nav ul > li{
    margin-left: 25px;
    display: inline-block;
    list-style-type: none;
}

nav ul li > a{
    display: block;
    text-decoration: none;
    color: black;
    color: #697683;
    transition: color 0.5s;
}

nav ul li > a:hover{
    color: #FFF;
}

.content{
    height: 1000px;
    margin-top: 500px;
    background-color: orange;
}

<!DOCTYPE html>

        <title></title>
        <link rel="stylesheet" href="index.css" >

        <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

Link 1

Link 1

Link 1


text:
Q: Push Notification behaving unexpected In my application I am registering device for APNS with this code
[[UIApplication sharedApplication]registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge )];

It will prompt an alert with two option Don't Allow and Ok.
I just want to know when didRegisterForRemoteNotificationsWithDeviceToken method will be called in application.
My problem is that didRegisterForRemoteNotificationsWithDeviceToken this method get called before user select any option Don't Allow and Ok for push notification.
Thanks.