text:
Q: Use $function (javascript) in mongo repository @Aggregation pipeline I have the below query that runs fine in mongo shell. I have to use this from my spring boot java application.
 db.UserGames.aggregate([
                        { $match: {$and: [{timestamp: {$gte : ISODate("2021-12-14T09:34:51.000Z"), $lte: ISODate("2022-12-31T09:34:51.000Z")}}]}},
                        { $sort:  {timestamp: 1  }},
                        { $group: {
                                   _id: {"userId" : "$userId", "username" : "$username"},
                                    docs: { $push: { win: "$win", timestamp: "$timestamp" } }
                                  }
                        },
                        {$project: {_id:1, docs:1, noOfGames: {$size: "$docs"}}},
                        {$match: {"noOfGames": {$gt: 1}}},
                        {$project: {_id:1, docs:1}},
                        {$addFields: { losingStreak : {
                                            $function: {
                                                body: function(docs) {
                                                            let longestStreak = 0;
                                                            let currentStreak = 0;
                                                            docs.forEach(element => {
                                                                if(element.win < 0) {
                                                                    currentStreak = currentStreak + 1;
                                                                    if(longestStreak < currentStreak) {
                                                                        longestStreak = currentStreak;
                                                                    }
                                                                } else {
                                                                    currentStreak = 0;
                                                                }
                                                            });
                                                            return longestStreak;
                                                        },
                                                args: ["$docs"],
                                                lang: "js"
                                        }}}},
                        {$project: {_id:1, losingStreak:1}},
                        {$match: {"losingStreak": {$gt: 0}}},
                                    { $sort:  {"losingStreak": -1  }}
                        ], { "allowDiskUse" : true })

I have used ReactiveMongoRepository and @Aggregation annotation as below:
public interface MyRepository extends ReactiveMongoRepository<UserGameDetails, Object> {

    @Meta(allowDiskUse = true)
    @Aggregation(pipeline = {
            "{ $match: {$and: [{'timestamp': {$gte : ?0, $lte: ?1 } } ] } }",
            "{ $sort:  {'timestamp' : 1 }}",
            "{ $group: { _id: {'userId' : '$userId', 'username' : '$username'},"
            + " docs: { $push: { 'win': '$win', 'timestamp': '$timestamp' } } } }",
            "{ $project: {_id : 1, docs : 1, noOfGames: {$size: '$docs'}}}",
            "{ $match: {'noOfGames': { $gt: ?2 } } }",
            "{ $project: {_id : 1, docs : 1 } }",
            "{ $addFields: { losingStreak : { $function: { "
            + "body: function(docs) { "
            + "let longestStreak = 0; "
            + "let currentStreak = 0; "
            + "docs.forEach(element => { "
            + "if(element.win < 0) { "
            + "currentStreak = currentStreak + 1; "
            + "if(longestStreak < currentStreak) { "
            + "longestStreak = currentStreak; "
            + "}  "
            + "} else { "
            + "currentStreak = 0;  "
            + "}  });"
            + " return longestStreak;  "
            + "}, "
            + "args: ['$docs'], "
            + "lang: 'js' }}}}",
            "{ $project: {_id : 1, losingStreak : 1 } }",
            "{ $match: {'losingStreak' : { $gt : ?2 } } }",
            "{ $sort:  {'losingStreak': -1  } }"})

    Mono<List<UsersScores>> getLosingStreakForAllGames(LocalDateTime startTime, LocalDateTime endTime, int minValue);
}

But it fails with below error. This error is coming from the java script function inside the query. How can I run this query from my Java Application?
reactor.core.Exceptions$ErrorCallbackNotImplemented: org.bson.json.JsonParseException: JSON reader was expecting a name but found '('.
Caused by: org.bson.json.JsonParseException: JSON reader was expecting a name but found '('.
    at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.readBsonType(ParameterBindingJsonReader.java:186)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:227)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:66)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:229)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:66)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:229)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:66)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:229)
    at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.captureExpressionDependencies(ParameterBindingDocumentCodec.java:202)
    at org.springframework.data.mongodb.repository.query.ReactiveStringBasedAggregation.computePipelineStage(ReactiveStringBasedAggregation.java:141)
    at org.springframework.data.mongodb.repository.query.ReactiveStringBasedAggregation.lambda$computePipeline$2(ReactiveStringBasedAggregation.java:132)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:125)
    at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120)
    at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.java:101)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2398)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onSubscribeInner(MonoFlatMapMany.java:150)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:189)
    at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
    at reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:62)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172)
    at reactor.core.publisher.FluxFilter$FilterSubscriber.onError(FluxFilter.java:157)
    at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onError(FluxMap.java:259)
    at reactor.core.publisher.Operators.error(Operators.java:198)
    at reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
    at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55)
    at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    at reactor.core.publisher.Flux.subscribe(Flux.java:8469)
    at reactor.core.publisher.FluxUsingWhen.subscribe(FluxUsingWhen.java:93)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
    at reactor.core.publisher.Mono.subscribeWith(Mono.java:4515)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4232)
    at com.dangalgames.leaderboard.service.LeaderboardJobManagerImpl.lambda$1(LeaderboardJobManagerImpl.java:49)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at com.dangalgames.leaderboard.service.LeaderboardJobManagerImpl.lambda$0(LeaderboardJobManagerImpl.java:49)
    at reactor.core.publisher.LambdaMonoSubscriber.onNext(LambdaMonoSubscriber.java:171)
    at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180)
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
    at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:128)
    at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2058)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onComplete(MonoFlatMapMany.java:260)
    at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:368)
    at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onComplete(FluxConcatMap.java:276)
    at reactor.core.publisher.FluxCreate$BaseSink.complete(FluxCreate.java:439)
    at reactor.core.publisher.FluxCreate$BufferAsyncSink.drain(FluxCreate.java:784)
    at reactor.core.publisher.FluxCreate$BufferAsyncSink.complete(FluxCreate.java:732)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.drainLoop(FluxCreate.java:240)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.drain(FluxCreate.java:206)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.complete(FluxCreate.java:197)
    at com.mongodb.reactivestreams.client.internal.BatchCursorFlux.lambda$recurseCursor$4(BatchCursorFlux.java:98)
    at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:171)
    at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180)
    at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:854)
    at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:165)
    at com.mongodb.reactivestreams.client.internal.MongoOperationPublisher.lambda$sinkToCallback$30(MongoOperationPublisher.java:549)
    at com.mongodb.internal.operation.AsyncQueryBatchCursor.next(AsyncQueryBatchCursor.java:167)
    at com.mongodb.reactivestreams.client.internal.BatchCursor.lambda$next$0(BatchCursor.java:35)
    at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
    at reactor.core.publisher.Mono.subscribeWith(Mono.java:4515)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4232)
    at com.mongodb.reactivestreams.client.internal.BatchCursorFlux.recurseCursor(BatchCursorFlux.java:104)
    at com.mongodb.reactivestreams.client.internal.BatchCursorFlux.lambda$subscribe$0(BatchCursorFlux.java:56)
    at reactor.core.publisher.LambdaMonoSubscriber.onNext(LambdaMonoSubscriber.java:171)
    at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
    at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249)
    at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180)
    at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:165)
    at com.mongodb.reactivestreams.client.internal.MongoOperationPublisher.lambda$sinkToCallback$30(MongoOperationPublisher.java:549)
    at com.mongodb.reactivestreams.client.internal.OperationExecutorImpl.lambda$execute$2(OperationExecutorImpl.java:92)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:95)
    at com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier$RetryingCallback.onResult(RetryingAsyncCallbackSupplier.java:114)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:95)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:95)
    at com.mongodb.internal.operation.FindOperation$2.onResult(FindOperation.java:762)
    at com.mongodb.internal.operation.CommandOperationHelper.lambda$transformingReadCallback$10(CommandOperationHelper.java:329)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor$2.onResult(DefaultServer.java:280)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.connection.CommandProtocolImpl$1.onResult(CommandProtocolImpl.java:84)
    at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection$1.onResult(DefaultConnectionPool.java:687)
    at com.mongodb.internal.connection.UsageTrackingInternalConnection$2.onResult(UsageTrackingInternalConnection.java:159)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
    at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:526)
    at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:503)
    at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:815)
    at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:782)
    at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:650)
    at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:647)
    at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:250)
    at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:233)
    at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127)
    at java.base/sun.nio.ch.Invoker.invokeDirect(Invoker.java:158)
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:562)
    at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:277)
    at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:298)
    at com.mongodb.internal.connection.AsynchronousSocketChannelStream$AsynchronousSocketChannelAdapter.read(AsynchronousSocketChannelStream.java:144)
    at com.mongodb.internal.connection.AsynchronousChannelStream.readAsync(AsynchronousChannelStream.java:118)
    at com.mongodb.internal.connection.AsynchronousChannelStream.readAsync(AsynchronousChannelStream.java:107)
    at com.mongodb.internal.connection.InternalStreamConnection.readAsync(InternalStreamConnection.java:647)
    at com.mongodb.internal.connection.InternalStreamConnection.access$600(InternalStreamConnection.java:86)
    at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:772)
    at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:757)
    at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:650)
    at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:647)
    at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:250)
    at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:233)
    at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127)
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(UnixAsynchronousSocketChannelImpl.java:439)
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:191)
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
    at java.base/sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:312)
    at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    Suppressed: org.bson.json.JsonParseException: JSON reader was expecting ':' but found ')'.
        at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.readBsonType(ParameterBindingJsonReader.java:191)
        at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:679)
        at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:721)
        at org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:456)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:80)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:31)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:235)
        ... 129 common frames omitted
    Suppressed: org.bson.json.JsonParseException: JSON reader was expecting a name but found '{'.
        at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.readBsonType(ParameterBindingJsonReader.java:186)
        at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:679)
        at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:721)
        at org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:456)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:80)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:31)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:235)
        ... 126 common frames omitted
    Suppressed: org.bson.json.JsonParseException: JSON reader was expecting ':' but found 'longestStreak'.
        at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.readBsonType(ParameterBindingJsonReader.java:191)
        at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:679)
        at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:721)
        at org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:456)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:80)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:31)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:235)
        ... 123 common frames omitted
    Suppressed: org.bson.json.JsonParseException: Invalid JSON input. Position: 88. Character: '='.
        at org.springframework.data.mongodb.util.json.JsonScanner.nextToken(JsonScanner.java:118)
        at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.popToken(ParameterBindingJsonReader.java:732)
        at org.springframework.data.mongodb.util.json.ParameterBindingJsonReader.readBsonType(ParameterBindingJsonReader.java:171)
        at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:679)
        at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:721)
        at org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:456)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:80)
        at org.bson.codecs.StringCodec.decode(StringCodec.java:31)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:360)
        at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:235)
        ... 120 common frames omitted

Sample Document:
{
    "_id" : ObjectId("61efcb757995cb2a0a408ca4"),
    "userId" : UUID("ae45122e-3bb8-40cf-af59-7362ecfa4d1e"),
    "username" : "testUser1",
    "userAvatar" : "test avatar",
    "game" : 8,
    "rake" : 43.0,
    "win" : -5121.0,
    "entryFee" : 34.0,
    "score" : 56,
    "timestamp" : ISODate("2022-01-25T10:05:41.725Z")
}

A: To answer the question -
https://docs.mongodb.com/manual/reference/operator/aggregation/function/#syntax says:

body   String or Code

Code works in the shell or nodejs driver. "String" is the only option for drivers on other languages. Wrap the body in quotes like this:
"{ $addFields: { losingStreak : { $function: { "
        + "body: \"function(docs) { "
        + "let longestStreak = 0; "
        + "let currentStreak = 0; "
        + "docs.forEach(element => { "
        + "if(element.win < 0) { "
        + "currentStreak = currentStreak + 1; "
        + "if(longestStreak < currentStreak) { "
        + "longestStreak = currentStreak; "
        + "}  "
        + "} else { "
        + "currentStreak = 0;  "
        + "}  });"
        + " return longestStreak;  "
        + "}\", "

Please be aware about performance impact and security concerns. It's very much recommended to do not use functions at any cost.
In this particular case I would recommend pre-aggregation. Apply the same logic at insert time once per document and store the result in the document itself, rather than run this function on every query for all documents.


text:
Q: Was General Swanwick & the army aware of Superman's powers? In the scene where Clark and Lois are conversing in the interrogation room:

*

*Clark reveals that he can in fact see a squad of soldiers in the next room, preparing a tranquilizing agent to subdue him, to which they act surprised.

*This is also reinforced due the fact that they were under the impression that they would be able to pierce his skin for it to take effect.
I was under the implication that Lois had already informed them regarding his powers and abilities. Did they have any understanding of his powers at all?

A: No, not really. It wasn't as if Lois Lane had a full accounting of Superman's powers, so any information she gave them was only slightly better than nothing at all. Up to this point, even Kal-El wasn't really aware of the full scope of his abilities.

*

*Most of Kal-el's sensory powers have invisible power effects so she could only know what he had told her or had seen herself.

*Most military people will work with things they understand and use technology based on their level of understanding of a particular threat. Given Superman's Kryptonian physiology and their lack of familiarity, it would explain why they thought ANYTHING they had in that room could even put a scratch on him in any way.

*After the rumble in Smallville, most of the military now realized they were completely outclassed in any conflict with a Kryptonian. They might have thought they could make a difference but Smallville certainly resolved that. The fight in Metropolis on further exacerbated their sense of helplessness overall.

A: The composure Lois has during the interview scene suggests she gave nothing up during interrogation.  Contrast that against the scene were Lois is saved from the damaged escape pod and she immediately confesses to having information taken from her.  Therefore, the whatever Lois may have been able to surmise about Superman's abilities, the military- at that point- does not know it through interrogating her.  They do know that he can fly.  They know he's alien.  And they have some inkling that he has abilities to gather intel despite their attempts to secure the information (it is doubtful that Lois's location is public information).  Beyond that, they don't know Superman's powers.
However, it is highly probable that there are omitted scenes or events between Superman's first contact with the military and Col. Hardy's arrival at Smallville.  Why?  Col. Hardy gives a short briefing, stating, "I have previously encountered and observed the beings we're about to engage at close proximity.  They are extremely dangerous..."
Based solely on what we see on the film, the conclusion is possible but a stretch.  Rather, it is more likely Hardy had an opportunity with Superman to observe a possible threat.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I use PartialFunctions to compose my match statements? Consider the following:
scala> object Currency extends Enumeration {
     |   type Currency = Value
     |   val USD = Value
     |   val GBP = Value
     |   val EUR = Value
     |   val TRY = Value // Turkish lira
     |   val NGN = Value // Nigerian naira
     | }
defined module Currency

scala> import Currency._
import Currency._

scala> val pf: (String) => Option[Currency] = {
     |     case "$" => Some(USD)
     |     case "€" => Some(EUR)
     |     case "£" => Some(GBP)
     |     case "₦" => Some(NGN)
     |     case _ => None
     |   }
pf: (String) => Option[Currency.Currency] = <function1>

I thought I'd be able to then do this:
scala> "$" match pf
<console>:1: error: '{' expected but identifier found.
       "$" match pf
                 ^

But no. Am I missing something basic here? My hope was that my PartialFunction could be used and reused in match statements. Is this not possible?

A: I think you just need to use it as a function, e.g.:
pf("$")

If you will define pf as PartialFunction[String, Option[String]] you can also use other useful stuff like pf.isDefinedAt("x").

If you will look in Scala Language Specification section 8.4 Pattern Matching Expressions, you will find following syntax:
Expr ::= PostfixExpr 'match' '{' CaseClauses '}'
CaseClauses ::= CaseClause {CaseClause}
CaseClause ::= 'case' Pattern [Guard] '=>' Block

So as you can see it's impossible to use it as you described, but pf("$") acts the same way.


text:
Q: Does there exist a non-zero continuous function such that $\int_{-2}^3 x^{5n}f(x)\, dx = 0$ for all $n\geq 0?$ I don't think there exists such a function. So my method is to assume such a function exists and show that it must be zero. I'm trying to follows the solution for this similar problem, but I can't seem to get anywhere.
What I've been doing is that by Stone-Weierstrass there exists $p_k(x)$, a sequence of polynomials that converges to uniformly to $f$, then I can write
$$
\int_{-2}^3 f(x)f(x)\,dx = \int_{-2}^3 f(x)\lim_{k\rightarrow \infty} p_k(x) \, dx = \lim_{k\rightarrow \infty}\int_{-2}^3 f(x) p_k(x) \, dx
$$
But of course I can't conclude this integral is $0$ from this. So I'm not sure where to go from here

A: Consider $p_k$ a sequence of polynomials that converges uniformly to $f\left(\sqrt[5]x\right)$ on $\left[-2^5,3^5\right]$ instead, hence $$\int_{-2}^3(f(x))^2\,dx=\int_{-2}^3 f(x)\lim_{k\to\infty} p_k(x^5)\,dx=\lim_{k\to\infty}\int_{-2}^3 f(x)p_k(x^5)\,dx=0$$


text:
Q: Как создать Picker по своему макету Android
Добрый вечер, в проекте нужно сделать Picker однако не обычный Число/Строка/Дата, а используя свой макет, пересмотрел множество библиотек однако у всех ты передаешь какой-то массив и все. Хотел найти что-то типо реализующее адаптер RecyclerView где можно использовать свой лаяут. Заранее спасибо всем, буду рад любой помощи.


text:
Q: Javascript embedding Every time I try embedding a URL no matter which url I use it always gives me this error

Uncaught SyntaxError: Unexpected token <

the code I use is
<script src="URL" type="text/javascript">
        </script>

It does not matter which URL I point too it just always gives that error.

A:
Uncaught SyntaxError: Unexpected token <

That means there's HTML markup in a JavaScript file.  So either the script tag you're showing us is in a JavaScript file, or the JavaScript file that it's referencing contains HTML.
When putting JavaScript code in an HTML file, you need to wrap it in script tags:
<script type="text/javascript">
    var foo = 'foo';
</script>

However, when putting JavaScript code in a JavaScript file, you don't need HTML tags.  Because it's not HTML:
var foo = 'foo';

Putting one kind of code in a file meant to be another kind of code results in a syntax error.


text:
Q: Plot multiple shapefile over multiple raster i am trying to plot same shapefile over multiple raster plot using the code below:
ras <- list.files("filepath", pattern = "\\.tif$", full=TRUE)
s <- stack(ras)
plot(s)
plot(world, add=TRUE)

Unfortunately, adding shapefile 'world' using the code below doesn't seem to work.
plot(world, add=TRUE)

Any help would be appreciated.
Thanks

A: I used to plot lots of rasters, and would plot data points, and overlay a map of the world to visualize my results.
I would plot my points first, and then add the map.  This sounds like what you want to do
I did not use the plot command twice though.  I would try
plot(s)
map(region="world", add=T)

Because I don't have access to your data, I cannot test this myself


text:
Q: Spring ResponseEntity - how to return HTTP 100 Continue Having rest services using Spring-boot 1.5.8.RELEASE some of the services may take time to process.
My idea is to use HTTP 100 Continue so the response will not time out and then return the final response.
I haven't find any way how to do that
Thanks for any hint


text:
Q: running playwright on bitbucket pipeline but doesn't generate html report and upload it to s3 server I'm trying to upload playwright html report with error only(probably without too) to s3 server using bitbucket pipeline.
I've searched for google and youtube, I can't find any solutions.
image: qawolf/playwright-ci:v1.0.0
pipelines:
  default:
    - step:
        name: Playwright Tests
        script:
          - npm install
          - npm init playwright@latest
          - npx playwright install
          - cd tests
          - cd staging
          - npx playwright test --reporter=html
          - cd ..
          - cd ..
          - cd playwright-report
          - mkdir "$(date +"%d-%m-%Y %I %M %p")"
          - mv index.html "$(date +"%d-%m-%Y %I %M %p")"
        artifacts:
          - playwright-report/*
    - step:
        name: Deploy to S3
        deployment: staging
        script:
          - pipe: atlassian/aws-s3-deploy:0.3.8
            variables:
              AWS_ACCESS_KEY_ID: 'CLASSIFIED'
              AWS_SECRET_ACCESS_KEY: 'CLASSIFIED'
              AWS_DEFAULT_REGION: 'CLASSIFIED'
              S3_BUCKET: 'CLASSIFIED'
              LOCAL_PATH: 'playwright-report'
              ACL: 'public-read'


text:
Q: Change value of all the properties on the class using generics in C# I need to change the values of the properties of a class in C# and I would like to have a generic method for it as it will be used for any class in my project.
Sample Classes (Entities):
    public class Apple
    {
       public string Name {get;set;}
       public string Value {get;set;}
       public int ID {get; set;}
    }

    public class Seller
    {
      public Guid Id {get; set;}
      public bool IsActive {get;set;}
    }

Dummy Get & Serialize methods:
var newApple = GetApple(1);

Serializing into JSON String gives me:

{
    "apple": {
      "id": 12345,
      "name": "Apple A",
      "value": "100"
    }
  }

var newSeller = GetSeller(new Guid());

Serializing into JSON String gives me:

{
    "seller": {
      "id": 12345,
      "isActive": false
    }
  }

Expected JSON after encryption:

{"apple": { "id": "A##VSDDSVDGFDG!@12321",
  "name": "SDD888#@##ASAS#40((!!AA",
   "value": "SSDSAD#$$$%^&#ADSAD)AA"                                             }}

I want the JSON to be in the above format where I want to encrypt the property values alone and not the property name. I tried using dynamics in C# but the property names are not being set in dynamic.
My Generic Method:
private List<object> EncryptPropertiesAlone<T>(T newObject)
{
{
Type type = newObject.GetType();
PropertyInfo[] properties = type.GetProperties();
List<object> myObjectList = new List<object>();
foreach (PropertyInfo property in properties)
{
var encString = this.EncryptString(property.GetValue(newObject, null)?.ToString());
var propertName = property.Name;
dynamic MyDynamic = new System.Dynamic.ExpandoObject();
MyDynamic.propertName = encString;
myObjectList.Add(MyDynamic);
}
return myObjectList;
}

Any ideas how this can be achieved? If there is any built in method in DOTNET which can achieve this? Thanks in advance.


text:
Q: Detect changes for complex object I have a BO with some dependent BO's (via navigation properties), which represent several linked tables in the database. For example, a Person main table, and Address, Education tables, linked via Person_Address, Person_Education tables, 1-to-many.
We need to track changes that occurs over the Person, Address, Education tables for the specific person. Any update in those three tables should update the Person.LastRecordUpdate date to the current date. I don't see any problems to track the Person table itself. However, we need to track changes in other two tables (Address, Education), which have the AddressId, EducationId PKs, and no PersonId (since they are linked with the primary table via intermediate tables). And saving in Address, Education happens in another dbcontext entity, that save of person. How can I resolve this?

A: I derive all of my business objects from a ModelBase that includes a public virtual DateTime? LastModified property.  It also implements the interface
public interface IHasLastModified
{
    DateTime? LastModified { get; set; }
}

Then I override SaveChanges() in my DbContext to look for anything being added or modified that implements IHasLastModified, and set the modified timestamp.
On a side note, EF is quirky about displaying DbEntityValidationException details in the debugger.  For that reason, in this code I also handle that
exception by building errorList that is straightforward to view in the debugger, and also log the details.  In my code, logger is an NLog logger.  You can
use any other logger, or remove that line.
public override int SaveChanges()
{
    try
    {
        DateTime now = DateTime.UtcNow;
        foreach (ObjectStateEntry entry in (this as IObjectContextAdapter).ObjectContext.ObjectStateManager.GetObjectStateEntries(EntityState.Added | EntityState.Modified))
        {
            //logger.Info("Setting LastModified on " + entry.Entity.GetType().FullName);
            if (!entry.IsRelationship)
            {
                IHasLastModified lastModified = entry.Entity as IHasLastModified;
                if (lastModified != null)
                    lastModified.LastModified = now;
            }
        }

        return base.SaveChanges();
    }
    catch (DbEntityValidationException valEx)
    {
        List<string> errorList = new List<string>();

        foreach (var error in valEx.EntityValidationErrors)
        {
            foreach (var entry in error.ValidationErrors)
            {
                errorList.Add(entry.PropertyName + ": " + entry.ErrorMessage);
            }

            logger.Error(string.Join(";", errorList));
        }
        throw;
    }
}

And saving in Address, Education happens in another dbcontext entity, that save of person.

It is very, very tricky to merge changes across multiple DbContext instances.  EF does not provide full support for all scenarios.
I strongly suggest avoiding this situation.  Pass a single instance of a DbContext around rather than attempting to merge changes from two DbContext images.
If you really want to try and manage changes that happen in two context instances, have a look at this writeup.  Note the concluding remark

As of today EF does not support of full object graph merging, and leaves that for you to manage on your own.


text:
Q: ¿Qué es memoización y cómo se usa? Tengo un programa para estudio de probabilidades que efectúa 10.000.000 de iteraciones. En cada iteración debe aplicar algunas pesadas formulas que incluyen el cálculo del factorial, y se está demorando mucho.
Me han dicho que debo aplicar memoización para reducir los tiempos de procesos.
¿Me podrían decir qué es y cómo lo uso?

A: Memoización es una técnica de optimización que evita recalcular resultados previamente obtenidos. Para esto, los resultados anteriores se almacenan; y cuando se pide un resultado ya calculado, se retorna el valor recordado, evitando recalcularlo.
La memoización se aplica a funciones que cumplan dos requisitos:

*

*Idempotentes. Es decir, funcion(n) siempre retornara el mismo valor para un n dado.

*Sin efectos secundarios. La función no debe alterar el ambiente externo. Por ejemplo, no puede cambiar variables globales, el contenido de archivos o bases de datos, imprimir, etc.

Una función memoizable sólo puede llamar a otras funciones memoizables.
Usaremos la función factorial para ejemplificar, partiendo de la implementación básica tradicional que usaremos como referencia:
def factorial(n):
    ''' Factorial basico
    '''
    if n > 1:
        fac = n * factorial(n - 1)
    else:
        fac = 1
    return fac

Memoización manual
Las funciones, como otros objetos, pueden tener atributos, los que pueden ser creados, consultados y modificados dinámicamente. Por ejemplo, un atributo predefinido es __doc__, que retorna el docstring de la función, así:
>>>print(factorial.__doc__)
Factorial basico

Otro atributo predefinido, que aprovecharemos aquí, es __dict__, un diccionario inicialmente vacío donde guardaremos los factoriales previamente calculado. La llave será el número de factorial y el valor, el factorial calculado.
Esta es la implementación manual:
def factorial_1(n):
    ''' Factorial memoizado manualmente.
    Los factoriales ya calculados se guardan en __dict__
    '''
    if n in factorial_1.__dict__:
        return factorial_1.__dict__[n]

    if n > 1:
        fac = n * factorial_1(n - 1)
    else:
        fac = 1

    factorial_1.__dict__[n] = fac
    return fac

Memoizacion con decoradores
La memoización manual tiene el inconveniente de agregar código a la función, lo que se puede prestar para confusiones y errores. Por supuesto, Python tiene una solución para eso: el decorador @lru_cache.
El uso no puede ser más simple: simplemente se agrega antes de la función, que ahora queda asi:
from functools import lru_cache

@lru_cache(maxsize=30)
def factorial_2(n):
    ''' Factorial con decorador
    '''
    if n > 1:
        fac = n * factorial_2(n - 1)
    else:
        fac = 1

    return fac

Lo que tenemos aquí es el factorial básico más el decorador.
@lru_cache tiene un argumento opcional, maxsize, que es una estimación del número de resultados a recordar. El valor por omisión es 128 resultados, y se puede aumentar si el problema manejara un mayor número de resultados posibles.
Demostración
Vamos a probar las tres versiones de factorial y perfilaras usando cProfile, que recibe una función, la ejecuta e imprime las estadísticas de tiempo, número de llamadas, etc.
Primero definimos la función que pondrá a prueba una versión de factorial. La función calcular recibe una versión de factorial y el número de veces que debe invocarla:
def calcular(funcion, limite):
    ''' Ejecuta una función un número de veces '''
    for n in range(limite):
        n = random.randrange(1, 30)
        fac = funcion(n)

y luego ejecutamos:
limite = 10_000_000  # Diez millones de ejecuciones
print("Ejecución sin memoización:")
cProfile.run("calcular(factorial, limite)")
print("---")
print("Ejecución con memoización manual")
cProfile.run("calcular(factorial_1, limite)")
print("---")
print("Ejecución con memoización por decorador")
cProfile.run("calcular(factorial_2, limite)")

lo que produce:
Ejecución sin memoización:
         191056920 function calls (51033737 primitive calls) in 49.410 seconds

Ejecución con memoización manual
         51034926 function calls (51034898 primitive calls) in 14.175 seconds

Ejecución con memoización por decorador
         41034155 function calls (41034129 primitive calls) in 11.722 seconds

Nota: sólo se muestra la primera línea de cada resultado para mayor claridad.
Como se aprecia, hemos reducido el tiempo de ejecución a la quinta parte simplemente agregando un decorador a nuestra función.


text:
Q: Admin stuck on loading when creating a new product some admin users whatever the role he has. when creating a new simple product Magento stocks loading the page without any HTTP request.
I tried these commands. setup:upgrade & setup:di:compile & setup:static-content:deploy nothing helps
Note: the problem is happening with some users on random devices, not a specific user or a specific device.

A: Can you please Check below things :
- Check broswer console on your network section may be dataprofider will display the error
- please try the below command
  $ php bin/magento indexer:reindex
- And it is still same then you can disable your custom module so you can get the issues (Please take the Backup of you DB)


text:
Q: EJB. When I call a Session Bean with var List throws: this javax.ejb.EJBException: java.rmi.MarshalException I created a java web project in netbeans, I created my entities beans and later deployed my project to generate my Database, this work was successful.
Then I generated my session beans to access the database created. I created a main class to test the session beans and when I tested the method "find" that I call through the session bean interface, I have noticed that some classes throws an exception, and I have noticed that the entities class  with vars List throws the exception as if they could not be serialized.
I want to bring me List of entities is a request.
I have the entities bean in the same project that have a my session beans, in a web application...
I worked with Glass Fish 3.1.2
Netbeans 7.1.2
EclipseLink 2.0
The Entity Persistence is:
@Entity

public class UserApplication implements Serializable {

private static long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idUserApplication;
@Basic(optional=false)
@Column(nullable=false)
private String dcn;
@Basic(optional=false)
@Column(nullable=false)
private String password;
@Basic(optional=false)
@Column(nullable=false)
private String title ;
@Basic(optional=false)
@Column(nullable=false)
private String firstName;
@Basic(optional=false)
@Column(nullable=false)
private String lastName;
@Basic(optional=false)
@Column(nullable=false)
private String ci;
@Basic(optional=false)
@Column(nullable=false)
private String personalEmail;
@Basic(optional=false)
@Column(nullable=false)
private String workEmail;

@OneToMany
@JoinColumn(name = "userApplication_id", nullable = false)
private List<Account> accounts;
@OneToMany
@JoinColumn(name = "userApplication_id", nullable = true)
private List<CreditCard> creditCards = null;

@ManyToMany
@JoinTable(name="UserApplication_BeneficiaryThird", joinColumns=@JoinColumn
        (name="userApplication_id", nullable = false), inverseJoinColumns=
        @JoinColumn(name="beneficiaryThird_id", nullable = false))
private List<BeneficiaryThird> beneficiariesThird = null;

@OneToMany
@JoinColumn(name = "userApplication_id_beneficiary", nullable = true)
private List<BeneficiaryBankItself> beneficiariesBankItself = null;

@ManyToMany
@JoinTable(name="UserApplication_TransactionRule", joinColumns=@JoinColumn
        (name="userApplication_id", nullable = false), inverseJoinColumns=
        @JoinColumn(name="transactionRule_id", nullable = false))
private List<TransactionRule> transactionRules = null;

@OneToOne(mappedBy = "userApplication", optional = true, cascade = CascadeType.ALL)
private SessionCookie cookieId = null;................

The Main Class is:
public class Main {

public static void main(String[] args) {

    long id = 2;

    bank.setId(id);
    UserApplication userApplication = GetBean.getUserFacade().find(id);
    System.out.println("user: " + userApplication.getFirstName());

    }

}

The GetBean is utility class, is:
public class GetBean {

public static BankFacadeLocal getBankFacade() {

    BankFacadeLocal bankFacade = null;
    String jndiName = beans.BankFacadeLocal.class.getName();
    try {
         //bankFacade = (BankFacadeLocal) new InitialContext().lookup("java:global/IntegrationBanking/BankFacade!sessionBeans.BankFacadeLocal");
          bankFacade = (BankFacadeLocal) new InitialContext().lookup(jndiName);
    } catch (NamingException ex) {
        Logger.getLogger(GetBean.class.getName()).log(Level.SEVERE, null, ex);
    }

    return bankFacade;
 }

 public static UserApplicationFacadeLocal getUserFacade() {

    UserApplicationFacadeLocal userFacade = null;
    String jndiName = UserApplicationFacadeLocal.class.getName();
    try {
         // userFacade = (UserApplicationFacadeLocal) new InitialContext().lookup("java:global/IntegrationBanking/UserApplicationFacade!beans.UserApplicationFacadeLocal");
         userFacade = (UserApplicationFacadeLocal) new InitialContext().lookup(jndiName);
    } catch (NamingException ex) {
        Logger.getLogger(GetBean.class.getName()).log(Level.SEVERE, null, ex);
    }

    return userFacade;
}

}
Peersistence Unit:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="BankingIntegrationPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>sqlServer</jta-data-source>
<properties>
  <property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>

The Exception is:
jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
Caused by: java.io.IOException: Mismatched serialization UIDs : Source (Rep. IDRMI:entities.UserApplication:5CDFA7C871B53786:F07C8D07E21B75FA) = F07C8D07E21B75FA whereas Target (Rep. ID RMI:entities.UserApplication:4357CF2703B83ACF:180694EF6A1B61BC) = 180694EF6A1B61BC
    at com.sun.corba.ee.impl.util.RepositoryId.useFullValueDescription(RepositoryId.java:679)
    at com.sun.corba.ee.impl.util.RepositoryId.useFullValueDescription(RepositoryId.java:639)
    at com.sun.corba.ee.impl.io.ValueHandlerImpl.useFullValueDescription(ValueHandlerImpl.java:360)
    at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)........
jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: ORBIO00013: Stream corrupted
java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
Caused by: java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)...........
Exception in thread "main" javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is:
    org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at beans._BeneficiaryBankItselfFacadeLocal_Wrapper.find(beans/_BeneficiaryBankItselfFacadeLocal_Wrapper.java)....................
Caused by: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is:
    org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:267)...........
Caused by: org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)..................
Caused by: java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)....................

A: I may be off in my answer, but I experienced this issue and resolved it.  For me, the issue was simply that my database was not connected!  I tested this in Glassfish, confirmed the database connectivity issue and fixed it, and then this error went away.
As far as understanding why this is the cryptic error message we get, the following explanation may help:

*

*First, entity beans (which are now superseded by using Java Persistence API) are a type of EJB and therefore are run in the EJB container.

*Your main class exists outside the EJB container and must therefore "invoke" an EJB.  It does this by using CORBA, the Common Object Request Broker Architecture

*CORBA is built around the idea that you can remotely instantiate and manipulate objects.  For example,  you can create an EJB instance, set its member properties, run its methods, all from your main method which is outside the EJB container.  CORBA is a general standard that in theory any "client" can use (e.g. a C++ program that makes a CORBA-compliant call could theoretically work here.  But of course, most of us in the Java world are just using CORBA to get access to the EJB container.

*The particular error you got is ORBIO00013: Stream corrupted, which I do not fully understand, but I take it to mean that your main program successfully connected to the EJB container, the EJB container threw an exception and then returned something that CORBA did not expect, and this corrupted the stream used to send the response.

*The real issue is that CORBA didn't do a very good job handling the exception thrown in the EJB so the only way you can resolve this is to debug your program and find where in the EJB the exception is thrown, then look at the exception directly in the debugger.

Doing all of this ultimately helped me to understand that a simple database connection issue (!) was the problem.
Hope this helps,
Josh


text:
Q: Сделать невозможным скачивание Видео файла Wordpress Пробовал через .htaccess deny from all но понял что не подходит!
Понимаю что видео в любом случае можно достать, как сделать так, что бы через Network нельзя было выдрать его?
Как это реализовать - видел что такое возможно...


text:
Q: Loading an FPGA image with SelectMap As of now, I have been programming my Xilinx Spartan 6 using JTAG. I now want to load the FPGA image using SelectMap with my STM32 processor. (See this document (pages 33ff) for more information about SelectMap on the Spartan 6.)
At the moment I have a .bit file, and I'm loading one bit every clock cycle. I've been told that the .bit file may have to be converted to a .bin file somehow, and that the loading sequence should end with some "extra" clock cycles.
Neither of these points seems to be mentioned in the linked document. Should I convert my .bit file to a .bin file? Should I have "extra" clock cycles after loading the FPGA image?

A: You need the script bitformat.pl to convert bit to bin.
Select MAP is via a processor. You wish to look at XAPP502. In p. 4 is say you can use the .bit file if you skip the header. The bin file has no header information. Xilinx recommends .bin or .hex.

A: You can tell bitgen to produce a .bin output instead of or as well at a .bit output.  They are the same file, but the .bit one has a header on it.
In the old days, loading in some extra 0xFFs at the end of the real bitstream was found to be helpful, but I don't think it matters now.
[You can actually load the .bit file (using slave serial mode anyway) as the FPGA waits for a sync word (which is not part of the header) before it starts configuring.]


text: Q: How to create a new index and add properties in elasticsearch? I am new for elastic search. I have installed and started elastic search in windows. now, how to create new index and how to add new properties in elastic search.


text:
Q: Issue with file upload form So I'm building this control panel, and on one of the pages i've included a file upload input so the user could upload image.
The thing is, when I'm trying to upload an image called "jappinner.jpg" for an example, it works perfectly, but when I'm trying to upload an image called "ELECTRIC_2WAY_PLASTIC_WITH-Z.jpg" the form just crashes and no $_POST variables are posted to the action page.
I'm stuck with this issue for a while now, and I really can't figure it out..
Heres the form code :

<form method="post" enctype="multipart/form-data" name="submit" action="manage.php?page=products">
  <input type="hidden" name="new_product">

    Product Name
    <input type="text" name="product_name" class="form-control" id="exampleInputEmail1" placeholder="Enter product name..">

    Image

  <input type="file" name="photo" id="photo" />

    Catalog

  <input type="file" name="catalog" id="catalog" />

    Product Drawing

  <input type="file" name="product_drawing" id="product_drawing" />

    Technical Information

  <input type="file" name="technical_information" id="technical_information" />

    Product Category
  <select id="category" name="category" class="form-control">
  <option value="agriculture">Agriculture</option>
  <option value="waterworks">Waterworks</option>
  <option value="fire_protection">Fire Protection</option>
  <option value="accessories_pilots">Accessories / Pilots</option>
</select>

    Sub Category
  <select name="sub_category" class="form-control">
  <option value="agriculture">Metal Valves</option>
  <option value="waterworks">Plastic Valves</option>
</select>

    Sub Category
  <select name="sub_category" class="form-control">
  <option value="agriculture">Metal</option>
  <option value="waterworks">Plastic</option>
</select>

    Product Description
 <textarea name="description" class="form-control" rows="10" placeholder="Enter product description here.."></textarea>

  <button type="submit" name="submit" class="btn btn-primary">Add Product</button>
  Cancel
</form>

Heres the PHP code :
 if(isset($_POST['new_product'])) {

 function replaceAll($string, $array = array(), $rpl) {
 foreach($array as $value) {
 $string = str_replace($value, $rpl, $string);
 }
 return $string;
 }

$slogen = replaceAll($_POST['product_name'], array('#', ' ', "'", ':', '"', '_', '&', '/', '?', ')', '('), '_');
$slogen = replaceAll($slogen, array('--'), '_');

$columns = array('name', 'slogen', 'category', 'sub_category', 'description');
$values = array($_POST['product_name'], $slogen, $_POST['category'], '', $_POST['description']);
$db->Add('products', $columns, $values);
$new_product_id = $db->ID;

include "../core/plugins/flourish/init.php";

// Product Picture
if(isset($_POST['photo'])) {
$uploader = new fUpload();
$uploader->setMIMETypes(array('image/gif','image/jpeg','image/jpg','image/pjpeg','image/png'),'The file uploaded is not an image');
$file = $uploader->move('../dist/images/products/', 'photo');
$columns = array("file", "role", "product_id");
$values = array("dist/images/products/".$uploader->final_name, "image", $new_product_id);
$db->Add("product_files", $columns, $values);
}

// Product Catalog
if(isset($_POST['catalog'])) {
$uploader = new fUpload();
$uploader->setMIMETypes(array('application/pdf'),'The file uploaded is not an PDF');
$file = $uploader->move('../dist/files/', 'catalog');
$columns = array("file", "role", "product_id");
$values = array("dist/files/".$uploader->final_name, "catalog", $new_product_id);
$db->Add("product_files", $columns, $values);
}

// Product Product Drawing
if(isset($_POST['product_drawing'])) {
$uploader = new fUpload();
$uploader->setMIMETypes(array('application/pdf'),'The file uploaded is not an PDF');
$file = $uploader->move('../dist/files/', 'product_drawing');
$columns = array("file", "role", "product_id");
$values = array("dist/files/".$uploader->final_name, "product_drawing", $new_product_id);
$db->Add("product_files", $columns, $values);
}

// Product Technical Information
if(isset($_POST['technical_information'])) {
$uploader = new fUpload();
$uploader->setMIMETypes(array('application/pdf'),'The file uploaded is not an PDF');
$file = $uploader->move('../dist/files/', 'technical_information');
$columns = array("file", "role", "product_id");
$values = array("dist/files/".$uploader->final_name, "technical_information", $new_product_id);
$db->Add("product_files", $columns, $values);
}

//redirect("manage.php?page=products&msg=new_product_success");

}

A: We're dealing with $_FILES here and not $_POST.
You need to change
if(isset($_POST['photo']))

to
if(isset($_FILES['photo']))

and do the same for all the other ones.
Reference:

*

*http://php.net/manual/en/features.file-upload.post-method.php
Add error reporting to the top of your file(s) which will help find errors.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// rest of your code

Sidenote: Displaying errors should only be done in staging, and never production.

*

*If it's crashing, check your logs.

Also make sure the folder(s) have proper permissions to write to it.

Another thing, your form tag contains name="submit" as does your submit button; that would be a conflict.
Plus, forms do not hold the name attribute, and should be removed from it.


text:
Q: Fade To Black When iPhone is Set Face Down As a new AppDeveloper, I've never used orientation. So, I would like to try to learn with a simple task. What I want to do is have the screen fade to black when the device is set face down. Is that something that would be simple to do, that perhaps somebody could assist me in, or provide helpful information?
Thanks! :D
Your help  is appriciated

A: You can use orientation (using the XYZ values when the screen is face down). I do not recommend this, because your screen will fade out even if a user is using the app while lying down, and staring up at the screen.
There is an easier and cleaner way. Notice how during phone calls, having the phone close to your ear blacks out the screen?
You can access that property by monitoring the proximityState property of UIDevice. Details here
Doing something like:
BOOL closeToUser = [[UIDevice currentDevice] proximityState];

will assign a YES to closeUser when the device is face down on a surface of some kind, and a NO when it is not
If the value is YES, you can invoke code to do whatever you want.


text:
Q: Visual Studio 2013 Report Definition is not valid using RDLC report i cant build my reports anymore, i have no ides what might have changed.
i am referencing the C:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer\ dll, and still i get this errer :
Error 24 The report definition is not valid.
Details: The report definition has an invalid target namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
which cannot be upgraded.

i have tried alot of things, but just wont work (some links i used) :
Visual Studio 2010: The report definition is not valid. Details: The report definition has an invalid target
http://beatheadagainstwall.blogspot.com/2011/03/invalid-target-namespace-when-deploying.html
Visual Studio 2013 Crashed While add a DataSet in RDLC report
if anyone can please give me an idea how to get this to work please help ive been struggeling 2 days with this issue.

A: RDLC report was generated in VS2008 and you are trying to compile in VS2013 which is not a valid schema definition for VS2013.
Compile in VS2008 or upgrade you rdlc report from VS2008 to VS2013.


text:
Q: JQuery vertical scroller I am trying to recreate the effect seen on this site: http://zipdesign.co.uk/New-State-Entertainment. I have a basic understanding of how it works but am having trouble applying it to the site I am working on. Any help would be greatly appreciated.

A: Without looking at the source of that particular site, I'd imagine it's using the jquery scrollTo plugin.
This essentially allows you to call $(selector).scrollTo() and the page with smoothly scroll to the selected element.

A: Check this :
http://plugins.jquery.com/plugin-tags/news-scroller


text:
Q: Pasting from Windows host to Ubuntu 18.04 LTS Guest So I tried a few things so the iso tools
Guest additions image

sudo apt-get install virtualbox-guest-dkms

However non of these seem to work, I tried a few solutions. I need to copy a vpn certificate and I really can't type it by hand.


text:
Q: AAPT: Attribute "layout_anchorGravity" already defined with incompatible format. AND 25.0.3\aapt.exe'' finished with non-zero exit value 1 I have a cordova app project in Visual studio 2017 that has been building fine up until now. No changes had been made to the project.
Now we are getting this build errors:
1>MSBUILD : cordova-build error : C:\Users\Adam.Akers\Documents\Visual Studio 2015\Projects\BCA\HH\BcaView\platforms\android\build\intermediates\res\merged\debug\values\values.xml:173: AAPT: Attribute "layout_anchorGravity" already defined with incompatible format.
1>MSBUILD : cordova-build error : C:\Users\Adam.Akers\Documents\Visual Studio 2015\Projects\BCA\HH\BcaView\platforms\android\build\intermediates\res\merged\debug\values\values.xml:172: AAPT: Original attribute defined here.
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : Execution failed for task ':processDebugResources'.
1>MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\ProgramData\Microsoft\AndroidSDK\25\build-tools\25.0.3\aapt.exe'' finished with non-zero exit value 1
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M

Any help would be great. I have removed plugins and check the version of the SDK and we have changed nothing

A:
AAPT: Attribute "layout_anchorGravity" already defined with incompatible format. AND 25.0.3\aapt.exe'' finished with non-zero exit value 1

According to the error info "AAPT: Attribute "layout_anchorGravity" already defined with incompatible format.", it seems you have defined a custom attribute named layout_anchorGravity in your application code that conflicts in some manner with the android-namespaced font attribute introduced in Android O. Try renaming or removing that custom attribute, like:
<declare-styleable name="AATextView">
    <attr name="layout_anchorGravity" format="string"/>
</declare-styleable>

To
<declare-styleable name="AATextView">
    <attr name="typeface" format="string"/>
</declare-styleable>

Certified: Error : Attribute "font" already defined with incompatible format
Hope this helps.


text:
Q: Resource interpreted as Document but transferred with MIME type application/csv I have a button that downloads a CSV file.
The file seems to download fine but, I get the following warning.
This warning seems to only appear in chrome.

Resource interpreted as Document but transferred with MIME type application/csv:

This is where I set the CSV header.
/**
* Set the PHP mime header
*
* This will overwrite any previous headers
*
* @param string $header any custom headers that need to be set
*
* @return void
* @access public
*/
function setHeader($header='')
{
    if ($header) {
        // set custom headers
        header($header);
    } else {
        header('Content-Type: application/csv');
        header('Content-Disposition: attachment; filename="'.$this->_filename.'";');

        //This is known that Internet Explorer has problems with SSL connection (https).
        //http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
        //http://support.microsoft.com/default.aspx?scid=kb;en-us;316431
        // do not send no cache header in https for IE

        // get protocol information
        $url_info = parse_url(current_url());
        $protocol = (isset($url_info['scheme'])) ? $url_info['scheme'] : NULL;
        $using_ie6_8 = isset ($_SERVER['HTTP_USER_AGENT']) ? preg_match('/(MSIE\s[0-8]+\.)/', $_SERVER['HTTP_USER_AGENT']) : FALSE;
        if (!is_null($protocol) && $protocol == 'https' && $using_ie6_8) {
            header('Cache-Control: private, max-age=0, must-revalidate');
            header('Pragma: private');
            header('Expires: '.gmdate('D, d M Y H:i:s', time()-3600).' GMT');

        }

    }

}//end setHeader()

response header
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:keep-alive
Content-Disposition:attachment; filename="submission_log.csv";
Content-Type:application/csv
Date:Thu, 22 Sep 2016 04:59:06 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:openresty
Transfer-Encoding:chunked
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN

request header
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:6252
Content-Type:multipart/form-data; boundary=----WebKitFormBoundary4CxCF8KLzdtoGRO2
Cookie:lastSelectedLinkId=2661; lastSelectedAssetId=2151; SQ_SYSTEM_SESSION=o44hori3h2fcu5ltm29u6rv2k44bq1tu6v3364pdi8jn273scebnjm3lsuik5teasneeh664j98o3ajbur6p39kque68qgjohkktsk3; _ga=GA1.2.545099348.1472451817
Host:matrixdev.squiz.net
Origin:http://matrixdev.squiz.net
Referer:http://matrixdev.squiz.net/_admin/?SQ_BACKEND_PAGE=main&backend_section=am&am_section=edit_asset&assetid=2151&sq_asset_path=70%2C2151&sq_link_path=71%2C2661&asset_ei_screen=log
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

A: if you have link inside <a> to download csv file, add "download" attribute to <a>.


text:
Q: ImageMagick no encode delegate I used to be able to convert text to an image using ImageMagick but now I get this error message:
$ echo text | convert -background none text:- file
convert: no encode delegate for this image format `TEXT' @ error/constitute.c/WriteImage/1167.

ImageMagick was installed using Homebrew
imagemagick: stable 7.0.7-10 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/7.0.7-10 (1,523 files, 23.1MB) *
  Poured from bottle on 2017-11-10 at 15:46:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb

A: In IM 7, convert is replaced by magick. You also have not specified an output image format for "file". Try this:
echo "text" | magick -background none text:- file.png

or
echo "text" | magick -background none text:- PNG32:file

That works for me on IM 7.0.7.10 Q16 Mac OSX
What do you get from
magick -version

Does it include freetype?
If not, then you probably need to install Freetype with ImageMagick via Homebrew


text:
Q: Working with Centroids The question is as follows:

Points $D$ and $E$ are marked on segments $AB$ and $BC$, respectively. When segments $CD$ and $AE$ are drawn, they intersect at point $T$ inside triangle $ABC$. It is found that segment $AT$ is twice as long as segment $TE$, and that segment $CT$ is twice as long as segment $TD$. Must $T$ be the centroid of triangle $ABC$?

I don't know where to start from. Please help!

A: Yes, since $ATC\sim ETD$ with coefficient of similarity $k=2$ we have that $AC||DE$ and $DE=AC/2$ so $DE$ is middle line and thus conclusion.
If it is easier to you, look at homothety at $T$ which takes $A$ to $E$. Then it takes $C$ to $D$ and thus $AC||DE$ and $DE=AC/2$ again...

A: hint:
let $[ABC]$ denote are of triangle
$[ABT] = \frac{[ABC]}{3}$ similarly $[BTC] = \frac{[ABC]}{3}$
So, we get $[ATC] = \frac{[ABC]}{3}$


text:
Q: Are there spaces "smaller" than $c_0$ whose dual is $\ell^1$? It is well known that both the sequence spaces $c$ and $c_0$ have duals which are isometrically isomorphic to $\ell^1$. Now, $c_0$ is a subspace of $c$. My question - is there an even smaller subspace of $c$ whose dual is isometrically isomorphic to $\ell^1$? More generally, is there a characterization of preduals of $\ell^1$? References are most welcome.

A: Preduals of $\ell_1$ are very interesting creatures. The question is slightly ill-posed but let me comment on that anyway.
We have quite a lot of isometric preduals of $\ell_1$. Indeed, for any countably infinite ordinal number $\alpha$ (endowed with the order topology) we have $C_0(\alpha)^* \cong \ell_1$. This essentially follows from the Riesz–Markov–Kakutani representation theorem as every measure on such a space has to be atomic.
Note that $c_0 = C_0(\omega)$ and $c=C(\omega+1)$ are isomorphic. Actually for each $\alpha\in [\omega, \omega^\omega)$ we have $C_0(\alpha) \cong c_0$. However, there exist $\aleph_1$ many countable ordinals which give pair-wise non-isomorphic Banach spaces. To be more precise, if $\alpha, \beta$ are countable ordinals then $C(\omega^{\omega^\alpha}+1)$ and $C(\omega^{\omega^\beta}+1)$ are isomorphic if and only if $\alpha = \beta$.
Historically, the first example different from the above-mentioned ones was due to Y. Benyamini and J. Lindenstrauss:

Y. Benyamini and J. Lindenstrauss. A predual of $\ell_1$ which is not isomorphic to a $C(K)$ space, Israel J. Math. 13 (1972), 246–254.

Johnson and Zippin proved that every isometric predual is a quotient of $C(\Delta)$, where $\Delta$ is the Cantor set.

W.B. Johnson and M. Zippin, Every separable predual of an $L_1$-space is a quotient of $C(\Delta)$, Israel J. Math. 16 (1973), 198–202.

This result combined with an old result of Pełczyński

A. Pełczyński, Banach spaces on which every unconditionally converging operator is weakly compact, Bull. Acad. Pol. Sci. Ser. Math. Astr. Phys. 10 (1962), 265–270.

asserting that an operator $T\colon C(K)\to X$ is weakly compact if and only if it is not bounded below on any isomorphic copy of $c_0$ yields the following corollary:
Corollary. Each isometric predual of $\ell_1$ contains a subspace isomorphic to $c_0$.
In some sense this answers OP's question.
One may wonder whether the Cantor set in the statement of the Johnson–Zippin theorem may be replaced by a countable compact Hausdorff space. This is not the case as shown by D. Alspach:

D. E. Alspach, A $\ell_1$-predual which is not isometric to a quotient of $C(\alpha)$, Contemp. Math. 144, Amer. Math. Soc., (1993), 9–14.

On the other hand, Gasparis constructed some new preduals of $\ell_1$ which are quotients of $C(\alpha)$:

I. Gasparis, A class of $\ell_1$-preduals which are isomorphic to quotients of $C(\omega^\omega)$, Studia Math. 133 (2) (1999), 131–143.

Since there is no characterisation of complemented subspaces of $C(K)$-spaces, this result is also noteworthy:

I. Gasparis, A new isomorphic $\ell_1$ predual not isomorphic to a complemented subspace of a $C(K)$ space, Bull. London Math. Soc. 45 (2013), 789–799.

If you are interested in spaces whose dual space is only isomorphic to $\ell_1$ then the situation is even more exciting. J. Bourgain and F. Delbaen constructed isomorphic preduals without subspaces isomorphic to $c_0$:

J. Bourgain and F. Delbaen, A class of special $\mathscr{L}_\infty$-spaces, Acta Math. 145 (1980), 155–176.

A recent variation of the BD construction is the famous Argyros–Haydon space which is an isomorphic $\ell_1$-predual with the property that each operator on this space is of the form $cI + K$, where $c$ is a scalar and $K$ is a compact operator.

S.A. Argyros and R.G. Haydon, A Hereditarily Indecomposable $\mathscr{L}_\infty$-space that solves the scalar-plus-compact problem, Acta Math. 206 (2011), no. 1, 1–54.

Even more recently, Spiros A. Argyros, Ioannis Gasparis and Pavlos Motakis constructed a $c_0$-asymptotic $\ell_1$-predual without copies of $c_0$:

S.A. Argyros, I. Gasparis and P. Motakis, On the structure of separable $\mathcal{L}_\infty$-spaces, Mathematika 62 (2016), no. 3, 685–700.

A nice overview of the BD-spaces (and some new variants of the Argyros–Haydon space) can be found in Matt Tarbard's PhD thesis:

M. Tarbard, Operators on Banach Spaces of Bourgain–Delbaen Type, PhD Thesis, University of Oxford, 2012.

I would also recommend the following paper by M. Daws, R. Haydon, Th. Schlumprecht and S. White

M. Daws, R. Haydon, Th. Schlumprecht, and S. White, Shift invariant preduals of $\ell_1(\mathbb{Z})$, Israel Journal of Mathematics, 192 (2012), 541–585.

which explains these subtleties very well.
Laustsen and myself have exhibited a version of the Argyros–Haydon space whose algebra of bounded operators has certain peculiar properties:

T. Kania and N.J. Laustsen, Ideal structure of the algebra of bounded operators acting on a Banach space, Indiana University Mathematics Journal 66 (2017), 1019–1043.

Let me finish with an open problem (I think) which I like very much:
Problem. We can easily construct $\aleph_1$ many isometric preduals of $\ell_1$. Can we construct in $\mathsf{ZFC}$ continuum many isometric preduals of $\ell_1$?


text:
Q: what general physical arguments discredit induced emission of nuclei? trying to read a bit about "quantum nucleonics", i've encountered this rebuttal from people at Livermore that induced radiation stimulation of Hafnium nuclei is possible. Something that catches my eye is the phrase "The earlier reports were also very unlikely, in any case, on very general physics arguments".
Question: what 'very general physics arguments' may have referred the author?

A: This is just the separation in energy scales of the X-ray and $\gamma$-ray emissions. For the nucleus, an x-ray is essentially a slowly varying static electromagnetic field, the wavelength is much longer than the object, and the static electromagnetic field doesn't affect the decay process by any appreciable amount.


text:
Q: Почему не правильно отображается css? Прстой акардеон. Хочу при раскрывающем списке разбить на две колонке
Но при использовании float:left .col-md-6{width:33;float:left}
Оно западает за другой пункт
Показано в демо

(function () {
    'use strict';
    $('.accordion').on('click', '.titlle', function (event) {
        event.preventDefault();
        $('.titlle').not($(this)).siblings('.content').slideUp('normal');
        $('.titlle').not($(this)).removeClass("active");
        $(this).siblings('.content').slideToggle('normal');
        $(this).toggleClass("active");
    });
    $('.accordion .content').hide();
    $('.accordion .active').next().slideDown('normal');
})();
section.accordion {
    margin: 0 0 15px 10px;
    padding: 1px 1px;
}
.titlle {
    background: #fff none repeat scroll 0 0;
    border: 1px solid #ddd;
border-radius: 30px;
    color: #333;
    display: block;
    font-size: 18px;
    font-weight: 600;
       padding: 8px 20px 10px 52px;
    position: relative;

}
.col-md-6{width:33;float:left}
.titlle a{color:#000!important;}
.active  {
    background: #ffb900 none repeat scroll 0 0;
    border: 1px solid transparent;
    border-radius: 30px;
    color: #fff;
    transition: all 0.3s ease 0s;
}
.active a{color:#fff!important;}

.content p {
    border-left: 1px dashed #8c8c8c;
    padding-left: 25px;
}
   .content {padding: 20px 10px;}

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">

Главная

текст текст
тексттекст

текст текст
тексттекст

лектрическая

Renewal of Mission Labour Card (Application+ Submission) 3

A: div с классом row пропущен, да и в этом варианте float: left не нужен

(function() {
  'use strict';
  $('.accordion').on('click', '.titlle', function(event) {
    event.preventDefault();
    $('.titlle').not($(this)).siblings('.content').slideUp('normal');
    $('.titlle').not($(this)).removeClass("active");
    $(this).siblings('.content').slideToggle('normal');
    $(this).toggleClass("active");
  });
  $('.accordion .content').hide();
  $('.accordion .active').next().slideDown('normal');
})();
section.accordion {
  margin: 0 0 15px 10px;
  padding: 1px 1px;
}

.titlle {
  background: #fff none repeat scroll 0 0;
  border: 1px solid #ddd;
  border-radius: 30px;
  color: #333;
  display: block;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 20px 10px 52px;
  position: relative;
}

.col-md-6 {
  width: 33;
}

.titlle a {
  color: #000!important;
}

.active {
  background: #ffb900 none repeat scroll 0 0;
  border: 1px solid transparent;
  border-radius: 30px;
  color: #fff;
  transition: all 0.3s ease 0s;
}

.active a {
  color: #fff!important;
}

.content p {
  border-left: 1px dashed #8c8c8c;
  padding-left: 25px;
}

.content {
  padding: 20px 10px;
}

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">

Главная

        текст текст тексттекст

        текст текст тексттекст

лектрическая

    Renewal of Mission Labour Card (Application+ Submission) 3


text:
Q: How to post data from jquery to webapi (mvc4.0)? I am trying to call below request from cross domain on local machine. It calls but at serverside it could not found passed values in function parameters. I am using MVC4 WebAPI.
$.ajax({
    url: 'http://localhost/webapp1/api/TicketAPI/GetTicketsByFilter',
    type: 'POST',
    dataType: 'jsonp',
    data: {
        Condition: '2',
        StartDate: 's',
        EndDate: 's',
        Priority: '2',
        Status: '2',
        Category: 's',
        PageNumber:1,
        PageSize: 10,
        OrderBy: 's',
        OrderDir: 'asc'
    },
    crossDomain: true,
    contentType: "application/json; charset=utf-8",
    success: function (data) {
        debugger;
        alert(data);
        // result = JSON.parse(data.lstRecords);
        // $(result).each(function (e) {
        //     var p = new Date(this["CreatedOnUtc"]);
        //     $("#list").addRowData(e, this);
        // });
    },
    error: function () {
        alert('fine');
    }
});
}

//below is the serverside code .

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//using System.Web.Mvc;
using CS.Services.Tickets;
using CS.Core;
using System.Data.SqlClient;
using System.Data;
using CS.Services;
using System.Web.Http;
using CS.Web.Utility;
using System.Security.Cryptography;
using System.Configuration;

public TicketSearchResult GetTicketsByFilter(SearchParameter ObjParameter)
{
    //I always found ObjParameter is null .It should have some values
    //some code here/
}

How to post values in ObjParameter so that it has values instead of null.?
 public class SearchParameter
    {
       public SearchParameter()
       {
        PageNumber = 1;
        PageSize = 100;
        OrderBy = "TicketID";
        OrderDir = "ASC";
    }

    public string Condition { get; set; }
    public string StartDate { get; set; }
    public string EndDate { get; set; }
    public string Priority { get; set; }
    public string Status { get; set; }
    public string Category { get; set; }
    public int PageNumber { get; set; }
    public int PageSize { get; set; }
    public string OrderBy { get; set; }
    public string OrderDir { get; set; }
}

A: You have to check if your json object has all the fields (and the same type) as SearchParameter class.
Then, you can make a call like this:
 $.ajax({
        url: 'http://localhost/webapp1/api/TicketAPI/GetTicketsByFilter',
        type: 'POST',
        data:JSON.stringify({ Condition: '2', StartDate: 's', EndDate:'s',Priority: '2', Status: '2', Category: 's',PageNumber:1,PageSize:10,OrderBy:'s',OrderDir:'asc' }),
        contentType: "application/json;charset=utf-8",
        success: function (data) {
            //your code
        },
        error: function (x, y, z) {
            alert(x + '\n' + y + '\n' + z);
        }
    });


text:
Q: Power Bi linked with Twitter Im quite new using Power Bi and im also not a programmer, so im facing some problems with the integration between Twitter and Power Bi.
I found this code (below) to integrate these two programs, but it has a limit of 100 rows. To increase this, i need to work with pagination (https://developer.twitter.com/en/docs/ads/general/guides/pagination).
However, as i said, my knowledge in this field is almost 0!
Does anyone knows what i need to change in this code?
Tks in advance!
http://chris.koester.io/index.php/2015/07/16/get-data-from-twitter-api-with-power-query/

A: I don't think you need any code for this.
The easier solution is connecting twitter to power bi using a third-party connector.which should be seemlingsly easy.
But you can also create an app following this link https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api
and after use the API URL and secret key in Get data -> From web and add it in the box that appears


text:
Q: How to create table in database automatically using C# Whenever the new user logs in to his registered account, at that time I need to create a table automatically for his account & it has to access the user name as the table name using C# coding. Because I want to add product details into cart like online shopping sites. If user login into their account what are the details available in the cart should display in their page..  is there is any other way to add product details into cart....

A: You shouldn't create a new table for each user. Instead create a single user table where you store user-specific data (such as username, email, etc.). Then for any type of item that you want to associate with a user, such as purchase items, create a foreign key to the user table. You may want to read up on the basics of relational/SQL database design first.

A: Online shopping cart is the temporary data in the current user session, I think you don't need to create table to stored that data. You just create a session variable (DataTable) to stores data of online shopping cart.


text:
Q: How to return 2 sets in one cypher query with a null filter So I am trying return 2 sets from a single cypher query:
Given parent nodes are in the index, then

*

*children of parent nodes

*childless parent nodes.

I was able to get a similar query that returns parents that are in the index in one set and their children in another set like the following
START Parents = node:app_fulltext('name:"City"'),
 MATCH Parents-[?:ChildOf]-Apps
 RETURN collect(Apps.Title), collect(Parents.Name);

==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name)                  |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"]   | ["Empty City 3D","Empty City 3D Fake"] |
==> +--------------------------------------------------------------+

This is close to what I want.  However, I want to filter out from Parents.Name those items that already have Children in the Apps.Title collection.
This is the result set I'd like to get.  "Empty City 3D Fake" does not have any children so it is returned in Parents.Name.
==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name)                  |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"]   | ["Empty City 3D Fake"]                 |

When I just added the Where r is null clause it returned nothing, so I ended up having to add two identical start Parent sets (Parents and Parents2) to do this.  However, that looks really cludgy so I was hoping there was a better way.
START Parents = node:app_fulltext('name:"City"'),
      Parents2 = node:app_fulltext('name:"City"')
      MATCH Parents-[r?:ChildOf]-Children, Parents2-[:ChildOf]-Apps
      Where r is null
      return collect(Apps.Title), collect(Parents.Name);

==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name)                  |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"]   | ["Empty City 3D Fake"]                 |
==> +--------------------------------------------------------------+

A: Can you try this -
START Parents = node:app_fulltext('name:"City"'),
 MATCH Parents-[?:ChildOf]-Apps
 WITH collect(Apps.Title) as myapps, collect(Parents.Name) as myparents
 RETURN myapps, filter(x in parents : not x in myapps) as myfilteredparents


text:
Q: parameters on the basis of which a particular n-tier architecture is chosen What are the parameters on the basis of which a particular n-tier architecture is chosen for an application.

A: Architecture (in general, not only n-tier) is chosen basing on a set of quality attributes required for a particular application/system. The list of attributes differs slightly in each of the architectural frameworks, most of them however is focused around:
End User's view

*

*Performance

*Availability

*Usability

*Security

Developer's view

*

*Maintainability

*Portability

*Reusability

*Testability

Business Community view

*

*Time To Market

*Cost and Benefits

*Projected life time

*Targeted Market

In addition, in most cases there are some strictly technical/infrastructural concerns involved, like legacy systems.
You can find some helpful information in this article about quality attributes.


text:
Q: C# Dynamic created dropdownlist not binding after FormView Update I am having trouble getting my dropdownlist to populate after I update the sqldatasource or change FormView Modes.  The dropdown is created from an array in the code behind.  I will post the snips of code below.  The dropdown binds as expected until these events.
Any assistance in why this does not work would be awesome.
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" DataSourceID="tbl_PreRegistration"
    Width="100%" CssClass="c2wForm" DefaultMode="Edit">
<EditItemTemplate>
    <asp:DropDownList ID="stateDDL" runat="server" OnSelectedIndexChanged="State_DDL_SelectedIndexChanged"
                                CausesValidation="false" AutoPostBack="true">
                            </asp:DropDownList>
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
            Text="Update" CssClass="button blue" />
         <asp:LinkButton ID="btnReset" runat="server" CausesValidation="False"
             Text="Cancel" CssClass="button white" OnClick="btnReset1_Click" />
             </ContentTemplate></asp:UpdatePanel>
    </EditItemTemplate>
</asp:FormView>

CODE BEHIND:
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            populateStateDDL("stateDDL", "CA");
        }
    }

protected void populateStateDDL(string DDL_ID, string getCurrentValue)
    {
        DropDownList strDDL_ID = (DropDownList)FormView1.FindControl(DDL_ID);
        ArrayList states = new ArrayList();

        strDDL_ID.DataValueField = "Value";
        strDDL_ID.DataTextField = "Text";
        strDDL_ID.DataSource = formating.GetAllStates();
        strDDL_ID.DataBind();
        strDDL_ID.SelectedValue = getCurrentValue.ToUpper();
    }

A: you need to create the control every time, not just when postback = false. the control should be rendered in the Init event so that it can then be wired into viewstate and all that other webforms stuff.
here is some pseudo-code
private DropDownList ctrl;

protected override void Init(EventArgs e)
{
      base.Init(e);

      ctrl = new DropDownList
              {
                   Id = "name of control",
                   DataValueField = "Value",
                   DataTextField = "Text"
              };

      Controls.Add(ctrl);
}

protected override void Load(EventArgs e)
{
      base.Load(e);

      if(ispostback) return;

      ctrl.DataSource = GetData();

      DataBind();
}


text:
Q: Rails - NoMethodError undefined method I am working on building an application (following Michael Hartl's chapter 11) where users can follow projects that are created by other users.
I created a ProjectRelationship model to hold two components: follower_id for the users and projectuser_id for the projects. The foreign keys have been set up as such.
Right now, my _follow_form.html.erb page renders "follow" or "unfollow" depending on whether the current_user is following the project. I have attached my code below.
Right now, the follow button is generated on each project show page. After I click the button follow that is generated by _follow.html.erb, it follows the project accordingly.
But when I press "unfollow" I get an error:
NoMethodError in ProjectRelationshipsController#destroy
undefined method `unfollow_project!' for #<User:0x007f9ed83dd6b8>

Application Trace | Framework Trace | Full Trace
app/controllers/project_relationships_controller.rb:12:in `destroy'

schema.rb
create_table "project_relationships", :force => true do |t|
  t.integer  "follower_id"
  t.datetime "created_at",     :null => false
  t.datetime "updated_at",     :null => false
  t.integer  "projectuser_id"
end

add_index "project_relationships", ["projectuser_id"], :name => "index_project_relationships_on_projectuser_id"

routes.rb
resources :projects do
  resources :comments
  member do
    get :following
  end
end
resources :project_relationships, only: [:create, :destroy]

project_relationship.rb
class ProjectRelationship < ActiveRecord::Base
   attr_accessible :projectuser_id

   belongs_to :user, foreign_key: "follower_id"
   belongs_to :project, foreign_key: "projectuser_id"
end

project.rb
has_many :project_relationships, foreign_key: "projectuser_id"
has_many :favorited_by, through: :project_relationships, source: :user

user.rb
has_many :project_relationships, foreign_key: "follower_id"
has_many :followed_projects, through: :project_relationships, source: :project

def following_project?(project)
  project_relationships.find_by_projectuser_id(project.id)
end

def follow_project!(project)
  project_relationships.create!(projectuser_id: project.id)
end

def project_unfollow!(project)
  project_relationships.find_by_projectuser_id(project.id).destroy
end

project_relationships_controller.rb
class ProjectRelationshipsController < ApplicationController

def create
    @project = Project.find(params[:project_relationship][:projectuser_id])
    current_user.follow_project!(@project)
    redirect_to @project
  end

  def destroy
    @project = ProjectRelationship.find(params[:id]).project
    current_user.unfollow_project!(@project)
    redirect_to @project
  end
end

projects/show.html.erb
<%= render 'follow_form' if signed_in? %>

projects/_follow_form.html.erb
<% if current_user.following_project?(@project) %>
    <%= render 'unfollow' %>
<% else %>
    <%= render 'follow' %>
<% end %>

projects/_follow.html.erb
<%= form_for(current_user.project_relationships.build(projectuser_id: @project.id)) do |f| %>

<%= f.hidden_field :projectuser_id %>

  <%= f.submit "Follow", class: "btn btn-large btn-primary" %>
<% end %>

projects/_unfollow.html.erb
<%= form_for(current_user.project_relationships.find_by_projectuser_id(@project),
         html: { method: :delete }) do |f| %>
  <%= f.submit "Unfollow", class: "btn btn-large" %>
<% end %>

projects/_followerstats.html.erb
<%= @project.favorited_by.count %>

A: you have defined a method  project_unfollow! in user.rb but you call current_user.unfollow_project! in project_relationships_controller.rb

A: You call unfollow_project! in ProjectRelationshipsController#destroy, but the method you want to call is project_unfollow! as defined in your user.rb.

A: Replace your unfollow_project! with project_unfollow! as declared in your model file.


text:
Q: Modificar JOptionPane
Opá pessoal, estou personalizando meus componentes do swing, tem como modificar o JOptionPane? de maneira que fiquei bem diferente ? ex: retirar a barra com titulo e a opção de fecha e etc...


text:
Q: Reason for SIGPIPE I have an application running on Linux, catching signals and reporting them to syslog.
This application frequently reports SIGPIPE events with no apparent reasons
The application is running in the background, as daemon. The signals occur at idle times with no apparent network/socket connections. The application frequently reads from and writes to disk and DVB cards (via the kernel DVB drivers).
I would like to find out the reason for the SIGPIPEs. Any means for tracing the signal source?
Edit:
I have added this to the code:
 stdin  = freopen("/dev/null", "r", stdin);
 stdout = freopen("/tmp/vdr_stdout", "w", stdout);
 stderr = freopen("/tmp/vdr_stderr", "w", stderr);

Still get the SIGPIPEs.

A: On POSIX-compliant platforms, SIGPIPE is the signal sent to a process when it attempts to write to a pipe without a process connected to the other end.
Since you are referring to a daemon context, maybe the STD* are closed and an attempt to read/write on those is performed.... a debug/progress report printf maybe?

A: Does your daemon close input and output?:
fclose (stdin);
fclose (stdout);
fclose (stderr);


text:
Q: ArcGIS / BING map overlay on Google map in Android I was searching the net few days and can't find any answer - it is possible to add ArcGIS (esri maps) and/or BING map as overlay on Google maps app on android? I founded that it is possible to do this in web version but no information about android. So, it is possible in some way or not?

A: Try the BingMapsLayer class.
MapView mv = new MapView(this);
mv.addLayer(new BingMapsLayer("[your Bing Maps key]", MapStyle.Aerial));
setContentView(mv);


text:
Q: read multiple excel file and apply process on it using matlab i have multiple excel files in D:\ directory these files name starting with "gt" characters i need to delete all empty rows in these files in , Sheet1 only and store processed files in other names  ,
Q :\ The following code has been successfully deleted all empty rows but from single file , how we can applied it to all files in D:\ directory and their names start with "gt" characters ?
the following code which i mention above ...
[~, ~, data] = xlsread('D:\gt1.xls','Sheet1');
data(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x), data)) = {''};
ii = 1;
while true
    try
        if any(strcmp('', data(ii,:)))  % find rows with empty cell
            data(ii,:) = [];               % remove the row
        else
            ii = ii+1;
        end
    catch
        break  % When the process goes beyond the end, stop the loop.
    end
end
xlswrite('D:\result1.xls', data)

and i tried this code long time for all excel file
FileNames=dir('D:\gt*.xls');
for i=1:length(FileNames)
FileToLoad=FileNames(i).name;
[~, ~, data] = xlsread(FileToLoad,'Sheet1');
data(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x), data)) = {''};
ii = 1;
while true
try
if any(strcmp('', data(ii,:)))  % find rows with empty cell
data(ii,:) = [];               % remove the row
else
ii = ii+1;
end
catch
break  % When the process goes beyond the end, stop the loop.
end
end
xlswrite('D:\result[ii].xls', data)
end

hope to get output like
    gt1.xls file store as result1.xls file ;
    gt2.xls file store as result2.xls file ;
    and so on ....