text:
Q: Unable to start session in appium I am setting error saying that session cannot be created in log.
I have latest version of appium 1.4.16.1 and chrome driver 2.25
I was able to run 2 or 3 days back but now am getting this error.
Am trying to launch google apk in my real device samsung galazy s7 edge.
    > info: --> POST /wd/hub/session {"desiredCapabilities":     {"appPackage":"com.android.chrome","appActivity":"com.google.android.apps.chrome.Main","platformName":"Android","deviceName":"215acd36","platformVersion":"6.0"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_73)
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session e22b5731-cc9e-498e-b9b8-25b13e8cc03f
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from C:\Android\sdk1\platform-tools\adb.exe
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device 215acd36
> info: [debug] Setting device id to 215acd36
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 wait-for-device
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "dumpsys window"
> info: Unlocking screen
> info: [debug] Screen is locked, trying to unlock
> info: [debug] Getting device API level
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 23
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "dumpsys window"
> info: [debug] Screen is locked, trying to unlock
> info: [debug] Getting device API level
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 23
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "dumpsys window"
> info: [debug] Screen is unlocked, continuing
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] json loading complete.
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: [debug] dataDir set to: /data/local/tmp
> info: Chromedriver: Changed state to 'starting'
> info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
> info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
> info: Chromedriver: No old chromedrivers seemed to exist
> info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
> info: Chromedriver: [STDOUT] Starting ChromeDriver 2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a) on port 9515
> Only local connections are allowed.
> info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0\"}}}"
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"215acd36"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"31bb74b2f9e98babac5164c0bb34cb16","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"215acd36"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"137c2c62945cd07d985069de12d2167d","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"215acd36"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"7ca8cb2ab512a0d163f2b5ca46420a04","status":13,"value":{"message":"unknown error: Device 215acd36 is not online\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"215acd36"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"89eb16f014c1755ab4857b7c9ccfb2f7","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> error: Chromedriver: Chromedriver exited unexpectedly with code null, signal SIGTERM
> info: Chromedriver: Changed state to 'stopped'
> info: Chromedriver stopped unexpectedly on us, shutting down then calling back up with the on-die callback
> error: Chromedriver: Error: A new session could not be created. (Original error: session not created exception
> from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"10020.1","isDefault":true},"id":1,"name":"","origin":"://"}
>   (Session info: chrome=54.0.2840.68)
>   (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))
>     at JWProxy.command$ (lib/proxy.js:133:15)
>     at tryCatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:67:40)
>     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:315:22)
>     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
>     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:136:37)
>     at bound (domain.js:284:14)
>     at GeneratorFunctionPrototype.runBound (domain.js:297:12)
>     at run (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:89:39)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:100:28
> info: [debug] Cleaning up appium session
>     at flush (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\$.microtask.js:17:13)
>     at process._tickDomainCallback (node.js:381:11)
>  { [Error: A new session could not be created. (Original error: session not created exception
> from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"10020.1","isDefault":true},"id":1,"name":"","origin":"://"}
>   (Session info: chrome=54.0.2840.68)
>   (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))
>     at JWProxy.command$ (lib/proxy.js:133:15)
>     at tryCatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:67:40)
>   httpCode: 200 }
> error: Failed to start an Appium session, err was: Error: A new session could not be created. (Original error: session not created exception
>     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
> from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"10020.1","isDefault":true},"id":1,"name":"","origin":"://"}
>     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:136:37)
>   (Session info: chrome=54.0.2840.68)
>     at bound (domain.js:284:14)
>   (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))
>     at GeneratorFunctionPrototype.runBound (domain.js:297:12)
>     at run (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:89:39)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:100:28
>     at flush (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\$.microtask.js:17:13)
>     at process._tickDomainCallback (node.js:381:11)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: A new session could not be created. (Original error: session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\":{\"frameId\":\"10020.1\",\"isDefault\":true},\"id\":1,\"name\":\"\",\"origin\":\"://\"}\n  (Session info: chrome=54.0.2840.68)\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64)))","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\":{\"frameId\":\"10020.1\",\"isDefault\":true},\"id\":1,\"name\":\"\",\"origin\":\"://\"}\n  (Session info: chrome=54.0.2840.68)\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64)"},"httpCode":200,"origValue":"A new session could not be created. (Original error: session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\":{\"frameId\":\"10020.1\",\"isDefault\":true},\"id\":1,\"name\":\"\",\"origin\":\"://\"}\n  (Session info: chrome=54.0.2840.68)\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 59119.310 ms - 1369
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 46.412
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] UiAutomator shut down normally
> info: [debug] executing cmd: C:\Android\sdk1\platform-tools\adb.exe -s 215acd36 shell "am force-stop com.android.chrome"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Cleaning up appium session


text:
Q: Where can I find XSD Schema files for PDF/A XMP metadata? I am trying to validate the XMP Metadata that are contained in PDF and PDF/A files. Unfortunately, it proved very hard to find the actual XSDs for most namespaces. Is there an official resource pool from Adobe where I could find them?
In special, I am looking for these namespaces:
http://www.aiim.org/pdfa/ns/id/
http://purl.org/dc/elements/1.1/
http://ns.adobe.com/xap/1.0/
http://ns.adobe.com/xap/1.0/mm/
http://ns.adobe.com/pdf/1.3/

Many thanks in advance for all hints.

A: Missing in the main adobe portal (https://developer.adobe.com/xmp/docs/XMPSpecifications/) but is still accessible here https://archimedespalimpsest.net/Documents/External/XMP/XMPSpecificationPart1.pdf

redpajama_set_name: RedPajamaStackExchange


text:
Q: .responsetext does not get the entire code On following website, i am trying to fetch the value(970.15 today) using MSXML2.ServerXMLHTTP and .responsetext.
I have done it on another site and found the info in the text.
On that site though, .responsetext does not this value anywhere, but when i do inspect element in my browser, i do see it !
I discovered that function to read information on sites only last week, so still learning ! If anyone can help me, that would be great !
https://www.spglobal.com/spdji/en/indices/equity/sp-euro-50-equal-weight-50-point-decrement-index/#overview
Since it did not work, i put .responsetext value in a cell and copy/pasted it in notepad but did not find 970 is the file.
Note that to put the text in a cell, i had to get rid of the first 50 characters ... i did not understand this either !
Thanks !
G


text:
Q: C# - Hiding mouse cursor in program I have been looking for resource for this issue but could not find what I want. I have a C# application in WPF which uses touch screen with mouse cursor present on the screen for users. The problem is I want to hide this mouse cursor but when I run the program in back end, the application should have mouse cursor displayed.
Does anyone have any good suggestion on where to start?

A: It's very simple:
if(runningAsClient)
    Cursor.Hide();

Of course you need a technique to determine the system you're running on, like a preprocessor directive. You can put this in your main method and set the directive in the client project configuration.
#if CLIENT
    Cursor.Hide();

If you use WPF, you have to set the Cursor property of your window to
Cursor = Cursors.None;

A: I suggest you to use command line arguments to achieve this:
public static class Program
{
    public static void Main(String[] args)
    {
        Boolean backend = args.Contains("-b");

        // ...

        MyApp app = new MyApp(backend);
        app.Run();
    }
}

public partial class MyApp : Application
{
    public MyApp(Boolean backend)
    {
        InitializeComponent();

        if (backend)
            Cursor = Cursors.None;
    }
}

To launch your app as "backend", just use the following command:
MyProgram.exe -b

and the mouse cursor will be hidden.


text:
Q: Scaling ActiveMQ on AWS First of all my knowledge of ActiveMQ, AMQPS and AWS auto scaling is fairly limited and I have been handed over this task where I need to create a scalable broker architecture for messaging over AMQPS using ActiveMQ.
In my current architecture if have a single machine ActiveMQ broker where the messaging is happening over AMQP + SSL and as a need of the product there is a publisher subscriber authentication (TLS authentication) to ensure correct guys are talking to each other. That part is working fine.
Now the problem is that I need to scale the whole broker thing over AWS cloud with auto-scaling in my mind. Without auto-scaling, I assume I can create a master slave architecture using EC2 instances, but then adding more slaves will be more like a manual process than automatic.
I want to understand wether below two options can solve the purpose -

*

*ELB + ActiveMQ nodes being auto scaled

*Something like a Bitnami powered ActiveMQ AMI running with auto scaling enabled.

In first case where ELB is there, I understand that ELB terminates SSL which will fail my mutual authentication. Also I am not sure wether my Pub/Sub model will still work where different ActiveMQ instances are independently running with no shared DB as such. If yes, if anyone can offer a pointer or a reference material it will be a help as I am not able to find one by myself.
In second case again, my concern is that when multiple instances are running with ActiveMQ how they will coordinate between each other and ensure that everyone has access to data being held up in queue.
The questions may be lame, but if any pointer it will be helpful.
AJ


text:
Q: Why does the linked list head pointer reference get updated when updating the tail reference? I am confused about how references work in JavaScript.
The context is a problem where I have to merge two sorted linked lists. The problem is as follows:
You are given the heads of two sorted linked lists list1 and list2.
Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists.
Return the head of the merged linked list.
Definition for singly-linked list:
 function ListNode(val, next) {
      this.val = (val===undefined ? 0 : val)
      this.next = (next===undefined ? null : next)
 }

My solution is below:
var mergeTwoLists = function(list1, list2) {

  if (!list1 && !list2) {
    return null
  }

  let list1Current = list1
  let list2Current = list2
  let newHead = new ListNode() // dummy head node
  let newTail = newHead

  while (list1Current && list2Current) {
    if (list1Current.val < list2Current.val) {
      newTail.next = new ListNode(list1Current.val, null)
      list1Current = list1Current.next
    } else {
      newTail.next = new ListNode(list2Current.val, null)
      list2Current = list2Current.next
    }
    newTail = newTail.next
  }

 if (list1Current) {
   newTail.next = list1Current
 } else if (list2Current) {
   newTail.next = list2Current
 }

  return newHead.next
};

I am confused how newHead is being updated when newTail gets updated. In the beginning, newHead in set to an empty ListNode. We are only ever updating newTail in the while loop. How does newHead have the contents of newTail, if we are never updating newHead? Shouldn't newHead remain the empty ListNode at the end?

A: newHead gets mutated in the first iteration of the while loop (or after the loop if one of the lists is empty).
It may help to visualise it. Let's take as example the merge of two lists which each just have one node -- one has the value 1, and the other 2.
Just before the loop starts, we have created a dummy node (with value 0) and referred to it with newHead and newTail:
                                      list1Current
                                       ↓
                                     ┌────────────┐
                                     │ val: 1     │
                                     │ next: null │
 newHead                             └────────────┘
  ↓
┌────────────┐
│ val:  0    │
│ next: null │
└────────────┘
  ↑
 newTail                             ┌────────────┐
                                     │ val: 2     │
                                     │ next: null │
                                     └────────────┘
                                       ↑
                                      list2Current

In the first iteration we get into the if block (because 1 < 2), where we create a new node and assign it to newTail.next:
                                      list1Current
                                       ↓
                                     ┌────────────┐
                                     │ val: 1     │
                                     │ next: null │
 newHead                             └────────────┘
  ↓
┌────────────┐   ┌────────────┐
│ val:  0    │   │ val: 1     │
│ next: ───────> │ next: null │
└────────────┘   └────────────┘
  ↑
 newTail                             ┌────────────┐
                                     │ val: 2     │
                                     │ next: null │
                                     └────────────┘
                                       ↑
                                      list2Current

Here already you can see that what happens to newTail is what happens to newHead, as they reference the same node.
In the same iteration of the loop, list1Current gets a new value (null in this example), and newTail gets a new value -- the node that was just created:
              list1Current == null

                                     ┌────────────┐
                                     │ val: 1     │
                                     │ next: null │
 newHead                             └────────────┘
  ↓
┌────────────┐   ┌────────────┐
│ val:  0    │   │ val: 1     │
│ next: ───────> │ next: null │
└────────────┘   └────────────┘
                   ↑
                  newTail            ┌────────────┐
                                     │ val: 2     │
                                     │ next: null │
                                     └────────────┘
                                       ↑
                                       list2Current

In this simple example there are no other iterations, and after the loop, list2Current is still not null, so we execute newTail.next = list2Current:
              list1Current == null

                                     ┌────────────┐
                                     │ val: 1     │
                                     │ next: null │
 newHead                             └────────────┘
  ↓
┌────────────┐   ┌────────────┐
│ val:  0    │   │ val: 1     │
│ next: ───────> │ next: ───────┐
└────────────┘   └────────────┘ │
                   ↑            │
                  newTail       │    ┌────────────┐
                                │    │ val: 2     │
                                └──> │ next: null │
                                     └────────────┘
                                       ↑
                                       list2Current

Although now newTail is no longer referencing the same node as newHead, the assignment to its next property does influence the chain that starts at newHead.
Finally, as we don't want to return a list with still the dummy node in it, we return newHead.next:
                 ┌────────────┐
                 │ val: 1     │
(returned) ────> │ next: ───────┐
                 └────────────┘ │
                                │
                                │    ┌────────────┐
                                │    │ val: 2     │
                                └──> │ next: null │
                                     └────────────┘

I hope this clarifies it.


text:
Q: Can't disable mod_security rule on apache If I post data of a form on my website, I keep getting this error in the log file.
[Thu Jul 16 09:45:25 2020] [error] [client 85.1.202.234] ModSecurity: Access denied with
code 403 (phase 2). Pattern match "(?i:\\bor\\b ?(?:\\d{1,10}|[\\'"][^=]{1,10}[\\'"]) ?[=.
<>]+|(?i:'\\s+x?or\\s+.{1,20}[+\\-!<>=])|\\b(?i:x?or)\\b\\s+(\\d{1,10}|'[^=]{1,10}')|\\b(?
i:x?or)\\b\\s+(\\d{1,10}|'[^=]{1,10}')\\s*[=<>])" at ARGS:tx_testzentraleshop_pi1[address].
[file "/etc/apache2/crs/base_rules/modsecurity_crs_41_sql_injection_attacks.conf"] [line
"134"] [id "959071"] [rev "2.2.5"] [msg "SQL Injection Attack"] [data "or 1"] [severity
"CRITICAL"] [tag "WEB_ATTACK/SQL_INJECTION"] [tag "WASCTC/WASC-19"] [tag "OWASP_TOP_10/A1"]
[tag "OWASP_AppSensor/CIE1"] [tag "PCI/6.5.2"] [hostname "xy.xxxx.com"] [uri
"/tests/panier-dachat/flexShow/buy/"] [unique_id "XxAFlVvHYlQAADKCJLYAAABH"]

I tried to disable the rule 959071 in different ways in the config file. But none of them actually worked. I always got the same error message again.
I tried these configurations:
<IfModule mod_security2.c>
  SecRuleRemoveById 959071
</IfModule>

<IfModule security2_module>
  SecRuleRemoveById 959071
</IfModule>

SecRule REQUEST_URI "@beginswith "/tests/panier-dachat/flexShow/buy/ "id:959071,phase:2,t:none,nolog,pass,ctl:ruleRemoveById=959071"

After every change I restarted the apache webserver.
Can someone explain me why they didn't work? How can I disable the rule?

A: SecRuleRemoveById needs to be specified AFTER the rule it's removing in the config, not before.


text:
Q: Sed - How to match a regex group and use it to replace all other matched occurrences in the same line? I'm trying to repeat a matched pattern n times in the same line, depending on another match (Constant).
Input
Parent:X 4541, SomeData, Constant:Child: Variable1, SomeData, Constant:Child: Variable2, SomeData, Constant:Child: Variable3, SomeData,
Parent:Y 2131, SomeData, Constant:Child: Variable4, SomeData, Constant:Child: Variable5, SomeData, Constant:Child: Variable6, SomeData,
Parent:Z 51 F, SomeData, Constant:Child: Variable7, SomeData, Constant:Child: Variable8, SomeData, Constant:Child: Variable9, SomeData,

Expected output
Parent:X 4541, SomeData, X 4541: Child: Variable1, SomeData, X 4541: Child: Variable2, SomeData, X 4541: Child: Variable3, SomeData,
Parent:Y 2131, SomeData, Y 2131: Child: Variable4, SomeData, Y 2131: Child: Variable5, SomeData, Y 2131: Child: Variable6, SomeData,
Parent:Z 51 F, SomeData, Z 51 F: Child: Variable7, SomeData, Z 51 F: Child: Variable8, SomeData, Z 51 F: Child: Variable9, SomeData,

Note that I replaced every Constant with Parent's name.
I think sed hold space might be the answer, but I honestly couldn't do it.
If it helps solving the problem, I can break the lines before every Constant first:
Parent:X 4541, SomeData,
Constant:Child: Variable1, SomeData,
Constant:Child: Variable2, SomeData,
Constant:Child: Variable3, SomeData,
Parent:Y 2131, SomeData,
Constant:Child: Variable4, SomeData,
Constant:Child: Variable5, SomeData,
Constant:Child: Variable6, SomeData,
Parent:Z 51 F, SomeData,
Constant:Child: Variable7, SomeData,
Constant:Child: Variable8, SomeData,
Constant:Child: Variable9, SomeData,

and it doesn't matter if the output isn't in the same line:
Parent:X 4541, SomeData,
 X 4541: Child: Variable1, SomeData,
 X 4541: Child: Variable2, SomeData,
 X 4541: Child: Variable3, SomeData,
Parent:Y 2131, SomeData,
 Y 2131: Child: Variable4, SomeData,
 Y 2131: Child: Variable5, SomeData,
 Y 2131: Child: Variable6, SomeData,
Parent:Z 51 F, SomeData,
 Z 51 F: Child: Variable7, SomeData,
 Z 51 F: Child: Variable8, SomeData,
 Z 51 F: Child: Variable9, SomeData,

Efforts:
This will correctly replace the last Constant with the a line break followed by parent's name, but I've to repeat the command multiple times untill there is no match left (Not practical).
Sed -r -i "s#Parent:([^,]*)(.*)Constant:#\1\2\n\1: #" file

Using awk is fine, but it would be much appreciated if anyone can help with a sed command with some explanation.

A: A sed based on the code from your comment:
sed -E ':a;s/(Parent:([^,]*).*)Constant:/\1\2: /;t a' file

t is for "test". If a previous s/// was successful, it goes to the specified label, or to the end of the script.

A: Another awk solution:
awk -F '[,:]+' '{gsub(/ Constant:/, " " $2 ": ")} 1' file

Parent:X 4541, SomeData, X 4541: Child: Variable1, SomeData, X 4541: Child: Variable2, SomeData, X 4541: Child: Variable3, SomeData,
Parent:Y 2131, SomeData, Y 2131: Child: Variable4, SomeData, Y 2131: Child: Variable5, SomeData, Y 2131: Child: Variable6, SomeData,
Parent:Z 51 F, SomeData, Z 51 F: Child: Variable7, SomeData, Z 51 F: Child: Variable8, SomeData, Z 51 F: Child: Variable9, SomeData,

A: With your shown samples, please try following awk code.
awk 'BEGIN{FS=OFS=", "} {split($1,arr,":");gsub(/Constant:/,arr[2]": ")} 1' Input_file

To perform inplace saving run following code.
awk 'BEGIN{FS=OFS=", "} {split($1,arr,":");gsub(/Constant:/,arr[2]": ")} 1' Input_file > temp && mv temp Input_file


text:
Q: $ u_k \leq \alpha \exp(kh\beta) $ (proof by induction ) Let $ (u_k)_{k={0,...,K}}  \subset \mathbb{R} $ be a non-negative sequence and let $ \alpha $ , $ \beta \in \mathbb{R} $ with $ \beta \geq 0 $ and $ h > 0$, so that
$$ u_k = \alpha + h\beta\sum_{l=0}^{k-1} u_l \qquad \forall k = 0,...,K$$
Show: for all $ k = 0,...,K $ the following inequality holds:
$$ u_k \leq \alpha \exp(kh\beta) $$
My attempt:
As you can read in the title I wanted to show this inequality by induction. So I have the base case:
$k=0$ :
$ u_0 = \alpha + h\beta\sum_{l=0}^{0-1} u_l = \alpha = \alpha \exp(0h\beta) $
Ok now I assume the statement is true for a $ k = 0,...,K $.
Now the inductive step:
We want:
$u_{k+1} \leq \alpha \exp((k+1)h\beta)  $
I started with the definition of $ u_{k+1} $:
$ u_{k+1} = \alpha + h\beta\sum_{l=0}^{k} u_l  = \alpha + h\beta\sum_{l=0}^{k-1} u_l + h\beta u_k = u_k + h\beta u_k = u_k ( h \beta +1) $.
Im not sure if I'm right at this point, but I could use my indutive hypothesis.
$ u_k ( h \beta +1) \leq \alpha \exp(kh\beta)( h \beta +1)$.
But unfortunately thats not what I want. Maybe I did something wrong? Can you help me out ?
Thank you in advance.

A: You didn't really do anything wrong, although a fairly minor point is that your use of variables $k$ and $K$ is somewhat inconsistent. To finish your work, first note you got
$$u_{k+1} = u_k(h\beta+1) \leq \alpha\exp(kh\beta)(h\beta+1) \tag{1}\label{eq1A}$$
The problem states $u_k$ is a non-negative sequence so, with $u_0 = \alpha$, then $\alpha \ge 0$. Since $\exp((k+1)h\beta) = \exp(kh\beta)\exp(h\beta)$, with
$$h\beta + 1 \le \exp(h\beta) \implies \alpha\exp(kh\beta)(h\beta+1) \le \alpha\exp((k+1)h\beta) \tag{2}\label{eq2A}$$
it's sufficient to just prove the LHS. Since $\beta \ge 0$ and $h \gt 0$, then $x = h\beta \ge 0$. Consider
$$f(x) = e^{x}-x-1 \tag{3}\label{eq3A}$$
Note $e^x = 1 + x + \frac{x^2}{2!} + \ldots \; \to \; f(x) = \frac{x^2}{2!} + \ldots$, then $f(x) \ge 0 \; \forall \; x \ge 0$. Alternatively, $f(0) = e^{0}-0-1 = 0$ and
$$f'(x) = e^{x} - 1 \ge 0 \; \; \forall \; x \ge 0 \tag{4}\label{eq4A}$$
In either case, $\forall \; x = h\beta \ge 0$, we get $f(x) \ge 0 \; \to \; x + 1 \le \exp(x) \; \to \; h\beta + 1 \le \exp(h\beta)$. This shows the LHS of \eqref{eq2A} is true, with this completing the induction step because \eqref{eq1A} and \eqref{eq2A} combined gives $u_{k+1} \le \alpha\exp((k+1)h\beta)$.


text:
Q: Find the minimum of a sorted and shifted array with better than O(n) time complexity We have an assignment to search for the minimum element of a sorted array that is shifted to the right afterwards. For example: [1, 5, 6, 19, 56, 101] becomes [19, 56, 101, 1, 5, 6]. The method should be implemented using a divide and conquer algorithm and it should have a better asymptotic time complexity than O(n).
EDIT: I forgot to add that the elements int the array are unique.
I already implemented a method and wanted to ask if this is better than O(n) and if there are ways to improve my method.
public class FindMinimum {
    public void findMinimum(int[] arr) {

        // the recursive method ends when the length of the array is smaller than 2
        if (arr.length < 2) {
            return;
        }

        int mid = arr.length / 2;

        /*
         * if the array length is greater or the same as two, check if the middle
         * element is smaller as the element before that. And print the middle element
         * if it's true.
         */
        if (arr.length >= 2) {
            if (arr[mid - 1] > arr[mid]) {
                System.out.println("Minimum: " + arr[mid]);
                return;
            }
        }

        /*
         * separate the array in two sub-arrays through the middle and start the method
         * with those two arrays again.
         */
        int[] leftArr = new int[mid];
        int[] rightArr = new int[arr.length - mid];
        for (int i = 0; i < mid; i++) {
            leftArr[i] = arr[i];
        }
        for (int i = mid; i < arr.length; i++) {
            rightArr[i - mid] = arr[i];
        }
        findMinimum(leftArr);
        findMinimum(rightArr);
    }
}

A: This is my new solution, without copying the array anywhere.
public class FindMinimum {

    public void findMinimum(int[] arr) {
        findMinimumSub(arr, 0, arr.length - 1, 2);
    }

    private void findMinimumSub(int[] arr, int start, int end, int size) {
        // the recursive method ends when the length of the array is smaller than 2
        if ((end - start) < 2) {
            if (arr[end] > arr[start])
                System.out.println("Minimum: " + arr[start]);
            else
                System.out.println("Minimum: " + arr[end]);
            return;
        }

        int mid = arr.length / size;

        if (arr[start] > arr[end]) {
            // right side
            start += mid;
            findMinimumSub(arr, start, end, size * 2);
        }
        else {
            // left side
            findMinimumSub(arr, start, mid, size * 2);
        }
    }
}

A: In Java you could use a List because than you can create a Sublist.
private Integer findMinimum(List<Integer> list) {
    if (list.size() < 2)
        return list.get(0);

    int mid = list.size() / 2;

    // create left and right list
    List<Integer> leftList = list.subList(0, mid);
    List<Integer> rightList = list.subList(mid, list.size());

    if (leftList.get(leftList.size() - 1) <= rightList.get(rightList.size() - 1))
        return findMin(leftList);
    else
        return findMin(rightList);
}

When you create a Sublist with Java there is no copy. So to create a new Sublist takes a complexity of O(1).
So the function has a complexity of O(logn).


text:
Q: Laravel Query Builder Search (match against) I'm trying to write this query in Laravel
select *, MATCH(hobbies)AGAINST('soccer') from users where MATCH(hobbies)AGAINST('soccer' IN BOOLEAN MODE) LIMIT 10 OFFSET 0;

I have looked in the documentation on query builder but didn't find anything on full-text search.
Please help.
Thank you in advance :)

A: Thanks to Samsquanch he pointed me in the right direction.
Here is how I got it done.
$my_query = "select *, MATCH (name) AGAINST (?) from users
    where MATCH (hobbies) AGAINST (? IN BOOLEAN MODE) limit 10 OFFSET ?"

$hobbies = DB::select($my_query, array($search_term, $search_term, (($page-1)*10)));

A: Nowadays, Laravel supports fullTextSearch in Query builder. You can have a look here https://laravel.com/docs/9.x/queries#full-text-where-clauses.

A: User::selectRaw("*, MATCH(hobbies)AGAINST('soccer')")
    ->whereRaw("MATCH(hobbies)AGAINST('soccer' IN BOOLEAN MODE)")
    ->limit(10);


text: Q: Classification vs regression for binary response variables I have a breast cancer dataset with ~30 predictors, all of which are continuous/numeric. The response variable is binary (the diagnosis is either malignant or benign). I know classification is good for cases where the responses are categorical and non-ordinal, but would regression suit this situation better, since it's along the lines of success/failure?


text:
Q: Can I extract embedded Google maps data from this webpage? I need the coordinates and data of the points marked on this embedded google maps page:
(The information is public)
link to webpage

maybe there is a way to view the data in google earth, and extract a kmz file?
or inspect the page with firefox/chrome inspection tool and find the data file?
or some hack...

A: You can access the full google map by clicking the "View Larger Map" icon in the upper right corner of the map embedded on the page you shared. Here is the url.
In the google map, if you go to the top of the legend and click the three vertical dots, the menu will display the option "Download KML".


text:
Q: recursive function in C This is a recursive function to calculate the fraction in the picture. but this program crashes for n >= 6. I understand there is a problem with stack overflow, but how to fix it?
n passed in the third parameter k
sqrt(b[k--]): it should calculate the square root of b[k], reduce k by 1, and transfer reduced k to dod
picture with task
float dod(int *a, int *b, int k){
if (k == 1)
    return (a[1] * a[1]) / sqrt(b[1]);
return a[k] * a[k] / (sqrt(b[k--]) + dod(a, b, k));}

A:   float dod(int *a, int *b, int k){
if (k == 1)
return (a[1] * a[1]) /sqrt(b[1]);
else
return a[k] * a[k] / (sqrt(b[k]) + dod(a, b, k-1));}

Did you try this?

A: In C array index start at 0. So your code should probably read:
float dod(int *a, int *b, int k)
{
    if (k == 1)
        return (a[0] * a[0]) / sqrt(b[0]);
    return a[k-1] * a[k-1] / (sqrt(b[k-1]) + dod(a, b, k-1));
}
int *a, *b;
int main()
{
    int n, i;
    printf("Enter n: ");
    scanf("%d", &n);
    a = malloc(n * sizeof(int));
    b = malloc(n * sizeof(int));
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    for (i = 0; i < n; i++) {
        scanf("%d", &b[i]);
    }
    printf("%f", dod(a, b, n));
    return 0;
}


text: Q: Phaser: How to detect collisoin between Phaser.Geom.Line and Phaser.Geom.Point? I'm planning to create a basic game where the point moves using Phaser.Geom.Point and that point should be bounded by lines using Phaser.Geom.Line.  How do you detect when there is a collision between Phaser.Geom.Point and Phaser.Geom.Line ????


text:
Q: Is calling a white person "white bread" considered racist in everyday conversation? I have just watched "Top Five" played by Chris Rock. In this movie, there is a scene where Chris Rock saw a white actor and here is the conversation:

The actor (played by white male actor): Hey, Alfred Alen
Alfred Alen (played by Chris Rock): Hey, white bread, happy birthday!

That is in the movie, but  is calling a white person "white bread" considered racist in everyday conversation?

A: "whitebread" is a wry or gently mocking expression originating in the African American communities of the United States which is most often used to describe a "white" person the user is on friendly terms with and the expression is not intended to offend or insult. "wry" adjective: 1. using or expressing dry, especially mocking, humor. synonyms: ironic, sardonic, satirical, mocking. see, google.com "wry" Link
A slightly more common but equivalent expression would be to refer to a "white" person as "Opie", as in Opie Taylor from Andy Griffith fame.

Belonging to the class of bland, clean-cut, middle-of-the-road suburbanite breeders. The Cleavers from the old TV show "Leave It To Beaver" are a familiar archetype of whitebread culture. see, The Urban Dictionary "white bread" Link

Most of the online dictionaries I've consulted don't seem to get the quality of "whitebread" I've included and refer to only the bland, insipid qualities which really connote to "lack of soul". But, in my personal experience, this is one of those, admittedly rare, occasions when the dictionary definitions are missing the more subtle nuances of the term - reporting as outsiders looking in - that said, "location, location, location!"

A: My understanding is that it is of American origin, and has to do with the mundane and uninteresting lifestyle which may be perceived of the white middle-class.

white bread
  2. bland; conventional. Random House Unabridged Dictionary
white bread North American informal Blandly conventional
  in a way that is regarded as characteristic of the white middle
  classes. Oxford Living Dictionaries

Check out the example sentences to get a feel of how it can be used.
Here is an explanation of the meaning at The Phrase Finder.

Pertaining to the US white middle classes.
The Phrase Finder

Billy Joel's famous 1983 song Uptown Girl features the phrase, where he talks about an uptown girl living in her white-bread world, here are the lyrics:
Link to lyrics in video

I'm gonna try for an uptown girl She's been living in her white bread
  world As long as anyone with hot blood can And now she's looking for a
  downtown man That's what I am
metrolyrics

It's interesting if you watch the video, a group of grease monkeys singing about a girl in her white-bread world who are working in what definitely looks like a rough part of the neighbourhood. You can obviously get the meaning intended by white bread here, though let's not forget this was 1983.
Here are two excerpts from an article from Huffington Post titled "How White Bread Became White Trash"

In truth, though, the pejorative "white bread" had earlier
  antecedents. In the diverse ranks of 1960s counterculture activism,
  the phrase had already come to signify everything bland, homogenous,
  suburban, chemical, and corporate—everything that the counterculture
  hoped to upend.
But, by the early 1980s, another usage had emerged. In this case,
  "white bread" signified almost the opposite: not dull affluent
  suburbia, but white trash. "White bread," like broken-down trailers,
  came to denote poverty of a white and rural kind—the world described
  by residents of TV's South Park as "a quiet, little, white-bread,
  Podunk, white trash, redneck corner of the U.S.A."
  Huffington Post article

Also, you can look through this short discussion among users at The Phrase Finder giving their understanding of the meaning of white bread.

Thus "white bread" describes the bourgeoisie not only because its
  members are racially white but also because they subsist on highly
  processed commercial foods.
Phrase Finder discussion
NB: This is just the opinion of some internet user.

It's hard to tell whether today its primary meaning is related to white middle-class lifestyle, dull lifestyle, or as the Huffington Post article put it, to denote "white trash". There's no doubt that it can be used in a primarily racial way, as seen in your original quote. This can be said in light-hearted playfulness or as a hateful slur, depending on context.

A: I'm white (at least, that's the check box that applies to me on applications, etc.). If I had a good friend who teasingly called me "white bread" I guess that might be okay--although it would not feel friendly. But, aside from that situation, if someone calls me "white bread" my response would be "what do you know?" As the term is often used, it is offensive. It may not be at the level of the "n word," but it stereotypes, is dismissive of the person, and is generally meant in at least a mildly derogatory way. I have never heard it used as a compliment. Also, ironically, many people who use "white bread" as a demeaning label actually enjoy eating white bread sandwiches, etc.!

A: In British English 'white bread' is not commonly used in everyday conversation outside of its context of actual white bread. So, in terms of directly answering your question is saying "white bread" considered as racist in everyday conversation? I would say probably not as the term is seldom used to describe a white person. (I would imagine that most people would believe one would literally be talking about white bread.)
However, where the context is sufficient for it to be clear that white bread is being used to describe a person's skin colour then this is racist.


text:
Q: AWS IAM Inline policy for Password Expiration I have a AWS account and different departments like Accounts, Developers and QA. I want to have a different password expiration policy for each departments. I tried with customs policy and its applicable for the users in account. Is it possible to change the password expiry groupwise?
Thanks in Advance.
I tried changing the Default to custom password policy but it is applying for all the users in the account.


text:
Q: I am always getting handlesigninresult : false I am trying to add google sign in to my android app. I have downloaded the google-services.json file from the google developers site. I am still not sure if this file is correct.
The code I used is from the google developers site itself.
My log cat status is:

handleSignInResult:false77445893

"77445893" is the hash code.
I have added runtime permission for GET_ACCOUNTS too.
This is my google-services.json file:
    {
  "project_info": {
    "project_number": "746238481207",
    "project_id": "civil-sprite-154007"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:746238481207:android:83984ccf8a4ecc15",
        "android_client_info": {
          "package_name": "com.example.george.project"
        }
      },
      "oauth_client": [
        {
          "client_id": "746238481207-0q17pl680i93e9qgeco3rjp74knipmco.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.example.george.project",
            "certificate_hash": "887E55694DCD8DA81377DB2F37C6276E64199263"
          }
        },
        {
          "client_id": "746238481207-jlitalqjls0f0nnfbk516bma7j76p0a2.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AIzaSyAytEslbivEZYWoulznIIIGQr7UfyVkeX4"
        }
      ],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "ads_service": {
          "status": 1
        }
      }
    }
  ],
  "configuration_version": "1"
}

This is my java code:
package com.example.george.project;
/**
 * Created by George on 29-12-2016.
 */
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.OptionalPendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;

import java.io.InputStream;

public class GPlusFragment extends Fragment implements GoogleApiClient.OnConnectionFailedListener {

    private static final String TAG = "GPlusFragent";
    private int RC_SIGN_IN = 9001;
    private GoogleApiClient mGoogleApiClient;
    private SignInButton signInButton;
    private Button signOutButton;
    private Button disconnectButton;
    private LinearLayout signOutView;
    private TextView mStatusTextView;
    private ProgressDialog mProgressDialog;
    private ImageView imgProfilePic;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        // Configure sign-in to request the user's ID, email address, and basic
        // profile. ID and basic profile are included in DEFAULT_SIGN_IN.
        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .build();

        // Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
        mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
                .enableAutoManage(getActivity() /* FragmentActivity */, this /* OnConnectionFailedListener */)
                .addApi(Auth.GOOGLE_SIGN_IN_API,gso)
                .build();

    }

    @Override
    public void onStart() {
        super.onStart();

        OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
        if (opr.isDone()) {
            // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
            // and the GoogleSignInResult will be available instantly.
            Log.d(TAG, "Got cached sign-in");
            GoogleSignInResult result = opr.get();
            handleSignInResult(result);
        } else {
            // If the user has not previously signed in on this device or the sign-in has expired,
            // this asynchronous branch will attempt to sign in the user silently.  Cross-device
            // single sign-on will occur in this branch.
            showProgressDialog();
            opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
                @Override
                public void onResult(GoogleSignInResult googleSignInResult) {
                    hideProgressDialog();
                    handleSignInResult(googleSignInResult);
                }
            });
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_gplus, parent, false);

        signInButton = (SignInButton) v.findViewById(R.id.sign_in_button);
        signOutButton = (Button) v.findViewById(R.id.sign_out_button);
        imgProfilePic = (ImageView) v.findViewById(R.id.img_profile_pic);

        mStatusTextView = (TextView) v.findViewById(R.id.status);
        Bitmap icon = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.user_default);
        imgProfilePic.setImageBitmap(ImageHelper.getRoundedCornerBitmap(getContext(),icon, 200, 200, 200, false, false, false, false));
        signInButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
                startActivityForResult(signInIntent, RC_SIGN_IN);
            }

        });

        signOutButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
                        new ResultCallback<Status>() {
                            @Override
                            public void onResult(Status status) {
                                updateUI(false);
                            }
                        });
            }

        });

        return v;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
        if (requestCode == RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            /*if (result.isSuccess()) {
                GoogleSignInAccount acct = result.getSignInAccount();
                // Get account information
                String mFullName = acct.getDisplayName();
                String mEmail = acct.getEmail();
                Toast.makeText(getContext(),mFullName,Toast.LENGTH_LONG).show();
            }*/

            handleSignInResult(result);
        }
    }

    private void handleSignInResult(GoogleSignInResult result) {
        Log.d(TAG, "handleSignInResult:" + result.isSuccess() + result.hashCode());

        if (result.isSuccess()) {
            // Signed in successfully, show authenticated UI.
            GoogleSignInAccount acct = result.getSignInAccount();
            mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName()));
            //Similarly you can get the email and photourl using acct.getEmail() and  acct.getPhotoUrl()

            if(acct.getPhotoUrl() != null)
                new LoadProfileImage(imgProfilePic).execute(acct.getPhotoUrl().toString());

            updateUI(true);
        } else {
            // Signed out, show unauthenticated UI.
            updateUI(false);
        }
    }

    private void updateUI(boolean signedIn) {
        if (signedIn) {
            signInButton.setVisibility(View.GONE);
            signOutButton.setVisibility(View.VISIBLE);
        } else {
            mStatusTextView.setText(R.string.signed_out);
            Bitmap icon = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.user_default);
            imgProfilePic.setImageBitmap(ImageHelper.getRoundedCornerBitmap(getContext(),icon, 200, 200, 200, false, false, false, false));
            signInButton.setVisibility(View.VISIBLE);
            signOutButton.setVisibility(View.GONE);
        }
    }

    @Override
    public void onConnectionFailed(ConnectionResult connectionResult) {
        // An unresolvable error has occurred and Google APIs (including Sign-In) will not
        // be available.
        Log.d(TAG, "onConnectionFailed:" + connectionResult);
    }

    private void showProgressDialog() {
        if (mProgressDialog == null) {
            mProgressDialog = new ProgressDialog(getActivity());
            mProgressDialog.setMessage(getString(R.string.loading));
            mProgressDialog.setIndeterminate(true);
        }

        mProgressDialog.show();
    }

    private void hideProgressDialog() {
        if (mProgressDialog != null && mProgressDialog.isShowing()) {
            mProgressDialog.hide();
        }

    }

    /**
     * Background Async task to load user profile picture from url
     * */
    private class LoadProfileImage extends AsyncTask<String, Void, Bitmap> {
        ImageView bmImage;

        public LoadProfileImage(ImageView bmImage) {
            this.bmImage = bmImage;
        }

        protected Bitmap doInBackground(String... uri) {
            String url = uri[0];
            Bitmap mIcon11 = null;
            try {
                InputStream in = new java.net.URL(url).openStream();
                mIcon11 = BitmapFactory.decodeStream(in);
            } catch (Exception e) {
                Log.e("Error", e.getMessage());
                e.printStackTrace();
            }
            return mIcon11;
        }

        protected void onPostExecute(Bitmap result) {

            if (result != null) {

                Bitmap resized = Bitmap.createScaledBitmap(result,200,200, true);
                bmImage.setImageBitmap(ImageHelper.getRoundedCornerBitmap(getContext(),resized,250,200,200, false, false, false, false));

            }
        }
    }

}

Please help me out.
Thanks


text:
Q: How do you reuse a protobuf message in another message without assigning another field? If I have a protobuf message like this:
message Hostnames {
  message Hostname {
    string hostname = 1;
    uint32 port = 2;
  }
  repeated Hostname hostnames = 1;
}

If I want to use that message in another message, how do I avoid assigning another field? Example:
message Backends {
  Hostnames hostnames = 1;
}

This seems like in YAML it would appear like this:
backends:
  hostnames:
    hostnames:
      - hostname: one.example.com
        port: 80
      - hostname: two.example.com
        port: 80

But what I want is just:
backends:
  hostnames:
    - hostname: one.example.com
      port: 80
    - hostname: two.example.com
      port: 80


text:
Q: Is there a bug with PostbackUrl and URL Rewriting? I have a page where I set the PostBackUrl property on a login button. I am using the IIS7 Url Rewriting Module. I am also rewriting the Page.Form.Action attribute to match the rewritten url, so that postbacks work properly. When I have the PostBackUrl property set, the page adds a "__PREVIOUSPAGE" hidden input. The problem is that ALL postbacks are now broken, such that the request is seen as a new request, and Page.IsPostback == false. Removing the line of code that sets PostBackUrl fixes all my postback issues.
I don't think I can rewrite the encrypted __PREVIOUSPAGE value to match the current rewritten url, but I suspect that is the issue. Has anyone else encountered and solved this problem?

A: ASP.NET webforms and url rewriting have never played particularly well. You might want to look at routing, which will work loads better . . .


text:
Q: Simple Encrypt Decrypt String with array in Android My problem seems easy, I am trying to encrypt a string in android.
What the program should do
The objective of the program is, put a word or a letter in textbox1, click on button encrypt  and textbox2 should to show the symbol in the same position in second array of the letter that you put in.
For example I write letter A (array 1 [0]) must show symbol $ (array 2 [0]) if a click on ENCRYPT button, if I put a symbol and click on DECRYPT must show the letter which is equivalent in position of array
Need help. Sorry for grammar and edit question, first time and no English speaker, i tried to make it more simple.
Arreglo Class, just for declare 2 arrays.
package PaqueteArreglo;

public class Arreglo {
public String [] encrypt = new String[3];
public String [] decrypt = new String[3];
}

Main Activity
package com.example.encrypt;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import PaqueteArreglo.Arreglo;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

//Instance the class with the arrays
PaqueteArreglo.Arreglo ins = new Arreglo();
public Button button1,button2;
public EditText text1, text2;

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  initialize();

  ins.encrypt[0] = "a";
  ins.encrypt[1] = "b";
  ins.encrypt[2] = "c";

  ins.decrypt[0] = "$";
  ins.decrypt[1] = "%";
  ins.decrypt[2] = "&";

}

private void initialize(){
  text1 = (EditText)findViewById(R.id.txtWord);
  text2 = (EditText)findViewById(R.id.txtResult);

  button1 = (Button)findViewById(R.id.btnEncrypt);
  button1.setOnClickListener(this);

  button2 =(Button)findViewById(R.id.btnDecrypt);
  button2.setOnClickListener(this);

}

@Override
public void onClick(View view) {
  String word = String.valueOf(this.text1.getText());

  if (view.getId() == R.id.btnEncrypt)
  {
     String demo = "";
     int lon = 0;
     lon = word.length();
     for (int i = 0; i < lon; i++ )
     {
        if (ins.encrypt[i].equalsIgnoreCase(String.valueOf(word.charAt(i))))
        {
           demo = demo + ins.decrypt[i];
           text2.setText(demo);
        }
     }
  }
}
}

A: There are two solutions to your problem using two different approach:
1- Using your defined structure (which is not optimized by the way) you need to put two nested loop for checking:
for (int i = 0; i < lon; i++ )
 {
    for(int j = 0; j<ins.encrypt.length;j++)
    {
       if (ins.encrypt[j].equalsIgnoreCase(String.valueOf(word.charAt(i))))
       {
          demo = demo + ins.decrypt[j];
       }
    }
 }

text2.setText(demo);

2- Using much better data structure like HashMap:
Change your Arreglo to the following:
public class Arreglo {
   public HashMap<Character, Character> encrypt = new HashMap<>();
   public HashMap<Character, Character> decrypt = new HashMap<>();
}

Now change the way you add your data like:
ins.encrypt.put('a','@');
ins.decrypt.put('@','a');
...

and finally do the encryption like:
for (int i = 0; i < lon; i++ )
{
   demo = demo + ins.encrypt.get(word.charAt(i));
}
text2.setText(demo);

The second implementation is more efficient


text:
Q: JS Discord Bot gets online but doesn't respond to messages I recently set up a JavaScript discord bot with node.js and visual studio. While the bot shows up as online, it doesn't respond to the messages that I send to it. I made sure to give the bot proper permissions and I read my code over and over but I can't seem to figure out what is wrong. I don't normally write JavaScript and any help would be appreciated.

A: This is because you have not requested the GUILD_MESSAGES intent.
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] })


text:
Q: Nativescript-vue graphql backend? Just started to experiment with nativescript-vue. Since it's pretty new, can't seem find good documentation on nativescript-vue integration with graphql. Tried vue-apollo, but can't install. When I do vue add apollo, it errors out. Is there any good docs on how to integrate nativescript-vue with graphql backend or more specifically via apollo?

A: I want to confirm that nativescript-vue is working properly with vue-apollo.
You should first install apollo-boost using npm or yarn
yarn add vue-apollo graphql apollo-boost

main.ts
import Vue from "nativescript-vue";
import routes from "./routes";
import store from "./store";
import * as ApplicationSettings from "tns-core-modules/application-settings";

import VueApollo from "vue-apollo";
import ApolloClient from "apollo-boost";

// GET TOKEN and Prepare for header bearer
const tokenInAppSet = ApplicationSettings.getString("token")
    ? ApplicationSettings.getString("token").replace(/['"]+/g, "")
    : false;

/////////////// APOLLO
export const defaultClient = new ApolloClient({
    uri: "http://000.com/graphql",
    headers: {
        authorization: `Bearer ${tokenInAppSet}`,
    }
});

Vue.use(VueApollo);
const apolloProvider = new VueApollo({
    defaultClient,
});

new Vue({
    store,
    apolloProvider,
    render: (h) =>
        h("frame", [h(tokenInAppSet ? routes.entered : routes.login)]),
}).$start();

If you want to see some installed version.
Vue-Apollo with Nativescript examples:
https://github.com/kaanguru/apollo-jwt
https://github.com/kaanguru/simple-question


text:
Q: What JavaScript functions are supported by different browsers? I want to know which sites can give me information on the list of JavaScript functions that are supported by IE/Firefox/Opera/Safari.

A: Take a look at quirksmode
and in the Compatibility Master Table
you will get a detailed listing.

A: Perhaps not a direct answer to this question, but never-the-less I think this is useful to know about: You can use the Sputnik JavaScript Conformance tool in Google Labs to check ECMAScript conformance in browsers:

Sputnik is a JavaScript conformance
  test suite containing over 5000 tests.
  It tests how well a JavaScript
  implementation adheres to the ECMA-262
  specification version 5, looking only
  at those features that were also
  present in the previous version,
  version 3, and not the new features
  added in version 5.

A: There are several sites for that but you'll probably find that none are absolutely complete, so it is worth checking out each of them

*

*quirksmode.org compatibility tables

*sitepoint JS reference (work in progress)

*Mozilla MDC reference (mozilla only but worth mentioning)

A: This looks useful http://kangax.github.com/es5-compat-table/


text:
Q: Where are these garlands?
Frank had laughed out loud when he saw the portrait. A delicate Marie
  Villette Lameraux sat in front of a painted backdrop of Mount Olympus
  in some long-ago photographer's studio, her girlish personage
  festooned with garlands from the swirling braids over her ears to the
  loopy ribbons draped between rosettes on her gown. She stared grimly
  at the camera.

from Loving Frank by Nancy Horan
I can't picture this sentence. I can understand that she is decorated with garlands but how? From the top of her ears to somewhere around the upper part of her dress?

A: That's a list, not one garland. The girl is adorned is several places. Let me break down the qoute:

her girlish personage festooned with garlands

*

*from the swirling braids over her ears

*to the loopy ribbons draped between rosettes on her gown

Meaning she has complicatedly braided hair and her dress has elaborate ribbon details.
The overall effect reminds the observer of her being hung with garlands, like an excessively decorated room. Just a general "too much" effect, not literally being hung with garlands.
Note that he explicitly mentions "some long-ago photographer's studio", and "a painted backdrop", so we are talking about a fashion style from possibly the early days of portrait photography - that would be the early 20th century, a bit earlier if other techniques like daguerrotypie were used. People would put much effort into their attire and had to sit very still, explaining the grim facial expression of the subject.


text:
Q: Angular - why use a Getter for a non-private field? I'm coming from Java where you try to make all variables as private as possible.
In Angular I noticed that we don't use the private field that often.

*

*Why should we not make fields private if possible?

*In the Angular docs I found this example:
.
 export class CartService() {
  items = [];

  addToCart(product) {
    this.items.push(product);
  }

  getItems() {
    return this.items;
  }

  clearCart() {
    this.items = [];
    return this.items;
  }
}

Here we have the non-private field items in the CartService. If we want to access the value of items from another class, can't we just do this.items = cartService.items?
What is the use of getItems()?

A: Coming from Java myself, I am of the same opinion.
As long as the value is public there is no need for accessing this variable by getter or setter. And even if you provide getters and setters for those variables, you can easily circumvent them by directly calling the variable. Here is the Typescript solution of getter and setter and the proof of how needless they actually are.
class Foo {
  // tslint:disable-next-line:variable-name
  _count = 100;

  get count(): number {
    console.log('you called the getter of Foo.count.');
    return this._count;
  }

  set count(value: number) {
    console.log('you called the setter of Foo.count.');
    this._count = value;
  }
}

ngOnInit(): void {
    const foo = new Foo();

    console.log('getting count by getter');
    console.log(foo.count);

    console.log('setting count by setter');
    console.log(foo.count = 200);

    console.log('getting count directly');
    console.log(foo._count);

    console.log('setting count directly');
    console.log(foo._count += 200);

    console.log('getting count by getter');
    console.log(foo.count);
}

Getters and setters are only useful when you use private variables. Even here in Typescript. At least if you want to make sure that you always have the control over the way this value is get and set.

A: In this particular example method
getItems() {
    return this.items;
}

Just does not make sense since it will be same as just calling into this.items.
What would make sense is probably to modify this class
class CartService {
  private items: any[] = [];

  addToCart(product: any) {
    this.items.push(product);
  }

  getItems() {
    return this.items.map(item=> ({...item}));
  }

  clearCart() {
    this.items = [];
    return this.getItems();
  }
}

This way you "cant access" private property or at least you will get compilation error :) and most important if you return items from here it will be immutable.  But its typescript so funny thing here even if you mark field private after compilation types go away so basically in JS there is no private field (I think private is coming to JS but thats other story). You can go to typescript play ground paste my class and try to remove private identifier you will see same js will be in the end;
Other option would be to use Observable instead of getItems so that way you can simply have listeners. And then you will be able to push new change to your consumers

A: As you come with Java background some things are here similar.
Java same as C# has reflection mechanism that allow us to access objects in runtime. Even tho some variables are private you can still access them.
If you declare class in Java with private field it won't be visible in your IDE and if you try to access it you won't be able to compile your code.
Why am I saying this?
Because it is similar case with Typescript. Your code is being compiled to javascript. Javascript doesn't have strong typing or access modifiers. In that case when you declare your field private, you will be able to access it in javascript - similar to reflection. But your code won't compile because Typescript compiler will mark that as an error.
So what is benefit of having private fields? Similar as in java bascially, to deny access to some object properties and detect in on compilation.
Just an information, you were not using Getter since java encapsulation is done as getFoo in typescript getter is done like this:
class Foo{
    private _boo: number;

    public get boo() {
        return this._boo;
    }
}


text:
Q: c++ Hidden Unique Pointer I have some code which depends on some include files which are partly defined at the start of source files (which is usual) and others which are used within functions.
I typical example for that are the OpenFOAM solver sources.
Because the scheme of this code is highly procedural, but I want to put all this into a class which provides init(), run() and maybe release(), I plan to put some of the variables into the classes as private making them members.
I don't want to modify the included files because they belong to a library.
The reason for using a class is that other routines classes run together with this code.
Here is the thing. init() must prepare some variable and there situations that theses variables (being type of other clases) not explicit constructors and special arguments. It is called once. run() is called several times. The procedural code has a loop only and the contents of that loop are put into the run() method.
So the best solution was to put these variables into std::unique_ptr and init can construct whatever it needs to. Obviously with that trick the variable signature changed, so I created a second declaration of a reference like this:
    std::unique_ptr<volScalarField> mp_p;
    volScalarField &p = *mp_p;

Now this is a bit tedious so I created a macro
    FOAMPTR(volVectorField, p)

which does all the work for me:
    #define FOAMPTR(TYPE,NAME) std::unique_ptr<TYPE> mp_##NAME; TYPE &NAME=*mp_##NAME

It works pretty well, but I'm not fan of macros in general, especially if you need to debug code.
Now my question is: Is there a better way to tackle this and use something else like a template definition which might do all the magic?
Edit: With 'works pretty well' I mean, that the compiler can translate that. The reference though still is invalid.
Edit: Okay, I solved the invalid pointer problem using two Macros:
    #define FOAMPTR(TYPE,NAME) std::unique_ptr<TYPE> mp_##NAME
    #define FETCHFOAMREF(NAME) auto &NAME=*mp_##NAME

Now I put FOAMPTR(TYPE,NAME) to the member and I get my unique ptrs. In the run() method the second macro FETCHFOAMREF(NAME) is used. Of course init() must be sure to correctly initialize the object or else the program is going to crash.
I still leave the question open because I'm not satisfied with that solution.


text:
Q: How to create new organisation and peers in Hyperledger Fabric? I am using first-network sample to build my fabric network. By default it provides 2 Organisations with 2 peers for each Org. I want to create new Organisation and add more peers to these Organisations. What are the steps involved in doing this?
Thank You

A: You can checkout this link from the official hyperledger-fabric docs.
This adds an organization to the already created fabric network


text:
Q: como utilizar a interpolação do vue.js em um template do django? O django utiliza uma ferramenta de sintaxe de template, chamada jinja2, ela permite a interpolação no documento html utilizando chaves duplas. Infelizmente, o vue.js usa a interpolação da mesma forma.

 {{ message }}

Em condições normais, apenas isso seria necessário para o funcionamento. Porém, o django reconhece como sua própria interpolação, não exibindo conteúdo algum.

A: Na configuração do Vue você tem a opção de definir novos delimitadores para o seu template, assim você pode informar algo que não conflite com o sistema de templates do Django.
const app = new Vue({
  delimiters: ['[[', ']]'],
  // ...
});

Assim, ao invés de utilizar {{ message }} basta utilizar [[ message ]].

var app = new Vue({
  delimiters: ['[[', ']]'],
  el: '#app',
  data: {
    message: 'Hello World'
  },
});

[[ message ]]


text:
Q: How to replace content of the file, if the file in the server is deleted? I am placing the file "Seq.properties" in the SAP server location.
The file Seq.properties holds the count of 2 variable. Every time a call is made to the java  function, it increments the count of 2 variables and stores the file in the SAP server location.
The Code is as follow,
public final static String executeRegNo() {

    File file=new File("C:/Users/xyz/Desktop/Files/Seq.properties");
    Properties properties=new Properties();
    //1. If file Seq.properties doesnt exist, it first initializes TransNum to 0 and RegId to 1
    if (!file.exists()) {
        try
        {
            file.createNewFile();

            properties.setProperty("TransNum", "0");
            properties.setProperty("RegId", "1");
            properties.store(new FileOutputStream(file), null);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
    //2. If file Seq.properties exist, it reads the file Seq.properties and
    //it increments TransNum to prev_value+1 and RegId remains the same 1
    try
    {

        properties.load(new FileInputStream(file));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    String transId = properties.getProperty("TransNum");
    String RegisId = properties.getProperty("RegId");

    properties.setProperty("TransNum", String.valueOf(Integer.parseInt(transId) + 1));
    properties.setProperty("RegId", String.valueOf(Integer.parseInt(RegisId)));

    //3. the incremented value is stored in the Seq.properties file
    try
    {

        properties.store(new FileOutputStream(file), null);
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    String RId = properties.getProperty("RegId");
    String TId = properties.getProperty("TransNum");
    DecimalFormat df = new DecimalFormat("00");
    String R = String.valueOf(df.format(Integer.parseInt(RId)));
    DecimalFormat df1 = new DecimalFormat("0000");
    String T = String.valueOf(df1.format(Integer.parseInt(TId)));
    return R + T;
}

Suppose in case due to system failure, if the file Seq.properties gets deleted, how to replace the content of that file?
Kindly provide your valuable inputs, as this is critical requirement.
Thanks in advance

A: My Suggestion is to store the content of variable in database and whenever u are retrieving the Seq.properties file, load the value from the database.
If the file is not present,it creates new file with previous value


text:
Q: Passing Parameter value and refreshing the page after selecting option from Dropdown Folks,
Greetings!
When the visitor select any option from the dropdown Menu, i want to capture that value with $_GET['q'], and it should reload the page also so that i can grab the valur of Q variable.
Right now what is happening is, when i select any Value, it just does not refresh and i am not able to passon the Q value as well, looks like its only Client side and can not even execure any PHP Data grabbing function.
here is the code i am using:
    <select id="items" onselect="javascript:reloadPage(this)">

 <?php foreach($searchWords as $lolachild): ?>
<option value="<?php
echo $host.str_replace(' ','-',$lolachild).'.html'; ?>"><?php echo ucwords($lolachild); ?> </option>
<?php endforeach; ?>

</select>

<script type="text/javascript"><!--
function reloadPage(id) {
   document.location.href = location.href + '?id=' + id.value;
}
--></script>

Can someone please help me with this, please?
Cheers
Natasha Thomas

A: You want the onchange event, not onselect.
There will be other issues though with your script though.

*

*The reloadPage function is adding to the location.href irregardless of if there is already a query string. I'd suggest reconstructing it, see window.location.

*You will need to reselect the value they changed it to. If the change the select box to the second option, your page will reload and the first option will be selected again.


text:
Q: php count rss entries since a specific date/time can anyone tell me why this code don't work:
$q = $_GET['q'];

// Load and parse the XML document

$rss =  simplexml_load_file("http://search.twitter.com/search.atom?lang=en&q=$q&rpp=100&page=1");

$Count1 = 0;

while(strtotime($rss->entry->published)>1270833600){

  foreach ($rss->entry as $item) {

    $Count1++;

  }

}

print "Total Record: ".$Count1;

A: I think you want to do:
foreach($rss->entry as $item) {
   if(strtotime($item->published) > 1270833600) {
      $Count1++;
   }
}

Or assuming that the entries in the RSS feed are ordered properly:
$items = $rss->entry;
$item = current($items);
while(strtotime($item->published) > 1270833600){
    $Count1++;
    $item = next($items);
}

I don't know how SimpleXMLElement works internally so that is why I assign the array of elements to a new variable before (it might be that the internal array pointer gets reset otherwise).


text:
Q: Is there a way to run an arbitrary Visualforce page in Lightning Experience? We have several very occasional use Visualforce pages that we run in Classic by entering the URL:
/apex/pagename

I presume there is no way to do this in Lightning Experience? So telling users to switch to Classic to run the pages is the way to go?
(Would be useful to be able to do this when checking if a Visualforce page works in Lightning Experience to.)

A: Some more Googling shows that this subject is discussed in the Developing Visualforce Pages for Lightning Experience Trailhead module. The solution for ad-hoc pages is, with Lightning Experience displayed, to execute this:
$A.get("e.force:navigateToURL").setParams({"url": "/apex/pagename"}).fire();

in the JavaScript console.


text:
Q: Moved Xcode project has missing files from other libraries I moved the folder of a project in Xcode to another computer, and I"m having some issues. I'm using NMSSH framework, and the libz.dylib file is missing from the project, and I'm unable to locate it, since the Inspector button for it is grayed out. The file is not on my system either. Shouldn't it have been inside my project folder?
Also, I'm using MBProgressHUD, and I'm using it by dragging its Xcode project in, and setting the appropriate links. One of the libraries libMBProgressHUD.a is missing, and I can't locate that either.
Everything was working fine on my other computer, so I'm guessing there's a problem with search paths, etc? Any help would be much appreciated. The errors are as follows:
ld: warning: directory not found for option '-F/Users/ramesh/Documents/CodeDump_Temp/iOS/RasbPiController/../../.Trash'

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_NMSSHSession", referenced from:
      objc-class-ref in UserPi.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A: you can download the missing file from the link below
https://www.dropbox.com/s/au2irnctslcpjih/libz.dylib
and paste it in your iOS Simulator folder.  I hope it will work .


text:
Q: Repeatedly losing data sources for raster layers in ArcGIS for Desktop? I have several raster layers that keep losing their data connection whenever I add a new layer from running a tool. I repaired the data source, but this keeps happening every time I run a tool. Is there an option/preference that I need to change so this stops happening? I didn't move any files so the path names are the same.
UPDATE:
I restarted Arc and the document, which seemed to work for a little bit, but after a while it started happening again.


text:
Q: How to print symfunc in Octave so it looks human-typed as opposed of human-written? I'm trying to see a laplace transform applied to a symbolic function, but it doesn't look like I would want to.
; file.m
syms t

f(t) = (3*t - 2) * cos(t);

laplace(f)

outputs
ans = (sym)

     2       / 2    \
  3*s  - 2*s*\s  + 1/ - 3
  -----------------------
                 2
         / 2    \
         \s  + 1/

and I want
ans = (sym) (3*2^2 - 2*s*(s^2 + 1) - 3)/(s^2 + 1)^2

A: sympref display flat

See here: https://octave.sourceforge.io/symbolic/function/sympref.html
Also possibly useful: https://octave.sourceforge.io/symbolic/function/@sym/pretty.html


text:
Q: Add Web Root Context to return calls in WSO2 IS 5.7.0 I need to add a WebRootContext to all the calls in the WSO2 Identity Server's Implicit Flow so that I can make calls through an API Gateway. I have managed to do this for all the calls I need by changing the
<WebContextRoot>/wso2-is<WebContextRoot>
property as well as changing the name of my webapp folders: wso2-is#authenticationendpoint and wso2-is#oauth2 endpoints. I can now successfully call http://localhost:9443/wso2-is/oauth2/authorize.
I also changed the endpoints in repository/conf/identity/identity.xml to include the wso2-is root context, specifically the OAuth2AuthzEPUrl, so that in the management console this shows up under identity:

 However, after I login, the application calls http://localhost:9443/wso2-is/commonauth which has a return location of http://localhost:9443/oauth2/authorize?sessionDataKey=... and I can't figure out how to add my context root to the returning call. Where does the commonauth endpoint get the location it returns to? I'm assuming there is some property I need to set to make that happen, but I can't find it.
I also tried re-seeding the database with all my changes and this did not solve my issue either.
I looked in the source code here in github and couldn't find any references to commonauth or oauth2/authorize that stood out as to where this call is being formed. Any additional details would be greatly appreciated.

A: As per the official documentation, using a reverse proxy is the recommended way to add a custom context path to wso2 products.
However, as I wrote in another question, I could complete the implicit flow with local auth successfully with the mentioned configs in my answer.
I guess, what you are missing here is ProxyContextPath.


text:
Q: Windows 7 DSCP and 802.1p QoS Mapping? When I create a QoS policy in Windows 7 through the Group Policy editor and set a DSCP value, does Windows 7 add the 802.1p QoS field to the Ethernet frame?  If so, how does it map the different values from DSCP (0-63) to the 802.1p QoS values (0-7)?
So to be clear, my questions are:

*

*Does Windows 7 set an 802.1p value for configured QoS policies?

*If so, how does Windows 7 map the QoS-policy's DSCP value to the 802.1p value?

This question is specifically for outgoing packets.
Note: 802.1p tagging is supported in Windows 7 (and has been since Windows 2000, XP SP2, Windows Server 2003).  Microsoft seems to allude to a mapping of DSCP to 802.1p in this document.

A: There appears to be a crapload of information here (new link).
DSCP and 802.1p are two different methods of QoS, and they do not necessarily correspond, although managed switches can certainly map between the two in the event that one or the other is unsupported on a particular device (with DSCP being the older, more widely-supported one). Windows maps traffic to both independently, with the following values used for 802.1q:
Non-conforming packets  0

Best-effort             0

Controlled load         4

Guaranteed service      5

Network control         7

Qualitative             0

The general trend is higher values = higher priority traffic, but most network devices tend to coalesce these values into a handful of queues/buffers internally (very low, low, medium, high, for example). Also, if your application doesn't label its traffic type, Windows will have nothing to map to and you won't see any change in performance.

A: Support for 802.1p and DSCP has been claimed by Microsoft since many years.
Yet I have found a troubling Microsoft article saying that 802.1p only started with  Server 2012 (same code-base as Windows 8).
The Microsoft article Quality of Service (QoS) Overview says:

Previous versions of Windows support priority tagging in the IP header
  of a network packet. The priority bits are known as Differentiation
  Service Code Point (DSCP). Windows Server 2012 adds the support of
  802.1p tagging. 802.1p is a 3-bit priority value in the layer 2 Ethernet frame. Therefore it applies to non-IP packets such as RDMA
  over Ethernet.

Both DSCP and 802.1p are said by Microsoft in the article Differentiated Services Code Point (DSCP) overview to be equivalent in functionality.
However, as these two standards apply to different layers of the communication protocol,
it is unlikely that one can be mapped to the other.


text:
Q: Graph minus a point has at most 2 connected components Let $G(V,E)$ be a connected undirected graph (undirected=easier), such that, $S_x=V\setminus\{x\}, \forall x \in V$ is a subset of vertices of G. Then the induced subgraph $G[S_x]$ is the graph whose vertex set is $S_x$ and whose edges set consists of all of the edges in $E$ that have both endpoints in $S_x$.
Prove that a graph $G(V,E)$ has a Hamiltonian path (not necesarily a cycle) if the induced subgraphs $\forall x \in V, G[S_x]$ have at most 2 connected components.

A: Below is probably the simplest counterexample.


text:
Q: How do I get a image link as input and make it appear on the view component below? class Newsfeed extends React.Component{
    state = {
      text: ''
  };
   render(){
    return (
       <View>

      <Text style={{fontSize: 50}}>Junior Facebook</Text>
      <View style={{flex: 1, flexDirection: "column"}} />
      <View style={{top: 20, marginLeft: 0, width: 300, height: 180, backgroundColor: "lightblue"}}>
      <TextInput
          style={{
            height: 150,
            borderStyle: "solid",
            borderWidth: 2,
            fontSize: 30
          }}
          placeholder="New Post"
        />
        <TouchableOpacity
          style={{ backgroundColor: "green", marginLeft: 220, width: 80, height: 40 }}
        >
          <Text style={{fontSize: 24}}>Enter</Text>

        </TouchableOpacity>

      </View>

      <View style={{marginTop: 30, marginLeft: 0, width: 300, height: 180, backgroundColor: "pink"}} >
      <TouchableOpacity style={{width: 65, height: 45, marginLeft: 260}}><Text>Share</Text></TouchableOpacity>
      <TouchableOpacity style={{width: 65, height: 45, marginLeft: 220, marginTop: -45}}><Text>Like</Text></TouchableOpacity>
      </View>

      <View style={{marginTop: 10, marginLeft: 0, width: 300, height: 130, backgroundColor: "yellow"}} >

      </View>
    </View>
  )
  }
}

The above is my current code. When I type in an image link in TextInput, I want the image to appear on the yellow View Component below. I have tried many different ways but it still does not work. How can I do so?
Thank you

A: @高鵬翔 answer is perfect, but said that you want to display image after clicking on 'enter' button. So here is my solution :
...
...
import { View, Text, Image } from "react-native";
...
...

//state
this.state = {
  link: "",
  enteredImageUri: "",
};

render() {
  return (
    <View>
      ...
      ...
      <View
        style={{
          top: 20,
          marginLeft: 0,
          width: 300,
          height: 180,
          backgroundColor: "lightblue",
        }}
      >
        <TextInput
          style={{
            height: 150,
            borderStyle: "solid",
            borderWidth: 2,
            fontSize: 30,
          }}
          placeholder="New Post"
          value={this.state.link}
          onChangeText={(link) => this.setState({ link })}
        />
        <TouchableOpacity
          style={{
            backgroundColor: "green",
            marginLeft: 220,
            width: 80,
            height: 40,
          }}
          onPress={() => {
            this.setState({
              enteredImageUri: this.state.link,
            });
          }}
        >
          <Text style={{ fontSize: 24 }}>Enter</Text>
        </TouchableOpacity>
      </View>

      <View>
        {/* Image View */}
        {this.state.enteredImageUri === "" ? (
          <Text>No Image link entered</Text>
        ) : (
          <Image
            source={{ uri: this.state.enteredImageUri }}
            style={{ width: 400, height: 400 }}
          />
        )}
      </View>
      ...
      ...
    </View>
  );
}

As you can see I have just assigned textinput text into the another state variable enteredImageUri, which will be used to display image.

A: You have to use Image Tag to show image.
Like this:
import {Image} from 'react-native';

...
<Image source={{uri: 'https://reactjs.org/logo-og.png'}}
       style={{width: 400, height: 400}} />

And you have to store the text input as a state to control Image as @Will said.
So you have to add a state and the text input should like this:
constructor(props) {
    super(props);
    this.state = { text: '' };
}
<TextInput
        style={{height: 40, borderColor: 'gray', borderWidth: 1}}
        onChangeText={(text) => this.setState({text})}
        value={this.state.text}
      />

And see how you want to control Image view to show something like this, but this may be error if the uri haven't finish?  Based on when you pass the correct uri to let it show, but it's an another question:
import {Image} from 'react-native';

...
<Image source={{uri: this.state.text}}
       style={{width: 400, height: 400}} />


text:
Q: MySQL connections from client programs persists In a college where I'm employed, we are currently testing (dry-run) the new enrollment system I have developed. The application has several modules (accounting, cashiering, course scheduling, admission, advising, grading) installed in different offices. We are using MySQL Server 5.1 and the front end was developed using VB.Net.
The system has 1 computer server and 25 clients.
I have noticed, using MySQL Administrator, that the clients' connections persists although   I have used using syntax for all my data access/manipulation codes. I thought after end using statement the connections would automatically be released.

A: I tend to find that using doesn't always close files and connections, esp if there was an exception thrown, so I just use a try..finally block to ensure that the connection is definately closed, regardless of what happened in the application.
So, just try it without the using and use a finally block to close the connection and see if that fixes your problem.


text:
Q: Does the potential energy for a given photon increase or decrease in quanta? As a photon leaves a strong gravitational field, it loses energy and redshifts. Is the exchange in potential energy of a photon characterized by energy quanta?

A: No. A photon of a given frequency $f$ is exactly one quantum of energy. An electromagnetic wave has a total energy given by $E_\text{total} = \langle N\rangle hf$, where $\langle N\rangle$ is the number of photons in the wave.
When an EM wave escapes from a gravitational potential well (or falls into one), it's the energy of each individual photon that changes; in other words, the unit in which energy is quantized gets smaller or larger. The number of units (number of photons) stays the same.


text:
Q: gnuplot: x11 terminal in "interactive mode" while calling gnuplot from shell I want to call gnuplot with a shell command, all the commands are stored in, let's say, "load.gp".
If I start the gnuplot shell and type "load 'load.gp'" I can change the viewpoint by dragging the splot with the mouse around.
The Problem is, I can't figure out how to reach that without being in the gnuplot shell.
echo "load 'load.gp'" | gnuplot -persist

or
gnuplot -persist 'load.gp'

won't work. Can somebody help me?
Thanks, Jan

A: I think
gnuplot load.gp -

does what you want.

A: The command
gnuplot -persist load.gp
should do the trick just fine...
Sounds like you have some error in your load.gp file. Try setting the terminal in your load.gp file. Perhaps it the terminal remains unset or is set to a terminal incompatible with the commands in y our file. all fail, post your load.gp file here, and let's have a look at it :)
/B2S

A: You need to add an hyphen after the command, e.g.
gnuplot -persist 'load.gp' -

As mentioned here: http://old.nabble.com/gnuplot-in-persist-mode-td28289021.html


text:
Q: Pass Column Object into UDF Scala Here is my code block., I want to pass Column to "calculateCredit" but the following code GlobalLock
take value of that column.
object CreditHostory {

    def calculateCredit(rows: Row)  = {

    }

    def main(args: Array[String]): Unit = {
    sparkSession.udf.register("calcCredit", calculateCredit _)

    callUDF("calcCredit", struct(col("credit") , col("amount")))
    }
}