text:
Q: Migration from Spring Batch 3 to 4 I'm trying to migrate from Spring Batch 3.0.6 to 4.1.1.
I'm stuck handling Spring Batch's execution context data as explained here.
What I would like is update tables batch_step_execution_context and batch_step_execution_context as follows, for each record :

*

*unserialize context data using the deprecated XStreamExecutionContextStringSerializer

*serialize the java object obtained using a jackson ObjectMapper

*update the table using this new string

It has worked for some records and I could run Spring Batch 4. But for some jobs, the new string is not deserializable as a ExecutionContext.
Here is an example of such a string :
{
   "setMoisAffaires":[
      {
         "premierJourDuMois":{
            "date":1257030000000,
            "stringFromDatePatternAmericain":"2009-11-01",
            "hour":0,
            "year":2009,
            "dayOfMonth":1,
            "dayOfWeek":7,
            "dateString":"20091101",
            "monthOfYear":11,
            "minuteOfHour":0,
            "secondOfMinute":0
         },
         "date":1257030000000,
         "stringFromDatePatternAmericain":"2009-11-01",
         "hour":0,
         "year":2009,
         "dayOfMonth":1,
         "dayOfWeek":7,
         "dateString":"200911",
         "monthOfYear":11,
         "minuteOfHour":0,
         "secondOfMinute":0
      },
      //a lot of records like the previous...
   ],
   "batch.taskletType":"com.sun.proxy.$Proxy57",
   "batch.stepType":"org.springframework.batch.core.step.tasklet.TaskletStep"
}

Here is the trace when I try to do : ExecutionContext a = objectMapper.readValue(objectMapper.writeValueAsString(javaObject),ExecutionContext.class);
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "setMoisAffaires" (class org.springframework.batch.item.ExecutionContext), not marked as ignorable (one known property: "dirty"])
 at [Source: (String)"{"setMoisAffaires":[{"prem...[truncated 15163 chars]; line: 1, column: 21] (through reference chain: org.springframework.batch.item.ExecutionContext["setMoisAffaires"])
 at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
 at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823)
 at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153)
 at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1589)
 at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1567)
 at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
 at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
 at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
 at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3004)

Here is a unit test to reproduce the problem :
package springBatch4Migration;

import static org.junit.Assert.assertNotNull;

import java.io.ByteArrayInputStream;

import org.junit.Test;
import org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer;
import org.springframework.batch.item.ExecutionContext;

import com.fasterxml.jackson.databind.ObjectMapper;

public class SerializeTest {

    @Test
    public void test() throws Exception {
        String oldJson = "{\"map\":[{\"entry\":[{\"string\":[\"batch.stepType\",\"org.springframework.batch.core.step.tasklet.TaskletStep\"]},{\"string\":[\"batch.taskletType\",\"com.sun.proxy.$Proxy56\"]},{\"string\":\"setMoisAffaires\",\"set\":[{\"tools.date.dates.Mois\":[{\"dateLocale\":{\"iLocalMillis\":1264982400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@resolves-to\":\"org.joda.time.chrono.ISOChronology$Stub\",\"@serialization\":\"custom\",\"org.joda.time.chrono.ISOChronology$Stub\":{\"org.joda.time.UTCDateTimeZone\":{\"@resolves-to\":\"org.joda.time.DateTimeZone$Stub\",\"@serialization\":\"custom\",\"org.joda.time.DateTimeZone$Stub\":{\"string\":\"UTC\"}}}}},\"categorie\":\"MOIS\",\"dateAsString\":201002},{\"dateLocale\":{\"iLocalMillis\":1312156800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201108},{\"dateLocale\":{\"iLocalMillis\":1288569600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201011},{\"dateLocale\":{\"iLocalMillis\":1285891200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201010},{\"dateLocale\":{\"iLocalMillis\":1243814400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200906},{\"dateLocale\":{\"iLocalMillis\":1257033600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200911},{\"dateLocale\":{\"iLocalMillis\":1277942400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201007},{\"dateLocale\":{\"iLocalMillis\":1249084800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200908},{\"dateLocale\":{\"iLocalMillis\":1320105600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201111},{\"dateLocale\":{\"iLocalMillis\":1283299200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201009},{\"dateLocale\":{\"iLocalMillis\":1328054400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201202},{\"dateLocale\":{\"iLocalMillis\":1325376000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201201},{\"dateLocale\":{\"iLocalMillis\":1296518400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201102},{\"dateLocale\":{\"iLocalMillis\":1306886400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201106},{\"dateLocale\":{\"iLocalMillis\":1267401600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201003},{\"dateLocale\":{\"iLocalMillis\":1251763200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200909},{\"dateLocale\":{\"iLocalMillis\":1262304000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201001},{\"dateLocale\":{\"iLocalMillis\":1280620800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201008},{\"dateLocale\":{\"iLocalMillis\":1270080000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201004},{\"dateLocale\":{\"iLocalMillis\":1317427200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201110},{\"dateLocale\":{\"iLocalMillis\":1272672000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201005},{\"dateLocale\":{\"iLocalMillis\":1304208000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201105},{\"dateLocale\":{\"iLocalMillis\":1233446400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200902},{\"dateLocale\":{\"iLocalMillis\":1254355200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200910},{\"dateLocale\":{\"iLocalMillis\":1246406400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200907},{\"dateLocale\":{\"iLocalMillis\":1309478400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201107},{\"dateLocale\":{\"iLocalMillis\":1259625600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200912},{\"dateLocale\":{\"iLocalMillis\":1238544000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200904},{\"dateLocale\":{\"iLocalMillis\":1314835200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201109},{\"dateLocale\":{\"iLocalMillis\":1330560000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201203},{\"dateLocale\":{\"iLocalMillis\":1241136000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200905},{\"dateLocale\":{\"iLocalMillis\":1322697600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201112},{\"dateLocale\":{\"iLocalMillis\":1301616000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201104},{\"dateLocale\":{\"iLocalMillis\":1275350400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201006},{\"dateLocale\":{\"iLocalMillis\":1293840000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201101},{\"dateLocale\":{\"iLocalMillis\":1235865600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200903},{\"dateLocale\":{\"iLocalMillis\":1291161600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201012},{\"dateLocale\":{\"iLocalMillis\":1298937600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201103}]}]}]}]}";

        /*
         * Unserializing oldJson to a Java object...
         */
        XStreamExecutionContextStringSerializer oldSerializer = new XStreamExecutionContextStringSerializer();
        oldSerializer.init();

        ByteArrayInputStream oldInputStream = new ByteArrayInputStream(oldJson.getBytes());
        Object javaObject = oldSerializer.deserialize(oldInputStream);

        /*
         * Serializing back to a new Json string using Jackson...
         */
        ObjectMapper newSerializer = new ObjectMapper();
        ExecutionContext a = newSerializer.readValue(newSerializer.writeValueAsString(javaObject),ExecutionContext.class);

        assertNotNull(a);
    }

}

And here is what I get if I try to run a job using such data :
ERROR - CommandLineJobRunner:367  - Job Terminated in error: Unable to deserialize the execution context
java.lang.IllegalArgumentException: Unable to deserialize the execution context
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:328)
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:312)
    at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:94)
    at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:61)
    at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:679)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:700)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:712)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:768)
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.getExecutionContext(JdbcExecutionContextDao.java:129)
    at org.springframework.batch.core.explore.support.SimpleJobExplorer.getStepExecutionDependencies(SimpleJobExplorer.java:210)
    at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecutions(SimpleJobExplorer.java:87)
    at org.springframework.batch.core.JobParametersBuilder.getNextJobParameters(JobParametersBuilder.java:266)
    at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:357)
    at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:564)
    at fr.mycompany.myapp.commun.batch.CommandLineJobRunnerTest.runJob(CommandLineJobRunnerTest.java:180)
    at fr.mycompany.myapp.commun.batch.CommandLineJobRunnerTest.execute(CommandLineJobRunnerTest.java:496)
    at fr.mycompany.myapp.commun.batch.CommandLineJobRunnerTest.main(CommandLineJobRunnerTest.java:529)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected VALUE_STRING: need JSON String that contains type id (for subtype of java.lang.Object)
 at [Source: (ByteArrayInputStream); line: 1, column: 21] (through reference chain: java.util.HashMap["setMoisAffaires"])
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
    at com.fasterxml.jackson.databind.DeserializationContext.wrongTokenException(DeserializationContext.java:1499)
    at com.fasterxml.jackson.databind.DeserializationContext.reportWrongTokenException(DeserializationContext.java:1274)
    at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._locateTypeId(AsArrayTypeDeserializer.java:151)
    at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._deserialize(AsArrayTypeDeserializer.java:96)
    at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer.deserializeTypedFromAny(AsArrayTypeDeserializer.java:71)
    at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserializeWithType(UntypedObjectDeserializer.java:712)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:529)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
    at org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer.deserialize(Jackson2ExecutionContextStringSerializer.java:70)
    at org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer.deserialize(Jackson2ExecutionContextStringSerializer.java:50)
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:325)
    ... 18 more

Here is an example of a step using such setMoisAffaires :
<bean id="jobname.jobstep" parent="jobItemParent"
    class="fr.mycompany.myapp.collecte.batch.jobname.jobstep" scope="step">
    <property name="setMoisAffaires" value="#{stepExecutionContext['setMoisAffaires']}" />
</bean>

A: What has been serialized with XStream is not necessarily deserializable with Jackson. So I'm not sure how you can solve this issue. See breaking change note here.
EDIT: After adding a minimal complete verifiable example
The XStreamExecutionContextStringSerializer#deserialize returns a Map<String, Object> of the key/value pairs of the old execution context. I would this map directly as input to the Jackson serializer instead of marshalling it to a String and then creating it back from a String. Here is how I updated the test:
import static org.junit.Assert.assertNotNull;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Map;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;

import org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer;
import org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer;

public class SerializeTest {

    @Test
    public void test() throws Exception {
        String oldJson = "{\"map\":[{\"entry\":[{\"string\":[\"batch.stepType\",\"org.springframework.batch.core.step.tasklet.TaskletStep\"]},{\"string\":[\"batch.taskletType\",\"com.sun.proxy.$Proxy56\"]},{\"string\":\"setMoisAffaires\",\"set\":[{\"tools.date.dates.Mois\":[{\"dateLocale\":{\"iLocalMillis\":1264982400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@resolves-to\":\"org.joda.time.chrono.ISOChronology$Stub\",\"@serialization\":\"custom\",\"org.joda.time.chrono.ISOChronology$Stub\":{\"org.joda.time.UTCDateTimeZone\":{\"@resolves-to\":\"org.joda.time.DateTimeZone$Stub\",\"@serialization\":\"custom\",\"org.joda.time.DateTimeZone$Stub\":{\"string\":\"UTC\"}}}}},\"categorie\":\"MOIS\",\"dateAsString\":201002},{\"dateLocale\":{\"iLocalMillis\":1312156800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201108},{\"dateLocale\":{\"iLocalMillis\":1288569600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201011},{\"dateLocale\":{\"iLocalMillis\":1285891200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201010},{\"dateLocale\":{\"iLocalMillis\":1243814400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200906},{\"dateLocale\":{\"iLocalMillis\":1257033600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200911},{\"dateLocale\":{\"iLocalMillis\":1277942400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201007},{\"dateLocale\":{\"iLocalMillis\":1249084800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200908},{\"dateLocale\":{\"iLocalMillis\":1320105600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201111},{\"dateLocale\":{\"iLocalMillis\":1283299200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201009},{\"dateLocale\":{\"iLocalMillis\":1328054400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201202},{\"dateLocale\":{\"iLocalMillis\":1325376000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201201},{\"dateLocale\":{\"iLocalMillis\":1296518400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201102},{\"dateLocale\":{\"iLocalMillis\":1306886400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201106},{\"dateLocale\":{\"iLocalMillis\":1267401600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201003},{\"dateLocale\":{\"iLocalMillis\":1251763200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200909},{\"dateLocale\":{\"iLocalMillis\":1262304000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201001},{\"dateLocale\":{\"iLocalMillis\":1280620800000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201008},{\"dateLocale\":{\"iLocalMillis\":1270080000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201004},{\"dateLocale\":{\"iLocalMillis\":1317427200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201110},{\"dateLocale\":{\"iLocalMillis\":1272672000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201005},{\"dateLocale\":{\"iLocalMillis\":1304208000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201105},{\"dateLocale\":{\"iLocalMillis\":1233446400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200902},{\"dateLocale\":{\"iLocalMillis\":1254355200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200910},{\"dateLocale\":{\"iLocalMillis\":1246406400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200907},{\"dateLocale\":{\"iLocalMillis\":1309478400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201107},{\"dateLocale\":{\"iLocalMillis\":1259625600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200912},{\"dateLocale\":{\"iLocalMillis\":1238544000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200904},{\"dateLocale\":{\"iLocalMillis\":1314835200000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201109},{\"dateLocale\":{\"iLocalMillis\":1330560000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201203},{\"dateLocale\":{\"iLocalMillis\":1241136000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200905},{\"dateLocale\":{\"iLocalMillis\":1322697600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201112},{\"dateLocale\":{\"iLocalMillis\":1301616000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201104},{\"dateLocale\":{\"iLocalMillis\":1275350400000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201006},{\"dateLocale\":{\"iLocalMillis\":1293840000000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201101},{\"dateLocale\":{\"iLocalMillis\":1235865600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":200903},{\"dateLocale\":{\"iLocalMillis\":1291161600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201012},{\"dateLocale\":{\"iLocalMillis\":1298937600000,\"iChronology\":{\"@class\":\"org.joda.time.chrono.ISOChronology\",\"@reference\":\"..\\/..\\/..\\/tools.date.dates.Mois\\/dateLocale\\/iChronology\"}},\"categorie\":\"MOIS\",\"dateAsString\":201103}]}]}]}]}";

        /*
         * Unserializing oldJson to a Java object...
         */
        XStreamExecutionContextStringSerializer oldSerializer = new XStreamExecutionContextStringSerializer();
        oldSerializer.init();

        ByteArrayInputStream oldInputStream = new ByteArrayInputStream(oldJson.getBytes());
        Map<String, Object> javaObject = oldSerializer.deserialize(oldInputStream);

        /*
         * Serializing back to a new Json string using Jackson...
         */
        ObjectMapper newSerializer = new ObjectMapper();
        String newJson = newSerializer.writeValueAsString(javaObject);
        assertNotNull(newJson);
        System.out.println("newJson = " + newJson);

        /*
         * Or more correctly
         */
        Jackson2ExecutionContextStringSerializer stringSerializer = new Jackson2ExecutionContextStringSerializer();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        stringSerializer.serialize(javaObject, out);

        newJson = new String(out.toByteArray());
        assertNotNull(newJson);
        System.out.println("newJson = " + newJson);
    }

}

Hope this helps.


text:
Q: "Calling Thread must be STA" error although the thread is STA I'm having a little trouble with my STA thread in WPF.
I do the following:
Dispatcher.BeginInvoke(new Action(CreateAndShow), null);

with CreateAndShow looking like this:
_mainWindow = new PresentWindow();
// not really important what happens in the next lines, the error is before this
AddPerspectives();
MainWindow = _mainWindow;
MainWindow.Show();

Now, I get an Exception, in the line where the PresentWindow constructor starts, stating that the calling thread needs to be an STA thread.
I put in a break point just before creating the PresentWindow. The AppartmentState of the current thread is STA. If I call CreateAndShow from a different point (without the invoke, but directly in the exact same STA thread), it works perfectly fine.
I'm sure there's a very simple explanation to all this, but I can't find it. Can someone help?
Thanks!

redpajama_set_name: RedPajamaStackExchange


text:
Q: faster way to replacing specific values per column, python I have a large-ish structure in as a pandas dataframe, shape =  (2000, 200000) I want to replace all of the values of 2 in each column with that particular columns mean (excluding the 2 values). This is how I do it for small structures, but for larger ones it takes a significantly longer time. Y is the DataFrame.
for i in Y.columns:
    x = Y[i][Y[i] != 2].mean()
    Y[i][Y[i] == 2] = x

Is there a faster solution?

A: Since you are working with arithmetic operations, I would suggest offloading all those computations to NumPy, get the final result and create a dataframe, like so -
# Extract into an array
arr = Y.values

# Mask to set or not-set elements in array
mask = arr!=2

# Compute the mean vaalues for masked elements along each column
avg = np.true_divide((arr*mask).sum(0),mask.sum(0))

# Finally choose values based on mask and create output dataframe
Yout = pd.DataFrame(np.where(~mask,avg,arr),columns=Y.columns)

For further performance boost, you can probably replace (arr*mask).sum(0)
 with np.einsum('ij,ij->j',arr,mask) as np.einsum is very efficient in most cases.
Verify results with a sample run -
In [128]: Y = pd.DataFrame(np.random.randint(0,4,(10,5)))

In [129]: arr = Y.values
     ...: mask = arr!=2
     ...: avg = np.true_divide((arr*mask).sum(0),mask.sum(0))
     ...: Yout = pd.DataFrame(np.where(~mask,avg,arr),columns=Y.columns)
     ...:

In [130]: for i in Y.columns:
     ...:     x = Y[i][Y[i] != 2].mean()
     ...:     Y[i][Y[i] == 2] = x
     ...:

In [131]: np.allclose(Y,Yout)
Out[131]: True

A: Assuming your dataframe is df, Let:
a = df.values

I'd calculate what the average is across non-twos with
avg = (a.sum(0) - (a == 2).sum(0) * 2.) / (a != 2).sum(0)

(a == 2).sum(0) is the number of 2s in each column.
Then use np.where to select between a and avg.  Wrap it in a pd.DataFrame constructor.
pd.DataFrame(np.where(a != 2, a, avg), df.index, df.columns)


text:
Q: How do I approach this ideal op-amp problem? This op-amp problem has been giving me issues. I see two inverting op-amp circuits which I'm sure I should be able to use to simplify this problem, but that 10k resistor at the top is making the analysis difficult. Since that resistor is there, doesn't it change the output of the first op-amp?
How do I approach this?

A:
simulate this circuit – Schematic created using CircuitLab
Because the Op-amps are ideal.
KCL at node 1 :
(0-V1)/10 + (0-Vout1)/5 + (0-V2)/10 = 0
<=>  -V1 -2Vout1 -V2 = 0                (1)
KCL at node 2 :
(0-Vout1)/5 + (0-V2)/12 =0
<=> Vout1 = -5/12 V2                    (2)
Sub (2) into (1) we have :
-V1 + (5/6)V2   - V2 = 0
=> V1 = -1/6 V2
<=> V2 = -6 V1

A: This circuit is a little bit tricky because it has positive feedback, that dominates the overall behavior. Basically it is a Schmitt-Trigger and therefore has hysteresis.
The two inner amplifiers have a gain of -0.5 and -2.4 resulting in an overall gain of 1.2.
Assuming that output is at the positive supply rail, this voltage is fed back to the input and is amplified by 1.2. Since the output of the opamp can't exceed the supply voltage, the output will remain constant.
Assuming a zero input voltage for this condition the output of the first opamp will be at -1/2 of the supply voltage. If now the input voltage is decreased the voltage at the output of the first opamp will increase until the the threshold is reached where the input voltage is too high so that the second opamp no longer provides the supply voltage at its output and the circuit toggles.
Update:
Another poster provided an answer with a detailed derivation showing that the circuit should have a gain of -6 and a few others seem to agree.
For this reason I'd like to point out where the problem with that other derivation is. The picture below shows a simulation of the circuit. The green trace is the input and the blue line shows the output of the circuit. So clearly, the gain is not -6 and the behavior described above can be seen.

Going back to the other poster's answer. At first glance, the derivation looks fine. However, the derivation was made under the assumption that the circuit is stable and that for this reason the differential voltage at the inputs of the opamps can be assumed to be zero. Neither is true. The linearized system is not stable, the circuit depends on the nonlinear behavior of the opamp to regain "stability".
The cyan trace of the simulation shows the input voltage of the second opamp. It can be seen that due to the nonlinear behavior the voltage difference at the input is no longer zero which violates an assumption made in that derivation.


text:
Q: F5 and Play button are not working, but F10/F11 do For a few days now the IDE has stopped responding to F5, and clicking the play button with my mouse also does nothing.  However, if I press F10 or F11 it will step into the code after which I can press F5 and then it runs just fine.
Also, I can right click on the project in the solution explorer and start a new instance of it there without any trouble.

*

*I have a default project selected

*I have double checked the keyboard shortcuts

*I am on a laptop, but there is no F-Lock key (again, F10/F11 work fine to start the app).

Not sure what to check next??

A: I recently had a similar issue with a WPF project after it was branched. You can try going to the solutions properties and double checking that it is set to build under either Startup Project or Project Dependency.


text:
Q: Wrong transformation of magnetic field components (defined from $F^{\mu\nu}$) under parity The electric and magnetic field components $E_i$ and $B_i$, defined from the electromagnetic field tensor $F_{\mu\nu}$ are $$E_i=cF_{0i},~~B_i=-\frac{1}{2}\epsilon_{ijk}F^{jk}.$$  Since $\epsilon_{ijk}$ is an invariant pseudotensor, it transforms as $\epsilon_{ijk}\xrightarrow{{\rm parity}}-\epsilon_{ijk}$. It can also be quickly checked that $F^{jk}\xrightarrow{{\rm parity}} F^{jk}$.
But this leads to a wrong conclusion that $B_i\xrightarrow{{\rm parity}}-B_i$. This means $\vec{B}$ is not an axial vector which is definitely false. What is the mistake?

A: Under parity, position changes as ${\bf r}\to -{\bf r}$, the electric field transforms as  ${\bf E}\to -{\bf E}$ and the magnetic field tranforms as ${\bf B}\to {\bf B}$. Do not confuse parity with reflection in a mirror where $(x,y,z)\to (-x,y,z)$. Under mirror reflection  ${\bf E}$ stays the same while ${\bf B}$ changes sign.

A: The mistake is the transformation behaviour of $\epsilon_{ijk}$ you assume.
Let's look at the transformation of the angular momentum
$$ \vec L = \vec r \times \vec p ,$$
which in components gives
$$ L_i = \epsilon_{ijk} r_j p_k . $$
Under parity we have $\vec L' = \vec L$, while $\vec r' = -\vec r$ and $\vec p' = -\vec p$ (those are proper vectors), this means, that in components we can identify:
$$ L_i' = \epsilon_{ijk}' r_j' p_k' = \epsilon_{ijk}' (-r_j) (-p_k) = L_i .$$
Which tells us, that $\epsilon_{ijk}$ has to stay invariant under these transformation. You already have the relevant point: it is pseudo-tensor (density) of third order, and a pseudo-tensor of arbitrary order transform as $T' =T$ under parity.


text:
Q: How to choose a file and download it in ASP.NET MVC I'm trying to let user choose a xls file and generate a new xls file based on it for the user to download. My question is, should I use two actionresults in my Controller? One gets the file path and the other generates the new file and send it back to my View. Or I can just use one actionresult instead?

A: That is entirely up to you. If you intend to store the original file somewhere, then process it later and return the derivative file, then it would make sense to use two action methods, one to upload and one to process/download. On the other hand, if it's a fairly small and quickly processed file, it might make sense to upload the file, process it, and return the derivative file all in one action method. Either way will work.


text:
Q: PHP Doctrine querying inherited classes with discriminator map In this example:
http://www.doctrine-project.org/docs/orm/2.0/en/reference/dql-doctrine-query-language.html#single-table
we see that
SELECT e FROM Entities\Employee e WHERE e.name = 'test'

makes this query:
 SELECT p0_.id AS id0, p0_.name AS name1, p0_.department AS department2,
        p0_.discr AS discr3 FROM Person p0_ WHERE (p0_.name = ?) AND p0_.discr IN ('employee')

Is there a way to query records only with the discriminator "Person"?
This:
SELECT e FROM Entities\Person e WHERE e.name = 'test'

returns all the records.
Any ideas?

A: By default the parent entity in a Inheritance Mapped Entity does not seem to use the Discriminator rules.
I got round this by creating a base class/entity.
/**
 * @Entity
 * @InheritanceType("SINGLE_TABLE")
 * @DiscriminatorColumn(name="discr", type="string")
 * @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
 */
class PersonBase
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue
     */
    protected $id;

    /**
     * @Column(type="string", length=50)
     */
    protected $name;

    // ...

}

/**
 * @Entity
 */
class Person extends PersonBase
{
}

/**
 * @Entity
 */
class Employee extends PersonBase
{
    /**
     * @Column(type="string", length=50)
     */
    private $department;

    // ...
}

Now Person will use discriminator rules, you need never directly reference PersonBase.


text:
Q: Converting slow "WHILE" loop to "apply"-type function I have created a while loop that is being executed across a sizable data set.  The loop is as such:
i = 1
while(i<=m){
  Date = London.Events$start_time[i]
  j=1
  while(j<=n){
    Hotel = London.Hotels$AS400.ID[j]
    Day.Zero[i,j] = sum(London.Bookings$No.of.Rooms[London.Bookings$Stay.Date == Date & London.Bookings$Legacy.Hotel.Code == Hotel])
  j=j+1
  }
i=i+1
}

Where:
m = 9957 #Number of Events
n = 814 #Number of Hotels

Day.Zero = as.data.frame(matrix(0, 9957, 814))

Briefly explained, for each combination of date and hotel (pulled from two other data frames), produce the sum from the column London.Bookings$No.of.Rooms and deposit that into the corresponding row of the matrix.
The loop appears to run without error, however when stopping it after 5 mins+ it is still running and nowhere near complete!
I would like to know how one of the apply family of functions could be used as a replacement here for much faster completion.
Thanks!

A: Probably,
xtabs(No.of.Rooms ~ Stay.Date + Legacy.Hotel, data = London.Bookings)

gets you something similar to what you want.

A: Using library dplyr, you can do something like the following (assuming your input data frame has such column names - vaguely interpreted from your code / question):
library(dplyr)
London.Bookings %>% group_by(Legacy.Hotel.Code, Stay.Date) %>% summarise(Total.No.of.Rooms = sum(No.of.Rooms))


text: Q: Laravel Backpack Admin Login 419 Page Expired I created a new Laravel project for both APIs and Admin. I first installed Sanctum for the API authentication and then I installed Backpack. After the Backpack installation, I hit the admin URL and attempted to log in but I got the 419 page expired error. It was the same for registration. This is not the first time this is happening. What could be wrong? I am using Laravel 8 and Backpack 4.0.x


text:
Q: How to display a dropdown menu based on cursor position using javascript or react? I am new to programming and want to check if the string contains @ character before or after the cursor position.
If the @ is present only before cursor position in the input field then get the complete string after @.
If the @ is present before and after the cursor position then get the string from @ (that is the one before cursor position) until white space.
String example: "I am @u @user1", here cursor position is at index 8.
What I have tried: I am using event.target.selectionStart to get the cursor position and then the lastindexOf('@') in the string.
if (event.target.selectionStart > event.target.value.lastIndexOf('@')) {
    /*this means there is no @ after cursor position*/
    string =    event.target.value.substr(event.target.value.lastIndexOf('@') +1);
}

But I am not sure how to find out if there is another @ character before cursor position and how to get the string after @ that is before the cursor position.
I am quite confused and don't know how to proceed further. Could someone help me with this? Thanks.

A: Well you're on the right track.
You just have to be more specific in your conditionnals.

const test = document.querySelector('input');

test.addEventListener('keyup', function(event) {

  if (event.target.selectionStart > event.target.value.indexOf('@') && event.target.selectionStart > event.target.value.lastIndexOf('@')) {
    console.log(event.target.value.substring(event.target.value.indexOf('@')));
  }
  if (event.target.selectionStart <= event.target.value.indexOf('@') && event.target.selectionStart <= event.target.value.lastIndexOf('@')) {
    console.log('after cursor');
  }
  if (event.target.selectionStart > event.target.value.indexOf('@') && event.target.selectionStart <= event.target.value.lastIndexOf('@')) {
    console.log(event.target.value.substring(event.target.value.indexOf('@'), event.target.value.lastIndexOf('@')));
  }
})
<input value="I am @u @user1">


text:
Q: How to set Status bar under transparent view when UIAlertController appears in swift 3 I am working on UIAlertController. Here when Alert appears we can see the transparent background. But status bar doesn't come under this transparent. Please look the image, the status bar is still visible.

My Code for UIAlertController is:
func showAlert(title: String, message: String,btnsText: [String], tag:String) {
    let alertController = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
    alertController.accessibilityLabel = tag
    for i in 0 ..< btnsText.count {
        alertController.addAction(UIAlertAction(title: btnsText[i], style: UIAlertActionStyle.default, handler:
                {(alert: UIAlertAction!) in self.delegate?.AlertCompleted!(title: alert.title!,tag: alertController.accessibilityLabel!)}))
    }
    self.present(alertController, animated: true, completion: nil)
}

Please guide me to achieve this.


text:
Q: save PHP form data without submit on page refresh I have two forms in the page one is filter, second is the item list, when I apply the filter to item list form, selected values reset to default. For filter I can save selected values, because I submit this form via POST method, but other remains not submited is possible to save selected that form values after page refresh? Here is some code of second form:
<form name="forma" method="post" onMouseOver="kaina();" onSubmit="return tikrinimas()" action="pagrindinis.php?page=generuoti.php">

    Client:
    MB:
    Price:

    <?php
        $query="SELECT name,surname,pers_code FROM Clients";
        mysql_query("SET NAMES 'UTF8'");
        $result = mysql_query ($query);
        echo "<select name=Clients id='clients'>";
        echo "<OPTION value=''>- Choose -</OPTION>\n";
        while($nt=mysql_fetch_array($result)){
            echo "<option value=$nt[pers_code]>$nt[name] $nt[surname]</option>";
        }
        echo "</select>";
    ?>

</form>

A: Unfortunately there is no easy way to do this, and it's something that PHP and web developers in general have maligned for years, because repopulating form fields is never easy AND clean.
Values in the form you aren't submitting wont be sent (via GET or POST), so you're left with writing a custom workaround.
While it's a bit Q&D, I would recommend sending an Ajax call on form submit to store the values for your second form in the $_SESSION variable.
I'm sorry to say there's no easy alternative - due to the stateless nature of HTTP requests, this is something that every programmer has to struggle with.

A: You need to set the selected attribute of your select element based on what is in $_POST. Something like:
$selected = $_POST['Client'];
while($nt=mysql_fetch_array($result)){
  if ($selected == $nt[pers_code]) {
    echo "<option value=$nt[pers_code] selected="selected">$nt[name] $nt[surname]</option>";
  }
  else {
    echo "<option value=$nt[pers_code]>$nt[name] $nt[surname]</option>";
  }
}

Also note that you should probably sanitize any values you get from $_POST.

A:

    <form name="1stform" method="post" action="/">
        <input type="text" name="misc" id="misc" />
        <input type="submit" name="submit" id="submit" value="submit 1st form"/>
    </form>

iframe page
     <form name="forma" method="post" onmouseover="kaina();" action="/">

              Client:
               MB:
      Price:

   <?php
    $selected = $_GET['Client'];
    $query="SELECT name,surname,pers_code FROM Clients";
    mysql_query("SET NAMES 'UTF8'");
    $result = mysql_query ($query);
    echo "<select name=Clients id='clients'>";
    echo "<OPTION value=''>- Choose -</OPTION>\n";
    while($nt=mysql_fetch_array($result)){
        echo "<option value=$nt[pers_code]>$nt[name] $nt[surname]</option>";
       }
    echo "</select>"; ?>

</form>

This will post all inputs inside your form to the file you specify then you can have it do whatever you like, for example show a thank you message..Hope it helps.

A: just to break the question down to a more simplified form, let's assume we don't have the hassle of working with dropdowns.  The real issue you're having is to take a value from form 1 and have it work even after form 2 has been submitted.
If you use a hidden field on form 2, of the same name as form 1, and populate it based on both form 1 and form 2's POST data, it will be "remembered"
<? // mostly html with a bit of php. ?>
<form id="f1" method="POST">
    <input type ="text" name="f1val" value="<?= htmlspecialchars( array_key_exists( 'f1val', $_POST )?$_POST['f1val']:'' ); ?>">
    <input type="submit">
</form>

<form id="f2" method="POST">
    <input type="hidden" name="f1val" value="<?= htmlspecialchars( array_key_exists( 'f1val', $_POST )?$_POST['f1val']:'' ); ?>">
    <input type ="text" name="f2val" value="<?= htmlspecialchars( array_key_exists( 'f2val', $_POST )?$_POST['f2val']:'' ); ?>">
    <input type="submit">
</form>


text:
Q: Data format for Ajax/jQuery request to backend Can someone please advise in which data format the below Ajax/jQuery request is sent to the backend.
Here is my Ajax/jQuery code:
$( document ).on( "pageinit", "#myPage", function() {
    $( "#autocomplete" ).on( "listviewbeforefilter", function ( e, data ) {
        var $ul = $( this ),
            $input = $( data.input ),
            value = $input.val(),
            html = "";
        $ul.html( "" );
        if ( value && value.length > 2 ) {
            $ul.html( "

" );
            $ul.listview( "refresh" );
            $.ajax({
                url: "/get_names/",
                dataType: "json",
                crossDomain: true,
                data: {
                    q: $input.val()
                }
            })
            .then( function ( response ) {
                $.each( response, function ( i, val ) {
                    html += "
" + val + "
";
                });
                $ul.html( html );
                $ul.listview( "refresh" );
                $ul.trigger( "updatelayout");
            });
        }
    });
});

A: It's JSON format:
{name1 : value1, name2 : value2}

At the backend you should be able to get this values just as simple as that:
$_GET['value1']


text:
Q: "asn1: structure error: integer not minimally-encoded" when reading an X.509 certificate I have an issue with certificates using Go.
I use product written in Go (Mongodb Ops Manager agents) and I have conifgured it to work with my custom CA bundle. After adding new CAs to the bundle I have got the following error:

asn1: structure error: integer not minimally-encoded

I have written script in go to identify the bad certificate.
After finding this certificate I have tried to parse it using openssl using:
openssl x509 -inform pem -in mycert.pem -text -noout
And it parsed correctly.
I couldn't find anything wrong with this certificate (comparing it to other certificates).
Do you have any idea what can cause this problem?
Unfortunately I can't provide the ceritificate.
Go version: 1.9.4


text:
Q: Can't get image orientation neither with EXIF nor from MediaStore This is the details of one sample picture I try to get orientation of:

Using EXIF I always get ORIENTATION_UNDEFINED (=0). Here is the code:
ExifInterface exif = new ExifInterface(imageUri.getPath());
int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);

So, I searched and found bunch of similar questions. The suggestions were using the details of image in MediaStore. I do it like this:
String[] projection = {MediaStore.Images.ImageColumns.ORIENTATION};
try {
    Cursor cursor = context.getContentResolver().query(imageUri, projection, null, null, null);
    if (cursor.moveToFirst()) {
        orientation = cursor.getInt(0);
    }
    cursor.close();
} catch (Exception e) {}

The above code doesn't also give any result as, "cursor" becomes null!
Having the orientation I will do image rotation and stuff. What should I do to get a photo orientation?

A: Your first piece of code will only work if imageUri has a file scheme. Many times, it will not.
Your second piece of code will only work if imageUri is a Uri from MediaStore.
Instead, use an ExifInterface implementation that works with streams, so you can use ContentResolver and openInputStream() to get the orientation. This should work for all Uri values, though whether or not the JPEG contains an orientation header will vary by the image.
This sample app demonstrates the approach. In my case, the images are in assets/, and so my InputStream comes from AssetManager, not ContentResolver, but otherwise it should work the same:
 ExifInterface exif=new ExifInterface();

 exif.readExif(is, ExifInterface.Options.OPTION_ALL);

 ExifTag tag=exif.getTag(ExifInterface.TAG_ORIENTATION);
 int orientation=(tag==null ? -1 : tag.getValueAsInt(-1));

(where is is the InputStream)


text:
Q: Could not found file i ma running my Asp.net solution but getting error:
<%@ Application Codebehind="Global.asax.cs" Inherits="TCSCloud.WebApp.MvcApplication " Language="C#" %>

everything is fine, it's been imported, went through almost every stack overflow issue regarding this but didn't fix anything. help plz
My solution contains 13 projects,

A: Can you confirm that the Inherits="TCSCloud.WebApp.MvcApplication " matches the namesspace and class name in your Global.asax.cs file.
So, you should have something like this in your Global.asax.cs file:
namespace TCSCloud.WebApp
{
    public class MvcApplication
    {
    }
}

Also, you have a space there at the end of your Inherits="TCSCloud.WebApp.MvcApplication "

A: Try rebuilding the whole solution once. It might help.


text:
Q: DateTime.ToString("g") fr_CA There is an aberration with date formatting using fr_CA culture.
DateTime.ToString("g") returns "YYYY-MM-DD 00:00" format because "YYYY-MM-DD" is the official Canada date format.
The problem is that this format is not used at all neither by francophones and anglophones !!
So my question is: is there a way to bypass the default implementation of DateTime.ToString(string format) so that I can use "dd/mm/yyyy" instead for fr_CA which corresponds to the real usage ? and the default implementation for all other cultures.
And is it possible to do it without using another method name ?

A: You can handle this on a case by case basis. If the culture is fr-CA, replace it with a modified copy when your app starts:
if (Thread.CurrentThread.CurrentCulture.Name == "fr-CA")
{
    var frca = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
    frca.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
    Thread.CurrentThread.CurrentCulture = frca;
}

And do the same for any culture you need to "customize".
Note that new threads will still start with the system-defined culture; if you're using .NET 4.5 or later, you can override that behavior using the DefaultThreadCurrentCulture property:
CultureInfo.DefaultThreadCurrentCulture = frca;


text:
Q: How to have dictionary print out random keys file = open(selection, 'r')
dictionary = {}
with file as f:
    for line in f:
        items = line.split(',')
        key, values = items[0], items[1:]
        dictionary[key] = values

n= int(input("How many words would you like to be tested on: "))
while n > length:
    print("Invalid. There are only" ,length, "entries")
    n= int(input("How many words would you like to be tested on: "))
print("You have chosen to be tested on",n, "words.\n")

for i in range(n):
    while len(dictionary)>0:
        choice = random.shuffle(list(dictionary.keys()))
        correctAnswer = dictionary.get(choice)
        print("English: ",choice)
        answer = input("Spanish: ")
        if answer.lower() == correctAnswer:
            print("Correct!\n")
            del dictionary[choice]
        else:
            print("Incorrect")
            wrongAnswers.append(choice)
        break
print("\nYou missed", len(wrongAnswers), "words\n")

Hi, I am trying to create a vocabulary test on python, but when I run the code, instead of printing out the key, it just prints out "None"
What can I do for the code to print out a random key?

A: You can use random.choice instead of shuffle.
choice = random.choice(list(dictionary.keys()))

shuffle changes the list you send into the function and since you don't save a reference to that list, you don't get anything. Also, it only generates a shuffled version of that list and not a single value.
alist = [1,2,3,4,5,6]
random.shuffle(alist)
print(alist)

>> [2, 5, 6, 4, 3, 1]


text:
Q: Laravel Mailable problem - multiple calls I noticed randomly I get this error "Trying to get property 'email' of non-object" when I want to send an email using this code:
Mail::to($email)->send(new TicketEmail($item, $request->response, "0"));

When I checked the logs I found out that Laravel calls Mailable and setAddress functions three times! And in two of them, it sends an empty array as an email address. How's it possible?

A: The problem was the env file, I replaced MAIL_FROM_ADDRESS and MAIL_FROM_NAME with their values in TicketEmail.php and the problem is gone!


text:
Q: getting error of "NullReferenceException was unhandled by user code" while i try to display first name after successful login in ASP.NET MVC I am getting error of "NullReferenceException was unhandled by user code" while i try to display first name after successful login in ASP.NET MVC.
Model:
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Data;
 using System.Data.SqlClient;
 using System.Linq;
 using System.Web;
 using System.Data.Linq.Mapping;
 namespace club.Models
{
public class User
{
    int j;
  public string type1  { get; set; }
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember on this computer")]
    public bool RememberMe { get; set; }

    ///
    /// Checks if user with given password exists in the database
    ///
    /// <param name="_username">User name</param>
    /// <param name="_password">User password</param>
    /// <returns>True if user exist and password is correct</returns>
    ///

    public bool IsValid(string _username, string _password)
    {
        using (var cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=E:\softwares\ASP.NET\club_hardik\club\App_Data\club.mdf;Integrated Security=True;User Instance=True"))
        {
            string _sql = @"SELECT [ContactNo],[type] FROM tblLogin " +
                   @"WHERE [ContactNo] = @u AND [Password] = @p";
            var cmd = new SqlCommand(_sql, cn);
            Console.WriteLine(cmd);
            cmd.Parameters
                .Add(new SqlParameter("@u", SqlDbType.NVarChar))
                .Value = _username;
            cmd.Parameters
                .Add(new SqlParameter("@p", SqlDbType.NVarChar))
                .Value = Models.SHA1.Encode(_password);

            cn.Open();

            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Read();
                type1 = reader.GetString(1);
                reader.Dispose();
                cmd.Dispose();
                return true;
            }
            else
            {
                reader.Dispose();
                cmd.Dispose();
                return false;
            }
        }
    }
}

}
Controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using club.Models;
using System.Text.RegularExpressions;
namespace club.Controllers
{
public class UserController : Controller
{
    //
    // GET: /User/

    public ActionResult Index()
    {
        return View();
    }
    [HttpGet]
    public ActionResult Member(User model)
    {

        var model1 = new M_Reg();
        using (var db = new clubDataContext())
        {
            var content = from p in db.M_Registarions
                          where p.M_ContactNo == model.UserName
                          select p;
            foreach (M_Registarion p in content)
            {
                model1.FName = p.M_Fname;

            }
        }
        return View();
    }
    [HttpGet]
    public ActionResult memberdisplay(User u)
    {

        return View();
    }
    [HttpGet]
    public ActionResult Login()
    {
        return View();
    }

    [HttpPost]
    public ActionResult Login(Models.User user)
    {
        if (ModelState.IsValid)
        {
            if (user.IsValid(user.UserName, user.Password))
            {

                FormsAuthentication.SetAuthCookie(user.UserName, user.RememberMe);
                string a = (user.type1).ToString();
                string fixedStringOne = Regex.Replace(a, @"\s+", String.Empty);

                if (string.Equals(fixedStringOne, "member"))
                {
                    return RedirectToAction("member",user);
                }
                else if (fixedStringOne.Equals("admin"))
                {
                    return RedirectToAction("Admin", "Admin");
                }
                else
                { }
            }
            else
            {
                ModelState.AddModelError("", "Login data is incorrect!");
            }
        }
        return View(user);
    }
    public ActionResult Logout()
    {
        FormsAuthentication.SignOut();
        return RedirectToAction("Index", "Home");
    }

}

}
View:
@model club.Models.M_Reg
   @{
    ViewBag.Title = "Member";
    }

Member

   @using (Html.BeginForm( ))
    {

    <fieldset>

           welcome   @Model.FName

Here I am getting error of** Null Reference was unhandled by Usercode

        </fieldset>

}
When i debug line by line i get the 'firstname' from database but it does not display in View and getting error of "NullReference Exception". I don't know what is the meaning of this error. Help me to solve this error.

A: The Model property in your view is null. You should pass the model you created in the Member action to the view:
[HttpGet]
public ActionResult Member(User model)
{
    var model1 = new M_Reg();
    // ...
    return View(model1);
}

Looking at your code, you have the same potential errors in your memberdisplay and Login actions.


text:
Q: Accessing method of derived class when using ptr_vector Setup
class Base
{
public:
    Base();
    virtual ~Base();
    int getType();
protected:
    int type;
};

class DerivedA : public Base
{
public:
    DerivedA() { this->type = 1; };
    ~DerivedA();

    int getA() { return 1;};
};

class DerivedB : public Base
{
public:
    DerivedB() { this->type = 2; };
    ~DerivedB();

    int getB() { return 2;};

};

Target
Having a vector containing objects of both derived classes and then be able to access child-specific methods.
Current "solution"
int main()
{
    typedef boost::ptr_vector<Base> BasePtr;
    BasePtr vec;

    // Fill vec with some stuff
    vec.push_back(new DerivedA());
    vec.push_back(new DerivedB());
    vec.push_back(new DerivedA());
    vec.push_back(new DerivedB());

    typedef BasePtr::iterator BaseIter;

    for ( BaseIter it = vec.begin(); it != vec.end(); it++ ) {

       if (it->getType() == 1) {
          std::cout << it->getA() << '\n';
       } else {
          std::cout << it->getB() << '\n';
       }

    }

    return 0;
 }

Problem
Obviously "it" is not recognised as either DerivedA or DerivedB, so the child-specific method cant be accessed.
Some form of cast is required, so i guess the question is:
How do I properly cast the iterator to the correct derieved class?
Maybe there is a better way to structure this whole scenario?
Edit:
Seems i was a bit unclear. The purpose of the methods in the derived classes is fundamentally different.
Consider the base class Item that have the derived classes Armor and Weapon.
In this example you can see why, for instance, Weapon have a function getDamage() that maybe returns a float.
This function is not needed for Armor and dosn't even have anything similar.
In this example you can see the vector as an Inventory that can contain any number, and types, of items. Maybe even items that have a stack and some use (Potions maybe)

A: If you have to cast to derived, then it means you have a broken design.
But if you really have to then this would do (put it in the for loop) :
DerivedB * typeB = dynamic_cast< DerivedB * >( &*it );
if ( typeB != nullptr )
{
  std::cout << typeB->getB() << '\n';
}

A better approach would be to add getB() to the interface, and implement it in DerivedA (it can return some dummy value, or throw if really needed).

A: Casting is a pretty ugly solution, and not very C++'y. Instead you should be using virtual functions.
Something like:
class Base
{
public:
    virtual int get() = 0;

    // ...
};

class DerivedA : public Base
{
public:
    int get() { return 1;};
};

class DerivedB : public Base
{
public:
    int get() { return 2;};
};

Then there is no need to have an extra type, and you can just call it->get();.

A: You can use dynamic_cast as below.
for ( BaseIter it = vec.begin(); it != vec.end(); it++ )
{
    DerivedA* dA = dynamic_cast<DerivedA*>(it);
    if(dA != NULL)
    {
      // Do whatever for DerivedA
    }

    // Similarly check for DerivedB

}

There is no easy way out here other than designing your interfaces to utilize the polymorphism. i.e, define function signatures in the base class and implement them in the derived class. The for-loop above, ideally shouldn't try to know what is the type of the container items. It is impossible to comment on this without knowing what is the real functions represented by getA() and getB().


text:
Q: Ordenar tarjetas de la persona que tenga más dinero PHP SQL estoy intentando crear un sistema, en el cual ordene cual es la persona que tenga más dinero, en este caso, quiero que ordene que el que esté en el primer puesto esté en el medio, el que este en el segundo en la derecha, y el que esté en el ultimo puesto en la izquierda. Pero con el código que intenté utilizar es que lo ordene de mayor a menor. ¿Hay alguna manera de solucionar esto?
Código:
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);

$sqlget = "SELECT * FROM `characters` ORDER BY `characters`.`dinero` DESC LIMIT 3";
$sqldata = $dbh->query($sqlget) or die('error users');

while($row = $sqldata->fetch(PDO::FETCH_ASSOC)) {
    if ($row["CKuIDStaff"] == 1) {
        echo '

        Personaje Muerto

'.$row["characterName"].'

'.$row["yo"].'

  Ver perfil

';
    } else {
        echo '

'.$row["characterName"].'

'.$row["yo"].'

        Ver perfil

';
    }

}


text:
Q: nginx service won't start after reboot AWS Linux server A few weeks ago I configured an ec2 server on AWS and database is on RDS and I use nginx as web server. When i reboot server from the AWS console my nginx wont restart automatically. I did this using service nginx start command.
Is there any way to configure nginx server, So it restarted when i reboot my ec2 instance

A: You may configure nginx to start automatically on system boot using below command.
 #chkconfig nginx on

Once you run above command, nginx will be always started whenever system boots.
You may check , if service is configured to start automaticaly on system boot using below command.
# chkconfig nginx --list

You may disable service auto start using below command
# chkconfig nginx off


text:
Q: I need help understanding how to get s stringified (variable) version of an SVG image I am currently working with an svg image that I need help stringifying, If that makes sense. Basically how to make the image open in a text/code editor as only variables?
Here is an example of what I am looking for:
var svgData='PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiB2ZXJzaW9uPSIxLjEiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0ic3Ryb2tl

Currently when open an svg image in a text editor I just get something like this.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG
Version: 6.00 Build 0)  -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 255.1 227.3" style="enable-background:new 0 0 255.1
227.3;" xml:space="preserve">
<style type="text/css">

Any help is welcome! Thank You.

A: It looks like svgData is cut a little short. But if I understand your question right, you want that encoded svgData available in a textarea?
You can use the native functions btoa and atob (https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding) to encode and decode the svg content.
For example using your svgData value: atob("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiB2ZXJzaW9uPSIxLjEiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0ic3Ryb2tl") = <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" version="1.1"><defs><linearGradient id="stroke"
and we can convert it back with:
btoa('<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" version="1.1"><defs><linearGradient id="stroke"') = "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiB2ZXJzaW9uPSIxLjEiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0ic3Ryb2tlIg=="


text:
Q: On Sliding down the SlideDialog I am getting RederFlex overflowed error on the bottom. Can you suggest any method to resolve this issue? I am using slide_popup_dialog package and calling this dialog on a button call. Below is the code
showSlideDialog(context: context, child: Column(children: <Widget>[
                    Container(
                      height: MediaQuery.of(context).size.height*0.50,
                      child: Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: CupertinoDatePicker(
                                    backgroundColor: Colors.grey[300],
                                    onDateTimeChanged: (DateTime newdate) {
                  print(newdate);
                                    },
                                  ),
                      ),
                    ),
                    Container(
                                          child: RaisedButton(
                  child: const Text("Confirm"),
                      shape: RoundedRectangleBorder(
                          borderRadius:
                              BorderRadius.circular(8.0)),
                      onPressed: () {
                        print("Confirm");
                      }),
                    )
                                  ], mainAxisAlignment: MainAxisAlignment.center));

A: It seems that the problem is with the package it self. If found same issue reported on the github repository too. Here is the link.
I tried the solution given there of using Expanded and SingleChildScrollView widget and it works. Here is the modified code. Hope it helps.
    showSlideDialog(
    context: context,
    child: Expanded(
      child: SingleChildScrollView(
        child: Column(children: <Widget>[
          Container(
            height: MediaQuery.of(context).size.height * 0.50,
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: CupertinoDatePicker(
                backgroundColor: Colors.grey[300],
                onDateTimeChanged: (DateTime newdate) {
                  print(newdate);
                },
              ),
            ),
          ),
          Container(
            child: RaisedButton(
                child: const Text("Confirm"),
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(8.0)),
                onPressed: () {
                  print("Confirm");
                }),
          )
        ], mainAxisAlignment: MainAxisAlignment.center),
      ),
    ));


text:
Q: Issue with heroku deploy - push to heroku does not seem to be working. Attempting to deploy my app to heroku. Im not really sure of the issue, as can be seen below, I have used the dotenv gem and basic authentication. Can anyone offer me some help. I can not find any comprehensive answers on linve Thanks
> remote: sh: 2: Syntax error: Unterminated quoted string
>     remote: sh: 2: Syntax error: Unterminated quoted string
>     remote:  !
>     remote:  !     Could not detect rake tasks
>     remote:  !     ensure you can run `$ bundle exec rake -P` against your app
>     remote:  !     and using the production group of your Gemfile.
>     remote:  !     rake aborted!
>     remote:  !     LoadError: cannot load such file -- dotenv
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/config/application.rb:4:in
> `require'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/config/application.rb:4:in
> `<top (required)>'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/Rakefile:4:in `require'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/Rakefile:4:in `<top
> (required)>'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in
> `load'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in
> `load_rakefile'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:686:in
> `raw_load_rakefile'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:96:in
> `block in load_rakefile'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:178:in
> `standard_exception_handling'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:95:in
> `load_rakefile'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:79:in
> `block in run'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:178:in
> `standard_exception_handling'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:77:in
> `run'
>     remote:  !     /tmp/build_42cddfee1412c60445a7a20452697211/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/exe/rake:27:in
> `<top (required)>'
>     remote:  !     vendor/bundle/bin/rake:16:in `load'
>     remote:  !     vendor/bundle/bin/rake:16:in `<main>'
>     remote:  !
>     remote: /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/lib/language_pack/helpers/rake_runner.rb:102:in
> `load_rake_tasks!': Could not detect rake tasks
> (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
>     remote: ensure you can run `$ bundle exec rake -P` against your app
>     remote: and using the production group of your Gemfile.
>     remote: rake aborted!
>     remote: LoadError: cannot load such file -- dotenv

My gem file is
source 'https://rubygems.org'

gem 'rails', '4.2.5'

gem 'pg'

gem 'sass-rails', '~> 5.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.1.0'

gem 'will_paginate', '~> 3.1.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 2.0'

gem 'sdoc', '~> 0.4.0', group: :doc
gem "font-awesome-rails"
gem 'dotenv-rails', :groups => [:development, :test]
gem 'will_paginate-bootstrap'

gem "paperclip", "~> 5.0.0"

gem 'dotenv-heroku'

group :development, :test do

  gem 'byebug'
end

group :development do

  gem 'web-console', '~> 2.0'

  gem 'spring'
end

A: The gem dotenv-heroku should be inside the :development group.
The purpose of the gem is to pull/push the current heroku config into/from a .env file locally.


text:
Q: @FormParam parameter always null in my JAX-RS resource service Here is a service that I request with a curl :
time curl -i -XPOST 'http://localhost:9080/my/service' -H "Authorization:OAuth MyToken" -H "Content-Type: application/json" -d "ids=516816b2e4b039526a235e2f,516816b2e4b039526a235e2f"

The resource :
@Path("/my")
@Consumes({"application/xml", "application/json"})
@Produces({"application/xml", "application/json", "text/json"})
@Restricted
public class MyResource {

    @POST
    @Path("/service")
    public Map<String ,Object> myService(@FormParam("ids") String myIds) {
       // service things
    }
}

That service worked fine, but it suddenly fails. Now the parameter myIds is always null, and the result of the curl is 400 bad request...
I didn't change anything in this resource so it should still be working.
If anybody has an idea, let me know.
Thanks!

A: In your curl-command, you are posting form data along with the Content-Type: application/json. Clearly this data is not valid JSON, hence the 400 bad request.
If you want to post form data, you need to use the content type application/x-www-form-urlencoded


text:
Q: Prove that $\lambda = 0$ is an eigenvalue if and only if A is singular, without using $\lambda_1\cdot\ldots\cdot\lambda_n = det(A)$. I would like to know if there is any proof without using the fact that:
$$\lambda_1\cdot\lambda_2\cdot\ldots\cdot\lambda_{n-1}\cdot\lambda_n = det(A)$$
I managed to prove that if $\lambda = 0$ then, A is singular, by:
$$
det(A-\lambda\cdot I)=0 \Rightarrow
det(A-0\cdot I)=0 \Leftrightarrow det(A)=0
$$
However I can't prove that if A is singular then, $\lambda = 0 $.
I talked to my teacher and he told me that maybe I could prove by induction that:
$$
p(\lambda)=a_n\lambda^n+\ldots+a_1\lambda+a_0
$$
where,
$$a_0=det(A)$$
Then:
$$
p(\lambda)=a_n\lambda^n+\ldots+a_1\lambda\Rightarrow p(\lambda)=\lambda(a_n\lambda^{n-1}+\ldots+a_1)
$$
which guarantees that $\lambda=0$ is an eigenvalue.
If anyone could help, I would greatly appreciate it.

A: A is singular iff there exists a nonzero vector X such that AX=0 iff 0 is an eigenvalue.
No determinants required here, just the definition ;)

A: The following answer is not as short and elegant as the one by @Béranger Seguin, but it I think it is interesting\important to understand it since it provides a good sense of what happens to eigenvalues of singular matrix.
Let $A$ be singular matrix, then $A$ is equivalent to a matrix $A'$ with a row of zeros. Let $\phi(I)=\phi(I)_1\phi_{n-1}(I)...\phi_1(I)$ be a sequence of elementary operation which one do to obtain $A'$ from $A$, i.e. $A'=\phi(I)A=\phi(I)_1\phi_{n-1}(I)...\phi_1(I)A$
the following polynomial has the same roots as $\det(A-\lambda I)$
$$\det\phi(I) \det(A-\lambda I)=\det(\phi(I)(A-\lambda I))
=det(A'-\lambda \phi(I))$$
since $A'$ has a row of zeros $A'-\lambda \phi(I)$ has a row $i$ with $-\lambda$ on a main diagonal. Calculate determinant by this row to get
$$det(A'-\lambda \phi(I)) = -\lambda M_{ii}
$$
where $M_{ii}$ denote a minor.
Note that $-\lambda M_{ii}=0$ has a solution $\lambda=0$.


text:
Q: How to programmatically redirect to Azure AD sign-in and sign-out pages in ASP.NET Core MVC? My ASP.NET Core 2.2 MVC app is using Azure AD to authenticate users. In startup.cs I added Azure AD:
services
  .AddAuthentication(AzureADDefaults.AuthenticationScheme)
  .AddAzureAD(options => Configuration.Bind("AzureAd", options));

services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
  options.Authority = options.Authority + "/v2.0/";
  options.TokenValidationParameters.NameClaimType = "preferred_username";
});

Authorization is done by a policy check:
services.AddAuthorization(options =>
{
    options.AddPolicy("AdministratorOnly", policy => {
      policy.RequireClaim("groups", adminGroupId);
  });
});

In appsettings.json I have all the required configuration:
"AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "TenantId": "662f1be2-...",
    "ClientId": "30eb6c27-...",
    "CallbackPath": "/signin-oidc",
    "SignedOutCallbackPath ": "/signout-callback-oidc"
}

If I try to access a controller decorated with [Authorize(Policy = "AdministratorOnly")] it will redirect to Azure AD and handle the login process and eventually redirect back to my app.
Questions:

*

*Is there a prescribed to kick off the login process (preferably in a popup window)? Where do I get the URL from to redirect to?

*How can I provide a button to let users logout again? If I redirect to "/signout-oidc" I'm getting signed out but I end up on a blank page.

A: Documentation explains it all. It is backed by a solid source code repository.
In general, the AzureAD middleware is taking care about redirection to Azure AD when the user is not authenticated. This is checked every time user ends up on action decorated with [Authorize] attribute.
As for Logout - if you use the oidc-logout, check out the sample and explanations here.


text:
Q: Will attempt to recover by breaking constraint in titanium I am suffering these error messages.
These messages come up every seconds and fill the console window.
I googled around and found out that it is related with iOS window layout and I could ignore the messages for now.
However the flood of the messages kick out other important messages for developping.
If I even change the error level, it comes out again.
If I mute the [info], it comes to [error].
Is there any good way to avoid this?
My environment is

*

*iOS 9.2.1

*CLI version 5.0.5,

*Titanium SDK version 5.1.1.GA

:log.
[INFO]  Will attempt to recover by breaking constraint
[INFO]  <NSLayoutConstraint:0x12d75b650 H:[MPKnockoutButton:0x12d6e94e0]-(34)-[MPDetailSlider:0x12d73ed30](LTR)>
[INFO]
[INFO]  Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
[INFO]  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
[INFO]  Unable to simultaneously satisfy constraints.
[INFO]          Probably at least one of the constraints in the following list is one you don't want.
[INFO]          Try this:
[INFO]              (1) look at each constraint and try to figure out which you don't expect;
[INFO]              (2) find the code that added the unwanted constraint or constraints and fix it.
[INFO]          (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
[INFO]  (
[INFO]      "<NSAutoresizingMaskLayoutConstraint:0x12d7458a0 h=-&- v=-&- _UIBackdropContentView:0x12d73d2a0.midX == _UIBackdropView:0x12d739f80.midX>",
[INFO]      "<NSAutoresizingMaskLayoutConstraint:0x12d7458f0 h=-&- v=-&- _UIBackdropContentView:0x12d73d2a0.width == _UIBackdropView:0x12d739f80.width>",
[INFO]      "<NSAutoresizingMaskLayoutConstraint:0x12d746890 h=-&- v=-&- MPVideoPlaybackOverlayView:0x12d5effe0.width == MPVideoContainerView:0x12d72bc50.width>",
[INFO]      "<NSAutoresizingMaskLayoutConstraint:0x12d746150 h=-&- v=-&- MPVideoContainerView:0x12d72bc50.width == MPSwipableView:0x12d6cc040.width>",
[INFO]      "<NSLayoutConstraint:0x12d75b5d0 H:|-(34)-[MPKnockoutButton:0x12d6e94e0](LTR)   (Names: '|':_UIBackdropContentView:0x12d73d2a0 )>",
[INFO]      "<NSLayoutConstraint:0x12d75b650 H:[MPKnockoutButton:0x12d6e94e0]-(34)-[MPDetailSlider:0x12d73ed30](LTR)>",
[INFO]      "<NSLayoutConstraint:0x12d75b6a0 H:[MPDetailSlider:0x12d73ed30]-(34)-[UIView:0x12d73de70](LTR)>",
[INFO]      "<NSLayoutConstraint:0x12d75b770 UIView:0x12d73de70.right == _UIBackdropView:0x12d739f80.right - 34>",
[INFO]      "<NSLayoutConstraint:0x12d73eb40 H:|-(0)-[_UIBackdropView:0x12d739f80]   (Names: '|':MPVideoPlaybackOverlayView:0x12d5effe0 )>",
[INFO]      "<NSLayoutConstraint:0x12d6d4b30 H:[_UIBackdropView:0x12d739f80]-(0)-|   (Names: '|':MPVideoPlaybackOverlayView:0x12d5effe0 )>",
[INFO]      "<NSLayoutConstraint:0x12d7b3180 '_UITemporaryLayoutWidth' H:[MPSwipableView:0x12d6cc040(0)]>"
[INFO]  )
[INFO]


text:
Q: Does SAML 2.0 allow to send SP data to IdP? I'm reading the SAML specification and experimenting with Keycloak and Shibboleth IdPs and I'm not sure how to implement one feature in an SP-initiated login.
I have a service that traditionally used to have an SP status information displayed on its login page (e.g. application version, status). After switching to using an IdP login page I'd like to keep displaying such per-SP additional information on the login page of the IdP. I'm interested in the data exchange, not in templating the login page itself.
Does SAML 2.0 specification allow for sending arbitrary data to the IdP for the purpose of logging in? If not, what are other options that can be used to decorate IdP login page using SP-generated data?

A: Sort of. The authentication request from SP to IdP is allowed to have "custom" extensions (the Extensions parent element), the content of the extensions is up to you. From the spec:

 [Optional] This extension point contains optional
  protocol message extension elements that are agreed on between the
  communicating parties. No extension schema is required in order to
  make use of this extension point, and even if one is provided, the lax
  validation setting does not impose a requirement for the extension to
  be valid. SAML extension elements MUST be namespace-qualified in a
  non-SAML-defined namespace.

If you're writing your own IdP, you could certainly make use of Extensions and do whatever you wish with it. "Standard" (commercial/OSS) IdPs won't know what to do with your extension. It'd be an interesting test to see if Shibboleth or Keycloak libraries parse the Extensions element and give you the contents.
The other, more standard possibility is using RelayState. This is a spec-compliant way of passing some provider-specific state information around, incl. from SP to IdP:

3.1.1 Use of RelayState Some bindings define a "RelayState" mechanism for preserving and conveying state information. When such a mechanism
  is used in conveying a request message as the initial step of a SAML
  protocol, it places requirements on the selection and use of the
  binding subsequently used to convey the response. Namely, if a SAML
  request message is accompanied by RelayState data, then the SAML
  responder MUST return its SAML protocol response using a binding that
  also supports a RelayState mechanism, and it MUST place the exact
  RelayState data it received with the request into the corresponding
  RelayState  parameter in the response.

Again, all IdPs or downstack libraries will parse RelayState but how they handle it from there depends on their reading of the spec. For one, the spec requires RelayState to be 80 bytes and integrity protection via a signature or "other means". This limitation is often ignored by IdPs and SPs.
What SP-specific information are you trying to display on IdP login page?

A: The only thing that an SP can send to the IdP is the Subject (see lines 585-589 of the spec).


text:
Q: how to send visual studio project 2017 to github? I have a project already connected to visual studio team services, because it is already connected there is no option to connect to a new git repository.
Does anyone know how to send the source code to GitHub through visual studio when this is the case?
When I go to the file menu there is nothing saying "add to source control".
Or in the bottom right button, there is only a master button which has something about branches.
I don't understand why they make it so hard by redefining so many things like download to pull and upload to push.
Can someone tell me that answer as well?

A: It is easier to switch to command line and check if your local sources are themselves in a Git repo:
cd /path/to/local/project
git status
git remote -v

If those commands fails, that means your project is connected to visual studio team services through TFVC, and not Git, in which case, you need to create a local Git repo (which will co-exists with the TFVC one)
git init .
git add .
git commit -m "first commit"

Eve if the Git repo already existed, you can continue with:
git remote add github /url/empty/GitHub/repo
git push --mirror


text:
Q: shutil.copy results in creating new directory instead of copying to existing directory I am attempting to copy files (named CF19-001.docx, CF-19-002.docx, etc.) into existing directories. Do not know if it's relavent, but the dest directories also have .pdf files with the same naming convention that I was able to shutil.copy.
Here is the code I am using for the .docx files:
for file2 in files2:
    dir_name2 = file2
    dir_path2 = dir_name2.replace(".docx", "")
    print(f'dir_name2: {dir_name2}')
    shutil.copy(os.path.join(dir, file2), os.path.join(dir_path2, file2))
    # copies case files into appropriate directories
    if os.path.exists(dir_path2):
        print(f'dir_path2: {dir_path2}')

Instead of copying into the source destination directories, it creates new folders for the .docx files named "CF19-001.docx", "CF19-001.docx", etc.
What am I doing wrong? Please help a newbie coder.


text:
Q: CodeIgniter: How to create a menu that doesn't refresh I am working on a website that has a sidebar1, that after clicking on an option in sidebar1 - it opens a sidebar2 right next to it, and after choosing an option from sidebar2 - it opens the relevant view in the rest of the space of the page.
I am trying to make it a little bit animated too.
Something like this if you look at the menu:
https://webdesignersdream.files.wordpress.com/2013/11/everlytic-cms-dashboard-by-zoe-love7.png
(the menu can be undisplayed too in my case "hide menu" and get a full page display)
Currenly, I have a header.php view which contains all the head content, and a dashboard.php with the menu and the content part that gets refreshed with all the page whenever clicking on an option.
Because when clicking on an option it runs in the controller the views I want to show:
public function index(){

    $this->load->view('header');
    $this->load->view('dashboard');
    $this->load->view('kas/kas_main');
    $this->load->view('footer');

}

and refreshes everything.
How do I create an interactive menu that doesn't get refreshed when clicking on an option?
I know that wordpress websites do refresh after clicking an option from a menu, is this even recommended?
dashboard.php:

                firs main option

                        <a href="<?php echo base_url();?>kas">option 1

                        <a href="<?php echo base_url();?>exx">option 1

                        <a href="<?php echo base_url();?>weekly_reports">option 1

                second main option

                        <a href="<?php echo base_url();?>mailer-generator"> Mailer Generator

                        <a href="<?php echo base_url();?>mailer-generator2"> Mailer Generator 2

        <a href='<?php echo base_url()."dashboard/logout" ?>'> Logout

A: You have to use AJAX to achieve that.
This will prevent the reload of page.
http://www.w3schools.com/ajax/
HTML
first main option

JS
        $('span.option').click(function(){
            var option = $(this).attr('data-option');
            $.ajax({
              url: "main/options",
              type: "POST",
              data: {opt: option},
              dataType: "html",
              success:function(result){
                   $('#content').html(result);
              }
            });
        });

Controller (main/options)
public function option(){

    echo $this->load->view( $_POST['opt'], null, true);

}


text:
Q: Assessing the Quality of a Normal Q-Q Plot I am trying to fit a model to predict housing prices. My residual plots look like the following:

Should I be concerned about the large hump for the higher quantiles? Would a transformation on the response variable help?

A: You have something to think about which is much more important than the normality assumption, and your last plot is helpful.
Residuals vs leverage  You have some data points with a very high leverage. If you are not used to leverage,  Leverage and Influence.  I would guess the points with high leverage corresponds to a high fitted value, which leads to ...
Residuals vs fitted This plot might indicate a variance increasing with fitted vales, and that is what @Dave indicated in his comment ... but for the very highest fitted values the trend of increasing spread is not followed. That can maybe be explained with high leverage of those points (investigate!), which tends to draw the fitted model to themselves, as if high leverage points have a gravitational force. You could also investigate this by some robust fitting.
Normal QQ until you have thought about the first two points, don't even bother to look at this plot.


text:
Q: Nancy and razor, "Cannot find the type name or namespace .." Since 3 days im trying to repair legacy project in m job (i never done single application in this technologies, sorry for the mistakes made bellow)
After changing Enums place (separate project) we encountered the problem with not compile page views.
After build, and app start we getting "[CS0246] Line: 2 Column: 11 - Cannot find the type name or namespace "Commons" (is the "using" directive or reference to the set missing)?"
But reference is present, nothing changed, sitting here with selected lovely check box. I tried so far almost every single way to adding assemblies and references but nothing changed at all.
I already tried:

*

*Adding/Removing reference

*Adding/Removing compilated DLL

*Adding all (i think 15+ ways) for assemblies and references.

*File properties

*Commons.Enums namespace

*Changed project

*Changed build targets

*I changed Visual Studio (i don't know why, we using jenkins for production but im loosing sanity from 3 days)

*Added assembly biding

*Compilation tag in config

*Added @using, removed @using

*I tried to compile with/without reference

*Cleaned project manually

*Many, many rebuilds

PS in CS files everthing is fine, only webview is broken


text:
Q: Oracle Procedure to Copy data view into table I would need to copy or insert data from my_view (that is based on 3 joined tables). Before that, I've created table my_table based on my_view .
For the procedure I've used the below :
create or replace procedure view_copy(
            my_view in varchar2,
            my_table in varchar2)
is
begin
     execute immediate 'insert into '||my_table||' (select * from '||my_view||')';
end;

The data are not copied to my_table. Is it possible to copy data from view to table? How can I write the procedure differently?

A: Your procedure works; if you can't find data in your target table, maybe you should check your view.
A simple test on your procedure:
SQL> create table table1 ( id1 number)
  2  /

Table created.

SQL> create table table2 ( id2 number)
  2  /

Table created.

SQL> create or replace view v_t1_t2 as select id1, id2 from table1 cross join table2
  2  /

View created.

SQL> create table table1_2 ( id1 number, id2 number)
  2  /

Table created.

SQL> create or replace procedure view_copy(
  2              my_view in varchar2,
  3              my_table in varchar2)
  4  is
  5  begin
  6       execute immediate 'insert into '||my_table||' (select * from '||my_view||')';
  7  end;
  8  /

Procedure created.

SQL> insert into table1 values (1);

1 row created.

SQL> insert into table2 values (2);

1 row created.

SQL> exec view_copy('v_t1_t2', 'table1_2');

PL/SQL procedure successfully completed.

SQL> select * from table1_2;

       ID1        ID2
---------- ----------
         1          2


text:
Q: Why does $\pi$ cancel out when converting angle measures from radians to degrees? Can someone tell me why $\pi$ cancels out from this fraction when converting radians to degrees?

A: $1$ rad $= \frac {180}{\pi}$ degrees, so $\frac {7 \pi}{8}$ radians = $\frac {7 \pi}{8} \cdot \frac {180}{\pi}$ degrees.  The $\pi$ gets canceled with part of the conversion factor.


text:
Q: How to recover this garbled text? I want to recover text that was partly made unreadable due to foreign characters:
Esse e-mail \u00E9 gerado automaticamente para informa\u00E7\u00E3o ao cliente e n\u00E3o deve ser respondido.
It's in Portuguese. Do you know a simple way to make messages like these readable? I think I need some decoder / encoder.
Thank you

A: Those are javascript utf-16 character constants.  This page will "make them readable":  http://www.rishida.net/tools/conversion/
Without knowing more about the form of these messages (are they in seperate files?) it's hard to offer more advice.


text:
Q: Correct path in MediaWiki I have a problem with my MediaWiki (www.sfb-higher-invariants.de).

*

*The login is connected via a Single-Sign-On of the University of Regensburg.
By logging in, there is a redirect to a specific site.

*After a correct login there is another redirect back to the Wiki.

*When not being logged in, the Wiki is on the server www-cgi.

*After logging into it the server changes (to a secure server).

My Problem:
- If I set the $wgScriptPaht to www-cgi image uploads are working and the css is loaded.

*

*But the redirect to the secure server does not work properly.

*If I set no path, the redirect works, but the other two things fail.
The secure server is https.

*Where do I get the path, which the Wiki sets automatically? And how can I work around this mess?
PS: There is no other way for the sign in because of security reasons of the university... :(

A: The server name can be overridden with $wgServer, if I understand your question correctly, this is the parameter you are looking for.
If you need to, you can set both upload path a and style path separately, using $wgUploadPath and $wgStylePath, even though I can't figure out why that would be necessary.