问:
Eclipse debugger not working ( Skip breakpoints disabled )
This is my first time running the debugger to check the values of my binary search tree but it seems to skip through all the debugger and it has a weird arrow beside the blue dot. By the way, the skip all breakpoints is disabled I made sure of it.

This is a short GIF of me running the program
https://gyazo.com/e236c1bd75ac746bf9982871ca847233

Added my other class

```<code>public class BinaryTree<T extends Comparable<T>> {

private class Node{

    private T data;
    private Node left;
    private Node right;

    // left and right child do not have to nessary exist
    public Node ( T data) {
        this.data = data;
        this.left = null;
        this.right = null;
    }}

    private Node root;
    private int count = 0;

    public void add( T data) {
        if ( isEmpty()) {
            root = new Node(data);
            count++;
        }
        else {
            insert(data, root);
            count++;
        }
    }

    public boolean isEmpty() {
        return root == null;
    }

    public T getRoot()  {
        if ( root.data == null) {
            System.out.println("Root is empty");
            return null;
        }
        else {
        return  root.data;
    }}

    /*
     * Checking if the data is larger or lesser than the parent's data
     * If the data is smaller than the parent's data, node.left is created
     * If the data is bigger than the parent's data, node.right is created
     */
    private void insert( T data, Node node) {

        /*
         * If 1st obj is less than the 2nd obj return a neg
         * if 1st obj is more than the 2nd obj return a pos
         * if equal return 0
         */
        int compare = data.compareTo(node.data);
        if ( compare < 1 ){
            if (node.left == null ) {
                node.left = new Node(data);

            }

        // make node.left if it is filled
            else {
                insert(data, node.left);
            }
        }

        else {
            if ( node.right == null) {
                node.right = new Node(data);
            }
            else {
                insert( data, node.right);
            }
        }
    }

    public int getSize() {
        return count;
    }

    private void removeInner( T data, Node node ) {

    Node temp;
    while ( node.data!=data) {
        int compare = data.compareTo(node.data);

        if ( compare < 1 ){
            node = node.left;
        }
        // make node.left if it is filled
        if ( compare > 1 ){
            node = node.right;
            }

        if ( compare == 0) {
            node = null;
        }

        }

    }
</code>```

}

答:
You have one or more so-called Trigger Points (decorated with a T) somewhere else from which one must be hit first to activate the other regular breakpoints. This can be seen by the regular breakpoint in line 9 being decorated with a crossed-out T.

Solution: Delete or deactivate all Trigger Points (those decorated with T), e.g. in the Breakpoints view.

Body:
This is my first time running the debugger to check the values of my binary search tree but it seems to skip through all the debugger and it has a weird arrow beside the blue dot. By the way, the skip all breakpoints is disabled I made sure of it.

This is a short GIF of me running the program
https://gyazo.com/e236c1bd75ac746bf9982871ca847233

Added my other class

public class BinaryTree<T extends Comparable<T>> {

private class Node{

    private T data;
    private Node left;
    private Node right;

    // left and right child do not have to nessary exist
    public Node ( T data) {
        this.data = data;
        this.left = null;
        this.right = null;
    }}

    private Node root;
    private int count = 0;

    public void add( T data) {
        if ( isEmpty()) {
            root = new Node(data);
            count++;
        }
        else {
            insert(data, root);
            count++;
        }
    }

    public boolean isEmpty() {
        return root == null;
    }

    public T getRoot()  {
        if ( root.data == null) {
            System.out.println("Root is empty");
            return null;
        }
        else {
        return  root.data;
    }}

    /*
     * Checking if the data is larger or lesser than the parent's data
     * If the data is smaller than the parent's data, node.left is created
     * If the data is bigger than the parent's data, node.right is created
     */
    private void insert( T data, Node node) {

        /*
         * If 1st obj is less than the 2nd obj return a neg
         * if 1st obj is more than the 2nd obj return a pos
         * if equal return 0
         */
        int compare = data.compareTo(node.data);
        if ( compare < 1 ){
            if (node.left == null ) {
                node.left = new Node(data);

            }

        // make node.left if it is filled
            else {
                insert(data, node.left);
            }
        }

        else {
            if ( node.right == null) {
                node.right = new Node(data);
            }
            else {
                insert( data, node.right);
            }
        }
    }

    public int getSize() {
        return count;
    }

    private void removeInner( T data, Node node ) {

    Node temp;
    while ( node.data!=data) {
        int compare = data.compareTo(node.data);

        if ( compare < 1 ){
            node = node.left;
        }
        // make node.left if it is filled
        if ( compare > 1 ){
            node = node.right;
            }

        if ( compare == 0) {
            node = null;
        }

        }

    }

}


来源: stackexchange

问:
How turn on flashlight using Barcode Detection in Google Play services?
I'm trying to reimplement Redlaser barcode Scanner using Google play services. And face to the problem with flashlight. Android hardware.Camera object can't be using in common with CameraSource from gms.vision.
Is there any opportunity to working with flashlight and Google barcode scanner?

答:
I am using this code and it is working successfully
Replace : cameraSource.start(surfaceView.getHolder()); OR cameraSource.start(); TO setFlash ();

BY

```<code>import java.lang.reflect.Field;
import android.hardware.Camera;
</code>```

Don't Forgot AndroidManifest:

```<code><uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<permission android:name="android.permission.FLASHLIGHT"
    android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
    android:protectionLevel="normal"/>
</code>```

Then ADD this methods

```<code> public static Camera getCamera(CameraSource cameraSource) {
    Field[] declaredFields = CameraSource.class.getDeclaredFields();

    for (Field field : declaredFields) {
        if (field.getType() == Camera.class) {
            field.setAccessible(true);
            try {
                Camera camera = (Camera) field.get(cameraSource);
                if (camera != null) {
                    return camera;
                }

                return null;
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            break;
        }
    }

    return null;
}

public void setFlash () throws IOException {
   getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
    cameraSource.start(surfaceView.getHolder());
        Camera _cam = getCamera (cameraSource);
        if (_cam != null) {
            Camera.Parameters _pareMeters = _cam.getParameters();
            _pareMeters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
            _cam.setParameters(_pareMeters);
            _cam.startPreview();
        }
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am using this code and it is working successfully
Replace : cameraSource.start(surfaceView.getHolder()); OR cameraSource.start(); TO setFlash ();

BY

import java.lang.reflect.Field;
import android.hardware.Camera;

Don't Forgot AndroidManifest:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<permission android:name="android.permission.FLASHLIGHT"
    android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
    android:protectionLevel="normal"/>

Then ADD this methods

 public static Camera getCamera(CameraSource cameraSource) {
    Field[] declaredFields = CameraSource.class.getDeclaredFields();

    for (Field field : declaredFields) {
        if (field.getType() == Camera.class) {
            field.setAccessible(true);
            try {
                Camera camera = (Camera) field.get(cameraSource);
                if (camera != null) {
                    return camera;
                }

                return null;
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            break;
        }
    }

    return null;
}

public void setFlash () throws IOException {
   getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
    cameraSource.start(surfaceView.getHolder());
        Camera _cam = getCamera (cameraSource);
        if (_cam != null) {
            Camera.Parameters _pareMeters = _cam.getParameters();
            _pareMeters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
            _cam.setParameters(_pareMeters);
            _cam.startPreview();
        }
}

ContentLicense: CC BY-SA 4.0


问:
How to transform list with in a list using jolt library
I am trying to transform a JSON into another using Jolt library and not getting the desired output.

Here is my input file.

{
  "maxResults": 150,
  "total": 89,
  "issues": [
    {
      "key": "1",
      "fields": {
        "fixVersions": [
          {
            "self": "FIX1-01",
            "id": "11"
          },
          {
            "self": "FIX1-02",
            "id": "12"
          }
        ]
      }
    },
    {
      "key": "2",
      "fields": {
        "fixVersions": [
          {
            "self": "FIX2-01",
            "id": "21"
          }
        ]
      }
    },
    {
      "key": "3",
      "fields": {
        "fixVersions": []
      }
    }
  ]
}
```
<p>and this is the spec file I am using for transformation.</p>
<pre class="lang-json prettyprint-override"><code>
[
  {
    "operation": "shift",
    "spec": {
      "issues": {
        "*": {
          "key": "[&1].id",
          "fields": {
            "fixVersions": {
              "*": {
                "self": "[&1].fixVersion.name"
              }
            }
          }
        }
      }
    }
  }
]
</code>```

And I am getting this output

[
  {
    "id": "1",
    "fixVersion": {
      "name": [
        "FIX1-01",
        "FIX2-01"
      ]
    }
  },
  {
    "fixVersion": {
      "name": "FIX1-02"
    },
    "id": "2"
  },
  {
    "id": "3"
  }
]
```
<p>Its not right. What it is doing is it is getting first self field value of each issue and populating it as a array in first fixVersions of the output and getting second self field value and populating it in the second fixVersions. What I want to do is keep the structure as it is in input just change self field name like this.</p>
<pre class="lang-json prettyprint-override"><code>[
  {
    "id": "1",
    "fixVersion": [
      {
        "name": "FIX1-01"
      },
      {
        "name": "FIX1-02"
      }
    ]
  },
  {
    "fixVersion": [
      {
        "name": "FIX2-01"
      }
    ],
    "id": "2"
  },
  {
    "id": "3"
  }
]
</code>```

What am I doing wrong?

答:
As you have used the XSLT tag and the Java tag you could use XSLT and/or XQuery 3 with Saxon 9 and use e.g.

```<code>declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method 'text';

declare variable $json as xs:string external := '{
      "maxResults": 150,
      "total": 89,
      "issues": [
        {
          "key": "1",
          "fields": {
            "fixVersions": [
              {
                "self": "FIX1-01",
                "id": "11"
              },
              {
                "self": "FIX1-02",
                "id": "12"
              }
            ]
          }
        },
        {
          "key": "2",
          "fields": {
            "fixVersions": [
              {
                "self": "FIX2-01",
                "id": "21"
              }
            ]
          }
        },
        {
          "key": "3",
          "fields": {
            "fixVersions": []
          }
        }
      ]
    }';

transform(map {
    'source-node' : json-to-xml($json),
    'stylesheet-node' : <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
      <xsl:mode on-no-match="shallow-copy"/>
      <xsl:template match="*:string[@key = 'self']">
        <xsl:copy>
          <xsl:attribute name="key">name</xsl:attribute>
          <xsl:value-of select="."/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>
})?output => xml-to-json(map { 'indent' : true() })
</code>```

https://xqueryfiddle.liberty-development.net/bdxZ8R

Body:
I am trying to transform a JSON into another using Jolt library and not getting the desired output.

Here is my input file.

{
  "maxResults": 150,
  "total": 89,
  "issues": [
    {
      "key": "1",
      "fields": {
        "fixVersions": [
          {
            "self": "FIX1-01",
            "id": "11"
          },
          {
            "self": "FIX1-02",
            "id": "12"
          }
        ]
      }
    },
    {
      "key": "2",
      "fields": {
        "fixVersions": [
          {
            "self": "FIX2-01",
            "id": "21"
          }
        ]
      }
    },
    {
      "key": "3",
      "fields": {
        "fixVersions": []
      }
    }
  ]
}

and this is the spec file I am using for transformation.

[
  {
    "operation": "shift",
    "spec": {
      "issues": {
        "*": {
          "key": "[&1].id",
          "fields": {
            "fixVersions": {
              "*": {
                "self": "[&1].fixVersion.name"
              }
            }
          }
        }
      }
    }
  }
]

And I am getting this output

[
  {
    "id": "1",
    "fixVersion": {
      "name": [
        "FIX1-01",
        "FIX2-01"
      ]
    }
  },
  {
    "fixVersion": {
      "name": "FIX1-02"
    },
    "id": "2"
  },
  {
    "id": "3"
  }
]

Its not right. What it is doing is it is getting first self field value of each issue and populating it as a array in first fixVersions of the output and getting second self field value and populating it in the second fixVersions. What I want to do is keep the structure as it is in input just change self field name like this.

[
  {
    "id": "1",
    "fixVersion": [
      {
        "name": "FIX1-01"
      },
      {
        "name": "FIX1-02"
      }
    ]
  },
  {
    "fixVersion": [
      {
        "name": "FIX2-01"
      }
    ],
    "id": "2"
  },
  {
    "id": "3"
  }
]

What am I doing wrong?

Body:
As you have used the XSLT tag and the Java tag you could use XSLT and/or XQuery 3 with Saxon 9 and use e.g.

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method 'text';

declare variable $json as xs:string external := '{
      "maxResults": 150,
      "total": 89,
      "issues": [
        {
          "key": "1",
          "fields": {
            "fixVersions": [
              {
                "self": "FIX1-01",
                "id": "11"
              },
              {
                "self": "FIX1-02",
                "id": "12"
              }
            ]
          }
        },
        {
          "key": "2",
          "fields": {
            "fixVersions": [
              {
                "self": "FIX2-01",
                "id": "21"
              }
            ]
          }
        },
        {
          "key": "3",
          "fields": {
            "fixVersions": []
          }
        }
      ]
    }';

transform(map {
    'source-node' : json-to-xml($json),
    'stylesheet-node' : <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
      <xsl:mode on-no-match="shallow-copy"/>
      <xsl:template match="*:string[@key = 'self']">
        <xsl:copy>
          <xsl:attribute name="key">name</xsl:attribute>
          <xsl:value-of select="."/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>
})?output => xml-to-json(map { 'indent' : true() })

https://xqueryfiddle.liberty-development.net/bdxZ8R


问:
gdb: logging something instead of breaking?
Is it possible to have gdb log something to the terminal instead of breaking on it?  For example I would like to set a 'breakpoint' on some method and have gdb print self as well as the parameters each time the method is invoked. Basically I want to insert print statements into arbitrary places without actually recompiling.

thanks for any suggestions

This is what i have so far after these helpful comments:

```<code>define logFoo
b fooMethod
commands
po self
end
end
</code>```

GDB doesn't seem to like the nested end statements though. any thoughts?

答:
You can use Breakpoint Command Lists. There is an example how to do it.

For example, here is how you could use
  breakpoint commands to print the value
  of x at entry to foo whenever x is
  positive.

```<code> break foo if x>0
 commands
 silent
 printf "x is %d\n",x
 cont
 end
</code>```

Body:
Is it possible to have gdb log something to the terminal instead of breaking on it?  For example I would like to set a 'breakpoint' on some method and have gdb print self as well as the parameters each time the method is invoked. Basically I want to insert print statements into arbitrary places without actually recompiling.

thanks for any suggestions

This is what i have so far after these helpful comments:

define logFoo
b fooMethod
commands
po self
end
end

GDB doesn't seem to like the nested end statements though. any thoughts?

Body:
You can use Breakpoint Command Lists. There is an example how to do it.

For example, here is how you could use
  breakpoint commands to print the value
  of x at entry to foo whenever x is
  positive.

 break foo if x>0
 commands
 silent
 printf "x is %d\n",x
 cont
 end


问:
Why white screen stuck after splash screen in Ionic 4?
I run ionic cordova run android for my Ionic Cordova project. At this time, I have my mobile connected to PC via USB. So when I run that command, it installs the app on my real device Android Redmi Note 6 PRO.

But what really happens is when the app opens, only white screen appears, nothing else at all. First it shows splash screen and then white screen forever. Why does this behaviour happen? I read somewhere that some people had this problem because of Ionic 4.

Below are my logcat logs from after I click the app to open on Android emulator (it shows white screen also on Android emulator).

```<code>2019-02-11 00:01:24.131 5945-5945/? I/zygote: Not late-enabling -Xcheck:jni (already on)
2019-02-11 00:01:24.148 5945-5945/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaLog: Changing log level to DEBUG(3)
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaActivity: Apache Cordova native platform version 7.1.4 is starting
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter D/CordovaActivity: CordovaActivity.onCreate()
2019-02-11 00:01:24.342 5945-5945/io.ionic.starter I/WebViewFactory: Loading com.android.chrome version 61.0.3163.98 (code 316409812)
2019-02-11 00:01:24.350 5945-5945/io.ionic.starter I/zygote: The ClassLoaderContext is a special shared library.
2019-02-11 00:01:24.392 5945-5945/io.ionic.starter I/cr_LibraryLoader: Time to load native libraries: 8 ms (timestamps 2894-2902)
2019-02-11 00:01:24.421 5945-5945/io.ionic.starter I/chromium: [INFO:library_loader_hooks.cc(136)] Chromium logging enabled: level = 0, default verbosity = 0
2019-02-11 00:01:24.422 5945-5945/io.ionic.starter I/cr_LibraryLoader: Expected native library version number "61.0.3163.98", actual native library version number "61.0.3163.98"
2019-02-11 00:01:24.436 5945-5963/io.ionic.starter W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
2019-02-11 00:01:24.464 5945-5945/io.ionic.starter I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
2019-02-11 00:01:24.513 5945-5945/io.ionic.starter W/o.ionic.starter: type=1400 audit(0.0:48): avc: denied { read } for name="vmstat" dev="proc" ino=4026532039 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
2019-02-11 00:01:24.544 5945-5945/io.ionic.starter I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2019-02-11 00:01:24.553 5945-5945/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa4516160: maj 3 min 0 rcv 3
2019-02-11 00:01:24.555 5945-5945/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa4516160: ver 3 0 (tinfo 0x94123730)
2019-02-11 00:01:24.635 5945-5945/io.ionic.starter D/IonicWebViewEngine: Ionic Web View Engine Starting Right Up 1...
2019-02-11 00:01:24.659 5945-5945/io.ionic.starter D/SystemWebViewEngine: CordovaWebView is running on device made by: Google
2019-02-11 00:01:24.675 5945-5945/io.ionic.starter D/PluginManager: init()
2019-02-11 00:01:24.718 5945-5999/io.ionic.starter D/OpenGLRenderer: HWUI GL Pipeline
2019-02-11 00:01:24.787 5945-5945/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
2019-02-11 00:01:24.793 5945-5963/io.ionic.starter I/cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
2019-02-11 00:01:24.795 5945-5992/io.ionic.starter W/cr_media: Requires BLUETOOTH permission
2019-02-11 00:01:24.800 5945-5945/io.ionic.starter D/CordovaActivity: Started the activity.
2019-02-11 00:01:24.805 5945-5945/io.ionic.starter D/CordovaActivity: Resumed the activity.
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter I/OpenGLRenderer: Initialized EGL, version 1.4
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 1
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 0
2019-02-11 00:01:24.856 5945-5999/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa48062c0: maj 3 min 0 rcv 3
2019-02-11 00:01:24.871 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.188 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.209 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x94170560: maj 3 min 0 rcv 3
2019-02-11 00:01:25.212 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x94170560: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.302 5945-6010/io.ionic.starter I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2019-02-11 00:01:25.302 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.313 5945-6010/io.ionic.starter W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
2019-02-11 00:01:25.372 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.450 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.458 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x941716a0: maj 3 min 0 rcv 3
2019-02-11 00:01:25.460 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x941716a0: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.537 5945-6012/io.ionic.starter W/cr_CrashFileManager: /data/user/0/io.ionic.starter/cache/WebView/Crash Reports does not exist or is not a directory
2019-02-11 00:01:25.537 5945-5950/io.ionic.starter I/zygote: Do partial code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: After code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: Increasing code cache capacity to 128KB
2019-02-11 00:01:25.546 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
2019-02-11 00:01:25.611 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
2019-02-11 00:01:25.619 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(http://localhost/)
2019-02-11 00:01:25.619 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/
2019-02-11 00:01:25.640 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/runtime.js
2019-02-11 00:01:25.641 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/polyfills.js
2019-02-11 00:01:25.644 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/styles.js
2019-02-11 00:01:25.645 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova.js
2019-02-11 00:01:25.646 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/vendor.js
2019-02-11 00:01:25.647 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/main.js
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/: Line 10 : The key "viewport-fit" is not recognized and ignored.
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(10)] "The key "viewport-fit" is not recognized and ignored.", source: http://localhost/ (10)
2019-02-11 00:01:25.997 5945-5991/io.ionic.starter E/chromium: [ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::BudgetService exposed by: content_browser
2019-02-11 00:01:26.012 5945-5945/io.ionic.starter D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
2019-02-11 00:01:26.083 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova_plugins.js
2019-02-11 00:01:26.101 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-statusbar/www/statusbar.js
2019-02-11 00:01:26.102 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-device/www/device.js
2019-02-11 00:01:26.106 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-splashscreen/www/splashscreen.js
2019-02-11 00:01:26.107 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-webview/src/www/util.js
2019-02-11 00:01:26.108 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-keyboard/www/android/keyboard.js
2019-02-11 00:01:26.201 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:26.213 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:26.268 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.505 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.812 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.826 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.878 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/main.js: Line 3385 : TypeError: Cannot read property 'apply' of null
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(3385)] "TypeError: Cannot read property 'apply' of null", source: http://localhost/main.js (3385)
2019-02-11 00:01:27.894 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/vendor.js: Line 75947 : Ionic Native: deviceready event fired after 973 ms
2019-02-11 00:01:27.895 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(75947)] "Ionic Native: deviceready event fired after 973 ms", source: http://localhost/vendor.js (75947)
2019-02-11 00:01:27.896 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/assets/icon/favicon.png
2019-02-11 00:01:27.916 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.924 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(http://localhost/)
2019-02-11 00:01:27.951 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:28.063 5945-5945/io.ionic.starter I/chatty: uid=10080(io.ionic.starter) identical 3 lines
2019-02-11 00:01:28.110 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
</code>```

Chrome debugger shows:

```<code>TypeError: Cannot read property 'apply' of null
    at vendor.js:88820
    at NgRedux.push../node_modules/ng2-redux/lib/components/ng-redux.js.NgRedux.configureStore (vendor.js:87925)
    at new AppModule (main.js:1511)
    at _createClass (vendor.js:56970)
    at _createProviderInstance (vendor.js:56940)
    at initNgModule (vendor.js:56873)
    at new NgModuleRef_ (vendor.js:57600)
    at createNgModuleRef (vendor.js:57589)
    at Object.debugCreateNgModuleRef [as createNgModuleRef] (vendor.js:59420)
    at NgModuleFactory_.push../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (vendor.js:60124)
vendor.js:75947 Ionic Native: deviceready event fired after 776 ms
</code>```

答:
If changing config.xml did not work for you, TRY THIS

Step 1 :

Open index.html

Change the base href from <base href="/" /> to <base href="./" />

Step 2:

Open tsconfig.json

Change the target in compilerOptions from "target": "es2015" to "target": "es5"

Reference: https://github.com/ionic-team/capacitor/issues/1878#issuecomment-523497238

Body:
I run ionic cordova run android for my Ionic Cordova project. At this time, I have my mobile connected to PC via USB. So when I run that command, it installs the app on my real device Android Redmi Note 6 PRO.

But what really happens is when the app opens, only white screen appears, nothing else at all. First it shows splash screen and then white screen forever. Why does this behaviour happen? I read somewhere that some people had this problem because of Ionic 4.

Below are my logcat logs from after I click the app to open on Android emulator (it shows white screen also on Android emulator).

2019-02-11 00:01:24.131 5945-5945/? I/zygote: Not late-enabling -Xcheck:jni (already on)
2019-02-11 00:01:24.148 5945-5945/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaLog: Changing log level to DEBUG(3)
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaActivity: Apache Cordova native platform version 7.1.4 is starting
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter D/CordovaActivity: CordovaActivity.onCreate()
2019-02-11 00:01:24.342 5945-5945/io.ionic.starter I/WebViewFactory: Loading com.android.chrome version 61.0.3163.98 (code 316409812)
2019-02-11 00:01:24.350 5945-5945/io.ionic.starter I/zygote: The ClassLoaderContext is a special shared library.
2019-02-11 00:01:24.392 5945-5945/io.ionic.starter I/cr_LibraryLoader: Time to load native libraries: 8 ms (timestamps 2894-2902)
2019-02-11 00:01:24.421 5945-5945/io.ionic.starter I/chromium: [INFO:library_loader_hooks.cc(136)] Chromium logging enabled: level = 0, default verbosity = 0
2019-02-11 00:01:24.422 5945-5945/io.ionic.starter I/cr_LibraryLoader: Expected native library version number "61.0.3163.98", actual native library version number "61.0.3163.98"
2019-02-11 00:01:24.436 5945-5963/io.ionic.starter W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
2019-02-11 00:01:24.464 5945-5945/io.ionic.starter I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
2019-02-11 00:01:24.513 5945-5945/io.ionic.starter W/o.ionic.starter: type=1400 audit(0.0:48): avc: denied { read } for name="vmstat" dev="proc" ino=4026532039 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
2019-02-11 00:01:24.544 5945-5945/io.ionic.starter I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2019-02-11 00:01:24.553 5945-5945/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa4516160: maj 3 min 0 rcv 3
2019-02-11 00:01:24.555 5945-5945/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa4516160: ver 3 0 (tinfo 0x94123730)
2019-02-11 00:01:24.635 5945-5945/io.ionic.starter D/IonicWebViewEngine: Ionic Web View Engine Starting Right Up 1...
2019-02-11 00:01:24.659 5945-5945/io.ionic.starter D/SystemWebViewEngine: CordovaWebView is running on device made by: Google
2019-02-11 00:01:24.675 5945-5945/io.ionic.starter D/PluginManager: init()
2019-02-11 00:01:24.718 5945-5999/io.ionic.starter D/OpenGLRenderer: HWUI GL Pipeline
2019-02-11 00:01:24.787 5945-5945/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
2019-02-11 00:01:24.793 5945-5963/io.ionic.starter I/cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
2019-02-11 00:01:24.795 5945-5992/io.ionic.starter W/cr_media: Requires BLUETOOTH permission
2019-02-11 00:01:24.800 5945-5945/io.ionic.starter D/CordovaActivity: Started the activity.
2019-02-11 00:01:24.805 5945-5945/io.ionic.starter D/CordovaActivity: Resumed the activity.
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter I/OpenGLRenderer: Initialized EGL, version 1.4
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 1
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 0
2019-02-11 00:01:24.856 5945-5999/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa48062c0: maj 3 min 0 rcv 3
2019-02-11 00:01:24.871 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.188 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.209 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x94170560: maj 3 min 0 rcv 3
2019-02-11 00:01:25.212 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x94170560: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.302 5945-6010/io.ionic.starter I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2019-02-11 00:01:25.302 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.313 5945-6010/io.ionic.starter W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
2019-02-11 00:01:25.372 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.450 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.458 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x941716a0: maj 3 min 0 rcv 3
2019-02-11 00:01:25.460 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x941716a0: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.537 5945-6012/io.ionic.starter W/cr_CrashFileManager: /data/user/0/io.ionic.starter/cache/WebView/Crash Reports does not exist or is not a directory
2019-02-11 00:01:25.537 5945-5950/io.ionic.starter I/zygote: Do partial code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: After code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: Increasing code cache capacity to 128KB
2019-02-11 00:01:25.546 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
2019-02-11 00:01:25.611 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
2019-02-11 00:01:25.619 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(http://localhost/)
2019-02-11 00:01:25.619 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/
2019-02-11 00:01:25.640 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/runtime.js
2019-02-11 00:01:25.641 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/polyfills.js
2019-02-11 00:01:25.644 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/styles.js
2019-02-11 00:01:25.645 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova.js
2019-02-11 00:01:25.646 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/vendor.js
2019-02-11 00:01:25.647 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/main.js
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/: Line 10 : The key "viewport-fit" is not recognized and ignored.
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(10)] "The key "viewport-fit" is not recognized and ignored.", source: http://localhost/ (10)
2019-02-11 00:01:25.997 5945-5991/io.ionic.starter E/chromium: [ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::BudgetService exposed by: content_browser
2019-02-11 00:01:26.012 5945-5945/io.ionic.starter D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
2019-02-11 00:01:26.083 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova_plugins.js
2019-02-11 00:01:26.101 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-statusbar/www/statusbar.js
2019-02-11 00:01:26.102 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-device/www/device.js
2019-02-11 00:01:26.106 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-splashscreen/www/splashscreen.js
2019-02-11 00:01:26.107 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-webview/src/www/util.js
2019-02-11 00:01:26.108 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-keyboard/www/android/keyboard.js
2019-02-11 00:01:26.201 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:26.213 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:26.268 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.505 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.812 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.826 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.878 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/main.js: Line 3385 : TypeError: Cannot read property 'apply' of null
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(3385)] "TypeError: Cannot read property 'apply' of null", source: http://localhost/main.js (3385)
2019-02-11 00:01:27.894 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/vendor.js: Line 75947 : Ionic Native: deviceready event fired after 973 ms
2019-02-11 00:01:27.895 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(75947)] "Ionic Native: deviceready event fired after 973 ms", source: http://localhost/vendor.js (75947)
2019-02-11 00:01:27.896 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/assets/icon/favicon.png
2019-02-11 00:01:27.916 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.924 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(http://localhost/)
2019-02-11 00:01:27.951 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:28.063 5945-5945/io.ionic.starter I/chatty: uid=10080(io.ionic.starter) identical 3 lines
2019-02-11 00:01:28.110 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread

Chrome debugger shows:

TypeError: Cannot read property 'apply' of null
    at vendor.js:88820
    at NgRedux.push../node_modules/ng2-redux/lib/components/ng-redux.js.NgRedux.configureStore (vendor.js:87925)
    at new AppModule (main.js:1511)
    at _createClass (vendor.js:56970)
    at _createProviderInstance (vendor.js:56940)
    at initNgModule (vendor.js:56873)
    at new NgModuleRef_ (vendor.js:57600)
    at createNgModuleRef (vendor.js:57589)
    at Object.debugCreateNgModuleRef [as createNgModuleRef] (vendor.js:59420)
    at NgModuleFactory_.push../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (vendor.js:60124)
vendor.js:75947 Ionic Native: deviceready event fired after 776 ms


问:
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start after geckodriver upgradation
I have written the below code in java to just open the firefox and redirect to gmail.com link, but seems its getting timed out before redirection. I have checked for the solution in stackoverflow and found the same problem faced by some one else. He/she has upgraded the geckodriver which was backdated and after that it successfully redirected to the link for him/her. After seeing that I have checked the versions of geckodriver, firefox and selenium and seems everything is updated. The version of the geckodriver is v0.20.1, firefox version is 60.0.2 and selenium is 3.12.0. The code I have written is:

```<code>System.setProperty("webdriver.gecko.driver", "C:\\Users\\MI SERVICE\\Downloads\\geckodriver.exe");
FirefoxOptions capa = new FirefoxOptions();
capa.setCapability("marionette", false);
WebDriver driver = new FirefoxDriver(capa);
driver.navigate().to("https://www.gmail.com");
driver.quit();
</code>```

The exception caused:

```<code>Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'DESKTOP-3P379LK', ip: '192.168.0.105', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.1'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:132)
    at org.openqa.selenium.firefox.XpiDriverService.start(XpiDriverService.java:117)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at firefoxScripts.MyFirstTestCase.main(MyFirstTestCase.java:17)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:36845/hub/status] to be available after 45002 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
    at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:130)
    ... 7 more
Caused by: java.util.concurrent.TimeoutException
    at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:148)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
    ... 8 more
</code>```

答:
I haved this error for 2 days, the solution for me was in Set.Plataform put Platafor.ANY or Plataform.Windows because Plataform.WIN10 not worked, marionette wasn't necessary and I added and neether works, only works this. I hope this helps someone else:</p>

```<code>public class Main {
    public static RemoteWebDriver driver;

    public static void main(String[] args) throws MalformedURLException {
        System.setProperty("webdriver.gecko.driver", "D:/Lib/geckodriver.exe");
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities().firefox();
        desiredCapabilities.setPlatform(Platform.ANY);
        desiredCapabilities.setBrowserName("firefox");

        driver = new RemoteWebDriver(new URL("http://172.20.19.182:5557/wd/hub"), desiredCapabilities);
        driver.navigate().to("http://www.google.com");
        driver.findElementByName("q").sendKeys("execute automation");
        driver.findElementByName("q").sendKeys(Keys.ENTER);
        driver.close();
        // write your code here
    }
}
</code>```

Body:
I have written the below code in java to just open the firefox and redirect to gmail.com link, but seems its getting timed out before redirection. I have checked for the solution in stackoverflow and found the same problem faced by some one else. He/she has upgraded the geckodriver which was backdated and after that it successfully redirected to the link for him/her. After seeing that I have checked the versions of geckodriver, firefox and selenium and seems everything is updated. The version of the geckodriver is v0.20.1, firefox version is 60.0.2 and selenium is 3.12.0. The code I have written is:

System.setProperty("webdriver.gecko.driver", "C:\\Users\\MI SERVICE\\Downloads\\geckodriver.exe");
FirefoxOptions capa = new FirefoxOptions();
capa.setCapability("marionette", false);
WebDriver driver = new FirefoxDriver(capa);
driver.navigate().to("https://www.gmail.com");
driver.quit();

The exception caused:

Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'DESKTOP-3P379LK', ip: '192.168.0.105', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.1'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:132)
    at org.openqa.selenium.firefox.XpiDriverService.start(XpiDriverService.java:117)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at firefoxScripts.MyFirstTestCase.main(MyFirstTestCase.java:17)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:36845/hub/status] to be available after 45002 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
    at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:130)
    ... 7 more
Caused by: java.util.concurrent.TimeoutException
    at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:148)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
    ... 8 more

Body:
I haved this error for 2 days, the solution for me was in Set.Plataform put Platafor.ANY or Plataform.Windows because Plataform.WIN10 not worked, marionette wasn't necessary and I added and neether works, only works this. I hope this helps someone else:

public class Main {
    public static RemoteWebDriver driver;

    public static void main(String[] args) throws MalformedURLException {
        System.setProperty("webdriver.gecko.driver", "D:/Lib/geckodriver.exe");
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities().firefox();
        desiredCapabilities.setPlatform(Platform.ANY);
        desiredCapabilities.setBrowserName("firefox");

        driver = new RemoteWebDriver(new URL("http://172.20.19.182:5557/wd/hub"), desiredCapabilities);
        driver.navigate().to("http://www.google.com");
        driver.findElementByName("q").sendKeys("execute automation");
        driver.findElementByName("q").sendKeys(Keys.ENTER);
        driver.close();
        // write your code here
    }
}


问:
Rollup replace my main class name (SDK) for default() name
I am developing a library, which had been working well until I started doing the unit tests. Until a few days ago, I could instantiate my library in the following way:

this.belpay = new belpay.SDK('test', {
            username: 'username',
            password: 'password',
            key: 'abc-def',
          });
```

<p>And in my chrome console:</p>

<p><img src="https://i.stack.imgur.com/klB8U.png" alt="enter image description here"></p>

<p>Now I present the following error:</p>

<p><img src="https://i.stack.imgur.com/JUB0R.png" alt="enter image description here"></p>

<p>To eliminate this error I have had to do the following:</p>

<pre class="lang-js prettyprint-override"><code>this.belpay = new belpay.default('test', {
            username: 'username',
            password: 'password',
            key: 'abc-def',
          });
</code>```

I don't understand why now it shows me default. I've always had this setting in rollup.config.js

import nodePolyfills from 'rollup-plugin-node-polyfills';
import babel from 'rollup-plugin-babel';
import serve from 'rollup-plugin-serve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import json from 'rollup-plugin-json';

export default {
  input: 'src/index.js',
  context: 'window',
  output: [
    {
      file: 'dist/belpay.js',
      format: 'umd',
      name: 'belpay',
      exports: 'named',
      globals: ['axios'],
    },
    {
      file: 'dist/belpay.min.js',
      format: 'umd',
      name: 'belpay',
      plugins: [terser()],
      exports: 'named',
    },
  ],
  external: ['axios'],
  plugins: [
    babel({
      exclude: ['node_modules/**'],
      runtimeHelpers: true,
    }),
    nodePolyfills(),
    serve({
      host: 'localhost',
      port: 1234,
      contentBase: 'dist',
      historyApiFallback: true,
      allowCrossOrigin: true,
    }),
    commonjs({
      include: 'node_modules/axios/**',
    }),
    livereload({
      watch: 'dist',
      verbose: true,
    }),
    json(),
  ],
};
```

<p><strong>[EDIT]</strong></p>

<p><strong>Contents of my entryfile (src/index.js):</strong></p>

<pre class="lang-js prettyprint-override"><code>export default class SDK {
  #myvar= '';
  #myobject = {};

  method1() {}
  method2() {}
}
</code>```

and this way I am importing the library in dist/index.html

...

```

It is strange because on Friday (last work day of the week for us), I left it working well, but on Monday I could no longer do the tests. I did not make any changes.

Any suggestion to improve this file will be welcome.

答:
I found the problem. I was doing:

export default class SDK {}
```

<p>and had to do:</p>

<pre class="lang-js prettyprint-override"><code>export class SDK {}
</code>```

I didn't have to set 'default'.

Body:
I am developing a library, which had been working well until I started doing the unit tests. Until a few days ago, I could instantiate my library in the following way:

this.belpay = new belpay.SDK('test', {
            username: 'username',
            password: 'password',
            key: 'abc-def',
          });

And in my chrome console:

Now I present the following error:

To eliminate this error I have had to do the following:

this.belpay = new belpay.default('test', {
            username: 'username',
            password: 'password',
            key: 'abc-def',
          });

I don't understand why now it shows me default. I've always had this setting in rollup.config.js

import nodePolyfills from 'rollup-plugin-node-polyfills';
import babel from 'rollup-plugin-babel';
import serve from 'rollup-plugin-serve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import json from 'rollup-plugin-json';

export default {
  input: 'src/index.js',
  context: 'window',
  output: [
    {
      file: 'dist/belpay.js',
      format: 'umd',
      name: 'belpay',
      exports: 'named',
      globals: ['axios'],
    },
    {
      file: 'dist/belpay.min.js',
      format: 'umd',
      name: 'belpay',
      plugins: [terser()],
      exports: 'named',
    },
  ],
  external: ['axios'],
  plugins: [
    babel({
      exclude: ['node_modules/**'],
      runtimeHelpers: true,
    }),
    nodePolyfills(),
    serve({
      host: 'localhost',
      port: 1234,
      contentBase: 'dist',
      historyApiFallback: true,
      allowCrossOrigin: true,
    }),
    commonjs({
      include: 'node_modules/axios/**',
    }),
    livereload({
      watch: 'dist',
      verbose: true,
    }),
    json(),
  ],
};

[EDIT]

Contents of my entryfile (src/index.js):

export default class SDK {
  #myvar= '';
  #myobject = {};

  method1() {}
  method2() {}
}

and this way I am importing the library in dist/index.html

...

It is strange because on Friday (last work day of the week for us), I left it working well, but on Monday I could no longer do the tests. I did not make any changes.

Any suggestion to improve this file will be welcome.

Body:
I found the problem. I was doing:

export default class SDK {}

and had to do:

export class SDK {}

I didn't have to set 'default'.


问:
Extending class with changing field requirements
Let's have example base class

```<code>@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
   @JsonProperty("login")
   private String login;

   @JsonProperty("password")
   private String password;

   @JsonProperty("additionalData")
   private String additionalData;
}
</code>```

and second one that extends User class

```<code>@Data
@NoArgsConstructor
@AllArgsConstructor
public class EnhancedUser extends User {
   @NotNull
   @JsonProperty("additionalData")
   private String additionalData;
}
</code>```

I but It doesn't work because when I create instance of EnhancedUser class field additionalData can be null.
Any idea?

答:
You do realize that you actually have 2 fields "additionalData"? Since you can't override fields but merely hide them. And this is a huge nono anti-pattern in general.
Either you rename your field or you think of a more approriate implementation, like implementing this logic yourself with and a constructor argument and a call of the additionalData setter from your constructor.  </p>

Body:
Let's have example base class

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
   @JsonProperty("login")
   private String login;

   @JsonProperty("password")
   private String password;

   @JsonProperty("additionalData")
   private String additionalData;
}

and second one that extends User class

@Data
@NoArgsConstructor
@AllArgsConstructor
public class EnhancedUser extends User {
   @NotNull
   @JsonProperty("additionalData")
   private String additionalData;
}

I but It doesn't work because when I create instance of EnhancedUser class field additionalData can be null.
Any idea?


问:
BIGQUERY equivalents of sign(bitand...) function
I need to decode one column on Big Query. In Oracle SQL Developer I used

```<code>sign(bitand(column, power(2,18)))
</code>```

Can I use its equivalent on Big Query?

答:
Below is for BigQuery Standard SQL        </p>

<p>You can use    </p>

```<code>SIGN(column & CAST(POWER(2,18) AS INT64))
</code>```

Body:
I need to decode one column on Big Query. In Oracle SQL Developer I used

sign(bitand(column, power(2,18)))

Can I use its equivalent on Big Query?

Body:
Below is for BigQuery Standard SQL

You can use

SIGN(column & CAST(POWER(2,18) AS INT64))


问:
Using calloc in Turbo C++ In-Line Assembly
I use to code in 8086 assembly and in Turbo C++ and I decided to make some tests with in-line assembly but I got stuck with this problem:

This code works perfectly:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

FILE *fp;

int regvga=0x13;
int regtxt=0x03;
int vgamem=0xA000;

unsigned char data[64000];

void main (void)
{

fp=fopen("pic1.dat","rb");
fread(data,64000,1,fp);
fclose(fp);

asm{
    mov ax,regvga
    int 0x10

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lea si,data
    mov di,0

    rep movsw
    }

getch();

asm{
    mov ax,regtxt
    int 0x10
    }
}
</code>```

But this code simply doesn't work.

```<code>#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

FILE *fp;

int regvga=0x13;
int regtxt=0x03;
int vgamem=0xA000;

unsigned char *data;

void main (void)
{

data=(char*)calloc(64000,sizeof(char));

fp=fopen("pic1.dat","rb");
fread(data,64000,1,fp);
fclose(fp);

asm{
    mov ax,regvga
    int 0x10

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lea si,data
    mov di,0

    rep movsw
    }

getch();

asm{
    mov ax,regtxt
    int 0x10
    }

free(data);
}
</code>```

It compiles without errors but the image is displayed incorrectly. What's wrong?

答:
@fuz @klutz @Ruud Helderman

Hi guys! Thanks for your great help and sorry for this late reply :)

In fact, the solution is very simple: it's just need to replace lea si,data for lds si,[data] and of course preserve the DS register. The code will be something like this:

```<code>asm{
    mov ax,regvga
    int 0x10

    push ds

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lds si,[data]
    mov di,0

    rep movsw

    pop ds
}
</code>```

There is no need to use faralloc because faralloc is only needed when our array is bigger than 64K. And of course there is need to compile using the Large Model.

Well, I'm using Turbo C++ 3.0 because I have made a little shooter for Windows, Amiga, Atari and Spectrum and now I want to convert it to MS-DOS. As I'm a little lazy I don't want to code it in assembly from the root but use the C code from Atari version and use in-line assembly to handle the graphical stuff :) . More info about my little game here: http://sardonic.planetaclix.pt/

Cheers,
MadAxe

Body:
I use to code in 8086 assembly and in Turbo C++ and I decided to make some tests with in-line assembly but I got stuck with this problem:

This code works perfectly:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

FILE *fp;

int regvga=0x13;
int regtxt=0x03;
int vgamem=0xA000;

unsigned char data[64000];

void main (void)
{

fp=fopen("pic1.dat","rb");
fread(data,64000,1,fp);
fclose(fp);

asm{
    mov ax,regvga
    int 0x10

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lea si,data
    mov di,0

    rep movsw
    }

getch();

asm{
    mov ax,regtxt
    int 0x10
    }
}

But this code simply doesn't work.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

FILE *fp;

int regvga=0x13;
int regtxt=0x03;
int vgamem=0xA000;

unsigned char *data;

void main (void)
{

data=(char*)calloc(64000,sizeof(char));

fp=fopen("pic1.dat","rb");
fread(data,64000,1,fp);
fclose(fp);

asm{
    mov ax,regvga
    int 0x10

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lea si,data
    mov di,0

    rep movsw
    }

getch();

asm{
    mov ax,regtxt
    int 0x10
    }

free(data);
}

It compiles without errors but the image is displayed incorrectly. What's wrong?

Body:
@fuz @klutz @Ruud Helderman

Hi guys! Thanks for your great help and sorry for this late reply :)

In fact, the solution is very simple: it's just need to replace lea si,data for lds si,[data] and of course preserve the DS register. The code will be something like this:

asm{
    mov ax,regvga
    int 0x10

    push ds

    mov ax,vgamem
    mov es,ax

    cld
    mov cx,32000

    lds si,[data]
    mov di,0

    rep movsw

    pop ds
}

There is no need to use faralloc because faralloc is only needed when our array is bigger than 64K. And of course there is need to compile using the Large Model.

Well, I'm using Turbo C++ 3.0 because I have made a little shooter for Windows, Amiga, Atari and Spectrum and now I want to convert it to MS-DOS. As I'm a little lazy I don't want to code it in assembly from the root but use the C code from Atari version and use in-line assembly to handle the graphical stuff :) . More info about my little game here: http://sardonic.planetaclix.pt/

Cheers,
MadAxe


问:
C# string manipulation - How to remove the first element of each concatenated string in a collection
I am creating concatenated strings based on the data in each row of my ListView control. I need to figure out how to remove the first element in each string which pertains to a single row of the ListView. How might I accomplish this? This is a C# winforms project.

Here is my current code:

```<code>        foreach (ListViewItem HazPackErrItems in HazmatPackageErrorListview.Items)
        {
            string HazPackErrRow = " ";

            foreach (ListViewItem.ListViewSubItem HazPackErrSub in HazPackErrItems.SubItems)
            {
                HazPackErrRow += " " + HazPackErrSub.Text + ",";
            }
            // Remove comma after last element of string.
            HazPackErrRow = HazPackErrRow.Substring(0, HazPackErrRow.Length - 2);
            MessageBox.Show(HazPackErrRow); // List concatenated subitems
        }
</code>```

答:
add the comma at the beginning, then you only have to do one check, rather than a check on every iteration

```<code>
string HazPackErrRow = "";
foreach (ListViewItem.ListViewSubItem HazPackErrSub in HazPackErrItems.SubItems)
{
            HazPackErrRow +=  "," + " " + HazPackErrSub.Text;
}
// Remove comma before first element of string.
if(HazPackErrRow.Length > 0)
 HazPackErrRow = HazPackErrRow.Substring(1);
</code>```

Edit:
Um, ignore me, I misread the question.

OwnerDisplayName: Jason R

ContentLicense: CC BY-SA 2.5

Body:
I am creating concatenated strings based on the data in each row of my ListView control. I need to figure out how to remove the first element in each string which pertains to a single row of the ListView. How might I accomplish this? This is a C# winforms project.

Here is my current code:

        foreach (ListViewItem HazPackErrItems in HazmatPackageErrorListview.Items)
        {
            string HazPackErrRow = " ";

            foreach (ListViewItem.ListViewSubItem HazPackErrSub in HazPackErrItems.SubItems)
            {
                HazPackErrRow += " " + HazPackErrSub.Text + ",";
            }
            // Remove comma after last element of string.
            HazPackErrRow = HazPackErrRow.Substring(0, HazPackErrRow.Length - 2);
            MessageBox.Show(HazPackErrRow); // List concatenated subitems
        }

LastEditorDisplayName: transmogrify

Body:
add the comma at the beginning, then you only have to do one check, rather than a check on every iteration

string HazPackErrRow = "";
foreach (ListViewItem.ListViewSubItem HazPackErrSub in HazPackErrItems.SubItems)
{
            HazPackErrRow +=  "," + " " + HazPackErrSub.Text;
}
// Remove comma before first element of string.
if(HazPackErrRow.Length > 0)
 HazPackErrRow = HazPackErrRow.Substring(1);

Edit:
Um, ignore me, I misread the question.

OwnerDisplayName: Kevin


问:
POWERSHELL - Module Active Directory command New-AdGroup Problem with Spaces in value OU="Servers Of Files"
I would need your help with the use of New-AdGroup command.

The goal of my script is to verify if an Active Directory group exists and if it doesn't exist the script create the group and add the member of the group in a specific OU.

But my problem is when I use the script with a combination of OU and one of them contains some spaces in its name (ex : "OU=Servers of Files"), the script returns an error.

Example: I need to add the group in "OU=Fileserver1" which is a sub OU of "OU=Servers of Files" which is a sub OU of "OU=Groupes".
When I call New-AdGroup with a path's value : "Ou=ServerFile1,OU=Servers of Files,OU=Groupes,DC=Contoso,DC=lan", I get the following error.

New-ADGroup : Objet de l’annuaire non trouvé At line:29 char:5
  +     New-ADGroup -Name "$DLGroupName" -Path "$Orga" -GroupCategory "Se ...
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (CN=G_GROUP1...ONTOSO,DC=lan:String) [New-ADGroup],
  ADIdentityNotFoundException
      + FullyQualifiedErrorId : Objet de l’annuaire non trouvé,Microsoft.ActiveDirectory.Management.Commands.NewADGroup

The problem is caused by "OU=Servers of Files" because I tried with an OU without spaces and it was working.

Please find a part of the script below, let me know how I can manage spaces under a path :

```<code>#Variable
$CurrentDomain = Get-ADDomain | Select -Property DistinguishedName
$TargetOU = "OU=FileServer1,OU=Servers of Files,OU=Groupes" #
$OrganizationalUnitDN = $TargetOU+","+ $CurrentDomain.DistinguishedName
$Orga = $OrganizationalUnitDN
$DLGroupName = "DL_FileServer1_TEST"
$Description = "\\FileServer1\Share\Test"

    New-ADGroup -Name "$DLGroupName" -Path "$Orga" -GroupCategory "Security" -GroupScope "Global" -Description "$Description" -PassThru
</code>```

Note : $Orga = Ou=ServerFile1,OU=Servers of Files,OU=Groupes,DC=Contoso,DC=lan

答:
When we encounter weird bugs like this, a good first test is to manually run the command with no variables to find the root cause of the error.  Doing this shows us that we don't need to escape spaces with a \ or \20 sequence and that route won't help us.

Because I can run your command with no errors when I manually expand the variables like so:

```<code>New-ADGroup -Name "DL_FileServer1_TEST" -Path "OU=Servers Of Files,DC=FoxDeploy,DC=local" `
   -GroupCategory "Security" -GroupScope "Global" -Description "Test" -PassThru

DistinguishedName : CN=DL_FileServer1_TEST1,OU=Servers Of Files,DC=FoxDeploy,DC=local
GroupCategory     : Security
GroupScope        : Global
Name              : DL_FileServer1_TEST1
ObjectClass       : group
ObjectGUID        : 5889f8ea-9d80-4609-ad47-92e50a574088
SamAccountName    : DL_FileServer1_TEST1
SID               : S-1-5-21-3818945699-900446794-3716848007-32100
</code>```

Now that I know this works, I know I can then store the values in variables to make it cleaner to read, like this:

```<code>$params = @{
    Name = "DL_FileServer1_TEST1";
    Path = "OU=Servers Of Files,DC=FoxDeploy,DC=local";
    GroupCategory = "Security";
    GroupScope = "Global";
    Description = "My Test Group"
    PassThru = $true
    }

New-ADGroup @params
</code>```

If I had to guess, I bet that you need to run the entire script to populate all of the variables, and instead you are rerunning the last command over and over but one of the variables is $null.

If that doesn't work...
If not that, then are we sure the container of Ou=ServerFile1 actually exists too?

Body:
I would need your help with the use of New-AdGroup command.

The goal of my script is to verify if an Active Directory group exists and if it doesn't exist the script create the group and add the member of the group in a specific OU.

But my problem is when I use the script with a combination of OU and one of them contains some spaces in its name (ex : "OU=Servers of Files"), the script returns an error.

Example: I need to add the group in "OU=Fileserver1" which is a sub OU of "OU=Servers of Files" which is a sub OU of "OU=Groupes".
When I call New-AdGroup with a path's value : "Ou=ServerFile1,OU=Servers of Files,OU=Groupes,DC=Contoso,DC=lan", I get the following error.

New-ADGroup : Objet de l’annuaire non trouvé At line:29 char:5
  +     New-ADGroup -Name "$DLGroupName" -Path "$Orga" -GroupCategory "Se ...
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (CN=G_GROUP1...ONTOSO,DC=lan:String) [New-ADGroup],
  ADIdentityNotFoundException
      + FullyQualifiedErrorId : Objet de l’annuaire non trouvé,Microsoft.ActiveDirectory.Management.Commands.NewADGroup

The problem is caused by "OU=Servers of Files" because I tried with an OU without spaces and it was working.

Please find a part of the script below, let me know how I can manage spaces under a path :

#Variable
$CurrentDomain = Get-ADDomain | Select -Property DistinguishedName
$TargetOU = "OU=FileServer1,OU=Servers of Files,OU=Groupes" #
$OrganizationalUnitDN = $TargetOU+","+ $CurrentDomain.DistinguishedName
$Orga = $OrganizationalUnitDN
$DLGroupName = "DL_FileServer1_TEST"
$Description = "\\FileServer1\Share\Test"

    New-ADGroup -Name "$DLGroupName" -Path "$Orga" -GroupCategory "Security" -GroupScope "Global" -Description "$Description" -PassThru

Note : $Orga = Ou=ServerFile1,OU=Servers of Files,OU=Groupes,DC=Contoso,DC=lan

Body:
When we encounter weird bugs like this, a good first test is to manually run the command with no variables to find the root cause of the error.  Doing this shows us that we don't need to escape spaces with a \ or \20 sequence and that route won't help us.

Because I can run your command with no errors when I manually expand the variables like so:

New-ADGroup -Name "DL_FileServer1_TEST" -Path "OU=Servers Of Files,DC=FoxDeploy,DC=local" `
   -GroupCategory "Security" -GroupScope "Global" -Description "Test" -PassThru

DistinguishedName : CN=DL_FileServer1_TEST1,OU=Servers Of Files,DC=FoxDeploy,DC=local
GroupCategory     : Security
GroupScope        : Global
Name              : DL_FileServer1_TEST1
ObjectClass       : group
ObjectGUID        : 5889f8ea-9d80-4609-ad47-92e50a574088
SamAccountName    : DL_FileServer1_TEST1
SID               : S-1-5-21-3818945699-900446794-3716848007-32100

Now that I know this works, I know I can then store the values in variables to make it cleaner to read, like this:

$params = @{
    Name = "DL_FileServer1_TEST1";
    Path = "OU=Servers Of Files,DC=FoxDeploy,DC=local";
    GroupCategory = "Security";
    GroupScope = "Global";
    Description = "My Test Group"
    PassThru = $true
    }

New-ADGroup @params

If I had to guess, I bet that you need to run the entire script to populate all of the variables, and instead you are rerunning the last command over and over but one of the variables is $null.

If that doesn't work...
If not that, then are we sure the container of Ou=ServerFile1 actually exists too?


问:
How do i add text to my floatingActionButton?
I am trying to add text to my floatingActionButton but I am unable to do so. How do I add the text to it not finding any way for it.

```<code>@override
Widget build(BuildContext context) {
  return Scaffold(
    floatingActionButton: FloatingActionButton(
      child: Icon(Icons.add),
      onPressed: () async {
        // when clicked on floating action button prompt to create user
        Navigator.pushReplacement(
          context,
          MaterialPageRoute(
            builder: (BuildContext context) => CreateUser(),
          ),
        );
      },
    ),
  );
}
</code>```

答:
You can use FloatingActionButton.extended to display Text and Icon in a FAB at once.

FloatingActionButton.extended(
  onPressed: () {
    // when clicked on floating action button prompt to create user
    Navigator.pushReplacement(
      context,
      MaterialPageRoute(
        builder: (BuildContext context) => CreateUser(),
      ),
    );
  },
  label: Text('Label'),
  icon: Icon(Icons.add),
),
```

Body:
I am trying to add text to my floatingActionButton but I am unable to do so. How do I add the text to it not finding any way for it.

@override
Widget build(BuildContext context) {
  return Scaffold(
    floatingActionButton: FloatingActionButton(
      child: Icon(Icons.add),
      onPressed: () async {
        // when clicked on floating action button prompt to create user
        Navigator.pushReplacement(
          context,
          MaterialPageRoute(
            builder: (BuildContext context) => CreateUser(),
          ),
        );
      },
    ),
  );
}


问:
How do you pivot some columns into rows using sql or t-sql
Here is the table

```<code>Income|Expenses|Other|Department|Date

 2k   |      4k|  .5k|Marketing |2014-05-28
 52k  |      7k|  .1k|Sales     |2014-04-01
</code>```

Result

```<code>Description|Value|Department|Date

 Income    |   2k|Marketing |2014-05-28
 Expenses  |   4k|Marketing |2014-05-28
 Other     |  .5k|Marketing |2014-05-28
 Income    |  52k|Sales     |2014-04-01
 Expenses  |   7k|Sales     |2014-04-01
 Other     |  .1k|Sales     |2014-04-01
</code>```

Actually, I can use SELECT + UNION to get the result but the requirement is to use Pivot.

How to get this result using PIVOT function?

答:
Just for fun, here is a little technique to "dynamically" unpivot your data without Dynamic SQL or declaring all the columns.

Example

```<code>Select Description = B.[Key]
      ,B.Value
      ,A.Department
      ,A.Date
 From  YourTable A
 Cross Apply ( Select [Key]
                      ,Value
               From OpenJson( ( Select A.* for JSON Path,Without_Array_Wrapper)   )
               Where [Key] not in ('Department','Date')
             ) B
</code>```

Returns

```<code>Description Value   Department  Date
Income      2k      Marketing   2014-05-28
Expenses    4k      Marketing   2014-05-28
Other       .5k     Marketing   2014-05-28
Income      52k     Sales       2014-04-01
Expenses    7k      Sales       2014-04-01
Other       .1k     Sales       2014-04-01
</code>```

Body:
Here is the table

Income|Expenses|Other|Department|Date

 2k   |      4k|  .5k|Marketing |2014-05-28
 52k  |      7k|  .1k|Sales     |2014-04-01

Result

Description|Value|Department|Date

 Income    |   2k|Marketing |2014-05-28
 Expenses  |   4k|Marketing |2014-05-28
 Other     |  .5k|Marketing |2014-05-28
 Income    |  52k|Sales     |2014-04-01
 Expenses  |   7k|Sales     |2014-04-01
 Other     |  .1k|Sales     |2014-04-01

Actually, I can use SELECT + UNION to get the result but the requirement is to use Pivot.

How to get this result using PIVOT function?

Body:
Just for fun, here is a little technique to "dynamically" unpivot your data without Dynamic SQL or declaring all the columns.

Example

Select Description = B.[Key]
      ,B.Value
      ,A.Department
      ,A.Date
 From  YourTable A
 Cross Apply ( Select [Key]
                      ,Value
               From OpenJson( ( Select A.* for JSON Path,Without_Array_Wrapper)   )
               Where [Key] not in ('Department','Date')
             ) B

Returns

Description Value   Department  Date
Income      2k      Marketing   2014-05-28
Expenses    4k      Marketing   2014-05-28
Other       .5k     Marketing   2014-05-28
Income      52k     Sales       2014-04-01
Expenses    7k      Sales       2014-04-01
Other       .1k     Sales       2014-04-01


问:
Error while reading avro file in spark code in Scala IDE
I am creating a data frame by reading avro file but getting error while reading the file in spark application in scala IDE.

```<code>package dataFrameBasics

import org.apache.spark.sql.SparkSession

object WorkingWithAvroFile {
  def main(ar : Array[String]): Unit={
    val ss= SparkSession.builder().master("local")
    .appName("Working with Avro File")
    .getOrCreate()

    val avroDF= ss.read
    .format("com.databricks.spark.avro")
    .load("C:/Spark_Files/userdata1.avro")

    avroDF.printSchema()
    avroDF.show(10)
    println("Count:"+avroDF.count())

  }

}
</code>```

On Console ,giving below error:
Exception in thread "main" java.lang.ClassNotFoundException: Failed to find data source: org.apache.spark.sql.avro.AvroFileFormat. Please find packages at http://spark.apache.org/third-party-projects.html

On Problems tab, giving below error:

spark-avro_2.11-3.2.0.jar of SparkCourseAsMavenProject build path is cross-compiled with an incompatible version of Scala (2.11.0). In case this report is mistaken, this check can be disabled in the compiler preference page.

In pom.xml,added dependency:

```<code><dependency>
        <groupId>com.databricks</groupId>
<artifactId>spark-avro_2.11</artifactId>
<version>3.2.0</version>
</dependency>
</code>```

Tried different versions of this library , but still its giving the same error.

答:
```<code>@QuickSilver -- Please find below full stacktrace

******************
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
20/05/28 19:53:10 INFO SparkContext: Running Spark version 2.4.5
20/05/28 19:53:12 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/05/28 19:53:12 ERROR Shell: Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
    at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:378)
    at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:393)
    at org.apache.hadoop.util.Shell.<clinit>(Shell.java:386)
    at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:79)
    at org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:116)
    at org.apache.hadoop.security.Groups.<init>(Groups.java:93)
    at org.apache.hadoop.security.Groups.<init>(Groups.java:73)
    at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:293)
    at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:283)
    at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:260)
    at org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:789)
    at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:774)
    at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:647)
    at org.apache.spark.util.Utils$.$anonfun$getCurrentUserName$1(Utils.scala:2422)
    at scala.Option.getOrElse(Option.scala:121)
    at org.apache.spark.util.Utils$.getCurrentUserName(Utils.scala:2422)
    at org.apache.spark.SparkContext.<init>(SparkContext.scala:293)
    at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)
    at org.apache.spark.sql.SparkSession$Builder.$anonfun$getOrCreate$5(SparkSession.scala:935)
    at scala.Option.getOrElse(Option.scala:121)
    at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:926)
    at dataFrameBasics.WorkingWithAvroFile$.main(WorkingWithAvroFile.scala:9)
    at dataFrameBasics.WorkingWithAvroFile.main(WorkingWithAvroFile.scala)
20/05/28 19:53:12 INFO SparkContext: Submitted application: Working with Avro File
20/05/28 19:53:12 INFO SecurityManager: Changing view acls to: santosh
20/05/28 19:53:12 INFO SecurityManager: Changing modify acls to: santosh
20/05/28 19:53:12 INFO SecurityManager: Changing view acls groups to:
20/05/28 19:53:12 INFO SecurityManager: Changing modify acls groups to:
20/05/28 19:53:12 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(santosh); groups with view permissions: Set(); users  with modify permissions: Set(santosh); groups with modify permissions: Set()
20/05/28 19:53:16 INFO Utils: Successfully started service 'sparkDriver' on port 50965.
20/05/28 19:53:16 INFO SparkEnv: Registering MapOutputTracker
20/05/28 19:53:16 INFO SparkEnv: Registering BlockManagerMaster
20/05/28 19:53:16 INFO BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
20/05/28 19:53:16 INFO BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
20/05/28 19:53:16 INFO DiskBlockManager: Created local directory at C:\Users\santosh\AppData\Local\Temp\blockmgr-0efb8730-052b-474d-ad33-669ad1b5d5ed
20/05/28 19:53:16 INFO MemoryStore: MemoryStore started with capacity 351.3 MB
20/05/28 19:53:16 INFO SparkEnv: Registering OutputCommitCoordinator
20/05/28 19:53:17 INFO Utils: Successfully started service 'SparkUI' on port 4040.
20/05/28 19:53:17 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://Lenovo-PC:4040
20/05/28 19:53:18 INFO Executor: Starting executor ID driver on host localhost
20/05/28 19:53:18 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 50976.
20/05/28 19:53:18 INFO NettyBlockTransferService: Server created on Lenovo-PC:50976
20/05/28 19:53:18 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
20/05/28 19:53:18 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, Lenovo-PC, 50976, None)
20/05/28 19:53:18 INFO BlockManagerMasterEndpoint: Registering block manager Lenovo-PC:50976 with 351.3 MB RAM, BlockManagerId(driver, Lenovo-PC, 50976, None)
20/05/28 19:53:18 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, Lenovo-PC, 50976, None)
20/05/28 19:53:18 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, Lenovo-PC, 50976, None)
20/05/28 19:53:19 INFO SharedState: Setting hive.metastore.warehouse.dir ('null') to the value of spark.sql.warehouse.dir ('file:/C:/Users/santosh/Scala/Workspace/SparkCourseAsMavenProject/spark-warehouse').
20/05/28 19:53:19 INFO SharedState: Warehouse path is 'file:/C:/Users/santosh/Scala/Workspace/SparkCourseAsMavenProject/spark-warehouse'.
20/05/28 19:53:23 INFO StateStoreCoordinatorRef: Registered StateStoreCoordinator endpoint
20/05/28 19:53:24 INFO InMemoryFileIndex: It took 232 ms to list leaf files for 1 paths.
**root
 |-- registration_dttm: string (nullable = true)
 |-- id: long (nullable = true)
 |-- first_name: string (nullable = true)
 |-- last_name: string (nullable = true)
 |-- email: string (nullable = true)
 |-- gender: string (nullable = true)
 |-- ip_address: string (nullable = true)
 |-- cc: long (nullable = true)
 |-- country: string (nullable = true)
 |-- birthdate: string (nullable = true)
 |-- salary: double (nullable = true)
 |-- title: string (nullable = true)
 |-- comments: string (nullable = true)**

20/05/28 19:53:31 INFO FileSourceStrategy: Pruning directories with:
20/05/28 19:53:31 INFO FileSourceStrategy: Post-Scan Filters:
20/05/28 19:53:31 INFO FileSourceStrategy: Output Data Schema: struct<registration_dttm: string, id: bigint, first_name: string, last_name: string, email: string ... 11 more fields>
20/05/28 19:53:31 INFO FileSourceScanExec: Pushed Filters:
20/05/28 19:53:32 INFO CodeGenerator: Code generated in 790.65082 ms
20/05/28 19:53:35 INFO CodeGenerator: Code generated in 188.480854 ms
20/05/28 19:53:36 INFO MemoryStore: Block broadcast_0 stored as values in memory (estimated size 220.3 KB, free 351.1 MB)
20/05/28 19:53:42 INFO MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 20.6 KB, free 351.1 MB)
20/05/28 19:53:42 INFO BlockManagerInfo: Added broadcast_0_piece0 in memory on Lenovo-PC:50976 (size: 20.6 KB, free: 351.3 MB)
20/05/28 19:53:42 INFO SparkContext: Created broadcast 0 from show at WorkingWithAvroFile.scala:24
20/05/28 19:53:42 INFO FileSourceScanExec: Planning scan with bin packing, max size: 4287865 bytes, open cost is considered as scanning 4194304 bytes.
20/05/28 19:53:42 INFO SparkContext: Starting job: show at WorkingWithAvroFile.scala:24
20/05/28 19:53:42 INFO DAGScheduler: Got job 0 (show at WorkingWithAvroFile.scala:24) with 1 output partitions
20/05/28 19:53:42 INFO DAGScheduler: Final stage: ResultStage 0 (show at WorkingWithAvroFile.scala:24)
20/05/28 19:53:42 INFO DAGScheduler: Parents of final stage: List()
20/05/28 19:53:42 INFO DAGScheduler: Missing parents: List()
20/05/28 19:53:42 INFO DAGScheduler: Submitting ResultStage 0 (MapPartitionsRDD[3] at show at WorkingWithAvroFile.scala:24), which has no missing parents
20/05/28 19:53:43 INFO MemoryStore: Block broadcast_1 stored as values in memory (estimated size 14.1 KB, free 351.1 MB)
20/05/28 19:53:43 INFO MemoryStore: Block broadcast_1_piece0 stored as bytes in memory (estimated size 6.0 KB, free 351.0 MB)
20/05/28 19:53:43 INFO BlockManagerInfo: Added broadcast_1_piece0 in memory on Lenovo-PC:50976 (size: 6.0 KB, free: 351.3 MB)
20/05/28 19:53:43 INFO SparkContext: Created broadcast 1 from broadcast at DAGScheduler.scala:1163
20/05/28 19:53:43 INFO DAGScheduler: Submitting 1 missing tasks from ResultStage 0 (MapPartitionsRDD[3] at show at WorkingWithAvroFile.scala:24) (first 15 tasks are for partitions Vector(0))
20/05/28 19:53:43 INFO TaskSchedulerImpl: Adding task set 0.0 with 1 tasks
20/05/28 19:53:43 INFO TaskSetManager: Starting task 0.0 in stage 0.0 (TID 0, localhost, executor driver, partition 0, PROCESS_LOCAL, 7732 bytes)
20/05/28 19:53:43 INFO Executor: Running task 0.0 in stage 0.0 (TID 0)
20/05/28 19:53:44 INFO FileScanRDD: Reading File path: file:///C:/Spark_Files/userdata1.avro, range: 0-93561, partition values: [empty row]
20/05/28 19:53:44 INFO CodeGenerator: Code generated in 85.990927 ms
20/05/28 19:53:46 INFO Executor: Finished task 0.0 in stage 0.0 (TID 0). 3182 bytes result sent to driver
20/05/28 19:53:46 INFO TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 2830 ms on localhost (executor driver) (1/1)
20/05/28 19:53:46 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool
20/05/28 19:53:46 INFO DAGScheduler: ResultStage 0 (show at WorkingWithAvroFile.scala:24) finished in 3.362 s
20/05/28 19:53:46 INFO DAGScheduler: Job 0 finished: show at WorkingWithAvroFile.scala:24, took 4.340480 s
**+--------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
|   registration_dttm| id|first_name|last_name|               email|gender|    ip_address|              cc|             country| birthdate|   salary|               title|comments|
+--------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
|2016-02-03T07:55:29Z|  1|    Amanda|   Jordan|    ajordan0@com.com|Female|   1.197.201.2|6759521864920116|           Indonesia|  3/8/1971| 49756.53|    Internal Auditor|   1E+02|
|2016-02-03T17:04:03Z|  2|    Albert|  Freeman|     afreeman1@is.gd|  Male|218.111.175.34|            null|              Canada| 1/16/1968|150280.17|       Accountant IV|        |
|2016-02-03T01:09:31Z|  3|    Evelyn|   Morgan|emorgan2@altervis...|Female|  7.161.136.94|6767119071901597|              Russia|  2/1/1960|144972.51| Structural Engineer|        |
|2016-02-03T12:36:21Z|  4|    Denise|    Riley|    driley3@gmpg.org|Female| 140.35.109.83|3576031598965625|               China|  4/8/1997| 90263.05|Senior Cost Accou...|        |
|2016-02-03T05:05:31Z|  5|    Carlos|    Burns|cburns4@miitbeian...|      |169.113.235.40|5602256255204850|        South Africa|          |     null|                    |        |
|2016-02-03T07:22:34Z|  6|   Kathryn|    White|  kwhite5@google.com|Female|195.131.81.179|3583136326049310|           Indonesia| 2/25/1983| 69227.11|   Account Executive|        |
|2016-02-03T08:33:08Z|  7|    Samuel|   Holmes|sholmes6@foxnews.com|  Male|232.234.81.197|3582641366974690|            Portugal|12/18/1987| 14247.62|Senior Financial ...|        |
|2016-02-03T06:47:06Z|  8|     Harry|   Howell| hhowell7@eepurl.com|  Male|  91.235.51.73|            null|Bosnia and Herzeg...|  3/1/1962|186469.43|    Web Developer IV|        |
|2016-02-03T03:52:53Z|  9|      Jose|   Foster|   jfoster8@yelp.com|  Male|  132.31.53.61|            null|         South Korea| 3/27/1992|231067.84|Software Test Eng...|   1E+02|
|2016-02-03T18:29:47Z| 10|     Emily|  Stewart|estewart9@opensou...|Female|143.28.251.245|3574254110301671|             Nigeria| 1/28/1997| 27234.28|     Health Coach IV|        |
+--------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
only showing top 10 rows**

20/05/28 19:53:47 INFO FileSourceStrategy: Pruning directories with:
20/05/28 19:53:47 INFO FileSourceStrategy: Post-Scan Filters:
20/05/28 19:53:47 INFO FileSourceStrategy: Output Data Schema: struct<>
20/05/28 19:53:47 INFO FileSourceScanExec: Pushed Filters:
20/05/28 19:53:48 INFO CodeGenerator: Code generated in 50.675225 ms
20/05/28 19:53:48 INFO CodeGenerator: Code generated in 45.623914 ms
20/05/28 19:53:48 INFO MemoryStore: Block broadcast_2 stored as values in memory (estimated size 220.3 KB, free 350.8 MB)
20/05/28 19:53:48 INFO MemoryStore: Block broadcast_2_piece0 stored as bytes in memory (estimated size 20.6 KB, free 350.8 MB)
20/05/28 19:53:48 INFO BlockManagerInfo: Added broadcast_2_piece0 in memory on Lenovo-PC:50976 (size: 20.6 KB, free: 351.3 MB)
20/05/28 19:53:48 INFO SparkContext: Created broadcast 2 from count at WorkingWithAvroFile.scala:25
20/05/28 19:53:48 INFO FileSourceScanExec: Planning scan with bin packing, max size: 4287865 bytes, open cost is considered as scanning 4194304 bytes.
20/05/28 19:53:48 INFO SparkContext: Starting job: count at WorkingWithAvroFile.scala:25
20/05/28 19:53:48 INFO DAGScheduler: Registering RDD 6 (count at WorkingWithAvroFile.scala:25) as input to shuffle 0
20/05/28 19:53:48 INFO DAGScheduler: Got job 1 (count at WorkingWithAvroFile.scala:25) with 1 output partitions
20/05/28 19:53:48 INFO DAGScheduler: Final stage: ResultStage 2 (count at WorkingWithAvroFile.scala:25)
20/05/28 19:53:48 INFO DAGScheduler: Parents of final stage: List(ShuffleMapStage 1)
20/05/28 19:53:48 INFO DAGScheduler: Missing parents: List(ShuffleMapStage 1)
20/05/28 19:53:48 INFO DAGScheduler: Submitting ShuffleMapStage 1 (MapPartitionsRDD[6] at count at WorkingWithAvroFile.scala:25), which has no missing parents
20/05/28 19:53:48 INFO MemoryStore: Block broadcast_3 stored as values in memory (estimated size 10.9 KB, free 350.8 MB)
20/05/28 19:53:48 INFO MemoryStore: Block broadcast_3_piece0 stored as bytes in memory (estimated size 5.5 KB, free 350.8 MB)
20/05/28 19:53:48 INFO BlockManagerInfo: Added broadcast_3_piece0 in memory on Lenovo-PC:50976 (size: 5.5 KB, free: 351.2 MB)
20/05/28 19:53:48 INFO SparkContext: Created broadcast 3 from broadcast at DAGScheduler.scala:1163
20/05/28 19:53:48 INFO DAGScheduler: Submitting 1 missing tasks from ShuffleMapStage 1 (MapPartitionsRDD[6] at count at WorkingWithAvroFile.scala:25) (first 15 tasks are for partitions Vector(0))
20/05/28 19:53:48 INFO TaskSchedulerImpl: Adding task set 1.0 with 1 tasks
20/05/28 19:53:48 INFO TaskSetManager: Starting task 0.0 in stage 1.0 (TID 1, localhost, executor driver, partition 0, PROCESS_LOCAL, 7721 bytes)
20/05/28 19:53:48 INFO Executor: Running task 0.0 in stage 1.0 (TID 1)
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 27
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 17
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 14
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 20
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 22
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 28
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 12
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 13
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 30
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 21
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 9
20/05/28 19:53:49 INFO FileScanRDD: Reading File path: file:///C:/Spark_Files/userdata1.avro, range: 0-93561, partition values: [empty row]
20/05/28 19:53:49 INFO CodeGenerator: Code generated in 33.699831 ms
20/05/28 19:53:49 INFO BlockManagerInfo: Removed broadcast_1_piece0 on Lenovo-PC:50976 in memory (size: 6.0 KB, free: 351.3 MB)
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 19
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 7
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 23
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 16
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 11
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 15
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 26
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 8
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 29
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 10
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 25
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 18
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 5
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 6
20/05/28 19:53:49 INFO ContextCleaner: Cleaned accumulator 24
20/05/28 19:53:49 INFO Executor: Finished task 0.0 in stage 1.0 (TID 1). 1638 bytes result sent to driver
20/05/28 19:53:49 INFO TaskSetManager: Finished task 0.0 in stage 1.0 (TID 1) in 618 ms on localhost (executor driver) (1/1)
20/05/28 19:53:49 INFO TaskSchedulerImpl: Removed TaskSet 1.0, whose tasks have all completed, from pool
20/05/28 19:53:49 INFO DAGScheduler: ShuffleMapStage 1 (count at WorkingWithAvroFile.scala:25) finished in 0.778 s
20/05/28 19:53:49 INFO DAGScheduler: looking for newly runnable stages
20/05/28 19:53:49 INFO DAGScheduler: running: Set()
20/05/28 19:53:49 INFO DAGScheduler: waiting: Set(ResultStage 2)
20/05/28 19:53:49 INFO DAGScheduler: failed: Set()
20/05/28 19:53:49 INFO DAGScheduler: Submitting ResultStage 2 (MapPartitionsRDD[9] at count at WorkingWithAvroFile.scala:25), which has no missing parents
20/05/28 19:53:49 INFO MemoryStore: Block broadcast_4 stored as values in memory (estimated size 8.6 KB, free 350.8 MB)
20/05/28 19:53:49 INFO MemoryStore: Block broadcast_4_piece0 stored as bytes in memory (estimated size 4.4 KB, free 350.8 MB)
20/05/28 19:53:49 INFO BlockManagerInfo: Added broadcast_4_piece0 in memory on Lenovo-PC:50976 (size: 4.4 KB, free: 351.3 MB)
20/05/28 19:53:49 INFO SparkContext: Created broadcast 4 from broadcast at DAGScheduler.scala:1163
20/05/28 19:53:49 INFO DAGScheduler: Submitting 1 missing tasks from ResultStage 2 (MapPartitionsRDD[9] at count at WorkingWithAvroFile.scala:25) (first 15 tasks are for partitions Vector(0))
20/05/28 19:53:49 INFO TaskSchedulerImpl: Adding task set 2.0 with 1 tasks
20/05/28 19:53:49 INFO TaskSetManager: Starting task 0.0 in stage 2.0 (TID 2, localhost, executor driver, partition 0, ANY, 7246 bytes)
20/05/28 19:53:49 INFO Executor: Running task 0.0 in stage 2.0 (TID 2)
20/05/28 19:53:49 INFO ShuffleBlockFetcherIterator: Getting 1 non-empty blocks including 1 local blocks and 0 remote blocks
20/05/28 19:53:49 INFO ShuffleBlockFetcherIterator: Started 0 remote fetches in 36 ms
20/05/28 19:53:50 INFO Executor: Finished task 0.0 in stage 2.0 (TID 2). 1749 bytes result sent to driver
20/05/28 19:53:50 INFO TaskSetManager: Finished task 0.0 in stage 2.0 (TID 2) in 397 ms on localhost (executor driver) (1/1)
20/05/28 19:53:50 INFO DAGScheduler: ResultStage 2 (count at WorkingWithAvroFile.scala:25) finished in 0.477 s
20/05/28 19:53:50 INFO DAGScheduler: Job 1 finished: count at WorkingWithAvroFile.scala:25, took 1.384763 s
20/05/28 19:53:50 INFO TaskSchedulerImpl: Removed TaskSet 2.0, whose tasks have all completed, from pool
**Count:1000**
</code>```

Body:
I am creating a data frame by reading avro file but getting error while reading the file in spark application in scala IDE.

package dataFrameBasics

import org.apache.spark.sql.SparkSession

object WorkingWithAvroFile {
  def main(ar : Array[String]): Unit={
    val ss= SparkSession.builder().master("local")
    .appName("Working with Avro File")
    .getOrCreate()

    val avroDF= ss.read
    .format("com.databricks.spark.avro")
    .load("C:/Spark_Files/userdata1.avro")

    avroDF.printSchema()
    avroDF.show(10)
    println("Count:"+avroDF.count())

  }

}

On Console ,giving below error:
Exception in thread "main" java.lang.ClassNotFoundException: Failed to find data source: org.apache.spark.sql.avro.AvroFileFormat. Please find packages at http://spark.apache.org/third-party-projects.html

On Problems tab, giving below error:

spark-avro_2.11-3.2.0.jar of SparkCourseAsMavenProject build path is cross-compiled with an incompatible version of Scala (2.11.0). In case this report is mistaken, this check can be disabled in the compiler preference page.

In pom.xml,added dependency:

<dependency>
        <groupId>com.databricks</groupId>
<artifactId>spark-avro_2.11</artifactId>
<version>3.2.0</version>
</dependency>

Tried different versions of this library , but still its giving the same error.


问:
Oracle: Import CSV file
I've been searching for a while now but can't seem to find answers so here goes...

I've got a CSV file that I want to import into a table in Oracle (9i/10i).

Later on I plan to use this table as a lookup for another use.

This is actually a workaround I'm working on since the fact that querying using the IN clause with more that 1000 values is not possible.

How is this done using SQLPLUS?

Thanks for your time! :)

答:
An alternative solution is using an external table: http://www.orafaq.com/node/848 </p>

<p>Use this when you have to do this import very often and very fast. </p>

Title: Oracle: Import CSV file

Body:
An alternative solution is using an external table: http://www.orafaq.com/node/848

Use this when you have to do this import very often and very fast.