text:
Q: Android inconsistent crashes I'm building an ionic application, I had to use this plugin in order to get the Twilio SDK to work. It was working, but without any reason I can put my finger on my app crashes when calling the Twilio.Device.connect.
when I'm debuging I can see the crash happens on native java code- on this line:
var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);

which is on the cordova.js file line 943.
what drives me crazy is the inconsistency, I cant tell what causing the crash!
here is the adb catlog:
> oc644369-2/lib/arm/libtwilio-native.so (Java_com_twilio_client_impl_useragent_Ca
ll_makeCall+174)
I/DEBUG   (  247):     #12 pc 000709fd  /data/dalvik-cache/arm/data@app@com.ioni
cframework.moneytunespoc644369-2@base.apk@classes.dex
W/AudioFlinger(  250): RecordThread: buffer overflow
I/AudioFlinger(  250): BUFFER TIMEOUT: remove(4098) from active list on thread 0
xb59c7000
I/DEBUG   (  247):
I/DEBUG   (  247): Tombstone written to: /data/tombstones/tombstone_02
I/BootReceiver(  773): Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_
TOMBSTONE)
I/Choreographer(11192): Skipped 99 frames!  The application may be doing too muc
h work on its main thread.
W/Thread-1259(11812): type=1701 audit(0.0:227): auid=4294967295 uid=10217 gid=10
217 ses=4294967295 subj=u:r:untrusted_app:s0 reason="memory violation" sig=6
W/ActivityManager(  773):   Force finishing activity 1 com.ionicframework.moneyt
unespoc644369/.MainActivity
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202b
f}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
0}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
1}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1201 a=1 r=0x1050
104}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1801 a=1 r=0x1050
103}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1801 a=1 r=0x1050
103}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
2}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
7}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
c}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
8}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1201 a=1 r=0x1050
104}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1801 a=1 r=0x1050
103}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x1801 a=1 r=0x1050
103}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
d}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
e}
I/WindowState(  773): WIN DEATH: Window{3195f6ed u0 com.ionicframework.moneytune
spoc644369/com.ionicframework.moneytunespoc644369.MainActivity}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
9}
W/Resources(  773): Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x10202c
4}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x3001 a=1 r=0x1050
037}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x3001 a=1 r=0x1050
037}
W/Resources(  773): Converting to string: TypedValue{t=0x5/d=0x3001 a=1 r=0x1050
037}
D/OpenGLRenderer(  773): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/Atlas   (  773): Validating map...
D/audio_hw_primary(  250): in_standby: enter: stream (0xb586de80) usecase(7: aud
io-record)
I/ActivityManager(  773): Process com.ionicframework.moneytunespoc644369 (pid 11
192) has died
W/ActivityManager(  773): Scheduling restart of crashed service com.ionicframewo
rk.moneytunespoc644369/com.twilio.client.TwilioClientService in 84912ms
D/zyz     ( 2420): bar facade onStart
I/Test    ( 2420): onResume activeId: 1436976492097
D/hardware_info(  250): hw_info_append_hw_type : device_name = handset-mic
D/audio_hw_primary(  250): adev_close_input_stream: enter:stream_handle(0xb586de
80)
D/audio_hw_primary(  250): in_standby: enter: stream (0xb586de80) usecase(7: aud
io-record)
I/OpenGLRenderer(  773): Initialized EGL, version 1.4
D/zyz     ( 2420): onResume
I/zhiping ( 2420): weather resume
I/xiaojun ( 2420): lastChoosen : com.gau.go.launcherex
D/OpenGLRenderer(  773): Enabling debug mode 0
W/SurfaceFlinger(  240): couldn't log to binary event log: overflow.
I/Timeline( 2420): Timeline: Activity_idle id: android.os.BinderProxy@fa4fbae ti
me:257449
I/Zygote  (  260): Process 11192 exited due to signal (6)
V/ActivityManager(  773): killProcessGroupAsync took 221 ms for PID 11192 on thr
ead 17
I/Timeline(  773): Timeline: Activity_windows_visible id: ActivityRecord{3795af7
2 u0 com.gau.go.launcherex/com.jiubang.golauncher.GOLauncher t8668} time:257688
D/audio_hw_primary(  250): out_standby: enter: stream (0xb5880600) usecase(1: lo
w-latency-playback)
D/hardware_info(  250): hw_info_append_hw_type : device_name = handset
E/AudioTrack(  773): AudioTrack::set : Exit
V/PhoneStatusBar( 1166): setLightsOn(true)
D/audio_hw_primary(  250): out_set_parameters: enter: usecase(1: low-latency-pla
yback) kvpairs: routing=2
W/InputMethodManagerService(  773): Got RemoteException sending setActive(false)
 notification to pid 11192 uid 10217
D/audio_hw_primary(  250): start_output_stream: enter: stream(0xb5880600)usecase
(1: low-latency-playback) devices(0x2)
D/audio_hw_primary(  250): start_output_stream: enter: usecase(1: low-latency-pl
ayback) devices(0x2)
D/audio_hw_primary(  250): select_devices: out_snd_device(2: speaker) in_snd_dev
ice(0: )
W/msm8974_platform(  250): Codec backend bitwidth 16, samplerate 48000
D/hardware_info(  250): hw_info_append_hw_type : device_name = speaker
I/msm8974_platform(  250): platform_send_audio_calibration: sending audio calibr
ation for snd_device(2) acdb_id(15)
D/ACDB-LOADER(  250): ACDB -> send_audio_cal, acdb_id = 15, path =  0
D/ACDB-LOADER(  250): ACDB -> send_adm_topology
D/ACDB-LOADER(  250): ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
D/ACDB-LOADER(  250): ACDB -> send_asm_topology
D/ACDB-LOADER(  250): ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
D/ACDB-LOADER(  250): ACDB -> send_audtable
D/ACDB-LOADER(  250): ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
D/ACDB-LOADER(  250): ACDB -> AUDIO_SET_AUDPROC_CAL
D/ACDB-LOADER(  250): ACDB -> send_audvoltable
D/ACDB-LOADER(  250): ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
D/        (  250): Failed to fetch the lookup information of the device 0000000F

E/ACDB-LOADER(  250): Error: ACDB AudProc vol returned = -19
D/ACDB-LOADER(  250): ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
D/ACDB-LOADER(  250): ACDB -> send_afe_cal
D/ACDB-LOADER(  250): ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
D/        (  250): Failed to fetch the lookup information of the device 0000000F

E/ACDB-LOADER(  250): Error: ACDB AFE returned = -19
D/ACDB-LOADER(  250): ACDB -> AUDIO_SET_AFE_CAL
D/audio_hw_primary(  250): select_devices: done
D/Ulp_jni (  773): Location CB invoked
D/ConnectivityService(  773): updateNetworkScore for NetworkAgentInfo [WIFI () -
 101] to 55
D/ConnectivityService(  773): rematching NetworkAgentInfo [WIFI () - 101]
D/ConnectivityService(  773): Network NetworkAgentInfo [WIFI () - 101] was alrea
dy satisfying request 1. No change.
D/ConnectivityService(  773): notifyType AVAILABLE for NetworkAgentInfo [WIFI ()
 - 101]
D/ConnectivityManager.CallbackHandler( 1166): CM callback handler got msg 524290

D/audio_hw_primary(  250): out_standby: enter: stream (0xb5880600) usecase(1: lo
w-latency-playback)
D/hardware_info(  250): hw_info_append_hw_type : device_name = speaker
D/Ulp_jni (  773): Location CB invoked
D/ConnectivityService(  773): updateNetworkScore for NetworkAgentInfo [WIFI () -
 101] to 56
D/ConnectivityService(  773): rematching NetworkAgentInfo [WIFI () - 101]
D/ConnectivityService(  773): Network NetworkAgentInfo [WIFI () - 101] was alrea
dy satisfying request 1. No change.
D/ConnectivityService(  773): notifyType AVAILABLE for NetworkAgentInfo [WIFI ()
 - 101]
D/ConnectivityManager.CallbackHandler( 1166): CM callback handler got msg 524290

D/Ulp_jni (  773): Location CB invoked
D/ConnectivityService(  773): updateNetworkScore for NetworkAgentInfo [WIFI () -
 101] to 55
D/ConnectivityService(  773): rematching NetworkAgentInfo [WIFI () - 101]
D/ConnectivityService(  773): Network NetworkAgentInfo [WIFI () - 101] was alrea
dy satisfying request 1. No change.
D/ConnectivityService(  773): notifyType AVAILABLE for NetworkAgentInfo [WIFI ()
 - 101]
D/ConnectivityManager.CallbackHandler( 1166): CM callback handler got msg 524290

D/Ulp_jni (  773): Location CB invoked
I/art     (  773): Background sticky concurrent mark sweep GC freed 130434(8MB)
AllocSpace objects, 174(3MB) LOS objects, 17% free, 38MB/46MB, paused 2.899ms to
tal 143.928ms
D/Ulp_jni (  773): Location CB invoked
D/LBSSystemMonitorService(  773): handleMessage what - 4
D/Wiper_jni(  773): Send Network Location.
D/WifiResults(12170): Results Incomming
V/WoorldsWifiController( 6019): scanned APs: 10
I/WoorldsService( 6019): calling find to server: {"charge_state":"usb","networkI
nfo":{"networkLocation":{"accuracy":30.0,"latitude":32.08029,"longitude":34.7741
596}},"wifiNodes":[{"bssid":"80:37:73:d7:a3:f7","connectedObject":null,"encrypti
on":2,"mNetworkId":0,"powerLevel":-64,"ssid":"ShukronOhad15"}]}
D/Retrofit( 6019): ---> HTTP POST http://app.woorlds.com/api/find
D/Retrofit( 6019): Content-Type: application/json; charset=UTF-8
D/Retrofit( 6019): Content-Length: 254
D/Retrofit( 6019): {"charge_state":"usb","networkInfo":{"networkLocation":{"accu
racy":30.0,"latitude":32.08029,"longitude":34.7741596}},"wifiNodes":[{"bssid":"8
0:37:73:d7:a3:f7","connectedObject":null,"encryption":2,"mNetworkId":0,"powerLev
el":-64,"ssid":"ShukronOhad15"}]}
D/Retrofit( 6019): ---> END HTTP (254-byte body)
D/Retrofit( 6019): <--- HTTP 200 http://app.woorlds.com/api/find (396ms)
D/Retrofit( 6019): : HTTP/1.1 200 OK
D/Retrofit( 6019): Cache-Control: no-store, no-cache, must-revalidate, post-chec
k=0, pre-check=0
D/Retrofit( 6019): Connection: keep-alive
D/Retrofit( 6019): Content-Length: 202
D/Retrofit( 6019): Content-Type: application/json
D/Retrofit( 6019): Date: Wed, 15 Jul 2015 16:09:03 GMT
D/Retrofit( 6019): Expires: Thu, 19 Nov 1981 08:52:00 GMT
D/Retrofit( 6019): Pragma: no-cache
D/Retrofit( 6019): Server: nginx
D/Retrofit( 6019): X-Android-Received-Millis: 1436976543217
D/Retrofit( 6019): X-Android-Response-Source: NETWORK 200
D/Retrofit( 6019): X-Android-Sent-Millis: 1436976543022
D/Retrofit( 6019): X-Powered-By: PHP/5.4.41
D/Retrofit( 6019): {"wifiWorlds":[],"segmentations":{"803a064d-6b34-41a3-a283-59
8a22536f02":[{"id":"554f6c37223599407e8b456c","name":"cafe"}]},"campaigns":{"803
a064d-6b34-41a3-a283-598a22536f02":null},"nearby_woorlds":[]}
D/Retrofit( 6019): <--- END HTTP (202-byte body)
I/WoorldsService( 6019): find successful: {"customDataHashMap":null,"serverHost"
:null,"wifiWorlds":[],"campaigns":{"803a064d-6b34-41a3-a283-598a22536f02":null},
"notifications":null,"segmentations":{"803a064d-6b34-41a3-a283-598a22536f02":[{"
id":"554f6c37223599407e8b456c","name":"cafe"}]},"msg":null,"res_code":0,"status"
:false}, was in woorld: [none] now in:
I/WoorldsService( 6019): not in a woorld anymore, notifying wifi controller its
null for filtering
I/WoorldsWifiController( 6019): setting inwoorld bssid = null
V/WoorldsService( 6019): Publishing data to all services. WOORLDS_DATA:{"pluginV
ersion":466,"serverData":{"customDataHashMap":null,"serverHost":"http://app.woor
lds.com","wifiWorlds":[]}} EXTENDED_DATA: {"locationData":{"networkLocation":{"a
ccuracy":30.0,"latitude":32.08029,"longitude":34.7741596},"networkProviderEnable
d":false,"networkProviderStatus":null},"notificationEnabled":false,"wifiData":{"
connectedAccessPoint":null,"seenAccessPoints":[{"bssid":"80:37:73:d7:a3:f7","con
nectedObject":null,"encryption":2,"mNetworkId":0,"powerLevel":-64,"ssid":"Shukro
nOhad15"}],"wifiEnabled":true},"pluginVersion":466,"serverData":{"customDataHash
Map":null,"serverHost":"http://app.woorlds.com","wifiWorlds":[]}} SEGMENTATIONS:
 {"803a064d-6b34-41a3-a283-598a22536f02":[{"id":"554f6c37223599407e8b456c","name
":"cafe"}]}
V/WoorldsService( 6019): Received global message on com.goldtouch.ynet: com.woor
lds.data. intentVersion=17
I/WoorldsService( 6019): publishing data in com.goldtouch.ynet permission: norma
l
I/WoorldsService( 6019): Segmentation: [{"id":"554f6c37223599407e8b456c","name":
"cafe"}]
V/WoorldsService( 6019): no client is bound to this service
D/Ulp_jni (  773): Location CB invoked
D/Ulp_jni (  773): Location CB invoked
W/ProcessCpuTracker(  773): Skipping unknown process pid 12628
D/Ulp_jni (  773): Location CB invoked
I/ActivityManager(  773): Start proc 12702:com.ionicframework.moneytunespoc64436
9/u0a217 for service com.ionicframework.moneytunespoc644369/com.twilio.client.Tw
ilioClientService
I/art     (12702): Late-enabling -Xcheck:jni
I/ActivityThread(12702): Switching default density from 440 to 480
I/PJSIP   (12702): 19:09:37.159 os_core_unix.c !pjlib 2.3 for POSIX initialized
D/PJSIP   (12702): 19:09:37.164 sip_endpoint.c  .Creating endpoint instance...
I/PJSIP   (12702): 19:09:37.166          pjlib  .select() I/O Queue created (0xb
4ad8044)
I/PJSIP   (12702): 19:09:37.166 sip_endpoint.c  .Module "mod-msg-print" register
ed
D/PJSIP   (12702): 19:09:37.166 sip_transport.  .Transport manager created.
I/PJSIP   (12702): 19:09:37.166   pjsua_core.c  .PJSUA state changed: NULL --> C
REATED
D/ConnectivityService(  773): updateNetworkScore for NetworkAgentInfo [WIFI () -
 101] to 59
D/ConnectivityService(  773): rematching NetworkAgentInfo [WIFI () - 101]
D/ConnectivityService(  773): Network NetworkAgentInfo [WIFI () - 101] was alrea
dy satisfying request 1. No change.
D/ConnectivityService(  773): notifyType AVAILABLE for NetworkAgentInfo [WIFI ()
 - 101]
D/ConnectivityManager.CallbackHandler( 1166): CM callback handler got msg 524290

D/Ulp_jni (  773): Location CB invoked
E/PJSIP   (12702): 19:09:39.294  tsx0xb48c6864  Failed to send Request msg REGIS
TER/cseq=2541 (tdta0xb4af9000)! err=320046 (No working DNS nameserver (PJLIB_UTI
L_EDNSNOWORKINGNS))
E/PJSIP   (12702): 19:09:39.295    pjsua_acc.c  ..SIP registration failed, statu
s=503 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS))
D/ConnectivityService(  773): updateNetworkScore for NetworkAgentInfo [WIFI () -
 101] to 55
D/ConnectivityService(  773): rematching NetworkAgentInfo [WIFI () - 101]
D/ConnectivityService(  773): Network NetworkAgentInfo [WIFI () - 101] was alrea
dy satisfying request 1. No change.
D/ConnectivityService(  773): notifyType AVAILABLE for NetworkAgentInfo [WIFI ()
 - 101]
D/ConnectivityManager.CallbackHandler( 1166): CM callback handler got msg 524290

I/MediaFocusControl(  773):  AudioFocus  abandonAudioFocus() from android.media.
AudioManager@7008991com.cyanogenmod.eleven.MusicPlaybackService$5@1c4af0f6
I/HeadsetService( 1564): Audio session removed: 18
D/NuPlayerDriver(  250): reset(0xb5bc60a0)
D/NuPlayerDriver(  250): notifyResetComplete(0xb5bc60a0)
I/MediaFocusControl(  773):  AudioFocus  abandonAudioFocus() from android.media.
AudioManager@7008991com.cyanogenmod.eleven.MusicPlaybackService$5@1c4af0f6
I/ActivityManager(  773): Killing 2061:com.cyanogenmod.eleven:main/u0a39 (adj 15
): empty #17
D/NuPlayerDriver(  250): reset(0xb5943e20)
D/NuPlayerDriver(  250): notifyResetComplete(0xb5943e20)
V/ActivityManager(  773): killProcessGroupAsync took 46 ms for PID 2061 on threa
d 17
D/Ulp_jni (  773): Location CB invoked
E/PJSIP   (12702): 19:09:49.257  tsx0xb48c6864  ..Failed to send Request msg REG
ISTER/cseq=40614 (tdta0xb4af9000)! err=320046 (No working DNS nameserver (PJLIB_
UTIL_EDNSNOWORKINGNS))
E/PJSIP   (12702): 19:09:49.257    pjsua_acc.c  ....SIP registration failed, sta
tus=503 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS))
F/PJSIP   (12702): 19:09:49.259    pjsua_acc.c  .Unable to create/send REGISTER:
 No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS) [status=320046]
D/Ulp_jni (  773): Location CB invoked
E/PushSDK ( 4036): read err :recvfrom failed: ECONNRESET (Connection reset by pe
er)
W/System.err( 4036): read err :recvfrom failed: ECONNRESET (Connection reset by
peer)
I/ActivityManager(  773): Killing 11578:com.google.android.apps.cloudprint/u0a54
 (adj 15): empty #17
V/ActivityManager(  773): killProcessGroupAsync took 47 ms for PID 11578 on thre
ad 17

I see there is an overflow and android chose to close the "suspicious" app due to its high memory usage. It might have something to do with the speaker as well,
Any help is welcome!


text:
Q: Where can I find BlackBerry's Android runtime? BlackBerry now have a Android Runtime. Cool. But I wonder if this runtime is available to be downloaded itself. I've read that only BlackBerry 10 devices comes with this runtime, and I'm researching ways to put my Android apps on older BlackBerries.
Does someone know a location to download the runtime (not simulators or tools to pack apps)?
Thanks in advance!

A: AFAIK is not available to be downloaded because is part of the OS itself.
Anyway, also Blackberry Playbook comes with Androud Runtime.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Get a callback when jQuery.queue() is done I'm trying to receive a callback from a queue. I want to call a function when the queue is done. How can this be done? (I've been searching the net for a while now, without success)
divs.each(function (index) {
    var thisDiv = $(this);
    var thisDelay = 75 * index;

    thisDiv.delay(thisDelay).queue(function () {
        $(this).removeClass('show');
        $(this).dequeue();
    });

    // For example 'return: true' / call a new function.
});

Thanks


text:
Q: What are some geodesics of the metric $ds^2=\frac{1}{y^2}(dx^2+dy^2)$? Ok, we have the metric $ds^2=\frac{1}{y^2}$ defined in the upper half plane $U=\{(x,y)\in\mathbb{R}^2|y>0\}$.
I know two geodesics are $x(t)=a-b\cos{t}$ and $y(t)=b\sin{t}$. What are some others? And why would they be geodesics of this metric? (Particularly this second question is important.)

A: This is the hyperbolic metric in the upper-half plane and we know that the geodesic of this model are the half-circles orthogonal to the $x$-axis and the vertical lines


text:
Q: Why does my push function store my data in a nested manner? I am working on updating my localStorage to store specific data after every transaction made by the client user. I noticed that my code saves the data in a nested format. This is not desirable.
What would be desirable is if the data is stored in un-nested format.
Find attached descriptive images, to give you a clearer idea of what I mean.

How do I formulate my code to save these data in NON nested manner?
Find below my code
var newData = {}; var transactionDataRetrieved = [];
newData.TransactionTime= "Thu 20:11",
newData.amount= "15,000",
newData.payersNumber= "070505788",
newData.transactionNumber= "PSC999",
newData.waitersName= "Agnes Johnsson!"

transactionDataRetrieved.push({newData: newData});

transactionDataRetrieved.push(JSON.parse(localStorage.getItem('transactionData')));
localStorage.setItem('transactionData', JSON.stringify(transactionDataRetrieved));

A: The problem is that you are pushing the old value onto a new array every time and then saving it back.  Here's one (untested) alternative, adding the newest data to the end.  It wouldn't be hard to modify it to put that data at the beginning.
var transactionDataRetrieved = JSON.parse(localStorage.getItem('transactionData') || '[]');
var newData = {};
newData.TransactionTime = "Thu 20:11",
// ...

transactionDataRetrieved.push(newData);

localStorage.setItem('transactionData', JSON.stringify(transactionDataRetrieved));

Or in a single expression:
localStorage .setItem ('transactionData', JSON .stringify (
    (JSON.parse (localStorage .getItem ('transactionData') || '[]') .concat (newData)
))

A: You are pushing array to array
// pushing object to array
transactionDataRetrieved.push({newData: newData});

// pushing array to array
// localStorage.getItem('transactionData') returns array
// because you created, var transactionDataRetrieved = []; as array
transactionDataRetrieved.push(JSON.parse(localStorage.getItem('transactionData')));
localStorage.setItem('transactionData', JSON.stringify(transactionDataRetrieved));

What you should be doing
transactionDataRetrieved.push({newData: newData});

// changed push to concat
var newArray = transactionDataRetrieved.concat(JSON.parse(localStorage.getItem('transactionData')));
localStorage.setItem('transactionData', JSON.stringify(newArray));

The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.

A: There are some minor issues with your code that I want edit check it:
var newData = {};
newData.TransactionTime= "Thu 20:11",
newData.amount= "15,000",
newData.payersNumber= "070505788",
newData.transactionNumber= "PSC999",
newData.waitersName= "Agnes Johnsson!"
// **newData** is already an Object so don't wrap it in an object
//First get data from the localStorage;
//store it in array of Objects
var transactionDataRetrieved = localStorage.getItem('transactionData');
transactionDataRetrieved.push(newData);
//Now set this array in local storage
localStorage.setItem('transactionData', transactionDataRetrieved);


text:
Q: Celery not returning any results after success? Here I am crawling some websites with different keywords. Before It was only scraping and it worked but I implemented celery for this. After using celery I am not being able to get the scraping result but no error is showing. I am using rabbitmq as the message broker here.
tasks.py
@shared_task()
def schedule_task(pk):
    task = Task.objects.get(pk=pk)
    keywords = ''
    # for keys in ast.literal_eval(obj.keywords.all()): #keywords change to csv
    for keys in task.keywords.all():
        if keywords:
            keywords += ', ' + keys.title
        else:
            keywords += keys.title

    task_ids = []  # one Task/Project contains one or multiple scrapy task

    settings = {
        'spider_count': len(task.targets.all()),
        'keywords': keywords,
        'unique_id': str(uuid4()),  # unique ID for each record for DB
        'USER_AGENT': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
    }

    # res = ast.literal_eval(ini_list)

    for site_url in task.targets.all():
        domain = urlparse(site_url.address).netloc  # parse the url and extract the domain
        spider_name = domain.replace('.com', '')
        task = scrapyd.schedule('default', spider_name, settings=settings, url=site_url.address, domain=domain,
                                keywords=keywords)

views
  def post(self, request, *args, **kwargs):

        form = CreateTaskForm(request.POST)
        if form.is_valid():

            unique_id = str(uuid4())  # create a unique ID.
            obj = form.save(commit=False)

            obj.created_by = request.user
            obj.unique_id = unique_id
            obj.status = 0
            obj.save()
            form.save_m2m()
            print(obj.pk)
            schedule_task.delay(pk=obj.pk)
            return redirect('crawler:task-list')

views before using celery ( which returns the scraped results worked fine) I just split the scraping part into tasks.py and call it from view with .delay but didn't returned the result(before it returned).
form = CreateTaskForm(request.POST)
        if form.is_valid():

            unique_id = str(uuid4()) # create a unique ID.
            obj = form.save(commit=False)

            obj.created_by = request.user
            obj.unique_id = unique_id
            obj.status = 0
            obj.save()
            form.save_m2m()

            keywords = ''
            # for keys in ast.literal_eval(obj.keywords.all()): #keywords change to csv
            for keys in obj.keywords.all():
                if keywords:
                    keywords += ', ' + keys.title
                else:
                    keywords += keys.title

            task_ids = [] #one Task/Project contains one or multiple scrapy task

            settings = {
                'spider_count' : len(obj.targets.all()),
                'keywords' : keywords,
                'unique_id': unique_id, # unique ID for each record for DB
                'USER_AGENT': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
            }

            # res = ast.literal_eval(ini_list)

            for site_url in obj.targets.all():
                domain = urlparse(site_url.address).netloc # parse the url and extract the domain
                spider_name = domain.replace('.com', '')
                task = scrapyd.schedule('default', spider_name, settings=settings, url=site_url.address, domain=domain, keywords=keywords)

            return redirect('crawler:task-list')

celery console
[2020-06-10 20:42:55,885: INFO/MainProcess] celery@DESKTOP-ENPLHOS ready.
[2020-06-10 20:42:55,900: INFO/MainProcess] pidbox: Connected to amqp://guest:**@127.0.0.1:5672//.
[2020-06-10 20:43:13,730: INFO/MainProcess] Received task: crawler.tasks.schedule_task[10e7bf06-5e4e-413c-85a3-79d61b9835cf]
[2020-06-10 20:43:17,077: INFO/MainProcess] Task crawler.tasks.schedule_task[10e7bf06-5e4e-413c-85a3-79d61b9835cf] succeeded in 3.3590000000040163s: None

http://localhost:6800/jobs here I can see the spiders are running but the results are not appearing in my view.

A:
views before using celery ( which returns the scraped results worked fine)

that is because your code runs synchronous....one after the other.
Celery on the other hand runs asynchronous and alway you will get a None as the returned value from it.
If you chain 2 or more Celery tasks (of which all of them run async) then you can make use of their returned value, but not chaining a synchronous view with an async celery task.
Celery tasks are meant to be dispatched and run in background...while your view is suppose to return something else...(without waiting for your spiders to finish)
To be able to make use of the Celery results:
Collected data needs to be stored somewhere (a file like csv, json, etc, .. OR inside a database)  and handle the Django View in 2 steps:

*

*first you trigger the Celery task

*second collect the stored results and display them


text:
Q: How to fix App Clip launch experience using an NFC tag? I've setup an App Clip launch experience using an iPhone 7 running iOS 14.2 and built using Xcode 12.2 RC.
My goal is to launch the App Clip using an NFC tag, but that doesn't seem to work correctly. When using the native NFC Tag Reader in the control center the spinner spins indefinitely, but never opens the App Clip. However, scanning the same exact URL through a QR code using the native QR code scanner opens the App Clip without problem.
This video shows the issue in action https://youtu.be/sobDXKLCTP0
Is this a known issue? Did I make a mistake in the configuration, knowing that the QR code scanning works as expected? I've seen videos demonstrating this feature working correctly but only using newer iPhones that support background NFC scanning.

A: I am new to the app clip & NFC Tags things. But I think you should check the NFC Tag type. Because, if your website have the meta data for the app clip, then the nfc tag should work fine. I used NTAG 213 NFC Tags with 144 byte memory that I bought from amazon.com. see here: https://www.amazon.sa/dp/B07P9DT7Z6/ref=cm_sw_r_cp_apip_9nUYQegsGHtIo. Important to know that I tried to use the tag on iPhone 8 Max but got no response. It worked great on iPhone 12 Pro.


text:
Q: why offsetX and offsetY return different value in firefox and chrome I am writing an drawing web application, use mousemove event's offsetX and offsetY, it works fine in chrome, but not in firefox.
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

    <svg class="svg" width="500" height="500" viewBox="0,0,600,600">
      <image xlink:href="https://picsum.photos/600/600" x="0" y="0" width="600" height="600"></image>
    </svg>

the above code, in chrome, the offsetX is between 0 and 500px, in firefox, the offsetX is between 0 and 600px, why they are not same ?

A: This is a known specs bug, it isn't clear how browsers should calculate this value for <svg> layout elements and we end up with inter-op issues like that.
Since you want Chrome's behavior, you can simply disable the pointer-events on your <image> element, so that the <svg> receives it directly:

let box = document.querySelector('.svg');
box.addEventListener('mousemove', (e) => {
  console.log(e.offsetX, e.offsetY);
})
.box {
  width: 300px;
  overflow: auto;
}
.svg image {
  pointer-events: none;
}

  <svg class="svg" width="500" height="500" viewBox="0,0,600,600">
    <image xlink:href="https://picsum.photos/600/600" x="0" y="0" width="600" height="600"></image>
  </svg>


text:
Q: get formatted html snippet (without stripping tags) Is there a way to get text snippet from a html document without removing the format(tag)?
Suppose you are given a following document:

 Hello World

You see this world quite often.
You must take the blue pill here blah blah...

You want to extract first 30 characters with the formatting tags included:

 Hello World

You see this world quite often.
You must take the blue...

javascript/jquery, python, language-agonostic strategry are all welcome.

A: extract first 30 characters with the formatting tags
With jquery i would do this:
$('
', {
   text : $('p').text(function(){ return this.textContent.slice(0, 30) })
}).replaceWith('p');

Fiddle

If you want to target p tags of specific block then you can do this:
$('
', {
   text : $('#div p').text(function(){ return this.textContent.slice(0, 30) })
}).replaceWith('p');

Within a context demo.

A: Have a look at this github project https://github.com/viralpatel/jquery.shorten It does what you want.


text:
Q: Scraping a RSS url in R I am trying to scrape some tags in a list of RSS urls. I have tried using a normal scraping structure with RSelenium (since I have a list of URLs) where I find the html_nodes for the things I am interested in: username, review, title, rating... But I keep getting this error "user_name: object not found". So I was wondering whether or not I should structure the scraping differently because it's a RSS url? I have tried looking at the R-related questions for this and that's where I came up with the structure, but it seemed to work in the related question... Here is my code:

selenium_f= rsDriver(browser=c("firefox"))

#start a driver
driver = selenium_f$client

scrapped = list()

i <- 1
while(i <= 11){

  url <- corpus_df$reviews_rss_url[i]

  print( paste("Accessing to:", url) )

  driver$navigate(url)

  page_source <- driver$getPageSource()

  URL <- read_html(page_source[[1]])

  results <- URL %>% html_nodes("item")

  records <- vector("list", length = length(results))

  for (ii in (records)) {

    title <- xml_contents(results[ii] %>%  html_nodes("title"))[1] %>%
      html_text(trim = TRUE)

    user_name <- xml_contents(results[ii] %>% html_nodes("user_name"))[1] %>%
      html_text(trim = TRUE)

    rating <- xml_contents(results[ii] %>% html_nodes("rss > channel > item:nth-child(11) > user_rating"))[1] %>%
      html_text(trim = TRUE)

    review <- xml_contents(results[ii] %>% html_nodes("rss > channel > item:nth-child(11) > user_review"))[1] %>%
      html_text(trim = TRUE)
}

  #remDr$close()

  scrapped[[i]] =  data.frame(name = user_corpus[i,'name'],
                             url = corpus_df[i,'review_rss_url'],
                             title = ifelse(length(title) > 0, title, NA),
                             username = ifelse(length(user_name) > 0, user_name, NA),
                             rating = ifelse(length(rating) > 0, rating, NA),
                             review = ifelse(length(review) > 0, review, NA))

  i = i + 1

}


text:
Q: Sniffing communications not working I am looking for a VirtualBox guru. I tried several settings without success and I don't know what should I try further.
I have three virtual machines:

*

*Two Windows 7 machines (master-slave simulator)

*One CentOS 7 machine (with sniffer - Suricata IDS)
I have no problem setting up connections between the VMs, but it is impossible to sniff Windows communications on the CentOS VM. CentOS only sees broadcast packets.
I tried connecting them with Internal network, Host-only Adapter and NAT networks. Promiscuous mode was set as "Allow All" in all cases.
Sniffing works when bridge mode is used, but that is not what I need.
Thanks for any advice.
VB version: Oracle VM VirtualBox Manager 5.2.18_Ubuntu
Host: Ubuntu 18.04.2 LTS

A: OK, I already solved this problem with two different internal networks. There is solution in a few points:

*

*1.network 192.168.100.0/24 between win1 (192.168.100.1) and centos (192.168.100.200)

*2.network 192.168.200.0/24 between centos (192.168.200.200) and win2 (192.168.200.1)

*on the win1 set up routing to second subnet through centos - route -p ADD 192.168.200.0 MASK 255.255.255.0 192.168.100.200 (run as admin in command line)

*on the win2 set up routing to first subnet through centos - route -p ADD 192.168.100.0 MASK 255.255.255.0 192.168.200.200
Vioala. Thats it.


text:
Q: Kombu - TypeError: Struct() argument 1 must be string, not unicode I have been using Kombu for sometime now - and today when I readied a new machine for deployment, I am getting TypeError on import from kombu:
>>> import kombu
>>> from kombu import Connection, Exchange, Queue, Producer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/kombu/__init__.py", line 81, in __getattr__
    module = __import__(object_origins[str(name)], None, None, [str(name)])
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 15, in <module>
    from kombu import exceptions
  File "/usr/local/lib/python2.7/site-packages/kombu/exceptions.py", line 6, in <module>
    from amqp import ChannelError, ConnectionError, ResourceError
  File "/usr/local/lib/python2.7/site-packages/amqp/__init__.py", line 48, in <module>
    from .basic_message import Message      # noqa
  File "/usr/local/lib/python2.7/site-packages/amqp/basic_message.py", line 29, in <module>
    from .serialization import GenericContent
  File "/usr/local/lib/python2.7/site-packages/amqp/serialization.py", line 33, in <module>
    from .exceptions import FrameSyntaxError
  File "/usr/local/lib/python2.7/site-packages/amqp/exceptions.py", line 264, in <module>
    str(_method_name)
TypeError: Struct() argument 1 must be string, not unicode

A: Looks like the known issue of kombu https://github.com/celery/kombu/issues/622


text:
Q: Best way to update the content of large lookups tables In our application we have a about 20 tables that contain lookup information (read only data that the application doesn't modify).
Nightly we'd like to update this information by deleting all the content and running a script that run a series of inserts and updates. This script could be a couple of million lines long.
I was thinking to run this within a transaction.
What behaviour should I expect from the database? Will the tables be updated at the end of the transaction without downtime?
Is there something I should be aware of when running large transactions?
The database I'm using is Postgres 9.3
Thanks.

A: Assuming that the script contains only INSERTs, UPDATEs and DELETEs to the target table(s), and that the app never attempts row locks (SELECT ... FOR UPDATE/SHARE) or DML on those tables, then the script shouldn't affect the app except for the increased load on the DB server.
When the script commits, the changes will instantly become visible to new statements (if the transaction is in READ COMMITTED isolation) or transactions (if they're in SERIALIZABLE isolation).
However...

Nightly we'd like to update this information by deleting all the content and running a script that run a series of inserts and updates. This script could be a couple of million lines long.

You should use COPY for this instead of a script full of inserts and updates, if possible.
Just:

*

*DELETE FROM mytable;

*VACUUM mytable;

*COPY mytable FROM 'inputfile.csv' WITH (FORMAT CSV)

or similar.
It will be a lot faster. Because of the next point, you might want to load several smaller files though.

Is there something I should be aware of when running large transactions?

Long running data modifying transactions prevent VACUUM from cleaning up rows in other tables that they might be able to "see". This can create quite a lot of table bloat.
If you use READ COMMITTED isolation and stick to individual statements that don't take an extremely long time you won't have a problem, because the snapshot that controls which rows the transaction can see gets updated after each statement.
It's mostly a concern if you're using cursors, working in SERIALIZABLE isolation, or running extremely long-running individual data modifying statements.

A: If you have a foreign key constraint from the data table that points to any of these 20 tables you will not be able to bulk delete from them.
Obviously the application will not receive any results if it tries to read any of the lookup tables after the deletion and before the insertion of the new values.  Will the application crash if this happens?
Deleting and loading millions of rows will blow out the size of your transaction files.  Ensure you have enough disk space to handle this and appropriate log maintenance procedures in place.
I would like to suggest a better architecture to you.  Load the new data into a set of staging tables.  There will be a staging table for each lookup table, with the same columns and data types.  Run verification against these staging tables, if required.  Perform and "upsert" (aka Merge) from each staging table to its corresponding lookup table.  Perform this in batches of a few thousand rows at a time, with an explicit transaction.  The ideal batch size will depend on your system and requirements.  This will afford good restart capabilities in the case of an error and may limit log file growth, depending on your setup.  Once complete, truncate the staging tables ready for the next run.


text:
Q: Group by multiple colums request with result on a single line - Android SQLite I need to do some kind of SELECT ... COUNT() ... GROUP BY 2 columns (Month and Type) request on an SQLite database on Android. I could to the following request :
select Month, Type, Count()
from MyTable
group by Month, Type

My problem is that I'd like to display the result in a Android Listview using a cursor with :

*

*one single line for each month

*COUNTs of the (fixed and known number of) types.

Maybe something like :
select Month, Count(Type = A), Count(Type = B), Count(Type = C)
from MyTable
group by Month

Database
Month   |   Type
-------- ---------
Feb 15  |   A
Feb 15  |   B
Dec 15  |   A
Dec 15  |   A
Dec 15  |   B
Dec 15  |   C

Expected result
Month   |  'COUNT(A)'  |   'COUNT(B)'  |   'COUNT(C)'
-------- -------------- --------------- -------------
Feb 15  |   1          |   1          |   0
Dec 15  |   2          |   1          |   1

Is that possible ?

A: select
 month,
 sum(case when "Type" = 'A' then 1 else 0 end) as "count(a)",
 sum(case when "Type" = 'B' then 1 else 0 end) as "count(b)",
 sum(case when "Type" = 'C' then 1 else 0 end) as "count(c)"
from
 mytable
group by
 month


text:
Q: Error while installing couch DB version 1.5.1 While installing couch DB 1.5.1 from source, in the step where make is called I get this error
make[1]: *** No rule to make target `THANKS', needed by `THANKS.gz'.  Stop.
make[1]: Leaving directory `/somedir'
make: *** [install-recursive] Error 1

Machine details
Linux machinename 2.6.32-431.1.2.el6.x86_64 #1 SMP Sun Nov 24 09:37:37 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

I saw from Couch DB bug archives that this is a locale problem and setting
export LC_TYPE=C

Would solve the issue, but it doesn't solve the issue.
I followed the instructions from this URL for guidance, overcame a lot of obstacles before this, and eventually stuck here. Any help will be appreciated.
Link is http://asaf.github.io/blog/2013/07/08/installing-couch-db-on-amazon-ami/

A: THANKS file isn't available since it's generated automatically from git log - you'd probably downloaded git archive instead. To solve the issue:

*

*use git clone to get the source code

*OR just touch THANKS to workaround the issue in your case

*OR use distributed sources from official web site


text:
Q: Initialize JFreeChart range axis values I am trying to load dataset during initialization of the JFreeChart. But every time I tried to create a dataset with higher "number of item per series", the more data (all data) displayed visible in the chart (the bigger the dataset, the smaller the graph). But actually what I wanted is to have the fixed range of dataset values displayed on the chart while the rest is still hidden. Just the same way the data would normally be displayed in the actual trading platform, let's say Metatrader (MT4). First time when I open the chart I can see the screen filled with the only visible dataset of the chart and if I left-scroll the chart I will be able to see the old/history dataset as well. Does anyone have idea how to achieve this using JFreechart?
Really appreciate for any help or any thing/articles I can refer. Thanks so much!

A: You can use setRange() on either the domain or range axis, as shown in this fragment. If you've already tried this, it may help to edit your question to include an sscce and/or image that exhibits any problems you encountered.


text:
Q: NDA for potential competitor demo I have a new website product which I'm beginning to demo. I have the opportunity to demo to a relatively large potential client. I've found out (from the individual) that they already have a similar product that they previously tried to monetize but would like to look at mine and are interested in switching over to my platform instead given its price point.
There's a natural reluctance since this potential client already has invested time and money into their own platform and has shown that they have tried to monetize it. Most of what I would demo could be completely viable for their own platform.
My first inclination is to ask for an NDA prior to the demo, however, as I've read and would have suspected, that's off putting so early on in the relationship. I've already read that an NDA, from the perspective of a small company like my own, is not very useful against a large company with resources.
So, does this situation warrant an NDA or is there another mechanism to protect my IP and ease my concern that I'm not thinking of?

A: As long as your demo does not involve giving your source code to others or installing your software on computers that you don't control, you don't have to fear about people copying your code.
For user-visible stuff, like the (visual) design of your application and the features you demonstrate, you have to consider how much work it would be to replicate those without having knowledge of the underlying implementation. Most likely, it will take a potential competitor just as much time to implement as it took you.
In short, I don't believe an NDA is going to be of value. It will be far more effective if you use only computers under your control for the demo and take those with you afterward.


text:
Q: Copy of file from one s3 location to another does not work after athena query boto3 I am using boto3 to query results from athena. They are working fine.
I am using boto3 again to copy the file from one s3 bucket to another, but it says it is unable to find the file. I am unable to find a solution. Please help!
When I go to s3 console, I am able to see the file, but boto3 is unable to find it.
import boto3

athena = boto3.client('athena')
s3 = boto3.resource('s3')
BUCKET_NAME = 'bucket1'
bucket = s3.Bucket(BUCKET_NAME)

query = 'SELECT * FROM "db"."table" limit 2'
response = athena.start_query_execution(QueryString=query, QueryExecutionContext={
            'Database': 'db'
            }, ResultConfiguration={
            'OutputLocation': 's3://bucket1/',
            })

key = response['QueryExecutionId'] + '.csv'

copy_source = {
    'Bucket': 'bucket1',
    'Key': key
}
s3.meta.client.copy(copy_source, 'bucket2', 'main.csv')

Error is:-
Traceback (most recent call last):
  File "/Users/tanmaysinghal/Vizualization/Python Scripts/test.py", line 23, in <module>
    s3.meta.client.copy(copy_source, 'bucket2', 'main.csv')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/boto3/s3/inject.py", line 379, in copy
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/s3transfer/futures.py", line 106, in result
    return self._coordinator.result()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/s3transfer/futures.py", line 265, in result
    raise self._exception
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/s3transfer/tasks.py", line 255, in _main
    self._submit(transfer_future=transfer_future, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/s3transfer/copies.py", line 110, in _submit
    **head_object_request)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found

A: There is fundamental problem with your code, i.e. you are trying to copy the Athena S3 output file before query was completed.
When you see it in console, it takes some seconds for you to see and by that time the file is ready.
You must wait for Athena to complete your query and write the output to S3.
Here is how Athena works:

*

*Submit a query.

*Check the status of your query.

*If status is running, wait and go to step 2. Elseif SUCCEEDED, go to step 4. Else FAILED, then do the corrective action.

*read the output S3 file.

Here goes the working code.
import boto3
import time
athena = boto3.client('athena')
# s3 = boto3.resource('s3')
# BUCKET_NAME = 'bucket1'
# bucket = s3.Bucket(BUCKET_NAME)

query = 'SELECT *  FROM your-database.your-table  limit 10'
response = athena.start_query_execution(QueryString=query, QueryExecutionContext={
            'Database': 'your-database'
            }, ResultConfiguration={
            'OutputLocation': 's3://your-s3-output-bucket',
            })

execution_id = response['QueryExecutionId']

key = execution_id + ".csv"
state = 'RUNNING';
##waiting for query to complete and then read the result.
while (state in ['RUNNING']):
    response = athena.get_query_execution(QueryExecutionId=execution_id)
    if 'QueryExecution' in response and \
                'Status' in response['QueryExecution'] and \
                'State' in response['QueryExecution']['Status']:
            state = response['QueryExecution']['Status']['State']
            if state == 'FAILED':
                print("FAILED")
            elif state == 'SUCCEEDED':
                s3_path = response['QueryExecution']['ResultConfiguration']['OutputLocation']
                print("S3-Path:" + s3_path)
    time.sleep(1)

# If state is succeeded, meaning query has completed successfully, now, you could read the output file or try copy it to somewhere else.
if state == 'SUCCEEDED':
    copy_source = {
        'Bucket': 'your-s3-output-bucket',
        'Key': key
    }
    s3.meta.client.copy(copy_source, 'bucket2', 'main.csv')

Hope it will help you!


text:
Q: XML envelope namespace What is correct URI of XML envelope namespace. I have seen many of them, e.g. "http://www.w3.org/2001/12/soap-envelope", "http://www.w3.org/2001/06/soap-envelope", "http://www.w3.org/2003/05/soap-envelope", "http://schemas.xmlsoap.org/soap/envelope/". Please tell me that which URI should be used and when?

A: That's pretty much covered in those comments at the top of each file.
2003/05 states: "Schema defined in the SOAP Version 1.2 Part 1 specification Recommendation"
xmlsoap.org has their own version "modifications to the W3C files"
So use the latest from w3c ("http://www.w3.org/2003/05/soap-envelope").
You will know when you need to use a different one.


text:
Q: Do arrows on the surface of a sphere also form a vector space? Given 2 points $a$ and $b$ on the plane $\mathbb{R}^2$, one can "go" from $a$ to $b$ by drawing an "arrow" from $a$ to $b$. These "arrows" have the structure of an additive group, and they can also be "scaled" by elements of $\mathbb{R}$.
Given 2 points $a$ and $b$ on (say) the 2-sphere, one can "go" from $a$ to $b$ by drawing a "geodesic arrow" from $a$ to $b$. Do such arrows on spheres (and maybe other manifolds) also form groups, or even vector spaces?

A: $\newcommand{\Reals}{\mathbf{R}}$For each point $a$ of the sphere, the set of arrows based at $a$ and tangent to the sphere at $a$ forms a real vector space, the tangent space $T_{a}S^{2}$.
The collection of all tangent spaces is not a vector space, but a vector bundle, the tangent bundle $TS^{2}$ of the sphere.
(A continuous vector field on the sphere is a continuous "section" of $TS^{2}$; the set of all continuous vector fields is a real vector space, as well as a module over the ring of continuous functions, loosely, a vector space where scalars are continuous, real-valued functions on the sphere.)
Assuming I understand your verbal description, if $a$ and $b$ are distinct, the "arrow from $a$ to $b$" describes a chord of the sphere. The sum of two such arrows only rarely determines a chord, and scalar multiplication determines a chord if and only if the scalar is $0$ or $1$: If you translate the sphere so that $a$ sits at the origin of $\Reals^{3}$, the set of chords is the set of points on the sphere regarded as displacement vectors from the origin, which is obviously not a vector subspace of $\Reals^{3}$.
(Judging from your comment, it's possible my chord interpretation is not what you have in mind. Note, however, that assigning two coordinates to points on the sphere and then using these coordinates as vector components certainly does not turn the sphere into a vector space in any natural way.)
With "geodesic arrows", it appears you're seeing the structure on the tangent bundle mapped to the round sphere by the exponential map. This scheme does not turn the sphere into a vector space. For example, if $a$ and $b$ are antipodal, then (with the obvious definition of addition as "sliding and concatenation") two times any geodesic arc from $a$ to $b$ is the zero arc from $a$ to $a$.
Similar remarks hold for other smooth manifolds.

A: If vectors are considered to be translations (translating the whole space) operating on points then they form a commutative transformation group as illustrated in the figure below:

The translations first $NE$ and then $OS$ move the point $X$ to a new location. It does not matter that we moved the points $OS$ by applying $NE$ first. The translations first $OS$ and then $NE$ moves $X$ to the same place and it does not matter that applying $OS$ moved the points $N$ and $E$ to a new location first.

This is not the case when our points are on a sphere. A pair of points can be considered as a translation of the whole space again. But this translation group will not be commutative. Look at the following figure.

We have a sphere and two pairs of points $NE$ and $OS$. Both pairs translate (rotate) the sphere. Let's see the effect of these translations if applied in different order.
First, apply $NE$. This translation will move $X$ to the north pole. But, also, this translation will move $S$ to the original place of $X$. If we apply this new $OS$ then $X$ will stay.
However, if we apply $OS$ first then $X$ will stay where it was originally. At the same time $N$ will be moved to the original location of $O$ and $E$ will stay. The new translation $NE$ will move $X$ to the original location of $O$.
So, there is a fundamental difference between the translation group of vectors and the translation group of rotations.


text:
Q: Check sequences by id on a large data set R I need to check if values for year are consecutive in a large data set.
This is how the data look:
b <- c(2011,2012,2010, 2009:2011, 2013,2015,2017, 2010,2010, 2011)
dat <- data.frame(cbind(a,b))
dat

   a    b
1  1 2011
2  1 2012
3  1 2010
4  2 2009
5  2 2010
6  2 2011
7  3 2013
8  3 2015
9  3 2017
10 4 2010
11 4 2010
12 5 2011

This is the function I wrote. It works very well on the small data set. However the real data set is very large 200k ids and it is taking a very long time. What can I do to make it faster?

seqyears <- function(id, year, idlist) {
year <- as.numeric(year)
year_values <- year[id==idlist]
year_sorted <- year_values[order(year_values)]
year_diff <- diff(year_sorted)
answer <- unique(year_diff)

if(length(answer)==0) {return("single line")} else { # length 0 means that there is only value and hence no diff can be computed
if(length(answer)==1 & answer==1) {return("sequence ok")}   else {
return("check sequence")}}
}

to get a vector of values

unlist(lapply(c(1:5), FUN=seqyears, id=dat$a, year=dat$b))

A: I'd think you can aggregate this more simply.
aggregate(dat$b, dat[,"a",drop=FALSE], function(z) any(diff(sort(z)) != 1))
#   a     x
# 1 1 FALSE
# 2 2 FALSE
# 3 3  TRUE
# 4 4  TRUE
# 5 5 FALSE

If you need it to be that string, an ifelse does what you need:
aggregate(dat$b, dat[,"a",drop=FALSE],
          function(z) ifelse(any(diff(sort(z)) != 1), "check sequence", "sequence ok"))
#   a              x
# 1 1    sequence ok
# 2 2    sequence ok
# 3 3 check sequence
# 4 4 check sequence
# 5 5    sequence ok

If you have the chance of repeated years (and that is acceptable), then you can change the inner anon-function from diff(sort(z)) to diff(sort(unique(z))).

A: Using dplyr
library(dplyr)
dat %>%
    arrange(a, z) %>%
    group_by(a) %>%
    summarise(x = case_when(any(z - lag(z) != 1) ~ 'check sequence',
      TRUE ~ 'sequence ok'))

A: This might also work:
library(dplyr)
dat %>%
  group_by(a) %>%
  arrange(a,b) %>%
  summarise(consecutive_sequence = ifelse(any(abs(b - lead(b)) ==1), TRUE, NA))

Output:
      a consecutive_sequence
  <dbl> <chr>
1     1 YES
2     2 YES
3     3 NA
4     4 NA
5     5 NA

A: A data.table option
setorder(setDT(dat), a, b)[, .(x = c("check sequence", "sequence ok")[1 + all(diff(b) == 1)]), a]

gives
   a              x
1: 1    sequence ok
2: 2    sequence ok
3: 3 check sequence
4: 4 check sequence
5: 5    sequence ok


text:
Q: How to stop a style being applied to a table I'm setting cell padding on a HTML table using : cellpadding: 10
A padding style is being inherited which causes the cellpadding to not be set :

So if I deselect the padding checkbox above (in Chrome) the cellpadding is applied correctly. How can I prevent the "padding: 0" style being set on my table. I've tried using !important on the cellspacing but this does not seem to have any effect.

A: I'd avoid using the cellpadding attribute and use CSS to control your presentation.
It looks as though you're using a css reset to zero out browser default values so you simple need to re-define them where needed:
th, td {
  padding: 10px;
}

A: Try creating more specific selectors. Something like
#myBody .myDiv table th, #myBody .myDiv table th {
    padding: 10px;
}


text:
Q: IE MIME/content filtering I'm looking into ways to develop an extension for IE6+ that will allow handling of custom MIME types.
As an example, I need to be able to take a document with a custom MIME type that is returned by the server, perform some processing on it, and then change the MIME type back to something that IE can natively handle, such as text/html or image/jpeg.
I am familiar with the urlmon MIME filters, but they have a huge weakness; they are only invoked for the top level document, and not for any of the additional page content such as images and the like.
The one way that I can think of that will work is to hook the HTTP/S protocol handlers using vtable/iat patches, similar to the way Google Gears works, to be able to intercept the response headers, and modify the headers and response body when a document with the specified MIME type is received.
I'm wondering if anybody else has any good ideas on how this could be accomplished in a less hacky/intrusive way.
Edit:
Just thought I'd follow up on this and mention that I went with the vtable patch into the HTTP/S protocol handlers, and it worked much better than I expected. If anybody else is looking to do something like this, I highly recommend taking a look at the HttpHandlerPatch class in Google Gears for some inspiration.

A: Several years ago, I wrote such extensions, BHO, IE toolbars, etc., based on a book called Shell Programming in VB6. The book I used is this one: http://oreilly.com/catalog/9781565926707/ This book tells you how to hook and trap messages coming into IE. I wrote a kind of screen scraper (post-render style not like a spider that doesn't execute the javascript first). It was based on IE5 but the extensions still work with IE6. I probably still have the VB6 source somewhere. I am not offering to upgrade it to .Net for you though.
PS. The review on that page by Haroeris Astrum is by me :)


text:
Q: Running a SQL install script with SMO. Alternative solutions needed I've got a web application that uses Microsoft Sql Management Objects (SMO) dll's. I'm wondering how I go about redistributing the libraries for a remote machine.
As I understand it, these come with SQL server or Sql express - which isn't on the remote (shared) webserver. Asking the host to install them, is probably out of the question, so is it possible to dynamically load them?
See below error-
Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=9.0.242.0,   Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Alternatively, if anyone can provide a workaround for the below snippet that would also be useful. The script variable is a SQL install script which has been read to the end. The nice thing about this is the outputting of each of the execute strings from SQL. I could of course just execute it all in one chunk, but that provides no visual feedback to the user line by line, that the sql is executing ok.
Is there a stored procedure that could perform this sort of thing? Or an alternative way to execute an install script without full permissions.
           Dim connection As New SqlConnection(Me.ConnectionString)

            connection.Open()
            connection.Close()

            Dim server As New Server(New ServerConnection(connection))
            server.ConnectionContext.SqlExecutionModes = SqlExecutionModes.ExecuteAndCaptureSql
            Dim commands As StringCollection = server.ConnectionContext.CapturedSql.Text
            server.ConnectionContext.ExecuteNonQuery(script, ExecutionTypes.ContinueOnError)

            Dim s As String
            For Each s In server.ConnectionContext.CapturedSql.Text
                AppendMessages(s)
            Next

A: http://www.mattberther.com/2005/04/11/executing-a-sql-script-using-adonet/
from
http://coolthingoftheday.blogspot.com/2006/11/execute-t-sql-scripts-with-gos.html
Was what I was looking for, and did the trick.

A: you can try using sqlcmd utilty that comes with sql server

A: No, you can't dynamically load them, and no, you can't install them without permissions.  Sorry about that, but no dice there.


text:
Q: Eliminating NHibernate collection type in Domain entity I have a domain entity that exposes a collection type (Iesi.Collections.Generic.ISet<Idea>) from NHibernate. The class is mapped via NHibernate mapping by code. But I don't like the collection type, Iesi.Collections.Generic.ISet<Idea>, which is a NHibernate type. I want to replace it with .Net collection type.
public class Person
{
    public virtual int Id { get; set; }
    public virtual string Name { get; set; }
    public virtual Iesi.Collections.Generic.ISet<Idea> Ideas { get; protected set; }
}

public class PersonMap : ClassMapping<Person>
{
    public PersonMap()
    {
        //...
    }
}

any idea?

A: You can replace ISet<T> with .NET's ICollection<T>, and initialize it with .NET HashSet<T> instead of the Iesi HashedSet<T>.
Reference Ayende's blog.
If you don't need the set semantics, then you can use bag semantics as Alex's answer suggests.

A: You can do that by following this article:
http://nhforge.org/blogs/nhibernate/archive/2011/03/15/using-lt-set-gt-in-mappings-without-iesi-collections-net-4.aspx
If you do not want to use the nuget package then:
1) Copy Paste this code. I think it is the same as the one in the nugetpackage
https://gist.github.com/mynkow/5580319
2) Copy Paste this configuration when you are configuring the session factory:
cfg.Properties[NHibernate.Cfg.Environment.CollectionTypeFactoryClass] = typeof(Net4CollectionTypeFactory).AssemblyQualifiedName;

3) Remove the assembly reference to Iesi. You will still need it but it will be copied automatically on build with NHibernate.dll to the output folder.
Kudos Jose Romaniello

A: Just use the IList<> from system.Collections.Generic.
I know this works when mapping the collection as a NHibernate Bag.
Because U have a ISet I presume that u map the collection as a NHibernate Set, I'm not certain it works on that too.
If it works that's it else consider mapping the collection as Bag.
We do mapping through .hbm.xml mapping files so I can't give U an example of in code mapping a Bag, but there are plenty of sites that discribe that :)
Mapping .hbm.xml example:
<bag name="Ideas" table="SomeTable" cascade="all-delete-orphan" inverse="true" lazy="false">
        <key column="Id"/>
        <one-to-many class="Idea"/>
    </bag>


text:
Q: Imposing Shapes on Video Files Using Matlab Is it possible to impose a shape, let's say rectangle, on video files in Matlab ? I know that it is easily possible to do it on image files using shape inserter but couldn't find a way to do it on videos.
So far my best guess is to extract the frames, impose the rectangles and somehow encode it again into the stream. However, I wonder if there's a more elegant way to achieve it.

A: That's exactly the way you have to do it.

*

*read a frame of video using vision.VideoFileReader

*insert whatever annotations you need into the frame using insertShape, insertMarker, insertText, or insertObjectAnnotation

*write the modified frame out to a new video file using vision.VideoFileWriter

*repeat for all frames


text:
Q: How to define source-tag for datadog when sending logs agentless with logback from Spring Boot? How can logback be configured to add tags,so that datadog can recognize the source?
I have the following logback.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>
<configuration>
    <springProperty scope="local" name="DATADOG_API_KEY" source="datadog.api-key" />
    <appender name="datadog" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
        <destination>intake.logs.datadoghq.com:10514</destination>
        <keepAliveDuration>1 minute</keepAliveDuration>
        <includeCallerData>true</includeCallerData>
        <encoder class="net.logstash.logback.encoder.LogstashEncoder">
            <includeCallerData>true</includeCallerData>
            <includeTags>true</includeTags>
            <customFields>{"ddtags": "source:java"}</customFields>
            <prefix class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
                <layout class="ch.qos.logback.classic.PatternLayout">
                    <pattern>${DATADOG_API_KEY} %mdc{weJustNeedSthEmptyHereSoTheXMLParserWillKeepAWhitespace}</pattern>
                </layout>
            </prefix>
        </encoder>
    </appender>
    <root>
        <appender-ref ref="datadog"/>
    </root>
</configuration

Where the custom field ddtags is supposed to set tags for datadog.
The logs show up in datadog and everything works as expected, despite the source-tag. The log messages sent from my service show up with two tags in datadog: source:java and source:undefined:

How do I get rid of the source:undefined tag so that datadog correctly recognizes the source?

A: Try this
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
        <customFields>
            {"service":"ServiceName","ddsource":"java"}
        </customFields>...
</encoder>


text:
Q: Iterating through python string array gives unexpected output I was debugging some python code and as any begginer, I'm using print statements. I narrowed down the problem to:
paths = ("../somepath") #is this not how you declare an array/list?
for path in paths:
    print path

I was expecting the whole string to be printed out, but only . is. Since I planned on expanding it anyway to cover more paths, it appears that
paths = ("../somepath", "../someotherpath")

fixes the problem and correctly prints out both strings.
I'm assuming the initial version treats the string as an array of characters (or maybe that's just the C++ in me talking) and just prints out characters.?...??
I'd still like to know why this happens.

A: ("../somepath")

is nothing but a string covered in parenthesis. So, it is the same as "../somepath". Since Python's for loop can iterate through any iterable and a string happens to be an iterable, it prints one character at a time.
To create a tuple with one element, use comma at the end
("../somepath",)

If you want to create a list, you need to use square brackets, like this
["../somepath"]

A: paths = ["../somepath","abc"]

This way you can create list.Now your code will work .
paths = ("../somepath", "../someotherpath") this worked as it formed a tuple.Which again is a type of non mutable list.

A: Tested it and the output is one character per line
So all is printed one character per character
To get what you want you need
# your code goes here
paths = ['../somepath'] #is this not how you declare an array/list?
for path in paths:
    print path


text:
Q: How to recover Intel Edison board I had flashed Intel's pre-built src images on board by replacing u-boot.elf compiled with buildroot(having support for Edison board).
But the board is stuck on FSBL(FSBL watchdog is continuously rebooting the board). I tried to flash on board, but on board no listener is present to serve flash operation (usually done by dfu utility in u-boot).
So that I am not able to flash pre-built images again.
By this present conditions, how can I bring my board up?
How can I flash images again?
INPUT :
Board console o/p
******************************
PSH KERNEL VERSION: b0182b2b
            WR: 20104000
******************************

SCU IPC: 0x800000d0  0xfffce92c

PSH miaHOB version: TNG.B0.VVBD.0000000c

microkernel built 11:24:08 Feb  5 2015

******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size)          = 0x00080000

*** Ready to receive application ***

In FSBL, is there present any kind of "dfu utility"?
Any help will be appreciated.

A: For installation fstk, I had asked question for the same.
Kindly refer Question mentioned below.
Install XFSTK in ubuntu 16.04
Along with this, prebuilt bins are received for recover edison board


text:
Q: how do i save my arraylist onto on onSaveInstanceState i have a growing arraylist with a custom object, for it to grow i need to save it so it doesn't get cleared, but even after implementing parcelable still doesn't work. did i implement parcelble wrong? all code works apart from being able to save my arraylist, if some one could help it will be a great help
//class
public class team implements Parcelable {
    // Defining Activity class to use
    private Activity activity;

    // Defining text box
    LinearLayout lay;
    View Tbox;

    // Members Defining
    String teamname;
    String teacher;
    ArrayList<Players> members = new ArrayList<Players>();

    public team(Activity activity, String teamname, String teacher) {
        // To be able to use activity
        this.activity = activity;

        // Normal things to define
        this.teamname = teamname;
        this.teacher = teacher;

        // initialize the lay and Tbox variables
        lay = activity.findViewById(R.id.Scontainer);
        Tbox = activity.getLayoutInflater().inflate(R.layout.text_box_output, null);
    }

    public void addtext() {
        // add text to the layout and view
        TextView title = Tbox.findViewById(R.id.daTeam);
        title.setText(teamname);
        lay.addView(Tbox);
    }

    //bs
    protected team(Parcel in) {
        teamname = in.readString();
        teacher = in.readString();
    }

   public static final Creator<team> CREATOR = new Creator<team>() {
        @Override
        public team createFromParcel(Parcel in) {
        return new team(in);
        }

        @Override
        public team[] newArray(int size) {
            return new team[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel parcel, int i) {
        parcel.writeString(teamname);
        parcel.writeString(teacher);

    }

}

    //mainactivity
public class MainActivity extends AppCompatActivity {
    ArrayList<team> listofteams ;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState != null ) {
            listofteams = savedInstanceState.getParcelableArrayList("key");

        }
        else{
            listofteams = new ArrayList<team>();

        }
        setContentView(R.layout.sports_screen);

        //sending out variable
        Intent intent = new Intent (this, Creating_Class_main.class);
        Activity ma = this;

        //names

        Intent MB = getIntent();
        String Classinp = MB.getStringExtra("strC");
        String tchinp = MB.getStringExtra("strT");

        //adding team

        team sportsteam;
        System.out.println(listofteams);
        boolean flag =  MB.getBooleanExtra("flag", false);
        if (flag){
            sportsteam = new team(ma, Classinp,tchinp);
            listofteams.add(sportsteam);
            System.out.println(listofteams);
        }

    }

    //saveing layout

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putParcelableArrayList("key", listofteams);
        super.onSaveInstanceState(outState);
    }

}


text:
Q: How to update file data stored in S3 bucket efficiently and inexpensively? I am working on a project that is based on AWS services. In this project I upload large files containing thousands of records to S3 bucket and I use Athena to query the data and creates reports. Recently I want to update data (let's say just a few records in a large file) and re-run reports with the new data!
What I have in mind is to load my data to a Redshift Cluster and run the updates on data persisted in Redshift and have a Lambda function to generate a new file using the updated data and replace the file in the S3 bucket. Is there a better way to accomplish this task?


text:
Q: Equal but not greater-or-equal? Сomparing anything with undefined has been discussed many times, but today I had to compare items in arrays and, at some point, items in the array could be undefined and I was curious how they will compare to each other. I found that undefined == undefined is true, but at the same time undefined >= undefined is not true. Wait a second, if something is equal, then greater-or-equal also mean to be true? That is how logic works!
I can accept anything that ECMA Standard is saying, I believe those guys are sane and have a good reason for everything. But what on the earth could be a reason for this comparison behavior? If I was implementing undefined I would return undefined for any comparison that has undefined as an operand. But they choose to return boolean, and then why the results are like this?
Now I think the best solution is just to handle any appearance of undefined in a special way with multiple of if statements.
    undefined === undefined: true
    undefined == undefined: true

    undefined !== undefined: false
    undefined != undefined: false
    undefined < undefined: false
    undefined > undefined: false
    undefined <= undefined: false
    undefined >= undefined: false

A:
But what on earth could be the reason for this comparison behavior?

The ECMAScript specification was not written to describe how JavaScript should work, it was written to describe how JavaScript actually works.
The language was implemented rapidly in Netscape Navigator, and contained many "bugs" such as this, which were then copied in IE's implementation. Eventually, ECMAScript was standardized, but not until after JavaScript existed in the wild. Standardizing any language that's already being used requires a certain amount of backwards compatibility.
<= and >= diverge from == simply because the standard says so. The standard says so because that was how they were implemented initially.


text:
Q: is it possible to separate var styles = StyleSheet.create from React.component into different script in react native? is it possible to separate var styles = StyleSheet.create from React.component into different script in react native?

A: Both of the below links explain very well how to move styles out of your 'structural' code :

*

*https://hackernoon.com/manage-react-native-project-folder-structure-and-simplify-the-code-c98da77ef792

*https://medium.com/the-react-native-log/tips-for-styling-your-react-native-apps-3f61608655eb
Basically (copying code snippet from above link #2) have your styles in separate JS, say text.js file :
const text = StyleSheet.create({
    p: {
      color: 'black',
      fontFamily: 'Open Sans',
      fontSize: 14,
    },
    title: {
      fontWeight: 'bold',
      color: 'black',
      fontFamily: 'Open Sans',
      fontSize: 20,
    }
  });

export default text;

In React component, you can simply import this text style, and use it directly
<Text style={text.p}>settings</Text>

Hope this helps.

A: that's possible. just create a js file with this pattern:
'use strict';

var React = require('react-native');

var myStyles = React.StyleSheet.create({
   style1: { },
   style2: { }
)}

module.exports = myStyles;

then in your component js use require to use that style sheet e.g. assuming your style js file is named phongyewtong.js
var s = require('../the/path/to/phongyewtong');

usage:
<View style = {s.style1} />

A: In a more recent React Version (0.31) I used this code:
import React, { Component, PropTypes } from 'react';
import { StyleSheet } from 'react-native';

var styles = StyleSheet.create({
  ...
});

module.exports = styles;


text:
Q: Get Unique ID of one attachment with GMAIL API I am working with the new GMail API. My goal is to get a list of all of attachments of each email. It is done and working.
Now, I would like to get the direct link to open in a new window each attachment when user clicks on each attachment. How can I get that "ID"?
This is what I do:
Message message = service.users().messages().get(userId, messageId).execute();
        List<MessagePart> parts = message.getPayload().getParts();
        for (MessagePart part : parts) {
          if (part.getFilename() != null && part.getFilename().length() > 0) {
            String filename = part.getFilename();
            String attId = part.getBody().getAttachmentId(); // It isn't ID that Im looking for.

I use JAVA.
Thank you,
Diego.

A: Actually there does seem to be a way to have the user directly download an attachment from gmail's servers without the file passing through our severs. Found it here:
https://github.com/KartikTalwar/gmail.js/issues/134#issuecomment-69447858
https://mail.google.com/mail/u/0/?ui=2&view=att&th={message_id}&attid=0.{atachment_index}&disp=safe&zw

attachmment_index is just the index of the attachment. If there are 3 attachments and you want to get the 3rd file, the index value will be 3. This URL is a 302 header that acts like a link shortener for the download file. Opening this link will lead you to the attachment data

There's a mention of an ik value, which I don't know what it's for, but it seems to work even without that.
@aloo

A: If I were you I would not try to rely on the attachment id, but rather download the raw content of the attachment on your server and display it to the user.
It should not be too complicated, you juste need to parse the content of the data field. You can do this using Java's Mime library. Then you copy the content into your Servlet's OutputStream.


text:
Q: How to create Back Button support in Fragment webview page to go to previous page In navigation menu of my android app, I add a webview of my blog website. When I click on the menu it opens the blog website in webview. Then I go to specific page of my blog. And when I press back button, The whole webview exit and returned to homepage of my app.
Now, I want to add support of back-key. that means If I press back button It will bring back to my webview blog home page from another pages, not to app homepage.
I use these code:
In fragmentblog.java
public class FragmentBlog extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_blog, container, false);
        WebView webView=(WebView)rootView.findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(false);
        webView.getSettings().setSupportZoom(true);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("https://google.com");
        return rootView;

    }
}

In fragment_blog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/webView" />

    </RelativeLayout>
</LinearLayout>

Please help me to do this. Advance Thanks!!!


text:
Q: Specific image files breaks form, refusing to post to PHP On my website, I have a form which allows the user to modify a selected item. As a part of this modification, they are allowed the upload (or delete) images associated with the item.
It seems that very specific images are causing my form to not post (I make this assumption because the loading indicator for my browser is pending).
From further inspection, although it does create a file, it's size is 0B. This is concurrent with the fact that the output of $_FILE['tree-photos']['size'][0] is 0. It seems that the image isn't even being attempted to be uploaded as a specific error code is not given by $_FILE['tree-photos']['error'][0] (returns 0).
I have changed all the appropriate file permissions required and the upload_max_size and post_max_size values accordingly. Interestingly, other files from the same folder which follow the exact same naming scheme and are larger upload fine. It seems random which photos trigger the form to not submit, but it is consistent what images do and don't submit.
File extensions are not the problem either, they are consistient.
Here is my code (I have been told off before for not posting all my code so sorry if a lot of it is not required):

<?php
    include("../content/head.php");
    include("../functions.php");

    if (!isset($_SESSION['admin'])) {
        header("Location: ../admin/admin.php?page=login");
        exit();
    }

    $id = $_REQUEST['treeID'];

    $tree_sql = "SELECT * FROM trees WHERE treeID=" . $id;
    $tree_query = mysqli_query($dbconnect, $tree_sql);
    $tree_rs = mysqli_fetch_assoc($tree_query);

    if ($_SERVER['REQUEST_METHOD'] == 'POST') {

        $com_name = test_input($_POST['com_name']);
        $sci_name = test_input($_POST['sci_name']);
        $height = test_input($_POST['height']);
        $origin = test_input($_POST['origin']);
        $description = test_input($_POST['description']);
        $type = test_input($_POST['type']);

        if(isset($_FILES['tree-photos']['name'][0])) {
            if (!empty($_FILES['tree-photos']['name'][0])) {
                for ($i = 0; $i < count($_FILES['tree-photos']['name']); $i++) {
                    $location = '../images/' . $sci_name .'/' . $sci_name . "_" . uniqid() . "." . strtolower(pathinfo($_FILES['tree-photos']['name'][$i], PATHINFO_EXTENSION));
                    move_uploaded_file($_FILES['tree-photos']['tmp_name'][$i], $location);
                }
            }
        }

        if ($tree_rs["photo"] == "noimage") {
            $updatesql = "UPDATE trees SET photo='$sci_name' WHERE treeID=".$id;
        }

        $_SESSION['err'] = $_FILES['tree-photos']['error'][0];

        $updatesql = "UPDATE trees SET com_name='$com_name', sci_name='$sci_name', height='$height', origin='$origin', description='$description', type='$type' WHERE treeID=".$id;

        $updatequery = mysqli_query($dbconnect, $updatesql);
    }

    $tree_sql = "SELECT * FROM trees WHERE treeID=" . $id;
    $tree_query = mysqli_query($dbconnect, $tree_sql);
    $tree_rs = mysqli_fetch_assoc($tree_query);

    include("../content/navigation.php");

?>

    Back

<?php echo $_SESSION['err']; ?>

    <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'])."?treeID=".$id;?>" method="post" enctype="multipart/form-data">

Common Name

        <input name="com_name" type="text" value="<?php echo $tree_rs['com_name']; ?>">

Scientific Name

        <input name="sci_name" type="text" value="<?php echo $tree_rs['sci_name']; ?>">

Height Name

        <input name="height" type="number" value="<?php echo $tree_rs['height']; ?>">

Origin

        <input name="origin" type="text" value="<?php echo $tree_rs['origin']; ?>">

Type

        <select name="type">
            <option value="Deciduous">Deciduous</option>
            <option value="Evergreen">Evergreen</option>
        </select>

Description

        <textarea name="description"><?php echo $tree_rs['description']; ?></textarea>

Add Photos

        <input name="tree-photos[]" type="file" multiple>
        <?php $tree_rs['photo']; ?>
            <?php
                if ($tree_rs['photo'] != "noimage") { ?>

 <?php
                    $path = "../images/".$tree_rs['photo']."/";
                    $images = glob("$path*.{jpg,jpeg,png,gif,bmp}", GLOB_BRACE);

                    foreach($images as $image) { ?>

                            <img class="editable-image" data-source="<?php echo $tree_rs['sci_name']; ?>" data-id="<?php echo $tree_rs["treeID"]; ?>" src="<?php echo $image?>" alt="<?php echo $tree_rs['com_name'] . " - " . $tree_rs['description']; ?>">

                    <?php } ?>
 <?php
                } else { ?>

No Images Currently

                <?php }
            ?>
        <input type="submit" value="Submit">
    </form>

<?php include("../content/footer.php"); ?

Edit: Included some images that work and don't work for me, would be interesting if its the same for you.

Edit 2: It seems that after restarting the server I am able to upload around 15 items, including ones I couldn't before. After that, though new random images are un-uploadable. This might be a config issue.


text:
Q: Redirect component causing 'Uncaught Invariant Violation: Maximum update depth exceeded' Can someone please shed some light as to why my code is returning Uncaught Invariant Violation: Maximum update depth exceeded.
export default () => {
  return (
    <BrowserRouter>
      <Switch>
        <Redirect from="/" to="/issues" />
        <Route exact path="/issues" component={IssueList} />
        <Route exact path="/issues/:id" component={IssueEdit} />
        <Route path="*" component={IssueNotFound} />
      </Switch>
    </BrowserRouter>
  );
};

But when I move the <Redirect from="/" to="/issues" /> component down in  route list, the error goes away but the functionality is not the one desired. I do have a setState in the IssueList component under the componentDidMount method.

A: you need match from exactly <Redirect exact from="/" to="/issues" />
if not, setting from="/" will match each route path and take it redirect infinitely.


text:
Q: scrollbar appears wrong on ItemsCotrol of a grid I have Itemscontrol in the 3rd column of my grid which shows some set of buttons which gets loaded dynamically.
I wanted these contents (i.e. buttons) to occupy maximum width of Grid. and when contents exceeds Grid size, it will show vertical scrollbar.
I applied Scrollbar style to ItemsControl as follows :
<Style x:Key="ItemControlStyle" TargetType="{x:Type ItemsControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ItemsControl}">
                        <Border>
                            <ScrollViewer HorizontalContentAlignment="Stretch"
                                          CanContentScroll="True"
                                          HorizontalScrollBarVisibility="Disabled"
                                          Uid="ScrollViewer_9"
                                          VerticalScrollBarVisibility="Auto">
                                <ItemsPresenter Margin="{TemplateBinding Padding}"
                                                KeyboardNavigation.DirectionalNavigation="Cycle"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                Uid="ItemsPresenter_5" />
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

I have also applied HorizontalAlignment and VerticalAllignMent as "Stretch" for both ItemsControl as well as its parent i.e. Grid.
Output view I want is( 3rd column of grid)

Output I am getting is :

Scrollbar should appear after size exceeds
How to adjust these contents horizontally to Grid's max width?

A: Is it just a case of adding HorizontalAlignment=Stretch to ScrollViewer?
ie:
<Style x:Key="ItemControlStyle" TargetType="{x:Type ItemsControl}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ItemsControl}">
                <Border>
                    <ScrollViewer  HorizontalAlignment="Stretch"
                                   HorizontalContentAlignment="Stretch"
                                   CanContentScroll="True"
                                   HorizontalScrollBarVisibility="Disabled"
                                   Uid="ScrollViewer_9"
                                   VerticalScrollBarVisibility="Auto">
                         <ItemsPresenter Margin="{TemplateBinding Padding}"
                                         KeyboardNavigation.DirectionalNavigation="Cycle"
                                         SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                         Uid="ItemsPresenter_5" />
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>


text:
Q: Connection pool have hundreds of idle connections I have these setting in my context file for the applications I have.
I'm seeing connection pools have hundreds of idle connections wasting DB resources.
I'm trying to figure out what  I need to have in my context to avoid the connection pool issue:
   type="javax.sql.DataSource"
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    maxActive="10"
    initialSize="0"
    maxAge="1800"
    testWhileIdle="true"
    testOnBorrow="true"
    testOnReturn="false"
    validationQuery="SELECT 1 FROM DUAL"
    validationInterval="30000"
    timeBetweenEvictionRunsMillis="30000"
    removeAbandonedTimeout="60"
    removeAbandoned="true"
    logAbandoned="true"
    minEvictableIdleTimeMillis="18000"
    jmxEnabled="true"
    fairQueue="true"
    jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
        org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"

beside the pool connection the application will throw this error: ((ORA-12516 ))
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:

ORA-12516, TNS:listener could not find available handler with matching protocol stack
    at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:275) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:264) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc.jar:?]


text:
Q: Looking for title of a film (could be tv show) about god in space I'm not religious but I watched something like this when I was a kid and now I'm just curious and trying to find the title.
The film starts with some astronauts traveling through some kind of blackhole / wormhole / portal-thing, and finding themselves in another universe / dimension where space looks to be red.
At some point they had to fire a laser at an asteroid, then they find out the asteroid is like some kind of cell, and they get attacked by some kind of force that is trying to crush the entire ship.
At the end every one abandons ship except one female character and who stays behind and sees her life flash before her and the ship gets crumbled into a ball.
Sounds like some weird stuff but that's what I thought of a particular movie until I found out it was called "The Langoliers". If anyone knows the answer, it would be appreciated.

A: Possibly the episode of the new outer limits entitled "in the blood"
The ship enters a form of hyperspace that they realize is like the bloodstream of an organism and tries to destroy them as a form of immune response.
One female crewmember has flashbacks, and sees a person.
There is constant dialog regarding possible God(s), a living creature, and metaphysical arguments about right/wrong in terms of the creature that makes up part of Hyperspace.
Here's a screencap the asteroid/cell in the reddish space:

Later, one of the crew techs develops a 3D model of "dark stars" that reveals the distant stars form a double helix, implying the objects mimic DNA strands.


text:
Q: Move file to archive if header contains a specific string using vbs I have a problem processing Holter ECG (medical) files based on headers within. Those are  binary datafiles that are approximately 20 MB in size starting with structured header and than the data. What I would like to achive is preferably with vbs script is:
1) To check all files in the current folder and move the processed ones to the archive folder -based on specific string in the header:
After a constant string "User Field #20" comes a 250-400 chars long text string that contains a substring like "Wn:" or "WN:" or "wn:" (with colon). If its there the file is processed and goes to archive.
The two examples hold conclusion strings like:
i)

Analize przeprowadzono w warunkach szpitalnych. Rytm prowadzacy zatokowy z HR sr 70/min ( zakres 45-133/min).
  Zarejestrowano 1 SVPB, bez epizodow czestoskurczu. Komorowych zaburzeń rytmu serca nie ma.
  PQ i QTc w normie.
  WN: zapis prawidłowy bez zaburezń rytmu serca

ii)

Zapis w warunkach szpitalnych. Rytm zatokowy, HR w zakresie 38 /min do 126/min, średnio 66/min; przeciętnie w dzień 58-95/min, w nocy 52-65/min. Nie zarejestrowano SVPB, VPB, pauz>2,5sek.PQ w normie wiekowej. QTc prawidłowe. Dobowy profil rytmu w normie.
  Wn: Zapis holterowski bez cech istotnej patologii

Newlines, special and regional chars possible within the string. I cant tell for sure but seems like the conclusions string ends with hex 80 (euro sign).
2) If possible - add log to the script - plain text, semicolon separated (maybe to be uploaded to excel if necessary).
   archive_log.txt: Timestamp; Lastname; Firstname; DateRecorded; DateProcessed; ConclusionsLongText (about 250-400 chars).
DateRecorded and DateProcessed based on files date created and last modified.
This is extension of a problem that was solved some time ago. The problem is different, only the files to handle are the same. Use the contents of a file to rename it

A: You could use the same strategy Ansgar used in the link you referenced. Read the file contents and then you can use InStr() to search for your string:
    ' Read the entire file into a string...
    strContents = objFS.OpenTextFile("file.dat").ReadAll()

    ' Search for the string "WN:" (case-insensitive)...
    intPos = InStr(1, strContents, "WN:", vbTextCompare)

    If intPos > 0 Then
        ' Found
    End If

This should find the first "WN:" occurrence within the file. Note that this could be some other occurrence, outside the header, so you could also determine the position of "User Field" and compare that to the position of "WN:". For example:
    intPosUser = InStr(1, strContents, "User Field", vbTextCompare)
    intPosWN   = InStr(1, strContents, "WN:", vbTextCompare)

    ' "WN:" should be within 400 chars of the first User Field record...
    If intPosWN > intPosUser And intPosWN - intPosUser < 400 Then
        ' Found
    End If


text:
Q: Proper configuration to redirect all http subdomain to https I have a following configuration for apache.
<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
    ServerName example.com
    SSLEngine on
    SSLCertificateFile <path to ssl certificate file>
    SSLCertificateKeyFile <path to key file>
    SSLCACertificateFile <path to CA certificate file>
</VirtualHost>

I need help to redirect all http subdomains to https subdomains. Thanks in advance.
e.g.

*

*http://example.com to https://www.example.com

*https://example.com to https://www.example.com

*http://subdomain.example.com to https://subdomain.example.com


text:
Q: two sets of locations on googlemaps I have a two lists of locations....(via postcodes or long and lats), and would like to put two lists onto the same googlemap... but representas different colours..
It is a follow up to the original question
postcode distances using google
I.e. Is there a away to put up all the student locations and the school locations on a single google map represented as different colours?
maybe using googleVis?

A: Sounds like a "categories" map.  Here is an example of a categories map from Mike Williams' Google Maps API v2 tutorial ported to the Google Maps API v3.

A: If you have a significant amount of data it would be impractical to show them all at one time. It would be better to show only one data type eg schools and if you click on an individual marker show the nearest students within a specific radius of that school.
The answer for your last question shows you how to find the coordinates required to display on map


text:
Q: String Manipulation var="<string> 1.11 </string>"

I want to get rid of  <string> and  </string>
How can I do it?
For now i got this:
var=${var:9:4}

1.11

A: You could use sed for string manipulation:
echo '$var = <string> 1.11 </string>' | sed -r 's/<string>(.*)<\/string>/\1/g'

returns
$var =  1.11

Explanation of the sed construct:
sed -r                       # call sed with regex-option (-r)
  's/                        # begin of regex (s means "replace, / is the seperator)
     <string>(.*)<\/string>  # construct that should be replaced (the / has to be escaped with \ here)
   /                         # seperator
     \1                      # replacement string (\1 means "whatever is matched between the () before")
   /g'                       # apply replacement globally (in case it occurs multiple times in the string)

A: I'm using another solution:
echo '$var = <string> 1.11 </string>' | awk -F'> | <' '{print $1,$3}'

What I did was defining > and < as delimiters and printing certain fields between the delimiters.

A: Bash has also its own regular expressions. However, they are not so powerful as in sed. The following code does the magic without calling external programs:
var="<string> 1.11 </string>"

first=${var#<*>}
second=${first%<*>}

#echo $first
echo $second

I tried to do it in one step too, but didn't succeed because bash regular expressions do not support non-greedy regular expressions. I tried something like this:
${var//<*>}

The code removes everything from the first < to the last >. :(
I am sure it can be done in one step with
${string/substring/replacement}
${string//substring/replacement}

but I don't have time to experiment right now. For details take a look here: http://www.tldp.org/LDP/abs/html/string-manipulation.html