text:
Q: Linker command failed with exit code 1, XCode 4.5, Facebook SDK 3.1 I'm trying to integrate the Facebook SDK into my xcode project, and I've sort of hit a stumbling point.
After some research, I tried making sure I had the latest version of the FacebookSDK, as those who had the same errors as I were able to resolve their issues with the latest version, but that did not help, so I tried downloading the source code from github and using the build_all.sh command to recompile, which also did not help.
I'll have the full error log be at the end because it's super long, but here is the part at the end:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've seen plenty of strings related to this issue but as I stated previously, neither updating to the latest SDK (an unnecessary step in my case as I already had it) or recompiling the source code for armv7, armv7s fixed the issue.
Thanks in advance,
Tom
Full Error Log:

duplicate symbol _OBJC_IVAR_$_FBRequest._delegate in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._url in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._connection in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._responseText in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._error in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._state in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBRequest._sessionDidExpire in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_CLASS_$_FBRequest in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_METACLASS_$_FBRequest in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBRequest.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBRequest.o)
  duplicate symbol _OBJC_IVAR_$_FBLoginDialog._loginDelegate in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBLoginDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBLoginDialog.o)
  duplicate symbol _OBJC_CLASS_$_FBLoginDialog in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBLoginDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBLoginDialog.o)
  duplicate symbol _OBJC_METACLASS_$_FBLoginDialog in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBLoginDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBLoginDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._orientation in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._webView in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._modalBackgroundView in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity->iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._loadingURL in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._frictionlessSettings in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._delegate in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._showingKeyboard in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._closeButton in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._spinner in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._params in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._serverURL in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBDialog._isViewInvisible in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_CLASS_$_FBDialog in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_METACLASS_$_FBDialog in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBDialog.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBDialog.o)
  duplicate symbol _OBJC_IVAR_$_FBFrictionlessRequestSettings._enabled in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBFrictionlessRequestSettings.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBFrictionlessRequestSettings.o)
  duplicate symbol _OBJC_IVAR_$_FBFrictionlessRequestSettings._allowedRecipients in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBFrictionlessRequestSettings.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBFrictionlessRequestSettings.o)
  duplicate symbol _OBJC_IVAR_$_FBFrictionlessRequestSettings._activeRequest in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBFrictionlessRequestSettings.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBFrictionlessRequestSettings.o)
  duplicate symbol _OBJC_CLASS_$_FBFrictionlessRequestSettings in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBFrictionlessRequestSettings.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBFrictionlessRequestSettings.o)
  duplicate symbol _OBJC_METACLASS_$_FBFrictionlessRequestSettings in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBFrictionlessRequestSettings.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(FBFrictionlessRequestSettings.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._requests in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._lastAccessTokenUpdate in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._frictionlessRequestSettings in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._fbDialog in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._appId in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._urlSchemeSuffix in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._isExtendingAccessToken in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_IVAR_$_Facebook._sessionDelegate in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_CLASS_$_Facebook in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  duplicate symbol _OBJC_METACLASS_$_Facebook in:
      /Users/tomhenry/Library/Developer/Xcode/DerivedData/Unity-iPhone-bioesylflkyylfdprjpcoipvoxpb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Facebook.o
      /Users/tomhenry/Facebook/build/FacebookSDK.framework/FacebookSDK(Facebook.o)
  ld: 41 duplicate symbols for architecture armv7
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

A: you are missing framework for social networking, add it in your link with binary libraries of build phases in targets.


text:
Q: Route with successful route as prerequisite (Camel) I currently have the following camel route:
//Only continue to next route if success
from("file:///tmp/camel/input")
    .routeId("Test Route")
    .to("file:///tmp/camel/test")
    .onCompletion().onCompleteOnly()
        .log("Success for file: ${header.CamelFileName}")
        .setHeader("recipientList", constant("file:///tmp/camel/output, file:///tmp/camel/output2"))
        .recipientList(header("recipientList"))
    .end();

Need to send a file to recipients only if the previous route was successful.
However, while running the route I came to the conclusion that the .to in the onCompletion() block also reads from the input folder, but the files are already gone, so it can't pick them up and write them to the recipients. (I can't set noop=true at the from, since I do want the files gone after sending them to the recipients...)
So how would we route the file to the recipients, having a successful previous route as prerequisite?

A: This will work
from("file:///tmp/camel/input")
            .routeId("Test Route")
            .to("file:///tmp/camel/test?noop=true")
            .onCompletion().onCompleteOnly()
            .log("Success for file: ${header.CamelFileName}")
            .end();

from("file:///tmp/camel/test?noop=true")
           .to("file:///tmp/camel/output")
           .to("file:///tmp/camel/output2");

I feel OnCompletion is redundant here, since the second route will not trigger, if the file transfer to /camel/test is failed.
Another point is you can make use of move=.done option just to make sure, that the second route doesn't start before the full file is transferd
from("file:///tmp/camel/test?noop=true&move=.done")
            .to("file:///tmp/camel/output")
            .to("file:///tmp/camel/output2")

redpajama_set_name: RedPajamaStackExchange


text:
Q: I want to display an error if the employee had an account already Here is my code:
 rs.Open("Select * from tbl_emp_security WHERE Emp_ID='" & EmpID_account.Text & "'", con)
        If EmpID_account.Text = LVempaccount.Items(rs(0).Value) Then
            MsgBox("this employee have existing account")
        Else
            user_account.Text = "Emp" & Lname_account.Text
            passRandom()
    End If

Is if the employee try to add an account and if he had already... the messagebox will appear but if none. It proceeds to the next line..
empid_accout.text is the textbox that I am comparing to the first item on table.
lvempaccount.tems(rs(0),value) is the item that on the 1st column the employee id on the table

A: I would rewrite your code as follows
Hope it helps
Dim OutDs AS new Dataset
OutDS = ("Select * from tbl_emp_security WHERE Emp_ID='" & EmpID_account.Text & "'", con)

If OutDs isnot nothing andalso OutDs.Table.Rows.Count > 0  Then
            MsgBox("this employee have existing account")
        Else
            user_account.Text = "Emp" & Lname_account.Text
            passRandom()
    End If

If the Select Query returns a dataset , it means it has value so i used this way..!


text:
Q: Data Gathering Portion of CUDA Code is Unexpectedly Outputting "0"s EDIT
In the initial posting's code snippet (see below) I was not properly sending the struct to the device, this has been fixed, but the results are still the same.  In my full code this mistake was not present. (There were two mistakes in that command in my initial posting -- one, the structure was being copied from HostToDevice, but was actually reversed, and the size of the copy was also wrong.  Apologies; both errors were fixed, but the recompiled code still displays the zeros phenomena described below, as does my full code.)
EDIT 2
In the haste of my de-proprietarization rewrite of the code I made a couple errors which dalekchef kindly pointed out to me (the copy of the struct to the device was performed BEFORE the allocation on the device, in my rewritten code and the device cudaMalloc calls were not multiplied with the sizeof(...) the type of the array elements.  I added these fixes, recompiled and retested, but it did not fix the problem.  Also double checked my original code -- it did not have those mistakes.  Apologies again, for the confusion.
I'm trying to dump statistics from a large simulations program.  A similar pared down code is displayed below.  Both codes exhibit the same problem -- they output zeroes, when they should be outputting averaged values.
#include "stdio.h"

struct __align__(8) DynamicVals
{
   double a;
   double b;
   int n1;
   int n2;
   int perDump;
};

__device__ int *dev_arrN1, *dev_arrN2;
__device__ double *dev_arrA, *dev_arrB;
__device__ DynamicVals *dev_myVals;
__device__ int stepsA, stepsB;
__device__ double sumA, sumB;
__device__ int stepsN1, stepsN2;
__device__ int sumN1, sumN2;

__global__ void TEST
(int step, double dev_arrA[], double dev_arrB[],
 int dev_arrN1[], int dev_arrN2[],DynamicVals *dev_myVals)
{
   if (step % dev_myVals->perDump)
   {
      dev_arrN1[step/dev_myVals->perDump] = 0;
      dev_arrN2[step/dev_myVals->perDump] = 0;
      dev_arrA[step/dev_myVals->perDump] = 0.0;
      dev_arrB[step/dev_myVals->perDump] = 0.0;
      stepsA = 0;
      stepsB = 0;
      stepsN1 = 0;
      stepsN2 = 0;
      sumA = 0.0;
      sumB = 0.0;
      sumN1 = 0;
      sumN2 = 0;
   }

   sumA += dev_myVals->a;
   sumB += dev_myVals->b;
   sumN1 += dev_myVals->n1;
   sumN2 += dev_myVals->n2;
   stepsA++;
   stepsB++;
   stepsN1++;
   stepsN2++;

   if ( sumA > 100000000 )
   {
      dev_arrA[step/dev_myVals->perDump] +=
     sumA / stepsA;
      sumA = 0.0;
      stepsA = 0;
   }
   if ( sumB > 100000000 )
   {
      dev_arrB[step/dev_myVals->perDump] +=
     sumB / stepsB;
      sumB = 0.0;
      stepsB = 0;
   }
   if ( sumN1 > 1000000 )
   {
      dev_arrN1[step/dev_myVals->perDump] +=
     sumN1 / stepsN1;
      sumN1 = 0;
      stepsN1 = 0;
   }
   if ( sumN2 > 1000000 )
   {
      dev_arrN2[step/dev_myVals->perDump] +=
     sumN2 / stepsN2;
      sumN2 = 0;
      stepsN2 = 0;
   }

   if ((step+1) % dev_myVals->perDump)
   {
      dev_arrA[step/dev_myVals->perDump] +=
     sumA / stepsA;
      dev_arrB[step/dev_myVals->perDump] +=
     sumB / stepsB;
      dev_arrN1[step/dev_myVals->perDump] +=
     sumN1 / stepsN1;
      dev_arrN2[step/dev_myVals->perDump] +=
     sumN2 / stepsN2;
   }
}

int main()
{
   const int TOTAL_STEPS = 10000000;
   DynamicVals vals;
   int *arrN1, *arrN2;
   double *arrA, *arrB;
   int statCnt;

   vals.perDump = TOTAL_STEPS/10;
   statCnt = TOTAL_STEPS/vals.perDump+1;
   vals.a = 30000.0;
   vals.b = 60000.0;
   vals.n1 = 10000;
   vals.n2 = 20000;

   cudaMalloc( (void**)&dev_arrA, statCnt*sizeof(double) );
   cudaMalloc( (void**)&dev_arrB, statCnt*sizeof(double) );
   cudaMalloc( (void**)&dev_arrN1, statCnt*sizeof(int) );
   cudaMalloc( (void**)&dev_arrN2, statCnt*sizeof(int) );
   cudaMalloc( (void**)&dev_myVals, sizeof(DynamicVals));
   cudaMemcpy(dev_myVals, &vals, sizeof(DynamicVals),
          cudaMemcpyHostToDevice);

   arrA = (double *)malloc(statCnt * sizeof(double));
   arrB = (double *)malloc(statCnt * sizeof(double));
   arrN1 = (int *)malloc(statCnt * sizeof(int));
   arrN2 = (int *)malloc(statCnt * sizeof(int));

   for (int i=0; i< TOTAL_STEPS; i++)
      TEST<<<1,1>>>(i, dev_arrA,dev_arrB,dev_arrN1,dev_arrN2,dev_myVals);

   cudaMemcpy(arrA,dev_arrA,statCnt * sizeof(double),cudaMemcpyDeviceToHost);
   cudaMemcpy(arrB,dev_arrB,statCnt * sizeof(double),cudaMemcpyDeviceToHost);
   cudaMemcpy(arrN1,dev_arrN1,statCnt * sizeof(int),cudaMemcpyDeviceToHost);
   cudaMemcpy(arrN2,dev_arrN2,statCnt * sizeof(int),cudaMemcpyDeviceToHost);

   for (int i=0; i< statCnt; i++)
   {
      printf("Step: %d   ; A=%g  B=%g  N1=%d  N2=%d\n",
         i*vals.perDump,
         arrA[i], arrB[i], arrN1[i], arrN2[i]);
   }
}

Output:
Step: 0   ; A=0  B=0  N1=0  N2=0
Step: 1000000   ; A=0  B=0  N1=0  N2=0
Step: 2000000   ; A=0  B=0  N1=0  N2=0
Step: 3000000   ; A=0  B=0  N1=0  N2=0
Step: 4000000   ; A=0  B=0  N1=0  N2=0
Step: 5000000   ; A=0  B=0  N1=0  N2=0
Step: 6000000   ; A=0  B=0  N1=0  N2=0
Step: 7000000   ; A=0  B=0  N1=0  N2=0
Step: 8000000   ; A=0  B=0  N1=0  N2=0
Step: 9000000   ; A=0  B=0  N1=0  N2=0
Step: 10000000   ; A=0  B=0  N1=0  N2=0

Now, if I were to use a small period for my dumps or if my #s were smaller, I could get away with just a direct

*

*add

*divide by period and the end of period

...algorithm, but I use temporary sums as otherwise my int would overflow (the double wouldn't overflow, but I was concerned about it losing precision).
If I use the above direct algorithm for smaller values I get correct non-zero values, but the second I use the intermediates (e.g. stepsA, sumA, etc.) the values go to zero.
I know I'm doing something silly here... what am I missing?
Notes:
A.) Yes, I know this code in its above form is not parallel and by itself does not warrant parallelization.  It is part of a small statistics collecting portion of a much longer code.  In that code it is encased in a thread index specific conditional logic to prevent clashing (making it parallel) and serves as data gathering to a simulations program (which warrants parallelization).  Hopefully you can understand where the above code originates and avoid snide comments about its lack of thread-safety. (This disclaimer is added out of past experience receiving unproductive comments from people who didn't understand I was posting an excerpt, not a full code, despite me writing in less explicit terms as such.)
B.) Yes, I know the names of the variables are ambiguous.  That is the point.  The code I'm working on is proprietary, though it will eventually be open sourced.  I only write this as I have posted similarly anonymized codes in the past and received rude commentary about my naming convention.
C.) Yes, I have read the CUDA manual several times, though I do make errors and I admit there's some features I don't understand.  I'm not using shared memory here, but I am using shared memory (OF COURSE) in my full code.
D.) Yes, the above code does represent the exact same features as the data dumping portion of my non-working code, with the logic not related to this particular problem removed, and with it the thread safety conditional.  The variable names have been changed, but algorithmically it should be unaltered and this is verified by the exact same non-working output (zeroes).
E.) I do realize the "dynamic" struct in the above snippet has non-dynamic values.  I named the structure that because in the full code, this struct contains simulations data, and is dynamic.  The static nature in the pared-down code should not make the statistics collecting code fail, it will simply mean that the average for each dump should be constant (and non-zero).

A: A couple of things:
It seems like you are calling cudaMemcpy for dev_MyVals before you are calling cudaMalloc for it. This is not how it should be.
ALSO: You do not multiply by sizeof int when you do your cudaMalloc calls.
You should really check all of your CUDA calls cudaMalloc/cudaMemcpy for an error code. They should all return an error or CUDA_SUCCESS. I believe the CUDA examples all show how to do this.
Also, for future reference NEVER use the modulo operator in CUDA it is incredibly slow. Just Google for "Modulo CUDA" for some alternatives.
Let me know how it goes, this will probably take a couple of iterations to fix.

A: The biggest problem I see here is one of scope. The way this code is written leads me to conclude that you might not understand how variable scoping in C++ works in general, and how device and host code scope works in CUDA in particular. A couple of observations:

*

*When you do this type of thing in code:
__device__ double *dev_arrA, *dev_arrB;
__global__ void TEST(int step, double dev_arrA[], double dev_arrB[], ....)
you have a variable scope problem. dev_arrA is declared at both compilation unit scope and function scope. The two declarations do not refer to the same variable -- the function unit scope declaration (in the kernel) takes precedence over the compilation unit scope declaration inside the kernel. you modify that variable, you are modifying the kernel scope declaration, not the __device__variable. This can lead to all sorts of subtle and unexpactd behaviour. It is much better to avoid ever having the same variable declared at multiple scopes.

*When you declare a variable using the __device__ specifier, it is intended to be exclusively a device context symbol, and should only be used directly in device code. So something like this:
__device__ double *dev_arrA;
int main()
{
....
cudaMalloc( (void**)&dev_arrA, statCnt*sizeof(double) );
....
}
is illegal. You cannot call an API function like cudaMalloc directly on a __device__ variable. Even though it will compile (because of the hackery involved in the CUDA compilation tradjectories for host and device code), it is incorrect to do so. In the above example dev_arrA is a device symbol. You can interact with it via the API symbol manipulation calls, but that is all it is technically legal to do. In you code, variables intended to hold device pointers and be passed as kernel arguments (like dev_arrA) should be declared at main() scope, and passed by value to the kernel.
It is a combination of the above two things which is probably causing your problems.
But the difficulty is that you have chosen to post roughy 150 lines of code (a lot of which is redundant) as a repro case. I doubt anyone cares enough about your problems to go through that much code with a fine tooth comb and pinpoint where the precise problem is. Further, you habit of doing these nasty "top edits"  in your questions quickly turn what might have been reasonably written starting points into unintelligible psuedo changelogs which are incredibly hard to follow and are unlikely to be of help to anyone. Also, the mildly passive-aggressive notes section serves no real purpose - it adds nothing of value to the question.
So I will leave you with a greatly simplified version of the code you posted which I think has all the basic things which you are trying to do working. I leave it as an "exercise for the reader" to turn it back into whatever it is that you are trying to do.
#include "stdio.h"

typedef float Real;
struct __align__(8) DynamicVals
{
    Real a;
    int n1;
    int perDump;
};

__device__ int stepsA;
__device__ Real sumA;
__device__ int stepsN1;
__device__ int sumN1;

__global__ void TEST
(int step, Real dev_arrA[], int dev_arrN1[], DynamicVals *dev_myVals)
{
    if (step % dev_myVals->perDump)
    {
        dev_arrN1[step/dev_myVals->perDump] = 0;
        dev_arrA[step/dev_myVals->perDump] = 0.0;
        stepsA = 0;
        stepsN1 = 0;
        sumA = 0.0;
        sumN1 = 0;
    }

    sumA += dev_myVals->a;
    sumN1 += dev_myVals->n1;
    stepsA++;
    stepsN1++;

    dev_arrA[step/dev_myVals->perDump] += sumA / stepsA;
    dev_arrN1[step/dev_myVals->perDump] += sumN1 / stepsN1;
}

inline void gpuAssert(cudaError_t code, char *file, int line,
                 bool abort=true)
{
   if (code != cudaSuccess)
   {
      fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code),
          file, line);
      if (abort) exit(code);
   }
}

#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }

int main()
{
    const int TOTAL_STEPS = 1000;
    DynamicVals vals;
    int *arrN1;
    Real *arrA;
    int statCnt;

    vals.perDump = TOTAL_STEPS/10;
    statCnt = TOTAL_STEPS/vals.perDump;
    vals.a = 30000.0;
    vals.n1 = 10000;

    Real *dev_arrA;
    int *dev_arrN1;
    DynamicVals *dev_myVals;

    gpuErrchk( cudaMalloc( (void**)&dev_arrA, statCnt*sizeof(Real)) );
    gpuErrchk( cudaMalloc( (void**)&dev_arrN1, statCnt*sizeof(int)) );
    gpuErrchk( cudaMalloc( (void**)&dev_myVals, sizeof(DynamicVals)) );
    gpuErrchk( cudaMemcpy(dev_myVals, &vals, sizeof(DynamicVals),
                cudaMemcpyHostToDevice) );

    arrA = (Real *)malloc(statCnt * sizeof(Real));
    arrN1 = (int *)malloc(statCnt * sizeof(int));

    for (int i=0; i< TOTAL_STEPS; i++) {
        TEST<<<1,1>>>(i, dev_arrA,dev_arrN1,dev_myVals);
        gpuErrchk( cudaPeekAtLastError() );
    }

    gpuErrchk( cudaMemcpy(arrA,dev_arrA,statCnt * sizeof(Real),
                cudaMemcpyDeviceToHost) );
    gpuErrchk( cudaMemcpy(arrN1,dev_arrN1,statCnt * sizeof(int),
                cudaMemcpyDeviceToHost) );

    for (int i=0; i< statCnt; i++)
    {
        printf("Step: %d   ; A=%g N1=%d\n",
                i*vals.perDump, arrA[i], arrN1[i] );
    }
}


text:
Q: Passing value between pages. What am I doing wrong? I have 2 pages, one called details.page and the other, maps.page
In the first page, I have a declared a search input like so :
  <form method="get" id="form-search" data-ajax="true" action="maps.page">
            <input type="search" name="search" id="search" value=""/>
        </form>

And in my second page, maps.page, I have one declared like so :
  <form action="maps.page">
        <input type="search" name="search" id="search-field" value=""/>
        </form>

Now, I was assuming that when I type something in the search bar from my first page and hit enter, the search bar on maps.page would be populated with the value previously entered.
I am correctly redirected, but the search bar is empty.
What am I doing wrong ?
Thanks in advance for your help.
EDIT : Also, I see in the URL that it seems to be working, because I can see what I searched in the URL like this : /maps.page?search=something

A: The value is not automatically filled. You need to print it from the server side.
  <form action="maps.page">
        <input type="search" name="search" id="search-field" value="<insert value>"/>
  </form>

A:
I was assuming that when I type something in the search bar from my first page and hit enter, the search bar on maps.page would be populated with the value previously entered.

That is what you are doing wrong.
The field will only be populated if you set the value attribute (or set the DOM value property after the element has been added to the DOM).
This is generally done using a server side process. The specifics depend on the language you are using to create that process, but do watch out for XSS as including unfiltered, unescaped user input will create a security hole.

A: You have a few option in how to do this without using a back end script.
1) You can set the form method to GET so that the variables are passed in the address bar, then grab them on the other side using a script like the one below (this actually reads the address and then parses it for variables). After that, you can put that value in your input field.
var getVars = new Array();
var locvartemp = ( window.location.href.indexOf( "?" ) + 1 ) ? window.location.href.substr( window.location.href.indexOf( "?" ) + 1 ) : "";
locvartemp = locvartemp.split( "&" );
for( var x = 0; x < locvartemp.length; x++ ) {
    var lvTempVar = locvartemp[x].split( "=" );
    getVars[ unescape( lvTempVar[0] ) ] = unescape( lvTempVar[1] );
}

2) You can use the jQuery cookie plugin to set the value as a cookie prior to submitting the form and then read it on the other side and set it to your input field.
jQuery.cookie("myCookie", document.formName.myFieldName.value);

Let me know if you need more details.


text:
Q: ListView Cell Translation manipulation affects other cells I'm working on a custom SwipeListView which allows to swipe cells to the left or to the right, currently only for Android. This works perfectly fine, but for some reason changing TranslationX of the Cell's ContentView affects other cells in the ListView. Every 8th cell changes it's TranslationX too (at least visually):

This is the line of code which results in this behavior:
mainContent.TranslationX = quota * Width + mainContentPositionX;

I've tried some possible solutions, none of them worked:

*

*Try every different CachingStrategy for the ListView (RetainElement, RecycleElement, RecycleElementAndDataTemplate)

*Run code on MainThread

*After manipulating TranslationX, iterate through all other cells in my ListView and set their TranslationX to 0

I was sure the problem is that the cell is being reused and that's why it applies the TranslationX manipulation, but if it's that then I'm confused why using CachingStrategy=RetainElement doesn't solve the issue.
I will also we grateful for ideas which help be to debug this problem.

Edit
I implemented the SwipeListView feature for iOS and it works without any problems. Seems to be an Android issue.

Edit - Github Repository
I have added a sample Github Repository: https://github.com/Zure1/SwipeListView-Sample
Edit
I can now confirm that this is only a problem in Android. iOS works fine.

A: You are right in your analysis that the issue lies in item recycling. As you are changing the translation programmatically, the framework is not aware about your change and that you want it to be reverted so it keeps the translation as is. All the Caching Strategies involve item recycling including RetainElement. Recycling is better to stay enabled as it provides big performance gains.
A possible solution to your issue is to use data binding to set the TranslationX property and have the bound property on your ViewModel. This way the value reset whenever the control is recycled and bound to a new ViewModel. You can either introduce an integer property on your ViewModel and bind that to TranslationX or maybe the cleaner way is you introduce a Boolean property like IsSwipped and create a Data Trigger on that to set the translation as needed.


text:
Q: MongoDB - How to exclude a record from a lookup query based on a field boolean value? I'm doing a lookup query but would like to exclude records where the boolean field value within the lookup table is false, is this possible? Here's my current query:
const pipeline = [
                {
                    '$lookup': {
                        'from': 'photos',
                        'localField': '_id',
                        'foreignField': 'postId',
                        'as': 'photoData'
                    }
                }, {
                    '$project': {
                        'createdAt': 1,
                        ...
                        'photoData': {
                            '$cond': {
                            'if': {
                                '$eq': [
                                    false, '$photoData.published'
                                ]
                            },
                            'then': '$$REMOVE',
                            'else': '$photoData'
                            }
                        }
                    }
                }
            ]

This is the photos collection
{
    id:'1234',
    url:'some.url.com',
    published:true
},
{
    id:'4567',
    url:'some.otherurl.com',
    published:false
},

I would like to exclude any records from the photos collection (photoData) lookup where 'published' is set to false. I think using 'project' would be the correct way to do this, but I'm not sure, and I can't seem to find the correct syntax/logic.

A: $lookup returns an array, so '$photoData.published' will also be an array, and will therefore never match false.
You can use $filter to remove the unpublished images from the array like:
{$filter: {
  input: "$photoData",
  as: "photo",
  cond: {$ne:["$$photo.published",false]}
}}
``

A: You can use $lookup with pipeline to perform joining between collections with sub-queries:

*

*Join posts (id) with photo (postId).

*Match with published: true only.

db.posts.aggregate([
  {
    "$lookup": {
      "from": "photos",
      let: {
        postId: "$_id"
      },
      pipeline: [
        {
          $match: {
            $expr: {
              $and: [
                {
                  $eq: [
                    "$postId",
                    "$$postId"
                  ]
                },
                {
                  $eq: [
                    true,
                    "$published"
                  ]
                }
              ]
            }
          }
        },

      ],
      "as": "photoData"
    }
  },
  {
    "$project": {
      "createdAt": 1,
      "photoData": 1
    }
  }
])

Sample Mongo Playground


text:
Q: Is my "Generic" USB Flash Drive broken? So here is the situation. I find myself technological knowledgeable about many things ( I love to code, whether it's websites, C#, C++ or so on). However:
My 2 toddlers (my wife actually) bought me a "Generic" 128 GB USB Storage Device (Usb Flash Drive) for Father's Day. I thought awesome at first..... WRONG! Nothing but problems with it. 3-4mb/s MAX transfer speed.
I can bear with it.
BUT!
When I went to reformat my computer I transferred my save files from my games over to the stick and then the USB Stick managed to become corrupted. Not just a simple format would work either. It's screwed.
I tried to use (Manually changed usb drive letter troubleshooting it to X) chmod X: /X /F /R with administrator rights, I did this after a long session to make it work with no errors (had to delete the log) and I finally recovered the files, however when I go to use it (transfer to or from) it transfers a couple kb to the stick or from it and then freezes, It says (Windows 7):
Name:
From: Folder (X:\File\Location)
To: Folder C:\Users\Username\Desktop)
Items Remaining: 0 (0 bytes)
Speed: 0 bytes/second
It does this forever... and ever... and ever... It transfered 3 files atleast, and then stopped.
This is a new USB Stick bought from a "High" reputation company on eBay.
Is the USB Stick screwed?

A: Sounds like you could have a fake drive. In reality is much smaller drive but was flashed to report 128GB. This video shows an example of such a drive https://www.youtube.com/watch?v=HaHokQ5EWv0
To be sure of this fact, consider using tools such as H2testw or BurnInTest to verify this device's capacity. It will try to write and read data to the full capacity of the device and report how accurate it is.

For Linux and Mac there's http://oss.digirati.com.br/f3/ that does the same thing.
If your device turns out to be fake, report it as 'counterfeit goods' to Ebay and leave negative review to the seller to inform others not to buy this product and to entice the seller to correct this problem either by refunding you money or providing you with a properly functioning drive. However, do not remove your negative review in exchange for a refund or new drive. It is blackmail(and I'm pretty sure against ebay TOS).


text:
Q: Stuck in a finite summation in a physics problem.r³/(r-1)² Actually it was not a hard problem as seen from physics point of view, just some application of Coulomb's law (multiple charge system) but it finally ended up as the summation of:-
$$
\sum_{r=2}^n \frac{(r+1)^3}{r^2}
$$
I tried to open things up but it finally took me to summation of $\frac{1}{r^2}$ and $\frac{1}{r}$, and I know they can be solved but it's too much for my level I guess (as I am a JEE aspirant). Is there any other way to solve the summation?

A: We have:
$$\frac{(r+1)^3}{r^2}=\frac{r^3+3r^2+3r+1}{r^2}=r+3+\frac{3}{r}+\frac{1}{r^2}$$
Thus:
$$\sum_{r=2}^n \frac{(r+1)^3}{r^2}=\sum_{r=2}^n \bigg( r+3+\frac{3}{r} \frac{1}{r^2} \bigg)$$
$$\sum_{r=2}^n \frac{(r+1)^3}{r^2}=\sum_{r=2}^n r +\sum_{r=2}^n 3 +3 \sum_{r=2}^n \frac{1}{r} + \sum_{r=2}^n \frac{1}{r^2}$$
$$\sum_{r=2}^n \frac{(r+1)^3}{r^2}=\bigg( \frac{n(n+1)}{2}-1 \bigg) +3(n-1) +3 \sum_{r=2}^n \frac{1}{r} + \sum_{r=2}^n \frac{1}{r^2}$$
$$\sum_{r=2}^n \frac{(r+1)^3}{r^2}=\frac{n^2+7n-8}{2}+(3H_n-3)+(H_n^{(2)}-1)=\frac{n^2+7n-16}{2}+3H_n+H_n^{(2)}$$
Now, it is not possible to get the exact values for $H_n$ and $H_n^{(2)}$, but for large $n$, you can approximate:
$$\lim_{n \to \infty} H_n - \ln{n} = \gamma = 0.577 \ldots \implies H_n \approx \ln{n}+ \gamma$$
$$\lim_{n \to \infty} H_n - \frac{\pi^2}{6}=0 \implies H_n^{(2)} \approx \frac{\pi^2}{6}$$
Hence, we have:
$$\sum_{r=2}^n \frac{(r+1)^3}{r^2} \approx \frac{n^2+7n-16}{2}+3 \ln{n} + 3 \gamma + \frac{\pi^2}{6}$$
As $n$ gets really large, the difference between the LHS and RHS tends to $0$. This shows that we have a really good approximation.


text:
Q: Datasheet for this transistor? I found this transistor on a board that I have no idea where it came from and I want a datasheet of its current and voltage handling. Has anyone seen something like this? I have looked all,over the web for a datasheet and couldn't fine one. If you can, that would be greatly appreciated!! Thanks for your time.

A: It's probably a manufacturer's internal part number. You'd have to find the service manual for the equipment it came from and see whether it provides a cross-reference to a generic part number.
Otherwise, the best you can do is reverse-engineer the circuit it came from and figure out what capabilities it had to have to work there. It's actual capabilities are (presumably) greater than that.
A transistor curve tracer would also give you some clues, along with knowing the power capacity of the TO-3 package that it's in.


text:
Q: Repeat Array within single JSON object (Ioinc 2) I have a JSON object that has an array of ingredients within, I want to repeat each object into an
 so I can list them out. The area I want to repeat is the "ingredientLines"
My JSON is
My current code is, I currently just get all 10 objects listed out in a single

<ion-content>
    <ion-list>
        <ion-item>

                <ion-img src="{{api?.images["0"].hostedLargeUrl}}">

{{api?.name}}

                    {{api?.totalTime}}

{{api?.ingredientLines}}

        </ion-item>
    </ion-list>
</ion-content>

If someone could point out where I'm going wrong that would be great!

A: Try to repeat the right object in the right HTML-Element and you will be fine. Here is a abstract working fiddle of what you try to achieve.

{{item}}


text:
Q: How can I merge output of two queries on two different databases in one single view on Tableau I am working with two MS-SQL databases and using a query on each database, I am able to get some data in a format which is common for both databases (i.e same column names and datatypes of field values). A brief overview of data is:
Output 1 :
Col1 Col2 Col3
A    1    1
A    2    1
A    1    2

Output 2:
Col1 Col2 Col3
B    2    1
C    3    1
D    1    3

And I want below data in a single view on tableau:
Col1 Col2 Col3
A    1    1
A    2    1
A    1    2
B    2    1
C    3    1
D    1    3

I have tried creating a clipboard data source, but the issue came when I tried creating calculated fields based on my previous two data sources. It only permits to have calculated field value as an aggregate value. I want the original value and not the aggregate. Help needed here!

A: If the two databases are accessible by a common database user, use a union all to merge the two queries together into one data set. You'll need to write the sql and then create Custom SQL for the database table.
If they aren't accessible by a common database user, look into the possibility of doing linked databases so the db user can see both tables and union.


text:
Q: 2 approximation for minimization problems I have a general question, I know there is a way to find 2-approximation for maximization problems by finding 2 solution s1 and s2 s.t
q(s1)+q(s2)>=q(OPT)

and by chosing max{q(s1),q(s2)} i've found a legit approx.
Back to my question,
Is it possible to do this general method for minimization problems ?
What will be the analog?


text:
Q: how do you extract some data from html format file in R I have an html file that I would like to extract some data and build a vector from the result:
My html file looks like this:
data
 "\r\n\r\n<meta http-equiv=\"Expires\" content=\"0\"/>\n<meta http-equiv=\"Pragma\" content=\"no-cache\"/>\n\r\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=Cp1252\"/>\r\n\r\n<TITLE>file</TITLE>\r\n<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"/SiteScope/htdocs/artwork/sitescopeUI.css\"/>\r\n\n\r\n\n\r\n

\r\nMost Recent Report\r\n
\n \n
\n
Report Summary
\r\n
 	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag1	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag10	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag11	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag12	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag13	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag14	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag15	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag16	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag2	WTAD::Linux: Total CPU Percent Utilization on server1	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag4	WTAD::Linux: Total CPU Percent Utilization on server2	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag6	WTAD::Linux: Total CPU Percent Utilization on server3	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag8	WTAD::Linux: Total CPU Percent Utilization on server9	WTAD::Linux: Total CPU Percent Utilization on dc2prwtag17	WTAD::Linux: Total CPU Percent Utilization on server10
\r\n
Information For	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak	avg	peak
\r\n
3:33 PM 1/18/15 - 3:33 PM 1/25/15 (text)	3.67%	28%	2.85%	10%	1.65%	18%	4.54%	14%	4.12%	15%	4.42%	18%	0%	2%	0.72%	6%	4.26%	30%	3.42%	16%	3.4%	16%	1.58%	7%	0.46%	7%	0.4%	2%	1.49%	11%	2.25%	8%	0%	0%	0.49%	4%
\r\n
1:05 AM 1/18/15 - 1:05 AM 1/25/15 (text)	3.68%	28%	2.75%	10%	1.6%	18%	4.41%	14%	4.11%	15%	4.39%	18%	0%	2%	0.72%	6%	4.25%	30%	3.43%	16%	3.39%	16%	1.58%	7%	0.46%	7%	0.4%	2%	1.49%	11%	2.17%	8%	0%	0%	0.55%	4%
\r\n
11:26 AM 1/13/15 - 11:26 AM 1/20/15 (text)	3.83%	27%	2.74%	15%	1.51%	6%	4.64%	20%	4.32%	21%	4.84%	20%	0%	1%	0.72%	7%	4.39%	27%	3.49%	16%	3.45%	16%	1.65%	7%	0.51%	6%	0.42%	6%	1.55%	7%	2.11%	8%	0%	1%	0.61%	4%
\r\n
\r\n
<FORM ACTION=\"/SiteScope/cgi/go.exe/SiteScope\" method=\"POST\">\n<input type=\"hidden\" name=\"page\" value=\"adhocReport\"/>\n<input type=\"hidden\" name=\"queryID\" value=\"1725002550\"/>\n<input type=\"hidden\" name=\"htmlFile\" value=\"yes\"/>\n<input type=\"hidden\" name=\"account\" value=\"login59\"/>\n<input type=\"hidden\" name=\"isFlipperContext\" value=\"false\"/>\n<input type=\"hidden\" name=\"isSwingContext\" value=\"true\"/>\n<input type=\"hidden\" name=\"locale\" value=\"en_US\"/>\n<input type=\"hidden\" name=\"useOldLinks\" value=\"false\"/>\n<input class=\"button\" type=\"submit\" value=\"Generate\" onclick=\"this.disabled=true; this.value= 'Generating. Wait..'; document.forms[0].submit();\" />\n</FORM>\nManagement Report Now - this will immediately generate and save this report, using the most current data\n (Note: This may take a few moments, depending on the speed of the SiteScope machine, the number of monitors and the time period of the report)\n\r\n"

I need to grep lines that start with HREF which end with >. For example,
I need to put all these entries into a vector:
HREF=/SiteScope/accounts/login59/htdocs/Reports-1725002550/Report-15_33-01_25_2015.txt
HREF=/SiteScope/accounts/login59/htdocs/Reports-1725002550/Report-11_26-01_20_2015.txt
HREF=/SiteScope/accounts/login59/htdocs/Reports-1725002550/Report-11_26-01_20_2015.txt

and sort the vector and list the latest from the vector.
I have tried this:
vec<-as.vector()
vec<-append(grepl("(HREF.*>?"),data, value=TRUE)

no luck, I'd appreciate any guidance with this?

A: I recommend you never use grep on html.  Instead, you can use the XML package for html parsing and searching.  I couldn't reproduce your html document, but since you mention in the comments that it works I'll post my comments here. Beginning with your data text,
library(XML)
doc <- htmlParse(data, asText=TRUE, useInternal=TRUE)
x <- xpathSApply(doc, "//*[@href]", xmlAttrs)

Now we have all the href links.  From there you can use
grep("[.]txt$", x, value=TRUE)

To get only the ones that end with .txt


text:
Q: How can I get repository resources associated with the given build in Azure DevOps using REST Api? Please, observe the following image:

It shows a Pull Request Build summary page. There we can see the build has two repository resources. This is because the build checks out multiple repositories. The first one is self, the other one is auxiliary.
I am trying to figure out what REST API I can use to get the information about the auxiliary repository associated with the given build. This is one of the rare cases when using the network capture proved useless to deduce the right API.
I tried the Pipeline Run API - http://server:8080/tfs/DefaultCollection/{OurProject}/_apis/pipelines/{BuildDefinitionID}/runs/{BuildID}?api-version=6.0-preview.1 - it does not return what I need.
So how do we do it?
(The build is a YAML build)
We use Azure DevOps Server 2020 on-prem.


text:
Q: Setting object property with ternary operator I am trying to set an object property using a ternary operator but I can't see to be able to do it. I am getting this error: > ',' expected.
Here's the code am using:
for(let i =0; i < res.value.length; i++ ){
          let event = res.value[i]
          events.push({
            eventEndDate: event.EndTime && '',
            eventName: event.Title,
            eventStartDate: event.StartTime && '',
            numOfAttendees: event.RSVPId?? event.RSVPId.length :  0, //here's my issue
            eventId: event.Id
          })
        }

I want to set the numOfAttendees to 0 if event.RSVPId is null, otherwise I want to set it to the length of that property. What am I doing wrong here? Isn't this how it's supposed to be written?

A: for(let i =0; i < res.value.length; i++ ){
          let event = res.value[i]
          events.push({
            eventEndDate: event.EndTime && '',
            eventName: event.Title,
            eventStartDate: event.StartTime && '',
            numOfAttendees: event.RSVPId? event.RSVPId.length :  0, //here's my issue
            eventId: event.Id
          })
        }

You had two ? instead of 1

event.RSVPId?? event.RSVPId.length :  0

is suppose to be

event.RSVPId? event.RSVPId.length :  0


text:
Q: Django runserver seems to run two instances I am working on a project where users can post and comment.
I made one app called core.
In core/views there is a file comments.py
There is a class inside it like this:
class CommentList(APIView):
    authentication_classes = [BasicAuthentication, TokenAuthentication]
    permission_classes = [IsAuthenticated]

    print("hello")

    def get(self, request: request.Request, pub_id: str) -> Response:
        pass

Also my core/views/__init__.py has this:
from .comments import *

Now when I run
python3.10 manage.py runserver,
it prints 'hello' two times.
I expect hello to be printed once.
Any possible explanation ?


text:
Q: How to fill all cell of the calendar? I'm trying to fill all height of the cell of the calendar (in the month view), this is what I did:
var event =
{
     'id': content.id,
     'start': content.start,
     'end': content.end,
     'allDay': true,
     'color': '#ff0000'
};

the problem's that I cannot see the cell of the calendar all filled, but I see only a rectangle. I need for example all the cell filled as red, in my example in the month view. Is it possible?
And also, is possible propagate the event to another cell?
UPDATE:
I just noticed dayRender property ,but how can I set the color of specific date?


text:
Q: Apuntar subdominio en Apache Un cliente apunto un subdominio a mi servidor, desde apache configure para tomar ese subdominio y apuntarlo a la carpeta deseada, pero no logro conservar la url del dominio, en cambio me muestra la ip de mi servidor. Que configuración me hace falta?
ssl.conf
Listen 443
NameVirtualHost *:443
LoadModule ssl_module modules/mod_ssl.so

SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
# SSLRandomSeed startup file:/dev/random  512
# SSLRandomSeed connect file:/dev/random  512
# SSLRandomSeed connect file:/dev/urandom 512
SSLCryptoDevice builtin

SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

<VirtualHost *:443>
 ServerName subdominio2
 DocumentRoot carpeta subdominio2
 SSLEngine on
 SSLCertificateFile camino a certificado.crt
 SSLCertificateKeyFile camino a key.key
 # SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>

<VirtualHost *:443>
 ServerName subdominio1
 DocumentRoot carpeta subdominio1
 SSLEngine on
 SSLCertificateFile camino a certificado.crt
 SSLCertificateKeyFile camino a key.key
# SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>

El subdominio1 funciona correctamente el subdominio2 es el problema. y creo que tengo la misma configuracion.


text:
Q: Uninstalling Firebase from app, went too far? I connected my app to Firebase and decided later I wanted to undo it all. So I removed firebase references from my Gradle files, ran this instead:
configurations {
    all*.exclude group: 'com.google.firebase', module: 'firebase-core'
    all*.exclude group: 'com.google.firebase', module: 'firebase-iid'
}

went to the Firebase console, and used the DELETE THIS APP function. I also deleted the project from the Firebase console.
However now I received an email saying that my app is being removed from the developer console itself as a result of this action? Did I overdo it somewhere?
All I want to do is remove Firebase from my app completely. I don't want to delete anything else past that.

A: You just needed to remove the dependencies and clear the application cache on the device
You overdid it by even touching the Firebase developer console


text:
Q: free -m output, should I be concerend about this servers low memory?
Possible Duplicate:
How to understand the memory usage and load average in linux server

This is the output of free -m on a production database (MySQL with machine. 83MB looks pretty bad, but I assume the buffer/cache will be used instead of Swap?
[admin@db1 www]$ free -m
             total       used       free     shared    buffers     cached
Mem:         16053      15970         83          0        122       5343
-/+ buffers/cache:      10504       5549
Swap:         2047          0       2047

top ouptut sorted by memory:
top - 10:51:35 up 140 days,  7:58,  1 user,  load average: 2.01, 1.47, 1.23
Tasks: 129 total,   1 running, 128 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.5%us,  1.2%sy,  0.0%ni, 60.2%id, 31.5%wa,  0.2%hi,  0.5%si,  0.0%st
Mem:  16439060k total, 16353940k used,    85120k free,   122056k buffers
Swap:  2096472k total,      104k used,  2096368k free,  5461160k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
20757 mysql     15   0 10.2g 9.7g 5440 S 29.0 61.6  28588:24 mysqld
16610 root      15   0  184m  18m 4340 S  0.0  0.1   0:32.89 sysshepd
 9394 root      15   0  154m 8336 4244 S  0.0  0.1   0:12.20 snmpd
17481 ntp       15   0 23416 5044 3916 S  0.0  0.0   0:02.32 ntpd
 2000 root       5 -10 12652 4464 3184 S  0.0  0.0   0:00.00 iscsid
 8768 root      15   0 90164 3376 2644 S  0.0  0.0   0:00.01 sshd

A: The line you should be looking at is:
-/+ buffers/cache:      10504       5549

which suggests you have more than 5GB that can be freed on a 16GB machine.  Alternatively, you can do math and add up the free + buffers + cache from the first line and get approximately the same number, but math is hard, so why bother if it's right there on the next line.

A: Yes the buffers are used by the system to speed up I/O operations (e.g., by caching file reads). If needed this memory will be automatically freed.
Your swap memory is not used which is a good sign (the system never needed more than the available physical memory).

A: Linux has managed to take advantage of almost all of your memory, letting very little go to waste. It's not like if you use 2GB less today, you can use an extra 2GB tomorrow.


text:
Q: Removing a date from a date array I created an array of datetime objects from 2014-12-1 to 2014-12-31, but i need to remove the 2014-12-29 entry from it. How do i do that ?

A: Use boolean indexing or Index.drop:
data = pd.date_range('2014-12-1', '2014-12-31')
print (data)
DatetimeIndex(['2014-12-01', '2014-12-02', '2014-12-03', '2014-12-04',
               '2014-12-05', '2014-12-06', '2014-12-07', '2014-12-08',
               '2014-12-09', '2014-12-10', '2014-12-11', '2014-12-12',
               '2014-12-13', '2014-12-14', '2014-12-15', '2014-12-16',
               '2014-12-17', '2014-12-18', '2014-12-19', '2014-12-20',
               '2014-12-21', '2014-12-22', '2014-12-23', '2014-12-24',
               '2014-12-25', '2014-12-26', '2014-12-27', '2014-12-28',
               '2014-12-29', '2014-12-30', '2014-12-31'],
              dtype='datetime64[ns]', freq='D')

print (data[data != '2014-12-29'])
DatetimeIndex(['2014-12-01', '2014-12-02', '2014-12-03', '2014-12-04',
               '2014-12-05', '2014-12-06', '2014-12-07', '2014-12-08',
               '2014-12-09', '2014-12-10', '2014-12-11', '2014-12-12',
               '2014-12-13', '2014-12-14', '2014-12-15', '2014-12-16',
               '2014-12-17', '2014-12-18', '2014-12-19', '2014-12-20',
               '2014-12-21', '2014-12-22', '2014-12-23', '2014-12-24',
               '2014-12-25', '2014-12-26', '2014-12-27', '2014-12-28',
               '2014-12-30', '2014-12-31'],
              dtype='datetime64[ns]', freq=None)

Or:
print (data.drop(pd.Timestamp('2014-12-29')))

A: use boolean check for that day
df = df[df['date'] !='2014-12-29']


text:
Q: Mysql Query Two Foreign Key To One Primary Key I have two table : history_tickets & users
Tabel 1 : history_ticket
history_id   |  id_klien    | id_staf   | message
  11         |     77       |   NULL    |  text
  12         |    NULL      |    1      |  text
  13         |     77       |   NULL    |  text

Tabel 2 : users
user_id   |  name    | group
  1       |   john   |  staff
  77      |   dion   |  member

I want result like this :
history_id   |  message | user_id  |  name   | group
  11         |    text  |   77     |  dion   |  member
  12         |    text  |    1     |  john   |  staf
  13         |    text  |   77     |  dion   |  member

A: You need to JOIN the tables:
select h.history_id,
  h.message,
  u.user_id,
  u.name,
  u.group
from history_ticket h
left join users u
  on h.id_staf = u.user_id
  or h.id_klien = u.user_id

See SQL Fiddle with Demo

A: SELECT  a.HISTORY_ID,
        a.MESSAGE,
        COALESCE(a.ID_KLIEN, a.ID_STAF) UserID,
        COALESCE(b.name, c.name) name,
        COALESCE(b.group, c.group) `group`
FROM    history_ticket a
        LEFT JOIN users b
            ON a.id_klien = b.user_ID
        LEFT JOIN users c
            ON a.id_staf = c.user_ID

*

*SQLFIddle Demo


text:
Q: Android: get images from gallery, display them in recycler adapter So i want to choose some images from gallery then display these images inside recyclerview , layout of image inside recyclerview would have a rotate button to rotate images before uploading to firebase.
now i would like to knew how to get display images from galelry inside recyclerview so i can rotate them and  upload the rotated images for firebase.

A: You should consider following steps:

*

*Fire an intent to select images from gallery.

*You can access the images by overloading the onActivityResult() function.

*Now, you have to save those images using the URIs provided for the images.

*Use those images on your recycler view.

*Upload them to firebase when the rotation is done.


text:
Q: pass JVM args to clover in a ant script I call runGraph class from CloverETL in a ANT script like this
      <java classname="org.jetel.main.runGraph" fork="true" failonerror="true">

           <arg value="${canadapostdir}/metadata/CanadaPostADDTypes34.grf"/>
                    <classpath>
                            <pathelement path="${ear.lib}/clover.jar" />
                            <pathelement path="${ear.libext}/oracle.jdbc/ojdbc6.jar" />
                            <pathelement path="${ear.libext}/mysql.jdbc/mysql-connector-java-3.0.15-ga-bin.jar" />
                            <fileset dir="${ear.lib}">
                                    <include name="*.jar"/>
                            </fileset>
                    </classpath>
            </java>

When clover start I can see that in the log :
    [java] [Clover] starting WatchDog thread ...
    [java] [WatchDog] Thread started.
    [java] [WatchDog] Running on 16 CPU(s) max available memory for JVM 3005703 kB
    [java] [Clover] Initializing phase: 0
    [java]  all edges initialized successfully...
    [java]  initializing nodes:
    [java]     INPUT ...OK
    [java]     TYPEFILTER ...OK
    [java]     REF ...OK
    [java]     OUTPUT ...OK
    [java] [Clover] phase: 0 initialized successfully.
    [java] [WatchDog] Starting up all nodes in phase [0]
    [java] [WatchDog]   INPUT ... started
    [java] [WatchDog]   TYPEFILTER ... started
    [java] [WatchDog]   REF ... started
    [java] [WatchDog]   OUTPUT ... started
    [java] [WatchDog] Sucessfully started all nodes in phase!

My question is : how can I make clover run with more memory than 3005703 kB ?There is actually 100gig of free ram on the server that this script is running.
EDIT : I know for what I see that clover is not running on a separate jvm and that it use all the free memory availble on the current JVM instance I guess. I need to find a way to start clover on a separate jvm which I can pass -Xms10240m -Xmx10240m.

A: <jvmarg> nested elements are used to pass JVM arguments:
<java classname="org.jetel.main.runGraph" fork="true" failonerror="true">

       <arg value="${canadapostdir}/metadata/CanadaPostADDTypes34.grf"/>
       <jvmarg value="-Xms1024M"/>
       <jvmarg value="-Xmx10240M"/>
       <classpath>
               <pathelement path="${ear.lib}/clover.jar" />
               <pathelement path="${ear.libext}/oracle.jdbc/ojdbc6.jar" />
               <pathelement path="${ear.libext}/mysql.jdbc/mysql-connector-java-3.0.15-ga-bin.jar" />
                   <fileset dir="${ear.lib}">
                         <include name="*.jar"/>
                   </fileset>
       </classpath>
</java>

You are executing the class in another VM. That's what fork=true means.


text:
Q: Does audio.loadSound, loads audio files synchronously? I'm working on a game that heavily depends on audio API of Corona SDK. The game neads to load a couple of sounds (wavs) and a relatively big background music (+15mb) I don't want to steam the files couse of a statement that I read in corona guides.

Note that streamed files may have a slightly higher latency cost and CPU cost than files loaded with audio.loadSound().

I'm using composer API and I'm planning to develop a loading screen based on event cycle.
My question is can I depend on audio API that if I put all of my loadSounds to the create event handler and they all going to load synchronously and then the show event will be dispatched after all of audio files loaded?..
...Or should I use a diffrent approach for my loading screen?

A: Yes I believe they are loaded synchronously.
On my apps with a larger background music file the load screen will take longer on slower devices.  So it blocks until it is loaded.
I would imagine this is the case since there is no mechanism to 'query' or a callback for when audio is loaded if it was asynchronous.
But don't take my word for it, test it.
PS: Your solution does seem to be solid though, that's about what I do.


text:
Q: How to register client script in HttpHandler to execute javascript function? I have an html page that using ajax to call HttpHandler which needs to return javascript function back to client, so, when button is clicked this function gets executed.
I'm learning ajax now and using old fashion way to call it.
Here is my .html file:

Returning JavaScript

  <form>
      <input type="button" value="Fetch JavaScript" onclick="getData('http://myserver/DataSources/data.ashx')" />
  </form>

The fetched data will go here.

Than I have my HttpHandler where I need to register client script to call the function:
public class data1 : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        EchoMessage(context);
    }

    private void EchoMessage(HttpContext context)
    {

    }
 }

What should I write in my EchoMessage to register the script needed to run on a client side?
Thank you

A: You can use RegisterStartupScript or RegisterClientScriptBlock to declare a script on the server and pass it on to be executed on the client. These are static functions of ClientScript and ScriptManager.
Differences between ScriptManager and ClientScript when used to execute JS?
Difference between RegisterStartupScript and RegisterClientScriptBlock?

A: After all, I just decided to go with context.Response.Write("alerter()") and it seems to be working. Not sure if this is the right solution though

A: You can simply use the ScriptManager.RegisterStartupScript, which worked for me as below:
Page page = HttpContext.Current.Handler as Page;
ScriptManager.RegisterStartupScript(page, this.GetType(), "ErrorSave", "$cmsj('.alert-label').html('Maximum 4 quick links are allowed.');", true);


text:
Q: Using geom_dl to label multiple geom_smooth plots I have a dataset of all football (soccer) transfers made in the last fifteen seasons. I am doing a regression analysis with the placement of the teams. I am plotting the lines via geom_smooth for all of the five respective leagues. I have chosen to categorise the seasons into five steps, => five colours in total.
In the end, I want to label the plots directly in the plot. Using geom_dl, I was only able to plot at the last remaining point.
The code I used is the following:
pal <- c("05/06" = "red","06/07" = "red","07/08" = "red","08/09" = "blue","09/10" = "blue","10/11" =
"blue","11/12" = "black","12/13" = "black","13/14" = "black","14/15" = "yellow","15/16" =
"yellow","16/17" = "yellow","17/18" = "forestgreen","18/19" = "forestgreen","19/20" = "forestgreen")

Reg_Ger <- lm(Placement ~ Transfer_Expenditure, data = DS_Ger)
summary(Reg_Ger)

ggplot(aes(x=Transfer_Expenditure ,y=Placement, colour = Season, fill=Season),data = DS_Ger)+
ggtitle("Bundesliga")+
geom_point(size=2)+
scale_y_continuous(limits = c(1, 18), breaks = seq(1, 18, by = 1))+
scale_x_continuous(limits = c(0, 150000000), breaks = seq(0, 150000000, by = 40000000))+
scale_colour_manual(values = pal)+
geom_smooth(method = "lm",se=F)+
theme_dark()
geom_dl(aes(label=Season),method=list("last.points"))

Result of the code
I also tried using GGrepel, but that gives me the season for all points in the plot, which I do not need/want.
If anyone can help me, that would be great, I searched a long for a solution but did not find any.
PS: If someone can explain these error messages to me that would also be great (not a big issue):
Warning messages:
1: Removed 8 rows containing non-finite values (stat_smooth).
2: Removed 8 rows containing missing values (geom_point).
3: Removed 101 rows containing missing values (geom_smooth).


text:
Q: Is it possible to get this result? I'm trying to get this result:
$P(Y,\theta \mid D,X) = P(Y \mid \theta, D,X) P(\theta | D)$
But I can't get exactly $P(Y \mid \theta, D,X) P(\theta | D)$ in the right side of the equation. What I get is:
$P(Y,\theta \mid D, X)=\frac{P(Y, \theta, D, X)}{P(D, X)}=\frac{P(Y \mid \theta, D, X) P(\theta \mid D, X)P(D, X)}{P(D, X)}=P(Y \mid \theta, D, X) P(\theta \mid D, X)$
Is it possible to get rid of the $X$ in $P(\theta \mid D,X)$


text:
Q: How to get a list of local drives without SUBST'ituted ones in Python / Windows? I'm looking for a way to get all the local drives on a Windows machine,
So far, I tried with two options
1)
# Win32Com
from win32com.client import Dispatch
import sys

fso = Dispatch('Scripting.FileSystemObject')
for drive in fso.Drives:
    print drive, drive.DriveType

2)
# win32api
import win32api
import win32file
drives = (drive for drive in win32api.GetLogicalDriveStrings().split("\000") if drive)
for drive in drives:
    print drive, win32file.GetDriveType(drive)

This two ways works (almost) fine, I get my drive list such as:
A: 1    // Removable
C: 2    // Fixed
D: 2
E: 2
G: 2    // Fixed    (??? SUBST'ed drive)
I: 4    // Cd-Rom
X: 3    // Network

but the G: drive is a SUBST'ed drive (eg: created with SUBST G: C:\TEST),
and I cannot find the way to differentiate it from a "real" local drive.
Any ideas?
TIA,
Pablo

A: Google tells me that if you try and fetch a GUID for a SUBST-ed drive it will fail:
>>> import win32file
>>> win32file.GetVolumeNameForVolumeMountPoint("C:\\")
'\\\\?\\Volume{50c800a9-c62e-11df-b5bb-806e6f6e6963}\\'
>>> win32file.GetVolumeNameForVolumeMountPoint("K:\\")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pywintypes.error: (87, 'GetVolumeNameForVolumeMountPoint',
                       'The parameter is incorrect.')

This seems to work but may not be reliable.


text:
Q: How to reset com port in python I have a device that communicate via serial com port. From time to time , the device stuck and I don't have access to read any information from it.Only when I physically disconnect and re-connect  the device from my computer , i can read the data again. Can I do it (disconnect and connect ) with python script?
when I tried to open the com port i print connection data:
def print_connection_data(self):
    logger.info("checking if port is opened:")
    logger.info(self.ser.isOpen())
    logger.info("checking if we have characters to read:")
    logger.info(self.ser.inWaiting())
    logger.info("getting settings dict:")
    logger.info(self.ser.getSettingsDict())

and the results are:

*

*2015-04-13 18:33:45,322 - wtests - INFO - checking if port is opened:

*2015-04-13 18:33:45,322 - wtests - INFO - True

*2015-04-13 18:33:45,323 - wtests - INFO - checking if we have characters to read:

*2015-04-13 18:33:45,323 - wtests - INFO - 0

*2015-04-13 18:33:45,323 - wtests - INFO - getting settings dict:

*2015-04-13 18:33:45,323 - wtests - INFO - {'parity': 'N', 'baudrate':
9600,       'bytesize': 8, 'xonxoff': False, 'interCharTimeout':
None, 'rtscts':     False, 'timeout': 1, 'stopbits': 1, 'dsrdtr':
False, 'writeTimeout':     None}


text:
Q: Hide removable drive in the MS Windows explorer? How can I hide the removable drive e.g. flash memory from the user in the MS Windows explorer ?
I want to hide the removable drive from the user and then do some operation on that e.g. delete some files or read some files from that and then show the drive to the user .
I was try to block the drive but when it become blocked I can't do any operations on it so I changed my approach to only hide the drive from the user .
I must do this with pure c and win32 api if needed .
Thanks a lot , good luck .

A: It should be pretty simple.  There's a registry entry that is a 32 bit number that has a 1 in place where a drive should be shown.  If you can extract the drive letter that you want, it should be as easy as then just editing this registry entry (which can be done with winapi i believe).
http://genesisdatabase.wordpress.com/2010/10/12/reading-and-writing-registry-in-windows-using-winapi/
Above is the winapi functions for editing registry.  Just change it to hide the drive after extracting the letter.
Then edit this value:
http://www.howtogeek.com/howto/windows-vista/hide-drives-from-your-computer-in-windows-vista/
And then change the registry value again to show the drive.  You don't want to unmap the drive, because that's a different concept than hiding the drive.


text:
Q: Passing array of data in Symfony I have my notification table in db where I am setting all read notifications by user.
For now, this function receives only one id, but also, there should be an option to pass array of ids there, to mark several at once as read. I need to extend this function so that it handles the case where $this>data['id'] is array.
How can I fix it?
My code:
public function readNotification(User $user, $notificationId)
{

   $notification = $this->getNotificationRepository()->findOneBy([
       'user' => $user,
       'id' => $notificationId
   ]);

   if($notification) {
       $notification->setRead(new \DateTime());
       $this->em->flush();
   }
}

My controller:
$this->requirePostParams(['id']);
    $this->get('app.service')->readNotification(
        $this->data['user'],
        $this->data['id']
    );

    return $this->success();

A: In real life it is a very bad approach to get all notifications and save each notification with flush. Suppose with your case you should update 1K or more notifications. This will cause 1K update queries. I advise you to create a distinct UPDATE query and update all related items in a single query:
UPDATE `tableName` SET `read` = NOW() WHERE id IN (id1, id2, ....)

id1, id2 ... is a list of ids that you want to update.
In your function you can do something like:
public function readNotification(User $user, $notificationIds)
{
    if (!is_array($notificationIds)) {
        $notificationIds = [$notificationIds];
    }

    // other code

}


text:
Q: Rails partial template using a custom handler is escaping html I'm working on a Rails 3.1 app using JavascriptMVC and ejs templates within the client to do some complicated features on my application. Unfortunately ejs syntax is very similar to erb syntax, to the point where I can't keep the code in the same file (although if someone knows of a good way to do this, I'd be ecstatic). Ultimately I want to be able to apply some rails code within the ejs template (say for I18n) but at this point I will just settle for getting this to work
Following the example from this question I have created a custom template handler that looks like this:
module CommonModel
    class Handler < ActionView::Template::Handler
        include ActionView::Template::Handlers::Compilable

        def compile(template)
            template.source.inspect
        end

    end
end

ActionView::Template.register_template_handler :ejs, CommonModel::Handler

Then I created a partial template that has my ejs code in it:
_jmvc_templates.html.ejs

Within my existing template, I attempt to include my partial:
<%= render 'path/to/my/ejs/templates/jmvc_templates' %>

At this point, the file is included and my handler is used, but everything is escaped, so my div in my template gets rendered to the page like this:
<div%gt;

I'm sure I'm missing something obvious here, but I don't know what it could be... How can I get this template handler to just include my ejs based template without escaping all of the html in it?
Edit:
I've found that calling render with html_safe works:
<%= render('path/to/my/ejs/templates/jmvc_templates').html_safe %>

This seems like a kludge though - there has to be a way to get the erb renderer to treat text from my handler as html safe text.

A: Maybee you should be using raw. Check this
def compile(template)
  raw template.source.inspect
end


text:
Q: How to shave off image in Java? This is what I need to do. I need to create square thumbnails from a standard photo. The photos are usually portrain layout, so I need to shave off the bottom part of the photo so that the height is equals to the width.
If the image is landscape layout then I need to shave off equal number of pixels from left and right to make it square.
Any ideas how to do this?
My image is BufferedImage object already.

A: You can use getSubimage to retrieve a cropped version of the original image.


text:
Q: angularjs multiple instances of the same service Say I want more than one instance of a user service (selectedUser & currentUser), they provide the same functionality. Currently I just get around the problem by creating two services that pull their definition from a local function:
angular.module('myUserModule', [])

.factory('userFactory', ['$http', '$q', function ($http, $q) {
  return function getUser(userId) {
    return new $q(function (resolve) {
      //Gets the user with the provided userId
    }
  }
}])

.value('currentUserId', '')
.value('selectedUserId', '')

.service('currentUserService', ['userFactory', 'currentUserId', User])
.service('selectedUserService', ['userFactory', 'selectedUserId', User]);

function User(userFactory, userId) {
  var self = this;
  var promise = userFactory(userId);
  promise.then(function setUserSuccess(result) {
    self.user = result;
  }
}

Just wondering how other people have approached this problem.
Updated:
Just to clarify that I am making use of these services as singletons too.

A: In an unrelated question the solution ended up using a factory that creates multiple instances:
what is the scope of a service in angularjs?
Use the Factory Pattern.
In essence, if you have a User service, you can use a factory to return a unique instance of the service.
function User(userId, $http) {

    var self = this;

    $http.get('/api/user/', {userId: userId}).success(function(result) {

        self.details = result.data;
    }):
}

userFactory.$inject = ['$http'];
function userFactory($http) {

    return function(user) {

        return new User(user, $http);
    }
}
angular.module('app').factory('user', userFactory);

But for this example, you can just use $resource. This is a built in angular factory that returns unique Resource instances.

A: You can use use your factory as an API to return a collection of objects with getter and setter methods.
You can declare new Factory by using the new keywords. However, it is preferable to encapsulate the creation of an instance into a getter method.
Service
(function(){

  function userFactory($http, $q){

    //Create our userFactory
    function userFactory(num){
      this.num = num;
    };

    //Retrieve some user data for example
    function getUser(id){
      return new $q(function(resolve){
        resolve({id: id, data: [1,2,3,4]});
      });
    }

    //Another method
    function awesome(){
      console.log('Awesome method called by : ' + this.num);
    }

    //Set method by prototyping
    userFactory.prototype.getUser = getUser;
    userFactory.prototype.awesome = awesome;

    return {
      //Use get method to return a new instance of our factory
      get: function(){
        //Pass a random id for our factory
        return new userFactory(Math.ceil(Math.random() * 100));
      }
    }

  }

  angular
    .module('app')
    .factory('UserFactory', userFactory);

})();

The you can create your own instance by using the .get() method :
Controller
(function(){

function Controller($scope, UserFactory) {

  var factoryA = UserFactory.get()
  var factoryB = UserFactory.get();

  console.log('A num instance ' + factoryA.num);
  console.log('B num instance ' + factoryB.num);

  factoryA.getUser(1).then(function(data){
    console.log(data);
  });

  factoryB.awesome();

  console.log('Equality = ' + angular.equals(factoryA, factoryB));

}

angular
.module('app', [])
.controller('ctrl', Controller);

})();

(function(){

function Controller2($scope, UserFactory) {

  var factoryC = UserFactory.get()

  console.log('C num instance ' + factoryC.num);

}

angular
.module('app')
.controller('ctrl2', Controller2);

})();


text:
Q: splitting words by syllable with CMU Pronunciation Dictionary, NLTK, and Python3 I am working on a natural language processing project and am stuck on splitting words into syllables (using nltk and cmudict.dict() in python 3).
I currently count syllables by looking a word in my corpus up in the CMU Pronunciation Dictionary and counting the number of stresses in its list of phonemes. This appears to work pretty well.
What I am stuck on is how to use this information to split the accompanying grapheme after counting, as I do not understand how to either translate the phonemes back to the graphemes (seems error prone) or use the list of phonemes to somehow split the grapheme.
Here is the function I wrote to do this (word tokenization happens elsewhere):
def getSyllables(self):
    pronunciation = cmudict.dict() # get the pronunciation dictionary
    syllableThreshold = 1 # we dont care about 1 syllable words right now
    for word in self.tokens:
        for grapheme, phonemes in pronunciation.items():
            if grapheme == word.lower(): # all graphemes are lowercase, we have to word.lower() to match
                syllableCounter = 0
                for x in phonemes[0]:
                    for y in x:
                        if y[-1].isdigit(): # an item ending in a number is a stress (syllable)
                            syllableCounter += 1
                if syllableCounter > syllableThreshold:
                    output = ' '.join([word, "=", str(syllableCounter)])
                    print(output)
                    print(phonemes)
                else:
                    print(word)

Just as an example, my current output is:
Once
an
angry = 2
[['AE1', 'NG', 'G', 'R', 'IY0']]
man

How can I split the word angry, for example, into an - gry?


text:
Q: How to check if a text contains Jinja2 expressions? The problem:
Separate files that have Jinja2 expressions from the rest using Python 3 and jinja2 lib
The question:
Is there utility method or another good way to check a test for Jinja2 expressions? Or am I stuck with RegEx?