问:
Cannot connect to SFP sever using key file with JSch and Java 8
I am trying to connect to a SFTP server using a 2048 bit RSA key file. It works fine running against version 7r45 of the JRE using JSch but i get the follow exception when running against version 8r31 of the JRE.

com.jcraft.jsch.JSchException: Session.connect: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 2048 (inclusive).

It's not an issue with limited Java security policy as I have tried it with and without the unlimited strength jars for both versions of java.

I have seen other references to this exception suggesting replacing the default java JCE provider with the BouncyCastle one, but why would there be a difference between java 7 and java 8? I did try this by running
Security.addProvider(new BouncyCastleProvider()); at program start up but it doesn't seem to make any difference.

答: We have resolved such issue by enabling diffie-hellman-group14 algorithm on SFTP server</p>


来源: stackexchange

问:
How to remove "encrypt contents to secure data"
My website had problems loading an image, css file and a javascript file downloaded as a package from "Superfish".

I found the problem to be the "encrypt contents to secure data" on each of the files.
Ok, so I right-click -> properties -> Advanced and unchecked the "encrypt contents to secure data" setting.

However, when I re-publish using Visual Studio 2010, the published files have the setting flagged again.  The source files do not have the flag set, only the published files.  All files are deleted prior to commencing the publish.

I have completely re-created each file by pasting the contents in to a new file, but still when they are copied across the flag is reset.

I have tried publishing to another folder, but alas the new file still get created with encrypted contents setting.

It seems as though Visual Studio still thinks that this setting should be flagged, or it is copying a cached version of the file from somewhere which hasn't had the setting removed.

How do I stop the setting from being re-flagged after each publish?

答:
I had this same issue with a CSS file.  The file was somehow encrypted inside the project folder, so when deployed, it was carrying over that flag.  Fixing it in the project folder solved the issue.

Check your local source, make sure it's not encrypted there first.  I know you said they weren't, but check again.

ContentLicense: CC BY-SA 2.5


问:
Android Emulator won't start from Android Studio on Windows 10
Recently (after install Android Studio 2.3.x, I'm now at 2.3.1) the emulator won't start in Android Studio.

I can run the emulator from the command line if it is in the SDK\tools directory.

If I run the emulator from a directory other than the SDK\tools directory I get an error like this:

```<code>[12236]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ..\emulator\lib64\qt\lib
Could not launch '..\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory
</code>```

The tools and platform-tools directories are in my path.  Android_home is set correctly.  First I tried re-installing the emulator from the SDK manager in Android (now that the standalone SDK manager is gone I can't do it there).  I manually downloaded the SDK and installed it overtop of the old SDK.  I then tried putting it in a new directory and changing the ANDROID_HOME and updating my paths and changed the setting in Android Studio (and all the local.properties files).  Next I completely uninstalled Android Studio and SDK, rebooted and reinstalled Android Studio.  Still having the same problem.

I've tried the suggestions here in the question here: Emulator on Android Studio doesn't start after SDK tools update to 25.3.1 by copying various directories (first sym-links then copy directories as sym-links work differently on windows).

I've tried all the suggestions here: https://issuetracker.google.com/issues/37137213 as well.

I've re-installed HAXM, but I don't think it is an Emulator problem as it does work when I start it from a command prompt in the tools directory.

Any suggestions?

Details:

Windows 10 (Build 1703)

Android Studio 2.3.1

答: Changing Graphics settings from "Automatic" to "Software - GLES 2.0" in Virtual Device Configuration worked for me. I think it's the same as "-gpu" command line option, but not all modes available: https://developer.android.com/studio/run/emulator-acceleration.html</p>

ContentLicense: CC BY-SA 3.0

Body:
Recently (after install Android Studio 2.3.x, I'm now at 2.3.1) the emulator won't start in Android Studio.

I can run the emulator from the command line if it is in the SDK\tools directory.

If I run the emulator from a directory other than the SDK\tools directory I get an error like this:

[12236]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ..\emulator\lib64\qt\lib
Could not launch '..\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory

The tools and platform-tools directories are in my path.  Android_home is set correctly.  First I tried re-installing the emulator from the SDK manager in Android (now that the standalone SDK manager is gone I can't do it there).  I manually downloaded the SDK and installed it overtop of the old SDK.  I then tried putting it in a new directory and changing the ANDROID_HOME and updating my paths and changed the setting in Android Studio (and all the local.properties files).  Next I completely uninstalled Android Studio and SDK, rebooted and reinstalled Android Studio.  Still having the same problem.

I've tried the suggestions here in the question here: Emulator on Android Studio doesn't start after SDK tools update to 25.3.1 by copying various directories (first sym-links then copy directories as sym-links work differently on windows).

I've tried all the suggestions here: https://issuetracker.google.com/issues/37137213 as well.

I've re-installed HAXM, but I don't think it is an Emulator problem as it does work when I start it from a command prompt in the tools directory.

Any suggestions?

Details:

Windows 10 (Build 1703)

Android Studio 2.3.1


问:
How to get all the single number from [number -(to) number] with comma-seperated in a column in sql server
column of data in sqlserver like
    numbers
    1000-1050, 1054, 1090-1230, 1245

```<code>numbers
-------
1000-1050, 1054, 1090-1230, 1245
</code>```

how to get the style like below:

```<code>numbers
-------
1000
1001
1002
1003
1004
...
1050
1054
1090
1091
1092
...
1245
</code>```

答:
You could use a split function and APPLY like this

```<code>DECLARE @SampleData AS TABLE
(
    numbers varchar(200)
)

INSERT INTO @SampleData
VALUES ('1000-1050, 1054, 1090-1230, 1245')

;WITH temp AS
(
    SELECT 1 AS Number
    UNION ALL
    SELECT t.Number + 1 FROM temp t
    WHERE t.Number < 5000
) -- return table from 1 --> 5000
SELECT  DISTINCT
       ca2.*
FROM @SampleData sd
CROSS APPLY
(
    SELECT pos, LTRIM(Value) AS Value
    FROM dbo.SplitString(sd.Numbers,',')
) ca1
CROSS APPLY
(
    SELECT *
    FROM temp t WHERE t.Number  BETWEEN LEFT(ca1.[Value], charindex('-', ca1.[Value] + '-') - 1) AND
                          CASE
                             WHEN len(ca1.[Value]) < charindex('-', ca1.[Value] + '-') THEN ca1.[Value]
                             ELSE RIGHT(ca1.[Value], len(ca1.[Value]) - charindex('-', ca1.[Value] + '-'))
                          END
) ca2
OPTION (MAXRECURSION 0)
</code>```

Split function

```<code>CREATE FUNCTION [dbo].[SplitString] (@Text varchar(max),@Delimiter varchar(10))
Returns Table
As
Return (
   Select Pos = Row_Number() over (Order By (Select null))
        ,Value = LTrim(RTrim(B.i.value('(./text())[1]', 'varchar(max)')))
   From (Select x = Cast('<x>'+ Replace(@Text,@Delimiter,'</x><x>')+'</x>' as xml).query('.')) as A
   Cross Apply x.nodes('x') AS B(i)
);
</code>```

Demo link: http://rextester.com/GIPGR78132

Body:
column of data in sqlserver like
    numbers
    1000-1050, 1054, 1090-1230, 1245

numbers
-------
1000-1050, 1054, 1090-1230, 1245

how to get the style like below:

numbers
-------
1000
1001
1002
1003
1004
...
1050
1054
1090
1091
1092
...
1245

Body:
You could use a split function and APPLY like this

DECLARE @SampleData AS TABLE
(
    numbers varchar(200)
)

INSERT INTO @SampleData
VALUES ('1000-1050, 1054, 1090-1230, 1245')

;WITH temp AS
(
    SELECT 1 AS Number
    UNION ALL
    SELECT t.Number + 1 FROM temp t
    WHERE t.Number < 5000
) -- return table from 1 --> 5000
SELECT  DISTINCT
       ca2.*
FROM @SampleData sd
CROSS APPLY
(
    SELECT pos, LTRIM(Value) AS Value
    FROM dbo.SplitString(sd.Numbers,',')
) ca1
CROSS APPLY
(
    SELECT *
    FROM temp t WHERE t.Number  BETWEEN LEFT(ca1.[Value], charindex('-', ca1.[Value] + '-') - 1) AND
                          CASE
                             WHEN len(ca1.[Value]) < charindex('-', ca1.[Value] + '-') THEN ca1.[Value]
                             ELSE RIGHT(ca1.[Value], len(ca1.[Value]) - charindex('-', ca1.[Value] + '-'))
                          END
) ca2
OPTION (MAXRECURSION 0)

Split function

CREATE FUNCTION [dbo].[SplitString] (@Text varchar(max),@Delimiter varchar(10))
Returns Table
As
Return (
   Select Pos = Row_Number() over (Order By (Select null))
        ,Value = LTrim(RTrim(B.i.value('(./text())[1]', 'varchar(max)')))
   From (Select x = Cast('<x>'+ Replace(@Text,@Delimiter,'</x><x>')+'</x>' as xml).query('.')) as A
   Cross Apply x.nodes('x') AS B(i)
);

Demo link: http://rextester.com/GIPGR78132


问:
What is the difference between phrase and term in structured queries?
How are phrase and term different in a Structured query?

I have this data in my CloudSearch domain:

```<code>{
    "guid": 9,
    "operating_systems": [
        "12345", "123"
    ],
    "manufacturer": "sealand",
    "model": "gaming tree whale plum",
    "identifier": "gaming tree whale plum",
    "type": "computer",
    "created_at": "1982-10-14T14:43:54Z"
}
</code>```

"model" is type text, "identifier" is type literal, "created_at" is type date.

Let's make a few queries:

```<code>(phrase field=model 'tree whale')                match
(phrase field= identifier 'tree whale')          no match
(phrase 'tree whale')                            match
(phrase field=created_at '1982-10-14T14:43:54Z') match (this shouldn't match according to docs)

(term field=model 'tree whale')                match
(term field= identifier 'tree whale')          no match
(term 'tree whale')                            match
(term field=created_at '1982-10-14T14:43:54Z') match
</code>```

Is there anything I can do with phrase that I can't do with term and vice-versa?

答:
In case anyone is wondering, turns out that a phrase search matches the entire phrase while a term search matches the terms which may be a phrase but may be words spread around the document. Example:

Text:

```<code>"model": gaming tree whale plum
</code>```

The following hold:

```<code>(phrase field=model 'tree whale')                match
(phrase field=model 'tree plum')                 no match

(term field=model 'tree whale')                  match
(term field=model 'tree plum')                   match
</code>```

Body:
How are phrase and term different in a Structured query?

I have this data in my CloudSearch domain:

{
    "guid": 9,
    "operating_systems": [
        "12345", "123"
    ],
    "manufacturer": "sealand",
    "model": "gaming tree whale plum",
    "identifier": "gaming tree whale plum",
    "type": "computer",
    "created_at": "1982-10-14T14:43:54Z"
}

"model" is type text, "identifier" is type literal, "created_at" is type date.

Let's make a few queries:

(phrase field=model 'tree whale')                match
(phrase field= identifier 'tree whale')          no match
(phrase 'tree whale')                            match
(phrase field=created_at '1982-10-14T14:43:54Z') match (this shouldn't match according to docs)

(term field=model 'tree whale')                match
(term field= identifier 'tree whale')          no match
(term 'tree whale')                            match
(term field=created_at '1982-10-14T14:43:54Z') match

Is there anything I can do with phrase that I can't do with term and vice-versa?

Body:
In case anyone is wondering, turns out that a phrase search matches the entire phrase while a term search matches the terms which may be a phrase but may be words spread around the document. Example:

Text:

"model": gaming tree whale plum

The following hold:

(phrase field=model 'tree whale')                match
(phrase field=model 'tree plum')                 no match

(term field=model 'tree whale')                  match
(term field=model 'tree plum')                   match


问:
How to get only Images from textarea in laravel blade?
I have a field of textarea by Tinymce. I am inserting images in that field. Now i want to retrieve the images one by one to use them in different div. Is it possible? Right now the result i am getting using this line {{ $busprice->bus->references }} is

and if i use {!! $busprice->bus->references !!} then i am getting the images as display.
Any suggestion to get only img tag?

答:
I would create a function that will split all img tags into an array or a string. You can place the function where you want - but maybe as an additional helper function.
My example is a function like that

```<code>function getImageTags($string, $result = 'string') {
    if (preg_match_all('/<img([\w\W]+?)\/>/', $string, $matches, PREG_SET_ORDER)) {
        if ($result == 'array') {
            $array = '';

            foreach ($matches as $match) {
                $array[] = $match;
            }

            return $array;
        } else {
            $string = '';

            foreach ($matches as $match) {
                $string .= $match[0];
            }

            return $string;
        }
    }

    if ($result == 'array') {
        return [];
    }

    return '';
}
</code>```

As helper function declared you can use it in a view of Laravel like this

```<code>{!! getImageTags($busprice->bus->references) !!}
</code>```

Body:
I would create a function that will split all img tags into an array or a string. You can place the function where you want - but maybe as an additional helper function.
My example is a function like that

function getImageTags($string, $result = 'string') {
    if (preg_match_all('/<img([\w\W]+?)\/>/', $string, $matches, PREG_SET_ORDER)) {
        if ($result == 'array') {
            $array = '';

            foreach ($matches as $match) {
                $array[] = $match;
            }

            return $array;
        } else {
            $string = '';

            foreach ($matches as $match) {
                $string .= $match[0];
            }

            return $string;
        }
    }

    if ($result == 'array') {
        return [];
    }

    return '';
}

As helper function declared you can use it in a view of Laravel like this

{!! getImageTags($busprice->bus->references) !!}


问:
Function with variable parameter type
I have these two functions which are basically the same:

```<code>private Order getOrder( List<Order> orders, String gcsId )
{
    Predicate<Order> predicate = c -> c.getGcsId().equals( gcsId );
    Order obj = orders.stream().filter( predicate ).findFirst().get();
    return obj;
}

private OrderLine getOrderLine( List<OrderLine> orderLines, String gcsId )
{
    Predicate<OrderLine> predicate = c -> c.getGcsId().equals( gcsId );
    OrderLine obj = orderLines.stream().filter( predicate ).findFirst().get();
    return obj;
}
</code>```

The only difference is the type of the first parameter. How can I create a single function with the first parameter having a variable type?

Edit: This is how I call those functions in another method of the same class:

```<code>Order order = getOrder( orders, orderId );
OrderLine orderLine = getOrderLine( order.getOrderLines(), orderLineId );
</code>```

答:
One way that you can perform  instance of   test after taking list as a parameter, but your List is parameterized.
if you have anything that is parameterized,

List<Foo>  fooList = new ArrayList<Foo>();

The Generics information will be erased at runtime. Instead, this is what the JVM will see

```<code>   `List fooList = new ArrayList();`
</code>```

This is called type erasure.
The JVM has no parameterized type information of the List (in the example) during runtime.

Since the JVM has no information of the Parameterized type on runtime,

there's no way you can do an instanceof of ArrayList.

So better you keep your both function to work.

Title: Function with variable parameter type

Body:
I have these two functions which are basically the same:

private Order getOrder( List<Order> orders, String gcsId )
{
    Predicate<Order> predicate = c -> c.getGcsId().equals( gcsId );
    Order obj = orders.stream().filter( predicate ).findFirst().get();
    return obj;
}

private OrderLine getOrderLine( List<OrderLine> orderLines, String gcsId )
{
    Predicate<OrderLine> predicate = c -> c.getGcsId().equals( gcsId );
    OrderLine obj = orderLines.stream().filter( predicate ).findFirst().get();
    return obj;
}

The only difference is the type of the first parameter. How can I create a single function with the first parameter having a variable type?

Edit: This is how I call those functions in another method of the same class:

Order order = getOrder( orders, orderId );
OrderLine orderLine = getOrderLine( order.getOrderLines(), orderLineId );

Body:
One way that you can perform  instance of   test after taking list as a parameter, but your List is parameterized.
if you have anything that is parameterized,

List<Foo>  fooList = new ArrayList<Foo>();

The Generics information will be erased at runtime. Instead, this is what the JVM will see

   `List fooList = new ArrayList();`

This is called type erasure.
The JVM has no parameterized type information of the List (in the example) during runtime.

Since the JVM has no information of the Parameterized type on runtime,

there's no way you can do an instanceof of ArrayList.

So better you keep your both function to work.


问:
Image not getting empty when cancel is clicked on file input?
Im using Croppie plugin for this crop image function. Input text field becomes empty and the image is not getting empty when a user clicks the cancel on file input. I want to remove the image too when a user clicks the cancel button on file input.

DEMO

HTML

```<code><form action="test-image.php" id="form" method="post">
  <input type="file" id="upload" value="Choose a file">
  <div id="upload-demo"></div>
  <input type="hidden" id="imagebase64" name="imagebase64">
  <a href="#" class="upload-result">Send</a>
</form>
</code>```

JS

```<code>$(document).ready(function() {
  var $uploadCrop;

  function readFile(input) {
    if (input.files && input.files[0]) {
      var reader = new FileReader();
      reader.onload = function(e) {
        $uploadCrop.croppie('bind', {
          url: e.target.result
        });
        $('.upload-demo').addClass('ready');
      }
      reader.readAsDataURL(input.files[0]);
    }
  }
  $uploadCrop = $('#upload-demo').croppie({
    viewport: {
      width: 200,
      height: 200,
      type: 'circle'
    },
    boundary: {
      width: 300,
      height: 300
    }
  });
  $('#upload').on('change', function() {
    readFile(this);
  });
  $('.upload-result').on('click', function(ev) {
    $uploadCrop.croppie('result', {
      type: 'canvas',
      size: 'original'
    }).then(function(resp) {
      $('#imagebase64').val(resp);
      $('#form').submit();
    });
  });
});
</code>```

答:
Well, this might be a typical scenario, as you cannot bind click event to cancel button of file-upload as the result of the file dialog is not exposed to the browser. So what I would suggest is, write an onchange event to file upload element and check if its value is empty. If yes, then reset the croppie instance after destroying it. Here's the updated code and working Fiddle.

HTML

```<code><form action="test-image.php" id="form" method="post">
  <input type="file" id="upload" value="Choose a file" onchange="clearImage(this)" />
  <div id="upload-demo"></div>
  <input type="hidden" id="imagebase64" name="imagebase64">
  <a href="#" class="upload-result">Send</a>
</form>
</code>```

JS

```<code>var $uploadCrop;
var opts = {
  viewport: {
    width: 200,
    height: 200,
    type: 'circle'
  },
  boundary: {
    width: 300,
    height: 300
  }
};

//change function.
function clearImage(ctrl) {
  if ($(ctrl).val() == "") {
    $('#upload-demo').croppie('destroy');
    $uploadCrop=$('#upload-demo').croppie(opts);
  }
}

$(document).ready(function() {
  function readFile(input) {
    if (input.files && input.files[0]) {
      var reader = new FileReader();
      reader.onload = function(e) {
        $uploadCrop.croppie('bind', {
          url: e.target.result
        });
        $('.upload-demo').addClass('ready');
      }
      reader.readAsDataURL(input.files[0]);
    }
  }

  $uploadCrop = $('#upload-demo').croppie(opts);

  $('#upload').on('change', function() {
    readFile(this);
  });
  $('.upload-result').on('click', function(ev) {
    $uploadCrop.croppie('result', {
      type: 'canvas',
      size: 'original'
    }).then(function(resp) {
      $('#imagebase64').val(resp);
      $('#form').submit();
    });
  });

});
</code>```

Body:
Im using Croppie plugin for this crop image function. Input text field becomes empty and the image is not getting empty when a user clicks the cancel on file input. I want to remove the image too when a user clicks the cancel button on file input.

DEMO

HTML

<form action="test-image.php" id="form" method="post">
  <input type="file" id="upload" value="Choose a file">

  <input type="hidden" id="imagebase64" name="imagebase64">
  Send
</form>

JS

$(document).ready(function() {
  var $uploadCrop;

  function readFile(input) {
    if (input.files && input.files[0]) {
      var reader = new FileReader();
      reader.onload = function(e) {
        $uploadCrop.croppie('bind', {
          url: e.target.result
        });
        $('.upload-demo').addClass('ready');
      }
      reader.readAsDataURL(input.files[0]);
    }
  }
  $uploadCrop = $('#upload-demo').croppie({
    viewport: {
      width: 200,
      height: 200,
      type: 'circle'
    },
    boundary: {
      width: 300,
      height: 300
    }
  });
  $('#upload').on('change', function() {
    readFile(this);
  });
  $('.upload-result').on('click', function(ev) {
    $uploadCrop.croppie('result', {
      type: 'canvas',
      size: 'original'
    }).then(function(resp) {
      $('#imagebase64').val(resp);
      $('#form').submit();
    });
  });
});

Body:
Well, this might be a typical scenario, as you cannot bind click event to cancel button of file-upload as the result of the file dialog is not exposed to the browser. So what I would suggest is, write an onchange event to file upload element and check if its value is empty. If yes, then reset the croppie instance after destroying it. Here's the updated code and working Fiddle.

HTML

<form action="test-image.php" id="form" method="post">
  <input type="file" id="upload" value="Choose a file" onchange="clearImage(this)" />
  <div id="upload-demo"></div>
  <input type="hidden" id="imagebase64" name="imagebase64">
  <a href="#" class="upload-result">Send</a>
</form>

JS

var $uploadCrop;
var opts = {
  viewport: {
    width: 200,
    height: 200,
    type: 'circle'
  },
  boundary: {
    width: 300,
    height: 300
  }
};

//change function.
function clearImage(ctrl) {
  if ($(ctrl).val() == "") {
    $('#upload-demo').croppie('destroy');
    $uploadCrop=$('#upload-demo').croppie(opts);
  }
}

$(document).ready(function() {
  function readFile(input) {
    if (input.files && input.files[0]) {
      var reader = new FileReader();
      reader.onload = function(e) {
        $uploadCrop.croppie('bind', {
          url: e.target.result
        });
        $('.upload-demo').addClass('ready');
      }
      reader.readAsDataURL(input.files[0]);
    }
  }

  $uploadCrop = $('#upload-demo').croppie(opts);

  $('#upload').on('change', function() {
    readFile(this);
  });
  $('.upload-result').on('click', function(ev) {
    $uploadCrop.croppie('result', {
      type: 'canvas',
      size: 'original'
    }).then(function(resp) {
      $('#imagebase64').val(resp);
      $('#form').submit();
    });
  });

});


问:
Plotting netcdf file with raster package leads to distorted representation, R
I want to properly plot this netcdf file: http://www.filedropper.com/sshgridsv16092015060412nc (Downloaded originally from here: https://opendap.jpl.nasa.gov/opendap/allData/merged_alt/L4/cdr_grid/contents.html)

But run into issues:

I should be able to just plot the raster (the SLA variable):

```<code>library(RNetCDF)
library(raster)
library(maptools)

d <- raster("ssh_grids_v1609_2015060412.nc.nc4", varname = "SLA")

plot(d)
#plot SLA
</code>```

But the result is very weird as you can see with the provided file.

Especially when plotting a world map on top:

```<code>data(wrld_simpl)
plot(wrld_simpl, add = T)
</code>```

They don't match at all :/

So I thought maybe the problem is with the longitude (ranging from 4.839944e-09 to 360)

Then I read that raster::rotate(d)

should be perfect for that (to get longitude to -180 to 180), but it won't let me. I get this warning message:

```<code>Warning message:
In .local(x, ...) :
  this does not look like an appropriate object for this function
</code>```

and

```<code>plot(d)
</code>```

still looks the same.

Any advice would be greatly appreciated!

Cheers

答:
The Netcdf file is not only "rotated" in longitude but x and y are also at the wrong position. The way it has been entered in the netcdf is not usual apparently.

I downloaded the netcdf directly on the OpenDap server because your filedropper link seems to be corrupt.

Anyway, here is my proposition:

```<code>library(raster)
library(maptools)

d <- raster("ssh_grids_v1609_2015060412.nc.nc4", varname = "SLA")

# transpose x to y and double flip the map
m.r <- flip(flip(t(d), direction = "y"), direction = "x")

# then rotate from 0:360 to -180:180
rm.r <- rotate(m.r)

data(wrld_simpl)

plot(rm.r)
plot(wrld_simpl, add = T)
</code>```

Body:
I want to properly plot this netcdf file: http://www.filedropper.com/sshgridsv16092015060412nc (Downloaded originally from here: https://opendap.jpl.nasa.gov/opendap/allData/merged_alt/L4/cdr_grid/contents.html)

But run into issues:

I should be able to just plot the raster (the SLA variable):

library(RNetCDF)
library(raster)
library(maptools)

d <- raster("ssh_grids_v1609_2015060412.nc.nc4", varname = "SLA")

plot(d)
#plot SLA

But the result is very weird as you can see with the provided file.

Especially when plotting a world map on top:

data(wrld_simpl)
plot(wrld_simpl, add = T)

They don't match at all :/

So I thought maybe the problem is with the longitude (ranging from 4.839944e-09 to 360)

Then I read that raster::rotate(d)

should be perfect for that (to get longitude to -180 to 180), but it won't let me. I get this warning message:

Warning message:
In .local(x, ...) :
  this does not look like an appropriate object for this function

and

plot(d)

still looks the same.

Any advice would be greatly appreciated!

Cheers

Body:
The Netcdf file is not only "rotated" in longitude but x and y are also at the wrong position. The way it has been entered in the netcdf is not usual apparently.

I downloaded the netcdf directly on the OpenDap server because your filedropper link seems to be corrupt.

Anyway, here is my proposition:

library(raster)
library(maptools)

d <- raster("ssh_grids_v1609_2015060412.nc.nc4", varname = "SLA")

# transpose x to y and double flip the map
m.r <- flip(flip(t(d), direction = "y"), direction = "x")

# then rotate from 0:360 to -180:180
rm.r <- rotate(m.r)

data(wrld_simpl)

plot(rm.r)
plot(wrld_simpl, add = T)


问:
Adding A Custom Search Engine To Firefox
I need to add a custom search engine to Firefox. I have a name and a search URL. How do I add those to the available search providers?</p>

答:
I came here to add tldr-pages as a custom search, looking for a way how to do that.

Turns out, that there was a very simple way:
In Firefox, next to the URL-bar, there is a search-bar with a magnifying-glass. If that magnifying-glass has a PLUS on it, the page you are looking at offers its own openSearch.xml-file.

hit the search-box

a pop-up opens

find the line that says "Add" at the bottom and

click it

That is how I solved my initial problem and maybe it solves yours, too.

ContentLicense: CC BY-SA 4.0


问:
Excel: Check if a set of rows is equal to another set
Is there a command in Excel to check if a set of rows is directly equal to another set. For instance I want to check if the values inside rows 1 to 10 is equal to another set of rows 13 to 22.

That is the values inside row 1 corresponds to row 13, row 2 corresponds to row 14, row 3 corresponds to row 15 and so on.

I know how to compare a row with another row using COUNTIFS(1:1, 13:13) but how to compare a range of rows using a single function?

答:
This will return True if all values are identical, False otherwise.

```<code>=AND(A1:Z10=A13:Z22)
</code>```

This is an array formula so you must enter it using Ctrl+Shift+Enter rather than just Enter. You'll know you've done it right when Excel puts curly braces {} around the formula in the formula bar.

In later versions of Excel (e.g. 365) you won't need to enter this as an array formula

Body:
This will return True if all values are identical, False otherwise.

=AND(A1:Z10=A13:Z22)

This is an array formula so you must enter it using Ctrl+Shift+Enter rather than just Enter. You'll know you've done it right when Excel puts curly braces {} around the formula in the formula bar.

In later versions of Excel (e.g. 365) you won't need to enter this as an array formula


问:
Hibernate Many to Many Bidirectional Mapping with using Java List
I am trying to make a many to many example with hibernate using java List. My codes are as follows, I am getting some erros. If someone can help me to solve this, it would be great

A Student can take many courses
A course can be taken by many students

```<code>                     Student ---->STUDENT_COURSE<-----Course
</code>```

Student Class:

```<code>public class Student implements java.io.Serializable
{
    private long studentId;
    private String studentName;
    private List<Course> courses = new LinkedList<Course>();
        //other getters and setters

}
</code>```

Course Class:

```<code>public class Course implements java.io.Serializable {

    private long courseId;
    private String courseName;
    private List <Student> Stu = new LinkedList <Student>();
        //other getters and setters
}
</code>```

Course Mapping File:

```<code><?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 14, 2010 7:14:32 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="com.BiddingSystem.domain.Course" table="COURSE">
        <id name="courseId" type="long">
            <column name="COURSEID" />
            <generator class="native" />
        </id>
        <property name="courseName" type="java.lang.String">
            <column name="COURSENAME" />
        </property>
        <list name="Stu"  table="STUDENT_COURSE">
            <key>
                <column name="COURSEID" />
            </key>
            <many-to-many column="STUDENTID"  class="com.BiddingSystem.domain.Student" />
        </list>
    </class>
</hibernate-mapping>
</code>```

Student Mapping File:

```<code><?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 14, 2010 7:14:32 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="com.BiddingSystem.domain.Student" table="STUDENT">
        <id name="studentId" type="long">
            <column name="STUDENTID" />
            <generator class="native" />
        </id>
        <property name="studentName" type="java.lang.String">
            <column name="STUDENTNAME" />
        </property>
        <list name="courses"  table="STUDENT_COURSE">
            <key>
                <column name="STUDENTID" />
            </key>
            <many-to-many column="COURSEID" class="com.BiddingSystem.domain.Course" />
        </list>
    </class>
</hibernate-mapping>
</code>```

Error:

```<code>Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
[WARN] /biddingsystem/greet
java.lang.ExceptionInInitializerError
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:16)
    at com.BiddingSystem.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:12)
    ... 26 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
    ... 33 more
Caused by: org.xml.sax.SAXParseException: The content of element type "list" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)
    ... 34 more
[WARN] Nested in java.lang.ExceptionInInitializerError:
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:12)
    at com.BiddingSystem.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
    ... 33 more
Caused by: org.xml.sax.SAXParseException: The content of element type "list" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)
</code>```

答: Have look at here. It will solve your probem, probably.</p>

Body:
I am trying to make a many to many example with hibernate using java List. My codes are as follows, I am getting some erros. If someone can help me to solve this, it would be great

A Student can take many courses
A course can be taken by many students

                     Student ---->STUDENT_COURSE<-----Course

Student Class:

public class Student implements java.io.Serializable
{
    private long studentId;
    private String studentName;
    private List<Course> courses = new LinkedList<Course>();
        //other getters and setters

}

Course Class:

public class Course implements java.io.Serializable {

    private long courseId;
    private String courseName;
    private List <Student> Stu = new LinkedList <Student>();
        //other getters and setters
}

Course Mapping File:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="com.BiddingSystem.domain.Course" table="COURSE">
        <id name="courseId" type="long">
            <column name="COURSEID" />
            <generator class="native" />
        </id>
        <property name="courseName" type="java.lang.String">
            <column name="COURSENAME" />
        </property>
        <list name="Stu"  table="STUDENT_COURSE">
            <key>
                <column name="COURSEID" />
            </key>
            <many-to-many column="STUDENTID"  class="com.BiddingSystem.domain.Student" />
        </list>
    </class>
</hibernate-mapping>

Student Mapping File:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="com.BiddingSystem.domain.Student" table="STUDENT">
        <id name="studentId" type="long">
            <column name="STUDENTID" />
            <generator class="native" />
        </id>
        <property name="studentName" type="java.lang.String">
            <column name="STUDENTNAME" />
        </property>
        <list name="courses"  table="STUDENT_COURSE">
            <key>
                <column name="STUDENTID" />
            </key>
            <many-to-many column="COURSEID" class="com.BiddingSystem.domain.Course" />
        </list>
    </class>
</hibernate-mapping>

Error:

Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
[WARN] /biddingsystem/greet
java.lang.ExceptionInInitializerError
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:16)
    at com.BiddingSystem.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:12)
    ... 26 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
    ... 33 more
Caused by: org.xml.sax.SAXParseException: The content of element type "list" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)
    ... 34 more
[WARN] Nested in java.lang.ExceptionInInitializerError:
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/BiddingSystem/domain/Student.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
    at com.BiddingSystem.server.HibernateUtil.<clinit>(HibernateUtil.java:12)
    at com.BiddingSystem.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
    ... 33 more
Caused by: org.xml.sax.SAXParseException: The content of element type "list" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)


问:
SQL: Map two table create a NEW one with new values
I am working with CANADA education data, What I currently have is data based on Province level. I am trying to populate the data set for CMA level. So if a province 'A' contains 'n' number of CMAs then I have to map the educational data value of 'A' for all the 'n' CMAs.

what I did, for now, is, Loaded all the province-level data in one SQL table(image-2). Loaded CMA-PROVINCE data in another SQL table(image-1).

What I am trying to get is illustrated in the final picture below.

I have tried query like,

```<code>select t2.occ-code,t2.emp14, t2.emp15, t2.bachelor, t2.graduate, t2.province,t1.CMA, t2.type = cma
    from CMA_PROVINCE_Mapping t1, dataProvince t2
    where t1.PROVINCE = t2.provincee
</code>```

I am getting error in update section of t2.type = cma

could anyone please help me with the mapping of these two tables for creating a new one.

Any suggestion would be helpful!

答:
don't need the t2.type = cma  </p>

```<code>select t2.occ-code,t2.emp14, t2.emp15, t2.bachelor, t2.graduate, t2.province,t1.CMA, t1.cma as type
        from CMA_PROVINCE_Mapping t1, dataProvince t2
        where t1.PROVINCE = t2.provincee
</code>```

Body:
I am working with CANADA education data, What I currently have is data based on Province level. I am trying to populate the data set for CMA level. So if a province 'A' contains 'n' number of CMAs then I have to map the educational data value of 'A' for all the 'n' CMAs.

what I did, for now, is, Loaded all the province-level data in one SQL table(image-2). Loaded CMA-PROVINCE data in another SQL table(image-1).

What I am trying to get is illustrated in the final picture below.

I have tried query like,

select t2.occ-code,t2.emp14, t2.emp15, t2.bachelor, t2.graduate, t2.province,t1.CMA, t2.type = cma
    from CMA_PROVINCE_Mapping t1, dataProvince t2
    where t1.PROVINCE = t2.provincee

I am getting error in update section of t2.type = cma

could anyone please help me with the mapping of these two tables for creating a new one.

Any suggestion would be helpful!

Body:
don't need the t2.type = cma

select t2.occ-code,t2.emp14, t2.emp15, t2.bachelor, t2.graduate, t2.province,t1.CMA, t1.cma as type
        from CMA_PROVINCE_Mapping t1, dataProvince t2
        where t1.PROVINCE = t2.provincee


问:
Where does the Wakanda Enterprise Server license file go, on a Mac OS Sierra system?
Where should the Wakanda Enterprise Server license file be located in a Mac OS Sierra system? I signed up for the 30-day trial, and the instructions said /Document/Wakanda/License, but when I created that path and started the server, it said

"License not found. Server running in Community mode"

I also tried ~/Documents/Wakanda/ and ~/Documents/Wakanda/License/ to no effect.  I can’t seem to find it in the documentation either, can someone point me in the right direction?

答: /Users//Documents/Wakanda/license/license.key is the correct path, note that the license file downloaded is not called "license.key" you must rename it, and use lowercase "license" for both the folder name and the file name.  Thanks to Yann for the answer.</p>


问:
How to validate Schema in mule esb?
I need to validate incoming XML file based on XSD Schema. Is there any component to achieve tis task? How can I achieve this in mule esb?

Please suggest I'm bit new to mule., Thanks..,

答:
The schema validation with the .xsd didn't work for me but the validation with regex worked for me as show below for above stated problem statement.</p>

```<code><set-variable variableName="CallingSrcSys" value="#[xpath3('//CallingSourceSystem')]" doc:name="Variable-callingSrcSystem"/>
                <validation:matches-regex value="#[flowVars.CallingSrcSys]" regex="^[a-zA-Z]{0,14}+$" doc:name="Validation-CallingSrcSys"/>
                <set-variable variableName="MandatoryFieldRestrictionLevel" value="#[xpath3('//MandatoryFieldRestrictionLevel')]" doc:name="var-MandatoryFieldRestrictionLevel"/>
                <validation:matches-regex value="#[flowVars.MandatoryFieldRestrictionLevel]"  doc:name="Validation-MandatoryFieldRestrictionLevel" regex="^\s*\d*\s*$"/>
                <set-variable variableName="MinimumSearchScore" value="#[xpath3('//MinimumSearchScore')]" doc:name="var-MinimumSearchScore"/>
                <validation:matches-regex value="#[flowVars.MinimumSearchScore]" regex="^[a-zA-Z]{0,14}+$" doc:name="Validation-MinimumSearchScore"/>
</code>```

Title: How to validate Schema in mule esb?

Body:
The schema validation with the .xsd didn't work for me but the validation with regex worked for me as show below for above stated problem statement.

<set-variable variableName="CallingSrcSys" value="#[xpath3('//CallingSourceSystem')]" doc:name="Variable-callingSrcSystem"/>
                <validation:matches-regex value="#[flowVars.CallingSrcSys]" regex="^[a-zA-Z]{0,14}+$" doc:name="Validation-CallingSrcSys"/>
                <set-variable variableName="MandatoryFieldRestrictionLevel" value="#[xpath3('//MandatoryFieldRestrictionLevel')]" doc:name="var-MandatoryFieldRestrictionLevel"/>
                <validation:matches-regex value="#[flowVars.MandatoryFieldRestrictionLevel]"  doc:name="Validation-MandatoryFieldRestrictionLevel" regex="^\s*\d*\s*$"/>
                <set-variable variableName="MinimumSearchScore" value="#[xpath3('//MinimumSearchScore')]" doc:name="var-MinimumSearchScore"/>
                <validation:matches-regex value="#[flowVars.MinimumSearchScore]" regex="^[a-zA-Z]{0,14}+$" doc:name="Validation-MinimumSearchScore"/>


问:
groovyc seems to not compile, class not runnable
I am not able to compile and run Groovy-scripts. I take a very first example Gold.groovy . I can compile it with
groovyc Gold.groovy

when I try to start it thereafter with:
java Gold

I get the error message

"Fehler: Hauptklasse Gold konnte nicht gefunden oder geladen werden" -
  which means in english ~ "Main class not found"

Has anybody a hint what I could try or where to find the error?

Thanks in forehand

source

List fibo = [1, 1]                          //#A
List gold = [1, 2]                          //#B

while ( ! isGolden( gold[-1] ) ) {          //#C
    fibo.add( fibo[-1] + fibo[-2] )         //#D
    gold.add( fibo[-1] / fibo[-2] )         //#E
}

println "found golden ratio with fibo(${ fibo.size-1 }) as"
println fibo[-1] + " / " + fibo[-2] + " = " + gold[-1]
println "_" * 10 +  "|"  + "_" * (10 * gold[-1])

def isGolden(candidate) {                   //#F
    def small = 1                           //#G
    def big = small * candidate             //#H
    return isCloseEnough( (small+big)/big, big/small)
}

def isCloseEnough(a,b) { return (a-b).abs() < 1.0e-9 }
//#A Initial Fibonacci numbers
//#B Golden ration candidates
//#C Last gold candidate
//#D Next fibo number
//#E Next golden candidate
//#F Candidate satisfies golden rule
//#G Smaller section
//#H Bigger section```
</div>
</div>
</p>

<p><strong>for request: screen output</strong></p>

```D:\work\groovy\GroovyInAction-master\listings\chap01>set CLASSPATH
CLASSPATH=.;D:\DevTools\groovy-2.4.7\embeddable\groovy-all-2.4.7.jar

D:\work\groovy\GroovyInAction-master\listings\chap01>type HelloWorld.groovy
println "Hello World"

D:\work\groovy\GroovyInAction-master\listings\chap01>groovyc HelloWorld.groovy

D:\work\groovy\GroovyInAction-master\listings\chap01>java WelloWorld
Fehler: Hauptklasse WelloWorld konnte nicht gefunden oder geladen werden

D:\work\groovy\GroovyInAction-master\listings\chap01>javac -cp .;D:\DevTools\gro
ovy-2.4.7\embeddable\groovy-all-2.4.7.jar HelloWorld
error: Class names, 'HelloWorld', are only accepted if annotation processing is
explicitly requested
1 error
```

答:
You should use groovy Gold.groovy

Java actually does not know about groovy scripts. A script is always compiled into a class. The Groovy compiler will compile the class for you, with the body of the script copied into a run() method.

Body:
I am not able to compile and run Groovy-scripts. I take a very first example Gold.groovy . I can compile it with
groovyc Gold.groovy

when I try to start it thereafter with:
java Gold

I get the error message

"Fehler: Hauptklasse Gold konnte nicht gefunden oder geladen werden" -
  which means in english ~ "Main class not found"

Has anybody a hint what I could try or where to find the error?

Thanks in forehand

source

List fibo = [1, 1]                          //#A
List gold = [1, 2]                          //#B

while ( ! isGolden( gold[-1] ) ) {          //#C
    fibo.add( fibo[-1] + fibo[-2] )         //#D
    gold.add( fibo[-1] / fibo[-2] )         //#E
}

println "found golden ratio with fibo(${ fibo.size-1 }) as"
println fibo[-1] + " / " + fibo[-2] + " = " + gold[-1]
println "_" * 10 +  "|"  + "_" * (10 * gold[-1])

def isGolden(candidate) {                   //#F
    def small = 1                           //#G
    def big = small * candidate             //#H
    return isCloseEnough( (small+big)/big, big/small)
}

def isCloseEnough(a,b) { return (a-b).abs() < 1.0e-9 }
//#A Initial Fibonacci numbers
//#B Golden ration candidates
//#C Last gold candidate
//#D Next fibo number
//#E Next golden candidate
//#F Candidate satisfies golden rule
//#G Smaller section
//#H Bigger section

for request: screen output

D:\work\groovy\GroovyInAction-master\listings\chap01>set CLASSPATH
CLASSPATH=.;D:\DevTools\groovy-2.4.7\embeddable\groovy-all-2.4.7.jar

D:\work\groovy\GroovyInAction-master\listings\chap01>type HelloWorld.groovy
println "Hello World"

D:\work\groovy\GroovyInAction-master\listings\chap01>groovyc HelloWorld.groovy

D:\work\groovy\GroovyInAction-master\listings\chap01>java WelloWorld
Fehler: Hauptklasse WelloWorld konnte nicht gefunden oder geladen werden

D:\work\groovy\GroovyInAction-master\listings\chap01>javac -cp .;D:\DevTools\gro
ovy-2.4.7\embeddable\groovy-all-2.4.7.jar HelloWorld
error: Class names, 'HelloWorld', are only accepted if annotation processing is
explicitly requested
1 error


问:
Difference between fold and reduce in Kotlin, When to use which?
I am pretty confused with both functions fold() and reduce() in Kotlin, can anyone give me a concrete example that distinguishes both of them?

答:
fold takes an initial value, and the first invocation of the lambda you pass to it will receive that initial value and the first element of the collection as parameters.

For example, take the following code that calculates the sum of a list of integers:

```<code>listOf(1, 2, 3).fold(0) { sum, element -> sum + element }
</code>```

The first call to the lambda will be with parameters 0 and 1.

Having the ability to pass in an initial value is useful if you have to provide some sort of default value or parameter for your operation. For example, if you were looking for the maximum value inside a list, but for some reason want to return at least 10, you could do the following:

```<code>listOf(1, 6, 4).fold(10) { max, element ->
    if (element > max) element else max
}
</code>```

reduce doesn't take an initial value, but instead starts with the first element of the collection as the accumulator (called sum in the following example).

For example, let's do a sum of integers again:

```<code>listOf(1, 2, 3).reduce { sum, element -> sum + element }
</code>```

The first call to the lambda here will be with parameters 1 and 2.

You can use reduce when your operation does not depend on any values other than those in the collection you're applying it to.

Body:
fold takes an initial value, and the first invocation of the lambda you pass to it will receive that initial value and the first element of the collection as parameters.

For example, take the following code that calculates the sum of a list of integers:

listOf(1, 2, 3).fold(0) { sum, element -> sum + element }

The first call to the lambda will be with parameters 0 and 1.

Having the ability to pass in an initial value is useful if you have to provide some sort of default value or parameter for your operation. For example, if you were looking for the maximum value inside a list, but for some reason want to return at least 10, you could do the following:

listOf(1, 6, 4).fold(10) { max, element ->
    if (element > max) element else max
}

reduce doesn't take an initial value, but instead starts with the first element of the collection as the accumulator (called sum in the following example).

For example, let's do a sum of integers again:

listOf(1, 2, 3).reduce { sum, element -> sum + element }

The first call to the lambda here will be with parameters 1 and 2.

You can use reduce when your operation does not depend on any values other than those in the collection you're applying it to.


问:
Android: Check if service is running via. bindService
What would be the best way to check if an Android Service is running? I am aware of the ActivityManager API, but it seems like the use of the API is not advised for the scenarios similar to mine (source). I am also aware of the possibility of using global/persistent variables to maintain the state of a service.

I have tried to use bindService with flags set to 0, but I got the same problems as the person on the source link (the only exception was, I was trying the bindService with a local service).

The following call

```<code>getApplicationContext().bindService(new Intent(getApplicationContext(),
        MyService.class), mServiceConnection, 0);
</code>```

always returns true, but does not get connected. Is this the expected behaviour? It seems to me bindService should return false if the service is not already running (it is not, I have checked that) or if the BIND_AUTO_CREATE flag is not set (again, it is not).

答: What do you plan on doing if the service is running/not running? Why not just call startService(). That will create it if it's not running, and if it is it will call its onStart() method.

Body:
What would be the best way to check if an Android Service is running? I am aware of the ActivityManager API, but it seems like the use of the API is not advised for the scenarios similar to mine (source). I am also aware of the possibility of using global/persistent variables to maintain the state of a service.

I have tried to use bindService with flags set to 0, but I got the same problems as the person on the source link (the only exception was, I was trying the bindService with a local service).

The following call

getApplicationContext().bindService(new Intent(getApplicationContext(),
        MyService.class), mServiceConnection, 0);

always returns true, but does not get connected. Is this the expected behaviour? It seems to me bindService should return false if the service is not already running (it is not, I have checked that) or if the BIND_AUTO_CREATE flag is not set (again, it is not).


问:
AJAX Contact form doesn't work correctly
I have a form:

```<code><form id="main-contact-form" name="contact-form" action="sendemail.php" method="post">
    <div class="form-group">
        <input type="text" name="name" class="form-control" required="required" placeholder="Name">
    </div>
    <div class="form-group">
        <input type="email" name="email" class="form-control" required="required" placeholder="Email">
    </div>
    <div class="form-group">
        <textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="Message"></textarea>
    </div>
    <div class="form-group">
        <input type="submit" name="submit" class="btn btn-submit" value="Send">
    </div>
</form>
</code>```

sendememail.php is:

```<code><?php

$name = htmlspecialchars($_POST["name"]);
$email = htmlspecialchars($_POST["email"]);

$to = "email@email.com";
$sub = "New message from site";

$message = "New message\n
Name: $name
Email: $email";

$from  = "From: $name <$name> \r\n";

mail($to, $sub, $message, $from);
return;

?>
</code>```

javascript is:

```<code>var form = $('#main-contact-form');
form.submit(function(event){
    event.preventDefault();
    var form_status = $('<div class="form_status"></div>');
    $.ajax({
        url: $(this).attr('action'),
        beforeSend: function(){
            form.prepend( form_status.html('<p><i class="fa fa-spinner fa-spin"></i> Sending...</p>').fadeIn() );
        }
    }).done(function(data){
        form_status.html('<p class="text-success">Thanks for you message!</p>').delay(3000).fadeOut();
    });
});
</code>```

The problem: it sends a message to email, but without input fields. Their value are empty. I tried to do that without JS, and it's sending every field correctly.

答:
Specify the method and data you want to send through ajax as here is POST method:

```<code>$.ajax({
        url: $(this).attr('action'),
        method: "POST",
        data: $(this).serialize();
    });
</code>```

Body:
I have a form:

<form id="main-contact-form" name="contact-form" action="sendemail.php" method="post">

        <input type="text" name="name" class="form-control" required="required" placeholder="Name">

        <input type="email" name="email" class="form-control" required="required" placeholder="Email">

        <textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="Message"></textarea>

        <input type="submit" name="submit" class="btn btn-submit" value="Send">

</form>

sendememail.php is:

<?php

$name = htmlspecialchars($_POST["name"]);
$email = htmlspecialchars($_POST["email"]);

$to = "email@email.com";
$sub = "New message from site";

$message = "New message\n
Name: $name
Email: $email";

$from  = "From: $name <$name> \r\n";

mail($to, $sub, $message, $from);
return;

?>

javascript is:

var form = $('#main-contact-form');
form.submit(function(event){
    event.preventDefault();
    var form_status = $('

');
    $.ajax({
        url: $(this).attr('action'),
        beforeSend: function(){
            form.prepend( form_status.html('
 Sending...
').fadeIn() );
        }
    }).done(function(data){
        form_status.html('
Thanks for you message!
').delay(3000).fadeOut();
    });
});

The problem: it sends a message to email, but without input fields. Their value are empty. I tried to do that without JS, and it's sending every field correctly.

Body:
Specify the method and data you want to send through ajax as here is POST method:

$.ajax({
        url: $(this).attr('action'),
        method: "POST",
        data: $(this).serialize();
    });


问:
Find the biggest square in numpy array
I'm trying to solve this algorithm problem: finding the biggest square with only one value in a numpy array.

Example Image :

My code taking too much time. Is there way to improve the speed?

```<code>import numpy as np
answer = 0
def allsame(board):
    memory = board[0,0]
    board = np.matrix(board)
    for i in range(board[0].size):
        for j in range(board[0].size):
            if board[i,j] != memory: return False
    return True

def findLargestSquare(board):
    global answer
    list = []

    a = np.matrix(board)
    if a[0].size == 1 or a[:,1].size==1: return answer
    if a[1].size < a[:,1].size: ran = a[1].size
    else: ran = a[:,1].size
    for i in range(ran+1):
        for j in range(ran+1):
           if a[i:j,i:j].size > 0 and allsame(a[i:j,i:j])==True:
                    if a[i:j,i:j].size > answer:
                       list.append(a[i:j,i:j].size)
                       answer = a[i:j,i:j].size

    findLargestSquare(a[1:])
    return findLargestSquare(a[:,1:])
    return answer

#testBoard = [['x','o','g'],['b','a','j'],['u','q','p']]
testBoard = [['X','O','O','O','X'],['X','O','O','O','O'],['X','X','O','O','O'],['X','X','O','O','O'],['X','X','X','X','X']]
print(findLargestSquare(testBoard))
</code>```

I changed My code to self convolution method.
can you take a look at which part is wrong?

```<code>import numpy as np
import time
answer = 0

def findLargestSquare(board):
    global answer

    a = np.array(board)

    for k in reversed(range(a[0].size + 1)):
        conv_size = k
        for i in range(a[0].size - conv_size + 1):
            num = i
            for j in range(a[0].size - conv_size + 1):
                #print('i:', i, 'j:', j)
                print(a[i:i + conv_size, j:j + conv_size])
                #print('unique: ',np.unique(a[i:i+ conv_size,j:j+conv_size]).size)
                if(np.unique(a[i:i+ conv_size,j:j+conv_size]).size == 1):
                    #print("returning")
                    return len(a[i:i+ conv_size,j:j+conv_size])**2
                num = num + 1
                print("================")
    return len(a[i:i+ conv_size,j:j+conv_size])**2

# testBoard = [['x','o','g'],['b','a','j'],['u','q','p']]
testBoard = [['X', 'O', 'O', 'O', 'X'], ['X', 'O', 'O', 'O', 'O'], ['X', 'X', 'O', 'O', 'O'], ['X', 'X', 'O', 'O', 'O'],
             ['X', 'X', 'X', 'X', 'X']]

print(findLargestSquare(testBoard))
</code>```

答:
You can do it in O(n^2) instead of your current O(n^4) (allsame() is in O(n^2) and is called O(n^2) times):

use a new matrix best_size, such that best_size[i, j] should contain the size of the biggest square starting at (i, j) in your original board. Fill this matrix starting from the end following this rule:

```<code>def get_best_size(a, best_size, i, j):
    # TODO Handle boundaries: best_size = 1 there
    if not a[i, j] == a[i+1, j] == a[i, j+1]:
        return 1
    min_neighbor_best_size = min(best_size[i+1, j], best_size[i, j+1])
    if a[i, j] == a[i + min_neighbor_best_size , j + min_neighbor_best_size ]:
        return min_neighbor_best_size + 1
    else:
        return min_neighbor_best_size
</code>```

Just drawing it should show you why this rule works.

And then you just iterate from the end of the array, to the start, and keep memory of the best one while you're at it:

```<code>best = 0
for i in range(ran,-1,-1):
    for j in range(ran,-1,-1):
        best_size[i, j] =  get_best_size(a, best_size, i, j)
        best = max(best, best_size[i, j])
return best
</code>```

Title: Find the biggest square in numpy array

Body:
I'm trying to solve this algorithm problem: finding the biggest square with only one value in a numpy array.

Example Image :

My code taking too much time. Is there way to improve the speed?

import numpy as np
answer = 0
def allsame(board):
    memory = board[0,0]
    board = np.matrix(board)
    for i in range(board[0].size):
        for j in range(board[0].size):
            if board[i,j] != memory: return False
    return True

def findLargestSquare(board):
    global answer
    list = []

    a = np.matrix(board)
    if a[0].size == 1 or a[:,1].size==1: return answer
    if a[1].size  0 and allsame(a[i:j,i:j])==True:
                    if a[i:j,i:j].size > answer:
                       list.append(a[i:j,i:j].size)
                       answer = a[i:j,i:j].size

    findLargestSquare(a[1:])
    return findLargestSquare(a[:,1:])
    return answer

#testBoard = [['x','o','g'],['b','a','j'],['u','q','p']]
testBoard = [['X','O','O','O','X'],['X','O','O','O','O'],['X','X','O','O','O'],['X','X','O','O','O'],['X','X','X','X','X']]
print(findLargestSquare(testBoard))

I changed My code to self convolution method.
can you take a look at which part is wrong?

import numpy as np
import time
answer = 0

def findLargestSquare(board):
    global answer

    a = np.array(board)

    for k in reversed(range(a[0].size + 1)):
        conv_size = k
        for i in range(a[0].size - conv_size + 1):
            num = i
            for j in range(a[0].size - conv_size + 1):
                #print('i:', i, 'j:', j)
                print(a[i:i + conv_size, j:j + conv_size])
                #print('unique: ',np.unique(a[i:i+ conv_size,j:j+conv_size]).size)
                if(np.unique(a[i:i+ conv_size,j:j+conv_size]).size == 1):
                    #print("returning")
                    return len(a[i:i+ conv_size,j:j+conv_size])**2
                num = num + 1
                print("================")
    return len(a[i:i+ conv_size,j:j+conv_size])**2

# testBoard = [['x','o','g'],['b','a','j'],['u','q','p']]
testBoard = [['X', 'O', 'O', 'O', 'X'], ['X', 'O', 'O', 'O', 'O'], ['X', 'X', 'O', 'O', 'O'], ['X', 'X', 'O', 'O', 'O'],
             ['X', 'X', 'X', 'X', 'X']]

print(findLargestSquare(testBoard))

Body:
You can do it in O(n^2) instead of your current O(n^4) (allsame() is in O(n^2) and is called O(n^2) times):

use a new matrix best_size, such that best_size[i, j] should contain the size of the biggest square starting at (i, j) in your original board. Fill this matrix starting from the end following this rule:

def get_best_size(a, best_size, i, j):
    # TODO Handle boundaries: best_size = 1 there
    if not a[i, j] == a[i+1, j] == a[i, j+1]:
        return 1
    min_neighbor_best_size = min(best_size[i+1, j], best_size[i, j+1])
    if a[i, j] == a[i + min_neighbor_best_size , j + min_neighbor_best_size ]:
        return min_neighbor_best_size + 1
    else:
        return min_neighbor_best_size

Just drawing it should show you why this rule works.

And then you just iterate from the end of the array, to the start, and keep memory of the best one while you're at it:

best = 0
for i in range(ran,-1,-1):
    for j in range(ran,-1,-1):
        best_size[i, j] =  get_best_size(a, best_size, i, j)
        best = max(best, best_size[i, j])
return best


问:
Convert a byteArray into an IntegerArray using javascript
I receive a bytearray and I want to convert it into a intarray.

Is this possible in NodeJS?

Reason to do that:

A proxy receives values from a serialconnection which is a bytearray and I try to decode that and put it into a more specific JSON object.

```<code>var uint8Message = new Uint8Array(8),
    output = [];

uint8Message[0] = 40;
uint8Message[1] = 40;
uint8Message[2] = 40;
uint8Message[3] = 40;
uint8Message[4] = 40;
uint8Message[5] = 40;
uint8Message[6] = 40;
uint8Message[7] = 40;

var counter = 0;
var intermediate = [];
for (var i = 0; i< uint8Message.byteLength; i++) {
    if (counter < 4) {
        intermediate.push(uint8Message[i]);
    }

    counter++;
    if (counter === 3 ){
        output.push(new Uint16Array(intermediate));
        counter = 0;
        intermediate = [];
    }
}

console.log(output);
</code>```

I am sending a intArray which is converted to byteArray from arduino to a NodeJS serialport handler. I want to get 8 integer values in array:

Status and value for four engines.

So in the end I want to have this:

[1,89,2,49,1,28,3,89]

Which is not complete correct with the example. But the example above is for testing.

答:
Still not sure I understand your question correctly but if you want to convert Uint8Array to say Uint32Array you could do

const uint8Array = new Uint8Array(8).fill(40)
console.log(new Uint32Array(uint8Array.buffer))```
</div>
</div>
</p>

<p>If you need plain old js array you could do </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const uint8Array = new Uint8Array(8).fill(40)

const intArray = Array.from(new Uint32Array(uint8Array.buffer))

console.log(Array.isArray(intArray))</code>```

Also you might want to take a look at what is called DataView that allows low level access to buffers' contents.

Body:
I receive a bytearray and I want to convert it into a intarray.

Is this possible in NodeJS?

Reason to do that:

A proxy receives values from a serialconnection which is a bytearray and I try to decode that and put it into a more specific JSON object.

var uint8Message = new Uint8Array(8),
    output = [];

uint8Message[0] = 40;
uint8Message[1] = 40;
uint8Message[2] = 40;
uint8Message[3] = 40;
uint8Message[4] = 40;
uint8Message[5] = 40;
uint8Message[6] = 40;
uint8Message[7] = 40;

var counter = 0;
var intermediate = [];
for (var i = 0; i< uint8Message.byteLength; i++) {
    if (counter < 4) {
        intermediate.push(uint8Message[i]);
    }

    counter++;
    if (counter === 3 ){
        output.push(new Uint16Array(intermediate));
        counter = 0;
        intermediate = [];
    }
}

console.log(output);

I am sending a intArray which is converted to byteArray from arduino to a NodeJS serialport handler. I want to get 8 integer values in array:

Status and value for four engines.

So in the end I want to have this:

[1,89,2,49,1,28,3,89]

Which is not complete correct with the example. But the example above is for testing.

Body:
Still not sure I understand your question correctly but if you want to convert Uint8Array to say Uint32Array you could do

const uint8Array = new Uint8Array(8).fill(40)
console.log(new Uint32Array(uint8Array.buffer))

If you need plain old js array you could do

const uint8Array = new Uint8Array(8).fill(40)

const intArray = Array.from(new Uint32Array(uint8Array.buffer))

console.log(Array.isArray(intArray))

Also you might want to take a look at what is called DataView that allows low level access to buffers' contents.


问:
Microsoft flow and B2C not working together
I am using B2C tokens in a web api. The web api will be called from flow. The authorize url in flow is
https://login.microsoftonline.com/lingeshtest.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_demo2

When flow redirects to the authorize end point it adds an additional question mark to the end of the url before appending the client id.
https://login.microsoftonline.com/lingeshtest.onmicrosoft.com/oauth2/v2.0/authorize?p=B2C_1_demo2?client_id=foobar...

whereas it should only append a & before adding client id.

Any suggestions?

答:
I had this error before, I think tyou are using an old library , i think i updated to the latest MSAL pre release and it fixed

Looks like a duplicate of

Azure B2C GetOwinContext().Authentication.Challenge creates wrong url with Question mark instead of And sign


问:
Chrome extension open new window behind the current window
i have a chrome extension which automatically open a window using
    window.open();
when user open some specific websites.
what i want is the new window which i open from the background script through window.open() should be displayed behind the current webiste opened by the user.

i have tried window.open properties like alwaysLowered=1, z-lock=1 etc. but not working.
Also tried.....

```<code>var w = window.open('url');
if(w){
w.blur();
window.focus();
}
</code>```

all these have no effect on chrome. can anybody help?

答:
```<code>chrome.windows.getCurrent(function(winCurrent){
        chrome.windows.create({url:url, function(win){
            chrome.windows.update(winCurrent.id, {focused: true});
        });
    });
</code>```

Try this, its fast so viewer doesn't feel much

Body:
i have a chrome extension which automatically open a window using
    window.open();
when user open some specific websites.
what i want is the new window which i open from the background script through window.open() should be displayed behind the current webiste opened by the user.

i have tried window.open properties like alwaysLowered=1, z-lock=1 etc. but not working.
Also tried.....

var w = window.open('url');
if(w){
w.blur();
window.focus();
}

all these have no effect on chrome. can anybody help?

Body:
chrome.windows.getCurrent(function(winCurrent){
        chrome.windows.create({url:url, function(win){
            chrome.windows.update(winCurrent.id, {focused: true});
        });
    });

Try this, its fast so viewer doesn't feel much


问:
SQL Server Catch exception and continue
Ive follow procedure:

```<code>alter procedure sp_insert_cities
(
    @txt_nome_cidade varchar(300),
    @txt_nome_estado varchar(150) = null,
    @txt_pais varchar(150) = null,
    @int_id_cidade int output
)
as
begin
            //Here an exception may occur
            insert into tb_cidades values(
            @txt_nome_cidade,
            @txt_nome_estado,
            @txt_pais)

            set @int_id_cidade = @@identity

            //Here i want to catch exception and continue executing the proc
            if(@@error <> 0)
            begin
            select @int_id_cidade = int_id_cidade
            from tb_cidades
            where
            txt_nome_cidade = @txt_nome_cidade
            end
</code>```

After if(@@error <> 0) line,i want to continue executing code even if there are any errors,but SQL throws an exception to my application and the code inside IF condition will not executed.

Any ideas?

答:
The following will try to run your command.  You can put anything you want to run in the CATCH block, which will execute only when an error occurs.  The remaining code after the CATCH will run with error or without error.</p>

```<code>BEGIN TRY
   insert into tb_cidades values(
   @txt_nome_cidade,
   @txt_nome_estado,
   @txt_pais)

       set @int_id_cidade = @@identity
END TRY

BEGIN CATCH
  PRINT 'Error occurred'

END CATCH

if(@@error <> 0)
begin
select @int_id_cidade = int_id_cidade
from tb_cidades
where
txt_nome_cidade = @txt_nome_cidade
end
</code>```

Title: SQL Server Catch exception and continue

Body:
Ive follow procedure:

alter procedure sp_insert_cities
(
    @txt_nome_cidade varchar(300),
    @txt_nome_estado varchar(150) = null,
    @txt_pais varchar(150) = null,
    @int_id_cidade int output
)
as
begin
            //Here an exception may occur
            insert into tb_cidades values(
            @txt_nome_cidade,
            @txt_nome_estado,
            @txt_pais)

            set @int_id_cidade = @@identity

            //Here i want to catch exception and continue executing the proc
            if(@@error <> 0)
            begin
            select @int_id_cidade = int_id_cidade
            from tb_cidades
            where
            txt_nome_cidade = @txt_nome_cidade
            end

After if(@@error <> 0) line,i want to continue executing code even if there are any errors,but SQL throws an exception to my application and the code inside IF condition will not executed.

Any ideas?

Body:
The following will try to run your command.  You can put anything you want to run in the CATCH block, which will execute only when an error occurs.  The remaining code after the CATCH will run with error or without error.

BEGIN TRY
   insert into tb_cidades values(
   @txt_nome_cidade,
   @txt_nome_estado,
   @txt_pais)

       set @int_id_cidade = @@identity
END TRY

BEGIN CATCH
  PRINT 'Error occurred'

END CATCH

if(@@error <> 0)
begin
select @int_id_cidade = int_id_cidade
from tb_cidades
where
txt_nome_cidade = @txt_nome_cidade
end


问:
Uncaught TypeError: Cannot read property 'setDate' of null
I am trying to set the check out date to be as the check in +1 automatically.

Here is the code:

jQuery("#" + in_date).datepicker({
    dateFormat : "yy-mm-dd",
    minDate: today,
    beforeShowDay:function (date){
        return enableAllTheseDays(date, in_date );
    },
    onClose: function() {
        //  var date2 = jQuery("#" + in_date).datepicker('getDate');
        var date2 =jQuery("#" + in_date).datepicker('getDate', '+1d');
        date2.setDate(date2.getDate()+1);
        if(date2){
             jQuery("#" + out_date).datepicker("setDate", date2);
        }
    }
});
```

答:
Try this code

initialize out_date datepicker before setting date to it

```<code>jQuery("#" + out_date).datepicker().datepicker("setDate", date2);
</code>```

$(document).ready(function(){
var today=new Date();
var in_date = 'in_date',out_date = 'out_date';

  jQuery("#" + in_date).datepicker({
  dateFormat : "yy-mm-dd",
  minDate: today,
  /*beforeShowDay:function (date){
    return enableAllTheseDays(date, in_date );
  },*/
   onClose: function() {
    //  var date2 = jQuery("#" + in_date).datepicker('getDate');
    var date2 =jQuery("#" + in_date).datepicker('getDate', '+1d');
    date2.setDate(date2.getDate()+1);
    if(date2){
       jQuery("#" + out_date).datepicker({dateFormat : "yy-mm-dd"}).datepicker("setDate", date2);
    }
  }
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<input id="in_date" type="text" />
<input id="out_date" type="text" /></code>```

Body:
Try this code

initialize out_date datepicker before setting date to it

jQuery("#" + out_date).datepicker().datepicker("setDate", date2);

$(document).ready(function(){
var today=new Date();
var in_date = 'in_date',out_date = 'out_date';

  jQuery("#" + in_date).datepicker({
  dateFormat : "yy-mm-dd",
  minDate: today,
  /*beforeShowDay:function (date){
    return enableAllTheseDays(date, in_date );
  },*/
   onClose: function() {
    //  var date2 = jQuery("#" + in_date).datepicker('getDate');
    var date2 =jQuery("#" + in_date).datepicker('getDate', '+1d');
    date2.setDate(date2.getDate()+1);
    if(date2){
       jQuery("#" + out_date).datepicker({dateFormat : "yy-mm-dd"}).datepicker("setDate", date2);
    }
  }
  });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<input id="in_date" type="text" />
<input id="out_date" type="text" />


问:
Display all usernames in the "users" table
I'm trying to show all usernames in the users table onto my index page.

Here is the PHP code:

```<code>$result = $db->prepare("SELECT username FROM users");
$result->execute();

while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
{
    $user = $row['users'];
    $username = $row['username'];
}

echo $user;
echo $username;
</code>```

答:
I think you are printing username outside of the while loop, so that you're getting the last username every time. </p>

```<code>$result = $db->prepare("SELECT username FROM users");
$result->execute();
while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
{
  echo $username = $row['username'];
}
</code>```

Body:
I'm trying to show all usernames in the users table onto my index page.

Here is the PHP code:

$result = $db->prepare("SELECT username FROM users");
$result->execute();

while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
{
    $user = $row['users'];
    $username = $row['username'];
}

echo $user;
echo $username;

Body:
I think you are printing username outside of the while loop, so that you're getting the last username every time.

$result = $db->prepare("SELECT username FROM users");
$result->execute();
while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
{
  echo $username = $row['username'];
}


问:
Latest Ruby Version not being recognized
Just installed ruby 2.4.1 on my Mac (running sierra) using rbenv. I also installed ruby 2.4.0. Ruby Directories are present.

however, ruby -v gives

```<code>ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
</code>```

even after setting "rbenv global 2.4.1" ...

Output from "gem env"

```<code>RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14.1
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/marauf/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
</code>```

Output from "rbenv versions"

```<code>  system
  2.4.0
* 2.4.1 (set by /Users/me/.rbenv/version)
</code>```

ruby-build updated, based on a few other posts.

I can't install latest Rails because it sees ruby 2.0.0 instead of ruby 2.4.1. Assistance Please!!

答:
rbenv global doesn't work the way you seem to think it does. global only sets the ruby version where not otherwise specified. So what other ways can the ruby version be set?

1) rbenv shell sets the version in use for the current shell session;

2) rbenv local sets the version for use in the current directory. You should see a .ruby_version file in your working directory dictating what version of ruby to use and overriding your rbenv global command.

You would know immediately if you were doing 1), so I'm betting that you set a ruby version in your project directory at some point, maybe without realizing it. You should be able to create and change to a new directory where your global version is respected.

Note: You may consider this a bit of editorializing, but if you're not totally wedded to rbenv, consider using rvm. rvm has a use command that sets the version of ruby in use on the fly, which is terribly convenient.

Body:
Just installed ruby 2.4.1 on my Mac (running sierra) using rbenv. I also installed ruby 2.4.0. Ruby Directories are present.

however, ruby -v gives

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

even after setting "rbenv global 2.4.1" ...

Output from "gem env"

RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14.1
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/marauf/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/

Output from "rbenv versions"

  system
  2.4.0
* 2.4.1 (set by /Users/me/.rbenv/version)

ruby-build updated, based on a few other posts.

I can't install latest Rails because it sees ruby 2.0.0 instead of ruby 2.4.1. Assistance Please!!