问:
Responsive image gallery using CSS flexbox or grid-layout
I am working on an Image-Gallery-Widget where the user can set a thumbnail width, thumbnail height and margin (between thumbnails) and the widget will present all image-thumnails in a nice grid where each image has the same width and height.

I am wondering whether css-flexbox or css-grid makes this possible without the need to define rows and columns in code and without the need for breakpoints/media-queries.

Thumbnail-Images are wrapped in an anchor, so a  gallery item (or grid-item) will look something like this:

```<code><a href="#" class="gallery-item">
    <img src="myimage" width="300" height="200" />
</a>
</code>```

The gallery items should fully fill the container div, which means, there should not be a gap between the last thumbnail in a row and the container div's right edge (except if we don't have enough items to fill the row i.e. when 3 items ft in a row, but we only have 8 items, then the 3rd row will only have 2 items and a gap to the right which is as wide as one item).

Gallery items can never be wider than the thumbnail-width the user set, because we don't want to degrade the quality of the thumbnails. Let's assume 300px width for this example. The margin between gallery items is fixed and set by the user. If there are not enough items left to fill a row, simply left align them i.e. like so:

I do not want to define any breakpoints in CSS nor add any html for row/column constructs. I want the browser to simply place as much gallery items side by side as fit into the container. If there's a gap on the right (ie 3 thumbnails * 300px width = 900px, but container is 1000px wide), the browser should scale down the grid items, so that one more gallery item will fit in and thus eliminate the gap. I need to be able to define a margin around each gallery item.

You can see the desired responsive behaviour (when changing the browser width) in this gif:

What you see in the gif is done without flexbox but needs a ton of CSS which I was hoping to avoid with flexbox. I have researched flexbox quite some bit, but haven't been able to get my head around it fully just yet.

Thanks for any tips!

答:
Using flex capabilities should be sufficient for your task. Be aware of partial support in IE11: http://caniuse.com/#feat=flexbox.

Put these styles on your container:

```<code>.gallery {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: space-between;
}
</code>```

Styles for wrappers:

```<code>.gallery a {
  flex-grow: 1;
  flex-basis: 125px;
  max-width: 300px;
  margin: 5px;
}
</code>```

Styles for images:

```<code>.gallery img {
  height: 100%;
  width: 100%;
}
</code>```

Space between images can be simply defined using margin.
In order to preserve image ratio you can use for example links () as a wrappers for images ().

Furthermore, in order to prevent enlarging images, you can apply flex-grow, flex-basis and max-width attributes on anchors.
There was also a problem with stretching images in the last row - hack for that is to put n - 1 (where n is number of images)  empty items inside container.

Setting width and height to 100% on the images enforces them to grow automatically up to the width defined by max-width attribute, while maintaining aspect ratio.

Please check the working example:
FIDDLE

Body:
I am working on an Image-Gallery-Widget where the user can set a thumbnail width, thumbnail height and margin (between thumbnails) and the widget will present all image-thumnails in a nice grid where each image has the same width and height.

I am wondering whether css-flexbox or css-grid makes this possible without the need to define rows and columns in code and without the need for breakpoints/media-queries.

Thumbnail-Images are wrapped in an anchor, so a  gallery item (or grid-item) will look something like this:

The gallery items should fully fill the container div, which means, there should not be a gap between the last thumbnail in a row and the container div's right edge (except if we don't have enough items to fill the row i.e. when 3 items ft in a row, but we only have 8 items, then the 3rd row will only have 2 items and a gap to the right which is as wide as one item).

Gallery items can never be wider than the thumbnail-width the user set, because we don't want to degrade the quality of the thumbnails. Let's assume 300px width for this example. The margin between gallery items is fixed and set by the user. If there are not enough items left to fill a row, simply left align them i.e. like so:

I do not want to define any breakpoints in CSS nor add any html for row/column constructs. I want the browser to simply place as much gallery items side by side as fit into the container. If there's a gap on the right (ie 3 thumbnails * 300px width = 900px, but container is 1000px wide), the browser should scale down the grid items, so that one more gallery item will fit in and thus eliminate the gap. I need to be able to define a margin around each gallery item.

You can see the desired responsive behaviour (when changing the browser width) in this gif:

What you see in the gif is done without flexbox but needs a ton of CSS which I was hoping to avoid with flexbox. I have researched flexbox quite some bit, but haven't been able to get my head around it fully just yet.

Thanks for any tips!

Body:
Using flex capabilities should be sufficient for your task. Be aware of partial support in IE11: http://caniuse.com/#feat=flexbox.

Put these styles on your container:

.gallery {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: space-between;
}

Styles for wrappers:

.gallery a {
  flex-grow: 1;
  flex-basis: 125px;
  max-width: 300px;
  margin: 5px;
}

Styles for images:

.gallery img {
  height: 100%;
  width: 100%;
}

Space between images can be simply defined using margin.
In order to preserve image ratio you can use for example links (<a>) as a wrappers for images (<img>).

Furthermore, in order to prevent enlarging images, you can apply flex-grow, flex-basis and max-width attributes on anchors.
There was also a problem with stretching images in the last row - hack for that is to put n - 1 (where n is number of images)  empty items inside container.

Setting width and height to 100% on the images enforces them to grow automatically up to the width defined by max-width attribute, while maintaining aspect ratio.

Please check the working example:
FIDDLE


来源: stackexchange

问:
modifying/ getting rid of characters in text from txt file ussing vb.net
I have a string of text i captured within AutoCAD (0.000000, 0.000000, 0.000000) wich is saved to a text based file named position.txt.

as you probably have gatherd with a file name such as position.txt the text could be composed of any random number combination eg: (5.745379, 0.846290, 150.6459046).

However for it to be of any use to me I need the captured string to exist without spaces or brackets how can i achiev this in VB.net?

答:
as above

```<code>s = "(5.745379, 0.846290, 150.6459046)"
s = s.replace("(","")
s = s.replace(")","")
</code>```

and then

```<code>dim answer() as string = s.split(",")
dim number as double
For each a as string in answer
  if double.tryparse(a,n) then
    console.writeline(n.tostring & " is a number")
  else
    console.writeline(n.tostring & " is rubbish")
next
</code>```

ContentLicense: CC BY-SA 2.5

Body:
as above

s = "(5.745379, 0.846290, 150.6459046)"
s = s.replace("(","")
s = s.replace(")","")

and then

dim answer() as string = s.split(",")
dim number as double
For each a as string in answer
  if double.tryparse(a,n) then
    console.writeline(n.tostring & " is a number")
  else
    console.writeline(n.tostring & " is rubbish")
next


问:
Convert div to canvas tag with html2canvas not working
I need to convert div to jpg image,
Here is my HTML code:

```<code><div id="widget" class="widget"  >

    <div ng-show="userNum!=null" class="inputfieldwrapper buttonprint right col-sm-6  col-sm-push-6   horizontalinputfieldwrapper ">
        <label id="userNumLbl" for="disForUserNum" class=" font-bold col-lg-5 col-lg-push-7 col-md-5 col-md-push-7 col-xs-push-8" ng-bind="'מספר משלם:'"></label>
        <div class="inputContainer col-lg-7 col-lg-pull-4 col-sm-7 col-sm-pull-5 col-xs-pull-0 col-xs-pull-1 col-xs-3">
            <label ng-model="userNum" class="col-lg-6 col-lg-push-7 col-md-5 col-md-push-7 col-xs-push-8" ng-bind="userNum"></label>
        </div>

    </div>

</div>
</code>```

Also I have button and div to put the created image in my body:

```<code><input type="button" id="btnSave" value="Save PNG" />
<div id="img-out"></div>
</code>```

In my js file I added click a function to this button:

```<code>$(function () {
            $("#btnSave").click(function () {
                html2canvas($("#widget"), {
                    onrendered: function (canvas) {
                        document.body.appendChild(canvas);
                        // Convert and download as image
                        Canvas2Image.saveAsJPEG(canvas);
                         $("#img-out").append(canvas);

                    }
                });
            });
        });
</code>```

I see some code that working fine in this link:
https://jsfiddle.net/8ypxW/3/

In this link - the span converted to canvas and appended to the end of the body.
My problem is that the image not include all my div's elements, It's only create some printscreen image,

What wrong in my code?

Thank you!!!

答:
My problem was with the html2canvas.js file, I download it from :https://github.com/niklasvh/html2canvas/releases

Thank you!! :)

ContentLicense: CC BY-SA 3.0

Body:
I need to convert div to jpg image,
Here is my HTML code:

Also I have button and div to put the created image in my body:

<input type="button" id="btnSave" value="Save PNG" />

In my js file I added click a function to this button:

$(function () {
            $("#btnSave").click(function () {
                html2canvas($("#widget"), {
                    onrendered: function (canvas) {
                        document.body.appendChild(canvas);
                        // Convert and download as image
                        Canvas2Image.saveAsJPEG(canvas);
                         $("#img-out").append(canvas);

                    }
                });
            });
        });

I see some code that working fine in this link:
https://jsfiddle.net/8ypxW/3/

In this link - the span converted to canvas and appended to the end of the body.
My problem is that the image not include all my div's elements, It's only create some printscreen image,

What wrong in my code?

Thank you!!!


问:
Swift - Cannot invoke initialiser for type dispatch_time_t
I've taken over some Swift 2 code and trying to bring it up to Swift 3 (Xcode 8.3), but I'm stuck on one line.

The code is checking to see if a host is connected:

```<code>func isHostConnected(hostAddress : String) -> Bool {
    let request = NSMutableURLRequest(url: NSURL(string: hostAddress.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)! as URL)
    request.timeoutInterval = 3
    request.httpMethod = "HEAD"

    let session = URLSession(configuration: URLSessionConfiguration.default)
    var responseCode = -1

    let group = DispatchGroup.init()
    group.enter()

    session.dataTask(with: request as URLRequest, completionHandler: {(_, response, _) in
        if let httpResponse = response as? HTTPURLResponse {
            responseCode = httpResponse.statusCode
        }
        group.leave()
    }).resume()

    group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture)) //ERROR LINE
    return (responseCode == 401)
}
</code>```

I am getting an error on the line:

group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture))

which reads:

Cannot invoke initializer for type 'dispatch_time_t' with an argument list of type '(DispatchTime)'

So it seems to be looking for an object of type DispatchTime as the parameter but I can't seem to find an answer on Google to match .distantFuture

Also, if I try:

group.wait(timeout: dispatch_time_t(.distantFuture))

I get an error saying:

Type of expression is ambiguous without more context

Thanks.

答:
First of all, to answer your question, it's simply

```<code>group.wait(timeout: .distantFuture)
</code>```

Second of all, it's very bad programming habit to wait in this case. There is no reason at all. The most efficient way to be notified asynchronously is to use a completion handler.

It's much less code, the code uses the Swift 3 native structs URL and URLRequest and considers also the case of a bad URL to prevent a crash:

```<code>func isHostConnected(hostAddress : String, completion: @escaping (Bool)->()) {
    guard let escapedString = hostAddress.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
          let url = URL(string: escapedString) else {
             completion(false)
             return
    }
    var request = URLRequest(url: url)
    request.timeoutInterval = 3
    request.httpMethod = "HEAD"

    let session = URLSession(configuration: URLSessionConfiguration.default)
    session.dataTask(with: request, completionHandler: {(_, response, _) in
        if let httpResponse = response as? HTTPURLResponse {
            completion(httpResponse.statusCode == 401)
        }
        completion(false)
    }).resume()
}
</code>```

And use it:

```<code>isHostConnected(hostAddress: "http://meyserver.com") { isConnected
    print("Host is connected:", isConnected)
}
</code>```

Body:
I've taken over some Swift 2 code and trying to bring it up to Swift 3 (Xcode 8.3), but I'm stuck on one line.

The code is checking to see if a host is connected:

func isHostConnected(hostAddress : String) -> Bool {
    let request = NSMutableURLRequest(url: NSURL(string: hostAddress.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)! as URL)
    request.timeoutInterval = 3
    request.httpMethod = "HEAD"

    let session = URLSession(configuration: URLSessionConfiguration.default)
    var responseCode = -1

    let group = DispatchGroup.init()
    group.enter()

    session.dataTask(with: request as URLRequest, completionHandler: {(_, response, _) in
        if let httpResponse = response as? HTTPURLResponse {
            responseCode = httpResponse.statusCode
        }
        group.leave()
    }).resume()

    group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture)) //ERROR LINE
    return (responseCode == 401)
}

I am getting an error on the line:

group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture))

which reads:

Cannot invoke initializer for type 'dispatch_time_t' with an argument list of type '(DispatchTime)'

So it seems to be looking for an object of type DispatchTime as the parameter but I can't seem to find an answer on Google to match .distantFuture

Also, if I try:

group.wait(timeout: dispatch_time_t(.distantFuture))

I get an error saying:

Type of expression is ambiguous without more context

Thanks.

Body:
First of all, to answer your question, it's simply

group.wait(timeout: .distantFuture)

Second of all, it's very bad programming habit to wait in this case. There is no reason at all. The most efficient way to be notified asynchronously is to use a completion handler.

It's much less code, the code uses the Swift 3 native structs URL and URLRequest and considers also the case of a bad URL to prevent a crash:

func isHostConnected(hostAddress : String, completion: @escaping (Bool)->()) {
    guard let escapedString = hostAddress.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
          let url = URL(string: escapedString) else {
             completion(false)
             return
    }
    var request = URLRequest(url: url)
    request.timeoutInterval = 3
    request.httpMethod = "HEAD"

    let session = URLSession(configuration: URLSessionConfiguration.default)
    session.dataTask(with: request, completionHandler: {(_, response, _) in
        if let httpResponse = response as? HTTPURLResponse {
            completion(httpResponse.statusCode == 401)
        }
        completion(false)
    }).resume()
}

And use it:

isHostConnected(hostAddress: "http://meyserver.com") { isConnected
    print("Host is connected:", isConnected)
}


问:
allocating memory using calloc and freeing
gcc 4.4.4 c89

I have a program that I am testing. I create a struct object called devname and allocate memory so that I can fill the elements. I display them and then free the memory that was allocated.

However, I am getting the following error:

```<code>invalid operands to binary != (have ‘struct Devices_names’ and ‘void *’)
</code>```

That is in my for loop for displaying the structure elements. However, I feel I am testing for a NULL pointer.

Just a further question, is there an problem with the free?

Many thanks for any advice,

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

static struct Devices_names {
#define MAX_NAME_LEN 80
    int id;
    char name[MAX_NAME_LEN];
} *devname;

static void g_create_device_names(size_t devices);
static void g_get_device_names();
static void destroy_devices();

int main(void)
{
#define DEVICES 5
    g_create_device_names(DEVICES);

    g_get_device_names();

    destroy_devices();

    return 0;
}

static void g_create_device_names(size_t devices)
{
    size_t i = 0;
    devname = calloc(devices, sizeof *devname);
    if(devname == NULL) {
        exit(0);
    }

    for(i = 0; i < devices; i++) {
        devname[i].id = i;
        sprintf(devname[i].name, "device: %d", i);
    }
}

static void g_get_device_names()
{
    size_t i = 0;

    for(i = 0; devname[i] != NULL; i++) { <-- ERROR HERE
        printf("Device id --- [ %d ]\n", devname[i].id);
        printf("Device name - [ %s ]\n", devname[i].name);
    }
}

static void destroy_devices()
{
    while(devname != NULL) {
        free(devname++);
    }
}
</code>```

答:
Since you only have one allocation to create the whole devname array, you only need to check that array for NULL, and only need to free that one array. As you're looking through devname, each entry is actually a struct Devices_names, not a pointer, so it can't be compared with NULL or freed in any meaningful way. In this case, you will need a separate variable that tracks how many entries there are:

```<code>for (i = 0; i < devname_count; i++) {
    printf("Device id --- [ %d ]\n", devname[i].id);
    printf("Device name - [ %s ]\n", devname[i].name);
}

...

free(devname);
devname = NULL;
devname_count = 0;
</code>```

Body:
gcc 4.4.4 c89

I have a program that I am testing. I create a struct object called devname and allocate memory so that I can fill the elements. I display them and then free the memory that was allocated.

However, I am getting the following error:

invalid operands to binary != (have ‘struct Devices_names’ and ‘void *’)

That is in my for loop for displaying the structure elements. However, I feel I am testing for a NULL pointer.

Just a further question, is there an problem with the free?

Many thanks for any advice,

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

static struct Devices_names {
#define MAX_NAME_LEN 80
    int id;
    char name[MAX_NAME_LEN];
} *devname;

static void g_create_device_names(size_t devices);
static void g_get_device_names();
static void destroy_devices();

int main(void)
{
#define DEVICES 5
    g_create_device_names(DEVICES);

    g_get_device_names();

    destroy_devices();

    return 0;
}

static void g_create_device_names(size_t devices)
{
    size_t i = 0;
    devname = calloc(devices, sizeof *devname);
    if(devname == NULL) {
        exit(0);
    }

    for(i = 0; i < devices; i++) {
        devname[i].id = i;
        sprintf(devname[i].name, "device: %d", i);
    }
}

static void g_get_device_names()
{
    size_t i = 0;

    for(i = 0; devname[i] != NULL; i++) { <-- ERROR HERE
        printf("Device id --- [ %d ]\n", devname[i].id);
        printf("Device name - [ %s ]\n", devname[i].name);
    }
}

static void destroy_devices()
{
    while(devname != NULL) {
        free(devname++);
    }
}

Body:
Since you only have one allocation to create the whole devname array, you only need to check that array for NULL, and only need to free that one array. As you're looking through devname, each entry is actually a struct Devices_names, not a pointer, so it can't be compared with NULL or freed in any meaningful way. In this case, you will need a separate variable that tracks how many entries there are:

for (i = 0; i < devname_count; i++) {
    printf("Device id --- [ %d ]\n", devname[i].id);
    printf("Device name - [ %s ]\n", devname[i].name);
}

...

free(devname);
devname = NULL;
devname_count = 0;


问:
GBQ: rewrite table with a POST request
Exploring Loading data to GBQ with POST request  I haven't found how to rewrite existing table (current examples append data to existing table or create new table if it doesn't exist). I see that there is a possibility to do it with web console so I assume there is a way to resolve this task with POST request. Are there someone who knows it?</p>

答:
You should set WRITE_TRUNCATE value for configuration.load.writeDisposition property of job configuration

configuration.load.writeDisposition   string  [Optional] Specifies the action that occurs if the destination table already exists.

The following values are supported:

  WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data.
  WRITE_APPEND: If the table already exists, BigQuery appends the data to the table.
  WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result.

  The default value is WRITE_APPEND.

Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.

Title: GBQ: rewrite table with a POST request


问:
cpanm use custom libs and cflags
On my mac OS X machine Darwin maci 15.6.0 Darwin Kernel Version 15.6.0

I have installed libxml2 and libxslt in following custom directory

/usr/local/MyLibs/libxml2-2.9.2

and libxslt

/usr/local/MyLibs/libxslt-1.1.29

Now I want to use these libs to build my CPANM module XML::LibXSLT.

This tells me that I can do so using --configure-args (its still experimental). So I do something like,

```<code>cpanm http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.94.tar.gz --configure-args="--cflags=-I/usr/local/libxslt-1.1.29/include -I/usr/include/libxml2 -I/usr/local/MyLibs/libxml2-2.9.2/include/libxml2 --libs=-L/usr/local/libxslt-1.1.29/lib -lxslt -lxml2 -lz -lpthread -licucore -lm -L/usr/local/MyLibs/libxml2-2.9.2/lib -lxml2 -lz -lpthread -liconv -lm" --force
</code>```

However, the build log says that it did not use the libraries installed in my custom location.

Is there something that I am not doing correctly?

答:
From the distro's README,

The Makefile.PL tries to determine the correct compiler and linker
flags for its library dependencies using pkg-config and
xslt-config. If this fails, you may override the values like this

```<code>perl Makefile.PL INC="..." LIBS="..."
</code>```

where INC contains flags for the compiler (such as -I/some_path/include etc.) and LIBS contains linker flags (such as -L/some_path/lib -llibsomething ...).

It might be simpler to forgo cpanm and install the module yourself.

```<code>curl -L -o - http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.95.tar.gz | tar xz
cd XML-LibXSLT-1.95
perl Makefile.PL INC="..." LIBS="..."
make test
make install
</code>```

ContentLicense: CC BY-SA 4.0

Title: cpanm use custom libs and cflags

Body:
On my mac OS X machine Darwin maci 15.6.0 Darwin Kernel Version 15.6.0

I have installed libxml2 and libxslt in following custom directory

/usr/local/MyLibs/libxml2-2.9.2

and libxslt

/usr/local/MyLibs/libxslt-1.1.29

Now I want to use these libs to build my CPANM module XML::LibXSLT.

This tells me that I can do so using --configure-args (its still experimental). So I do something like,

cpanm http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.94.tar.gz --configure-args="--cflags=-I/usr/local/libxslt-1.1.29/include -I/usr/include/libxml2 -I/usr/local/MyLibs/libxml2-2.9.2/include/libxml2 --libs=-L/usr/local/libxslt-1.1.29/lib -lxslt -lxml2 -lz -lpthread -licucore -lm -L/usr/local/MyLibs/libxml2-2.9.2/lib -lxml2 -lz -lpthread -liconv -lm" --force

However, the build log says that it did not use the libraries installed in my custom location.

Is there something that I am not doing correctly?

Body:
From the distro's README,

The Makefile.PL tries to determine the correct compiler and linker
flags for its library dependencies using pkg-config and
xslt-config. If this fails, you may override the values like this

perl Makefile.PL INC="..." LIBS="..."

where INC contains flags for the compiler (such as -I/some_path/include etc.) and LIBS contains linker flags (such as -L/some_path/lib -llibsomething ...).

It might be simpler to forgo cpanm and install the module yourself.

curl -L -o - http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.95.tar.gz | tar xz
cd XML-LibXSLT-1.95
perl Makefile.PL INC="..." LIBS="..."
make test
make install


问:
Filter on level 2 properties
I use LoopBack with MongoDB connector.

Models:

Application for a job:

```<code>{
    "name": "application",
    "plural": "applications",
    "base": "PersistedModel",
    "idInjection": true,
    "options": {
        "validateUpsert": true
    },
    "properties": {
        "jobId": {
            "type": "string",
            "required": true
        },
        "staffId": {
            "type": "string",
            "required": true
        }
    },
    "validations": [],
    "relations": {},
    "acls": [],
    "methods": {}
}
</code>```

Job:

```<code>{
    "name": "job",
    "plural": "jobs",
    "base": "PersistedModel",
    "idInjection": true,
    "options": {
        "validateUpsert": true
    },
    "properties": {
        "title": {
            "type": "string",
            "required": true
        }
    },
    "validations": [],
    "relations": {
        "applications": {
            "type": "hasMany",
            "model": "application",
            "foreignKey": "jobId",
            "primaryKey": "id"
        }
    },
    "acls": [],
    "methods": {}
}
</code>```

If the user's id (staffId) is in the applications array I need to not show  for user this job.

Example:
We have array of jobs with applications

```<code>[
  {
    id: 1,
    title: "Job 1",
    applications: [
      {
        jobId: 1,
        staffId: 1
      },
      {
        jobId: 1,
        staffId: 2
      }
    ]
  },
  {
    id: 2,
    title: "Job 2",
    applications: [
      {
        jobId: 2,
        staffId: 1
      }
    ]
  }
]
</code>```

If user's id (staffId) is 2 then user sees only "Job 2".

I tried something like this:

```<code>/jobs?filter[include][applications]&filter[where not][applications][elemMatch][staffId]=2
</code>```

But it doesn't work.

Any suggestions?

Thanks.

答:
At this state of the development you can't filter on a level 2 properties with REST: https://github.com/strongloop/loopback/issues/517 (defect till 2014).

What you can do instead is to define a custom emote method that will contain something like:

```<code>    var userId = 2;
    Jobs.find({
          include: {
                 relation: 'applications',
                       scope: {
                           where: {staffId: {eq: userId}},
                       }
                  }
    }, function (err, jobs) {

    });
</code>```

Title: Filter on level 2 properties

Body:
I use LoopBack with MongoDB connector.

Models:

Application for a job:

{
    "name": "application",
    "plural": "applications",
    "base": "PersistedModel",
    "idInjection": true,
    "options": {
        "validateUpsert": true
    },
    "properties": {
        "jobId": {
            "type": "string",
            "required": true
        },
        "staffId": {
            "type": "string",
            "required": true
        }
    },
    "validations": [],
    "relations": {},
    "acls": [],
    "methods": {}
}

Job:

{
    "name": "job",
    "plural": "jobs",
    "base": "PersistedModel",
    "idInjection": true,
    "options": {
        "validateUpsert": true
    },
    "properties": {
        "title": {
            "type": "string",
            "required": true
        }
    },
    "validations": [],
    "relations": {
        "applications": {
            "type": "hasMany",
            "model": "application",
            "foreignKey": "jobId",
            "primaryKey": "id"
        }
    },
    "acls": [],
    "methods": {}
}

If the user's id (staffId) is in the applications array I need to not show  for user this job.

Example:
We have array of jobs with applications

[
  {
    id: 1,
    title: "Job 1",
    applications: [
      {
        jobId: 1,
        staffId: 1
      },
      {
        jobId: 1,
        staffId: 2
      }
    ]
  },
  {
    id: 2,
    title: "Job 2",
    applications: [
      {
        jobId: 2,
        staffId: 1
      }
    ]
  }
]

If user's id (staffId) is 2 then user sees only "Job 2".

I tried something like this:

/jobs?filter[include][applications]&filter[where not][applications][elemMatch][staffId]=2

But it doesn't work.

Any suggestions?

Thanks.

Body:
At this state of the development you can't filter on a level 2 properties with REST: https://github.com/strongloop/loopback/issues/517 (defect till 2014).

What you can do instead is to define a custom emote method that will contain something like:

    var userId = 2;
    Jobs.find({
          include: {
                 relation: 'applications',
                       scope: {
                           where: {staffId: {eq: userId}},
                       }
                  }
    }, function (err, jobs) {

    });


问:
AWS EC2 UTC timezone conversion off by a day with moment JS
Yesterday I posted this question about MongoDB UTC record timestamp issues when using MomentJS:

MomentJS not converting date correctly

Blakes Seven's answer solved the issue locally, but when I deployed to AWS EC2, the problem reoccurred. Here are the steps I took to understand the issue:

I verified the Elastic Beanstalk instance was using the correct zip from S3 bucket. So the code fix is definitely live.

EC2 location: US East (N. Virginia)

The request location to MongoDB for records is the same for the local and live

Launch Time: October 21, 2015 at 4:51:31 PM UTC-4 (2684 hours): I can't find the actual time zone config of my EC2, but this tells me it's UTC.

So my questions are:

How can I verify that my EC2 is set to UTC time

Is the server timezone even the issue? Somehow the dates aren't being read or parsed correctly

答:
I have a simular issue. Everything was going fine with moment.locale('fr') but wen wrong on AWS EBS/EC2.
I solved it by using moment-timezone and force to 'Europe/Paris':

moment.tz('Europe/Paris')


问:
Cordova - white screen after splash, no exceptions in console
I've been away from my Cordova app for a bit, but just did a fresh clone yesterday and noticed that it's got the "white screen of death" symptoms -- the splash screen displays, the program loads... and then I just get a blank screen. Some more details:

CLI: Cordova 6.1.1, android 5.1.1, ios 4.1.1

I'm not using any special plugins to display a splash screen -- just <splash> elements in my config.xml file.

This is happening in both iOS and Android, both on local builds and using PhoneGap Build (i.e., debug and release).

There are no exceptions of missing resources in the console, either in iOS (using Safari's dev tools) or Android (using Chrome's dev tools).

I've done a diff with my last known working build, and there's really nothing that pops out. I saw an undefined Underscore reference, but I backed that change out and it didn't resolve anything -- I think I'd see the exception in the console, anyway.

Has Cordova / PhoneGap done something recently that might be causing this? Any ideas on how to isolate this one? I'm really stumped.

答: My problem was with ES6, it runs perfectly on iPhone and Android 6, but it doesn't work with Android 4 and 5.</p>


问:
Excluding some tags from the Cufon Font system
I'm using Cufon to load some nice fonts with javascript.
And, as I have many tags, I use the following instruction to replace all the tags:

```<code>Cufon.replace('*', { fontFamily: 'MyFont' });
</code>```

But, I recently decided to exclude some tag classes from the replacement.
Is there an instruction like:

```<code>Cufon.exclude('TheClassToExclude');
</code>```

?

答:
You can use the '>'s as necessary to select an exact element/ element class. I'm using this way on a drupal site to select all the level 2 sidebar links,

'#sidebar-left .menu-level-2>ul.menu>li>a'

Body:
I'm using Cufon to load some nice fonts with javascript.
And, as I have many tags, I use the following instruction to replace all the tags:

Cufon.replace('*', { fontFamily: 'MyFont' });

But, I recently decided to exclude some tag classes from the replacement.
Is there an instruction like:

Cufon.exclude('TheClassToExclude');

?


问:
Why doesn't my PHP see the javascript post- request?
I am kind of new to Javascript, PHP and AJAX. I searched for a long time for an answer to this problem but couldn't quite find the answer. First off here is my my code:

My index.html file:

```<code><input type="text" id="value" onkeyup="loadDoc(this.value)">
        <p id="demo"></p>
        <p id="demo2"></p>
</code>```

My test.js file:

```<code>function loadDoc(kruispunt) {
  var xhttp;
  xhttp=new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        document.getElementById("demo").innerHTML = kruispunt;
    }
  };
  xhttp.open("POST","link.php?q=" + kruispunt, true);
  xhttp.send("kruispunt");
}
function myFunction(){
var xhttp;
  xhttp=new XMLHttpRequest();
  xhttp.onload = function() {
    if (this.readyState == 4 && this.status == 200) {
         document.getElementById("demo2").innerHTML = this.responseText;
  xhttp.open("GET","link.php", true);
  xhttp.send();
  }
   }
  }
</code>```

My link.php file:

```<code><?php

 $kruispunt5= file_get_contents('http://fiwarelab.ckan.nl/api/action/datastore_search?   resource_id=0077d99e-127c-4c28-acde-c0f337e13065');
 $kruispunt5 = json_decode($kruispunt5, true);
 $lat5 = json_encode($kruispunt5['result']['records'][4]['latitude']);
 $long5 = json_encode($kruispunt5['result']['records'][4]['longitude']);

 $kruispunt11 = file_get_contents('http://fiwarelab.ckan.nl/api/action/datastore_search?  resource_id=6b39a68b-54d1-4254-a2ce-af59a8856f3f');
 $kruispunt11 = json_decode($kruispunt11, true);
 $lat11 = json_encode($kruispunt11['result']['records'][4]['latitude']);
 $long11 = json_encode($kruispunt11['result']['records'][4]['longitude']);

 $q = $_REQUEST['kruispunt'];
 $x = 0;
 $y = 0;
 if ($q !== "") {
   if ($q === "5"){
      $x = $lat5;
      $y = $long5;
    } else if ($q === "11"){
        $x = $lat11;
        $y = $long11;
   }
 }
  echo json_encode($x);
  echo json_encode ($y);
   ?>
</code>```

What I want to achieve is that my inputvalue gets stored in "demo" and at the same time to give that parameter (kruispunt) to my .php file. Then I want my .php file figure out what $x and $y is and send that back to myFunction() and put the $x and $y variables from the php file into my "demo2".

If I put 5 as my inputvalue for example, "demo" does return 5 but after that nothings shows in "demo2" so I think there is something wrong with either my POST or my .php file. I somehow don't get an error in my browser, but nothing shows either.

I really hope i made clear what I wanted to achieve and thanks in advance for solving or helping with my problem!

答:
You said q=" + kruispunt. So your query string (why are you making a POST request if you're going to send the data in a query string?) has the key q.

Then you say $q = $_REQUEST['kruispunt'];

The key kruispunt is not q.

Meanwhile, the data you do send in the POST request — xhttp.send("kruispunt"); … is a plain text string and not URL encoded form data.

Body:
I am kind of new to Javascript, PHP and AJAX. I searched for a long time for an answer to this problem but couldn't quite find the answer. First off here is my my code:

My index.html file:

<input type="text" id="value" onkeyup="loadDoc(this.value)">

My test.js file:

function loadDoc(kruispunt) {
  var xhttp;
  xhttp=new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        document.getElementById("demo").innerHTML = kruispunt;
    }
  };
  xhttp.open("POST","link.php?q=" + kruispunt, true);
  xhttp.send("kruispunt");
}
function myFunction(){
var xhttp;
  xhttp=new XMLHttpRequest();
  xhttp.onload = function() {
    if (this.readyState == 4 && this.status == 200) {
         document.getElementById("demo2").innerHTML = this.responseText;
  xhttp.open("GET","link.php", true);
  xhttp.send();
  }
   }
  }

My link.php file:

<?php

 $kruispunt5= file_get_contents('http://fiwarelab.ckan.nl/api/action/datastore_search?   resource_id=0077d99e-127c-4c28-acde-c0f337e13065');
 $kruispunt5 = json_decode($kruispunt5, true);
 $lat5 = json_encode($kruispunt5['result']['records'][4]['latitude']);
 $long5 = json_encode($kruispunt5['result']['records'][4]['longitude']);

 $kruispunt11 = file_get_contents('http://fiwarelab.ckan.nl/api/action/datastore_search?  resource_id=6b39a68b-54d1-4254-a2ce-af59a8856f3f');
 $kruispunt11 = json_decode($kruispunt11, true);
 $lat11 = json_encode($kruispunt11['result']['records'][4]['latitude']);
 $long11 = json_encode($kruispunt11['result']['records'][4]['longitude']);

 $q = $_REQUEST['kruispunt'];
 $x = 0;
 $y = 0;
 if ($q !== "") {
   if ($q === "5"){
      $x = $lat5;
      $y = $long5;
    } else if ($q === "11"){
        $x = $lat11;
        $y = $long11;
   }
 }
  echo json_encode($x);
  echo json_encode ($y);
   ?>

What I want to achieve is that my inputvalue gets stored in "demo" and at the same time to give that parameter (kruispunt) to my .php file. Then I want my .php file figure out what $x and $y is and send that back to myFunction() and put the $x and $y variables from the php file into my "demo2".

If I put 5 as my inputvalue for example, "demo" does return 5 but after that nothings shows in "demo2" so I think there is something wrong with either my POST or my .php file. I somehow don't get an error in my browser, but nothing shows either.

I really hope i made clear what I wanted to achieve and thanks in advance for solving or helping with my problem!


问:
Access https page in Common Lisp error
Right now when I am trying in Common Lisp to connect to an https site with dexador I get this error:

```<code>   SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
       [Condition of type CL+SSL:SSL-ERROR-VERIFY]
</code>```

What should I do?

答:
I get this problem also, I do not get a good solution but it works. It seems that it is a issue:

```<code>CL-USER> (dex:get "https://www.google.com")
; Evaluation aborted on #<CL+SSL:SSL-ERROR-VERIFY {1006991FA3}>.
</code>```

This issue is related here it seems that is a problem with the CAcerts file. that doesn't have the correct CA authorities and cl+ssl:

It may be related to SSLv3 is disabled by default in CL+SSL, so
  Dexador tries to connect with TLS 1.2.

SSL verification of Dexador is quite new and not mature at all. It
  would be better to specify the verification setting in Dexador easily,
  however, using cl+ssl:make-context to allow SSLv3 is the only option
  for now, I guess.

So for now you have two options:

1) make it insecure

```<code>CL-USER> (dex:get "https://www.google.com" :insecure t)
"<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org
</code>```

....
peer: 216.58.211.227:443" {1004DD8003}>>

use the path for ca file usually at /etc/ssl/cert.pem

```<code>CL-USER> (dex:get "https://www.google.com" :ca-path "/etc/ssl/oldcert.pem")
"<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"es\"><head><meta content=\"Google.es permite acceder a la información mundial en castellano, catalán, gallego, euskara e inglés.\" name=\"description\"><meta content=\"noodp\" name=\"robots\"><meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\"><meta content=\"/images/branding/googleg/1x/googleg_standard_color_128dp.png\" itemprop=\"image\"><title>Google</title><script>(function(){window.google={kEI:'zwrdWM3qM4X9ae68n9gF',kEXPI:'1351891,1352993,1353040,1353108,1353148,3700248,3700347,3700405,3700407,4029815,4031109,4032677,4036527,4038012,4039268,4043492,4045841,4048347,4065786,4066196,4071842,4072364,4072776,4076096,4076999,4078430,4079444,4081039,4081165,4083046,4083863,4088341,4090550,4090553,4090806,4091420,4092183,4092245,4092628,4092827,4092934,4093498,4093792,4094055,4094251,4094544,4094837,4095574,4095787,4095910,4095998,4096324,4097129,4097153,4097203,4097866,4097922,4097929,4098047,4098721,4098728,4098752,4100150,4100169,4100380,4100825,4100859,4101375,4101651,4101681,4102020,4102099,4102411,4102658,4102753,4102987,4103060,4103183,4103238,4103474,4103987,4103999,4104006,4104290,4105239,4105317,8300497,8503585,8507380,8508229,8508707,8508931,8509037,8509373,8511650,10200083,10200096,19001720,19001764,19001922,41027342',authuser:0,kscs:'c9c918f0_24'};google.kHL='es';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute(\"eid\")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute(\"leid\")));)a=a.parentNode;return b};google.https=function(){return\"https:\"==window.location.protocol};google.ml=function(){return null};google.wl=function(a,b){try{google.ml(Error(a),!1,b)}catch(c){}};google.time=function(){return(new Date).getTime()};google.log=function(a,b,c,d,g){a=google.logUrl(a,b,c,d,g);if(\"\"!=a){b=new Image;var e=google.lc,f=google.li;e[f]=b;b.onerror=b.onload=b.onabort=function(){delete e[f]};window.google&&window.google.vel&&window.google.vel.lu&&window.google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,c,d,g){var e=\"\",f=google.ls||\"\";c||-1!=b.search(\"&ei=\")||(e=\"&ei=\"+google.getEI(d),-1==b.search(\"&lei=\")&&(d=google.getLEI(d))&&(e+=\"&lei=\"+d));a=c||\"/\"+(g||\"gen_204\")+\"?atyp=i&ct=\"+a+\"&cad=\"+b+e+f+\"&zx=\"+google.time();/^http:/i.test(a)&&google.https()&&(google.ml(Error(\"a\"),!1,{src:a,glmm:1}),a=\"\");return a};google.y={};google.x=function(a,b){google.y[a.id]=[a,b];return!1};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);var a=window.location,b=a.href.indexOf(\"#\");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf(\"#\")&&a.replace(\"/search?\"+c.replace(/(^|&)fp=[^&]*/g,\"\")+\"&cad=h\")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}body{background:#fff;color:black}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff !important}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}.ftl,#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script></script><link href=\"/images/branding/product/ico/googleg_lodp.ico\" rel=\"shortcut icon\"></head><body bgcolor=\"#fff\"><script>(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id=\"mngb\"> <div id=gbar><nobr><b class=gb1>Búsqueda</b> <a class=gb1 href=\"https://www.google.es/imghp?hl=es&tab=wi\">Imágenes</a> <a class=gb1 href=\"https://maps.google.es/maps?hl=es&tab=wl\">Maps</a> <a class=gb1 href=\"https://play.google.com/?hl=es&tab=w8\">Play</a> <a class=gb1 href=\"https://www.youtube.com/?gl=ES&tab=w1\">YouTube</a> <a class=gb1 href=\"https://news.google.es/nwshp?hl=es&tab=wn\">Noticias</a> <a class=gb1 href=\"https://mail.google.com/mail/?tab=wm\">Gmail</a> <a class=gb1 href=\"https://drive.google.com/?tab=wo\">Drive</a> <a class=gb1 style=\"text-decoration:none\" href=\"https://www.google.es/intl/es/options/\"><u>Más</u> »</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href=\"http://www.google.es/history/optout?hl=es\" class=gb4>Historial web</a> | <a  href=\"/preferences?hl=es\" class=gb4>Configuración</a> | <a target=_top id=gb_70 href=\"https://accounts.google.com/ServiceLogin?hl=es&passive=true&continue=https://www.google.es/%3Fgfe_rd%3Dcr%26ei%3DzwrdWNy9H4LVXu2VpOAE\" class=gb4>Iniciar sesión</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div> </div><center><br clear=\"all\" id=\"lgpd\"><div id=\"lga\"><div style=\"padding:28px 0 3px\"><div style=\"height:110px;width:276px;background:url(/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png) no-repeat\" title=\"Google\" align=\"left\" id=\"hplogo\" onload=\"window.lol&&lol()\"><div style=\"color:#777;font-size:16px;font-weight:bold;position:relative;top:70px;left:218px\" nowrap=\"\">España</div></div></div><br></div><form action=\"/search\" name=\"f\"><table cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\"><td width=\"25%\"> </td><td align=\"center\" nowrap=\"\"><input name=\"ie\" value=\"ISO-8859-1\" type=\"hidden\"><input value=\"es\" name=\"hl\" type=\"hidden\"><input name=\"source\" type=\"hidden\" value=\"hp\"><input name=\"biw\" type=\"hidden\"><input name=\"bih\" type=\"hidden\"><div class=\"ds\" style=\"height:32px;margin:4px 0\"><input style=\"color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top\" autocomplete=\"off\" class=\"lst\" value=\"\" title=\"Buscar con Google\" maxlength=\"2048\" name=\"q\" size=\"57\"></div><br style=\"line-height:0\"><span class=\"ds\"><span class=\"lsbb\"><input class=\"lsb\" value=\"Buscar con Google\" name=\"btnG\" type=\"submit\"></span></span><span class=\"ds\"><span class=\"lsbb\"><input class=\"lsb\" value=\"Voy a tener suerte\" name=\"btnI\" onclick=\"if(this.form.q.value)this.checked=1; else top.location='/doodles/'\" type=\"submit\"></span></span></td><td class=\"fl sblc\" align=\"left\" nowrap=\"\" width=\"25%\"><a href=\"/advanced_search?hl=es&authuser=0\">Búsqueda avanzada</a><a href=\"/language_tools?hl=es&authuser=0\">Herramientas del idioma</a></td></tr></table><input id=\"gbv\" name=\"gbv\" type=\"hidden\" value=\"1\"></form><div id=\"gac_scont\"></div><div style=\"font-size:83%;min-height:3.5em\"><br><div id=\"prm\"><style>.szppmdbYutt__middle-slot-promo{font-size:small;margin-bottom:32px}.szppmdbYutt__middle-slot-promo a._uFi{display:inline-block;text-decoration:none}.szppmdbYutt__middle-slot-promo img{border:none;margin-right:5px;vertical-align:middle}.szppmdbYutt__middle-slot-promo ._vFi{color:red}</style><div class=\"szppmdbYutt__middle-slot-promo r-itJmcvDa5V20\" jsl=\"$t t-Gza07Ho9En4;$x 0;\" data-ved=\"0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQnIcBCAQ\">Recorre los confines del mundo. <a class=\"_XIi\" href=\"https://www.google.com/url?q=https://www.google.com/maps/%4061.017504,-45.299466,3a,75y,248.21h,81.91t/data%3D!3m6!1e1!3m4!1sxRh_03mgvd7k4DYZhLy_fA!2e0!7i13312!8i6670&source=hpp&id=19001922&ct=3&usg=AFQjCNGSMFzu6dYrNjwBD6tC2CU6qUF4tA&sa=X&ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ8IcBCAU\" rel=\"nofollow\">Explora Groenlandia</a> en Google Maps.</div></div><div id=\"als\"><style>#als{font-size:small;margin-bottom:24px}#_eEe{display:inline-block;line-height:28px;}#_eEe a{padding:0 3px;}._lEe{display:inline-block;margin:0 2px;white-space:nowrap}._PEe{display:inline-block;margin:0 2px}</style><div id=\"_eEe\">Google.es también en: <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Dca%26source%3Dhomepage&sa=U&ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAc&usg=AFQjCNHFNrDxel2PpypWfm8Q8S_Hma4dBA\">català</a>  <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Dgl%26source%3Dhomepage&sa=U&ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAg&usg=AFQjCNFWHfz2qcwwnr3ukNqO0e5E-_K25A\">galego</a>  <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Deu%26source%3Dhomepage&sa=U&ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAk&usg=AFQjCNF2MZ0hnDNRZugUR8OTrCA7dp50Ag\">euskara</a> </div></div></div><span id=\"footer\"><div style=\"font-size:10pt\"><div style=\"margin:19px auto;text-align:center\" id=\"fll\"><a href=\"/intl/es/ads/\">Programas de publicidad</a><a href=\"http://www.google.es/intl/es/services/\">Soluciones Empresariales</a><a href=\"https://plus.google.com/115920203808848871228\" rel=\"publisher\">+Google</a><a href=\"/intl/es/about.html\">Todo acerca de Google</a><a href=\"https://www.google.es/setprefdomain?prefdom=US&sig=__JEQfki8NLT51lY27hVKTcD7x60I%3D\" id=\"fehl\">Google.com</a></div></div><p style=\"color:#767676;font-size:8pt\">© 2017 - <a href=\"/intl/es/policies/privacy/\">Privacidad</a> - <a href=\"/intl/es/policies/terms/\">Condiciones</a></p></span></center><script>(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b)var c=window.document,d=\"CSS1Compat\"==c.compatMode?c.documentElement:c.body,a=d.clientWidth,b=d.clientHeight;a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log(\"\",\"\",\"/client_204?&atyp=i&biw=\"+a+\"&bih=\"+b+\"&ei=\"+google.kEI);}).call(this);})();</script><div id=\"xjsd\"></div><div id=\"xjsi\"><script>(function(){function c(b){window.setTimeout(function(){var a=document.createElement(\"script\");a.src=b;document.getElementById(\"xjsd\").appendChild(a)},0)}google.dljp=function(b,a){google.xjsu=b;c(a)};google.dlj=c;}).call(this);(function(){window.google.xjsrm=['mids'];})();if(google.y)google.y.first=[];if(!google.xjs){window._=window._||{};window._DumpException=window._._DumpException=function(e){throw e};if(google.timers&&google.timers.load.t){google.timers.load.t.xjsls=new Date().getTime();}google.dljp('/xjs/_/js/k\\x3dxjs.hp.en_US.q7EuCVIfdZw.O/m\\x3dsb_he,d/am\\x3dAAg/rt\\x3dj/d\\x3d1/t\\x3dzcms/rs\\x3dACT90oHF3pWF1nFj9p3M-bzcFbKqP3_GDw','/xjs/_/js/k\\x3dxjs.hp.en_US.q7EuCVIfdZw.O/m\\x3dsb_he,d/am\\x3dAAg/rt\\x3dj/d\\x3d1/t\\x3dzcms/rs\\x3dACT90oHF3pWF1nFj9p3M-bzcFbKqP3_GDw');google.xjs=1;}google.pmc={\"sb_he\":{\"agen\":true,\"cgen\":true,\"client\":\"heirloom-hp\",\"dh\":true,\"dhqt\":true,\"ds\":\"\",\"fl\":true,\"host\":\"google.es\",\"isbh\":28,\"jam\":0,\"jsonp\":true,\"lm\":true,\"msgs\":{\"cibl\":\"Borrar búsqueda\",\"dym\":\"Quizás quisiste decir:\",\"lcky\":\"Voy a tener suerte\",\"lml\":\"Más información\",\"oskt\":\"Herramientas de introducción de texto\",\"psrc\":\"Esta búsqueda se ha eliminado de tu \\u003Ca href=\\\"/history\\\"\\u003Ehistorial web\\u003C/a\\u003E.\",\"psrl\":\"Eliminar\",\"sbit\":\"Buscar por imagen\",\"srch\":\"Buscar con Google\"},\"nds\":true,\"ovr\":{},\"pq\":\"\",\"refpd\":true,\"rfs\":[],\"sbpl\":24,\"sbpr\":24,\"scd\":10,\"sce\":5,\"stok\":\"mhB5xRw_UP_UKC2jJd_Cpa-6ZKQ\"},\"d\":{},\"YFCs/g\":{}};google.y.first.push(function(){if(google.med){google.med('init');google.initHistory();google.med('history');}});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}
</script></div></body></html>"
200
#<HASH-TABLE :TEST EQUAL :COUNT 13 {10075921A3}>
#<QURI.URI.HTTP:URI-HTTPS https://www.google.es/?gfe_rd=cr&ei=zwrdWNy9H4LVXu2VpOAE>
#<CL+SSL::SSL-STREAM for #<FD-STREAM for "socket 192.168.43.17:53430, peer: 172.217.20.67:443" {1007458073}>>
</code>```

Or activate SSlv3 in a cl+ssl context

Title: Access https page in Common Lisp error

Body:
Right now when I am trying in Common Lisp to connect to an https site with dexador I get this error:

   SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
       [Condition of type CL+SSL:SSL-ERROR-VERIFY]

What should I do?

Body:
I get this problem also, I do not get a good solution but it works. It seems that it is a issue:

CL-USER> (dex:get "https://www.google.com")
; Evaluation aborted on #<CL+SSL:SSL-ERROR-VERIFY {1006991FA3}>.

This issue is related here it seems that is a problem with the CAcerts file. that doesn't have the correct CA authorities and cl+ssl:

It may be related to SSLv3 is disabled by default in CL+SSL, so
  Dexador tries to connect with TLS 1.2.

SSL verification of Dexador is quite new and not mature at all. It
  would be better to specify the verification setting in Dexador easily,
  however, using cl+ssl:make-context to allow SSLv3 is the only option
  for now, I guess.

So for now you have two options:

1) make it insecure

CL-USER> (dex:get "https://www.google.com" :insecure t)
"<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org

....
peer: 216.58.211.227:443" {1004DD8003}>>

use the path for ca file usually at /etc/ssl/cert.pem

CL-USER> (dex:get "https://www.google.com" :ca-path "/etc/ssl/oldcert.pem")
"<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"es\"><head><meta content=\"Google.es permite acceder a la información mundial en castellano, catalán, gallego, euskara e inglés.\" name=\"description\"><meta content=\"noodp\" name=\"robots\"><meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\"><meta content=\"/images/branding/googleg/1x/googleg_standard_color_128dp.png\" itemprop=\"image\"><title>Google</title><script>(function(){window.google={kEI:'zwrdWM3qM4X9ae68n9gF',kEXPI:'1351891,1352993,1353040,1353108,1353148,3700248,3700347,3700405,3700407,4029815,4031109,4032677,4036527,4038012,4039268,4043492,4045841,4048347,4065786,4066196,4071842,4072364,4072776,4076096,4076999,4078430,4079444,4081039,4081165,4083046,4083863,4088341,4090550,4090553,4090806,4091420,4092183,4092245,4092628,4092827,4092934,4093498,4093792,4094055,4094251,4094544,4094837,4095574,4095787,4095910,4095998,4096324,4097129,4097153,4097203,4097866,4097922,4097929,4098047,4098721,4098728,4098752,4100150,4100169,4100380,4100825,4100859,4101375,4101651,4101681,4102020,4102099,4102411,4102658,4102753,4102987,4103060,4103183,4103238,4103474,4103987,4103999,4104006,4104290,4105239,4105317,8300497,8503585,8507380,8508229,8508707,8508931,8509037,8509373,8511650,10200083,10200096,19001720,19001764,19001922,41027342',authuser:0,kscs:'c9c918f0_24'};google.kHL='es';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute(\"eid\")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute(\"leid\")));)a=a.parentNode;return b};google.https=function(){return\"https:\"==window.location.protocol};google.ml=function(){return null};google.wl=function(a,b){try{google.ml(Error(a),!1,b)}catch(c){}};google.time=function(){return(new Date).getTime()};google.log=function(a,b,c,d,g){a=google.logUrl(a,b,c,d,g);if(\"\"!=a){b=new Image;var e=google.lc,f=google.li;e[f]=b;b.onerror=b.onload=b.onabort=function(){delete e[f]};window.google&&window.google.vel&&window.google.vel.lu&&window.google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,c,d,g){var e=\"\",f=google.ls||\"\";c||-1!=b.search(\"&ei=\")||(e=\"&ei=\"+google.getEI(d),-1==b.search(\"&lei=\")&&(d=google.getLEI(d))&&(e+=\"&lei=\"+d));a=c||\"/\"+(g||\"gen_204\")+\"?atyp=i&ct=\"+a+\"&cad=\"+b+e+f+\"&zx=\"+google.time();/^http:/i.test(a)&&google.https()&&(google.ml(Error(\"a\"),!1,{src:a,glmm:1}),a=\"\");return a};google.y={};google.x=function(a,b){google.y[a.id]=[a,b];return!1};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);var a=window.location,b=a.href.indexOf(\"#\");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf(\"#\")&&a.replace(\"/search?\"+c.replace(/(^|&)fp=[^&]*/g,\"\")+\"&cad=h\")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}body{background:#fff;color:black}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff !important}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}.ftl,#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script></script><link href=\"/images/branding/product/ico/googleg_lodp.ico\" rel=\"shortcut icon\"></head><body bgcolor=\"#fff\"><script>(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id=\"mngb\"> <div id=gbar><nobr><b class=gb1>Búsqueda</b> <a class=gb1 href=\"https://www.google.es/imghp?hl=es&tab=wi\">Imágenes</a> <a class=gb1 href=\"https://maps.google.es/maps?hl=es&tab=wl\">Maps</a> <a class=gb1 href=\"https://play.google.com/?hl=es&tab=w8\">Play</a> <a class=gb1 href=\"https://www.youtube.com/?gl=ES&tab=w1\">YouTube</a> <a class=gb1 href=\"https://news.google.es/nwshp?hl=es&tab=wn\">Noticias</a> <a class=gb1 href=\"https://mail.google.com/mail/?tab=wm\">Gmail</a> <a class=gb1 href=\"https://drive.google.com/?tab=wo\">Drive</a> <a class=gb1 style=\"text-decoration:none\" href=\"https://www.google.es/intl/es/options/\"><u>Más</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href=\"http://www.google.es/history/optout?hl=es\" class=gb4>Historial web</a> | <a  href=\"/preferences?hl=es\" class=gb4>Configuración</a> | <a target=_top id=gb_70 href=\"https://accounts.google.com/ServiceLogin?hl=es&passive=true&continue=https://www.google.es/%3Fgfe_rd%3Dcr%26ei%3DzwrdWNy9H4LVXu2VpOAE\" class=gb4>Iniciar sesión</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div> </div><center><br clear=\"all\" id=\"lgpd\"><div id=\"lga\"><div style=\"padding:28px 0 3px\"><div style=\"height:110px;width:276px;background:url(/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png) no-repeat\" title=\"Google\" align=\"left\" id=\"hplogo\" onload=\"window.lol&&lol()\"><div style=\"color:#777;font-size:16px;font-weight:bold;position:relative;top:70px;left:218px\" nowrap=\"\">Espa&ntilde;a</div></div></div><br></div><form action=\"/search\" name=\"f\"><table cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\"><td width=\"25%\">&nbsp;</td><td align=\"center\" nowrap=\"\"><input name=\"ie\" value=\"ISO-8859-1\" type=\"hidden\"><input value=\"es\" name=\"hl\" type=\"hidden\"><input name=\"source\" type=\"hidden\" value=\"hp\"><input name=\"biw\" type=\"hidden\"><input name=\"bih\" type=\"hidden\"><div class=\"ds\" style=\"height:32px;margin:4px 0\"><input style=\"color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top\" autocomplete=\"off\" class=\"lst\" value=\"\" title=\"Buscar con Google\" maxlength=\"2048\" name=\"q\" size=\"57\"></div><br style=\"line-height:0\"><span class=\"ds\"><span class=\"lsbb\"><input class=\"lsb\" value=\"Buscar con Google\" name=\"btnG\" type=\"submit\"></span></span><span class=\"ds\"><span class=\"lsbb\"><input class=\"lsb\" value=\"Voy a tener suerte\" name=\"btnI\" onclick=\"if(this.form.q.value)this.checked=1; else top.location='/doodles/'\" type=\"submit\"></span></span></td><td class=\"fl sblc\" align=\"left\" nowrap=\"\" width=\"25%\"><a href=\"/advanced_search?hl=es&amp;authuser=0\">Búsqueda avanzada</a><a href=\"/language_tools?hl=es&amp;authuser=0\">Herramientas del idioma</a></td></tr></table><input id=\"gbv\" name=\"gbv\" type=\"hidden\" value=\"1\"></form><div id=\"gac_scont\"></div><div style=\"font-size:83%;min-height:3.5em\"><br><div id=\"prm\"><style>.szppmdbYutt__middle-slot-promo{font-size:small;margin-bottom:32px}.szppmdbYutt__middle-slot-promo a._uFi{display:inline-block;text-decoration:none}.szppmdbYutt__middle-slot-promo img{border:none;margin-right:5px;vertical-align:middle}.szppmdbYutt__middle-slot-promo ._vFi{color:red}</style><div class=\"szppmdbYutt__middle-slot-promo r-itJmcvDa5V20\" jsl=\"$t t-Gza07Ho9En4;$x 0;\" data-ved=\"0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQnIcBCAQ\">Recorre los confines del mundo. <a class=\"_XIi\" href=\"https://www.google.com/url?q=https://www.google.com/maps/%4061.017504,-45.299466,3a,75y,248.21h,81.91t/data%3D!3m6!1e1!3m4!1sxRh_03mgvd7k4DYZhLy_fA!2e0!7i13312!8i6670&amp;source=hpp&amp;id=19001922&amp;ct=3&amp;usg=AFQjCNGSMFzu6dYrNjwBD6tC2CU6qUF4tA&amp;sa=X&amp;ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ8IcBCAU\" rel=\"nofollow\">Explora Groenlandia</a> en Google Maps.</div></div><div id=\"als\"><style>#als{font-size:small;margin-bottom:24px}#_eEe{display:inline-block;line-height:28px;}#_eEe a{padding:0 3px;}._lEe{display:inline-block;margin:0 2px;white-space:nowrap}._PEe{display:inline-block;margin:0 2px}</style><div id=\"_eEe\">Google.es también en: <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Dca%26source%3Dhomepage&amp;sa=U&amp;ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAc&amp;usg=AFQjCNHFNrDxel2PpypWfm8Q8S_Hma4dBA\">català</a>  <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Dgl%26source%3Dhomepage&amp;sa=U&amp;ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAg&amp;usg=AFQjCNFWHfz2qcwwnr3ukNqO0e5E-_K25A\">galego</a>  <a href=\"/url?q=https://www.google.es/setprefs%3Fsig%3D0_4urS_u8UYjdxr9RWPRUbF0f5UVE%253D%26hl%3Deu%26source%3Dhomepage&amp;sa=U&amp;ved=0ahUKEwiNjuixrf7SAhWFfhoKHW7eB1sQ2ZgBCAk&amp;usg=AFQjCNF2MZ0hnDNRZugUR8OTrCA7dp50Ag\">euskara</a> </div></div></div><span id=\"footer\"><div style=\"font-size:10pt\"><div style=\"margin:19px auto;text-align:center\" id=\"fll\"><a href=\"/intl/es/ads/\">Programas de publicidad</a><a href=\"http://www.google.es/intl/es/services/\">Soluciones Empresariales</a><a href=\"https://plus.google.com/115920203808848871228\" rel=\"publisher\">+Google</a><a href=\"/intl/es/about.html\">Todo acerca de Google</a><a href=\"https://www.google.es/setprefdomain?prefdom=US&amp;sig=__JEQfki8NLT51lY27hVKTcD7x60I%3D\" id=\"fehl\">Google.com</a></div></div><p style=\"color:#767676;font-size:8pt\">&copy; 2017 - <a href=\"/intl/es/policies/privacy/\">Privacidad</a> - <a href=\"/intl/es/policies/terms/\">Condiciones</a></p></span></center><script>(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b)var c=window.document,d=\"CSS1Compat\"==c.compatMode?c.documentElement:c.body,a=d.clientWidth,b=d.clientHeight;a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log(\"\",\"\",\"/client_204?&atyp=i&biw=\"+a+\"&bih=\"+b+\"&ei=\"+google.kEI);}).call(this);})();</script><div id=\"xjsd\"></div><div id=\"xjsi\"><script>(function(){function c(b){window.setTimeout(function(){var a=document.createElement(\"script\");a.src=b;document.getElementById(\"xjsd\").appendChild(a)},0)}google.dljp=function(b,a){google.xjsu=b;c(a)};google.dlj=c;}).call(this);(function(){window.google.xjsrm=['mids'];})();if(google.y)google.y.first=[];if(!google.xjs){window._=window._||{};window._DumpException=window._._DumpException=function(e){throw e};if(google.timers&&google.timers.load.t){google.timers.load.t.xjsls=new Date().getTime();}google.dljp('/xjs/_/js/k\\x3dxjs.hp.en_US.q7EuCVIfdZw.O/m\\x3dsb_he,d/am\\x3dAAg/rt\\x3dj/d\\x3d1/t\\x3dzcms/rs\\x3dACT90oHF3pWF1nFj9p3M-bzcFbKqP3_GDw','/xjs/_/js/k\\x3dxjs.hp.en_US.q7EuCVIfdZw.O/m\\x3dsb_he,d/am\\x3dAAg/rt\\x3dj/d\\x3d1/t\\x3dzcms/rs\\x3dACT90oHF3pWF1nFj9p3M-bzcFbKqP3_GDw');google.xjs=1;}google.pmc={\"sb_he\":{\"agen\":true,\"cgen\":true,\"client\":\"heirloom-hp\",\"dh\":true,\"dhqt\":true,\"ds\":\"\",\"fl\":true,\"host\":\"google.es\",\"isbh\":28,\"jam\":0,\"jsonp\":true,\"lm\":true,\"msgs\":{\"cibl\":\"Borrar búsqueda\",\"dym\":\"Quizás quisiste decir:\",\"lcky\":\"Voy a tener suerte\",\"lml\":\"Más información\",\"oskt\":\"Herramientas de introducción de texto\",\"psrc\":\"Esta búsqueda se ha eliminado de tu \\u003Ca href=\\\"/history\\\"\\u003Ehistorial web\\u003C/a\\u003E.\",\"psrl\":\"Eliminar\",\"sbit\":\"Buscar por imagen\",\"srch\":\"Buscar con Google\"},\"nds\":true,\"ovr\":{},\"pq\":\"\",\"refpd\":true,\"rfs\":[],\"sbpl\":24,\"sbpr\":24,\"scd\":10,\"sce\":5,\"stok\":\"mhB5xRw_UP_UKC2jJd_Cpa-6ZKQ\"},\"d\":{},\"YFCs/g\":{}};google.y.first.push(function(){if(google.med){google.med('init');google.initHistory();google.med('history');}});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}
</script></div></body></html>"
200
#<HASH-TABLE :TEST EQUAL :COUNT 13 {10075921A3}>
#<QURI.URI.HTTP:URI-HTTPS https://www.google.es/?gfe_rd=cr&ei=zwrdWNy9H4LVXu2VpOAE>
#<CL+SSL::SSL-STREAM for #<FD-STREAM for "socket 192.168.43.17:53430, peer: 172.217.20.67:443" {1007458073}>>

Or activate SSlv3 in a cl+ssl context


问:
How to compare if any of the elements in a row is same
Is there a way to compare whether "any value of" a row is identical to "any value" of the row above -- regardless of the order? Below is a very random input data table.

```<code>DT <- data.table(A=c("a","a","b","d","e","f","h","i","j"),
                 B=c("a","b","c","c","f","g",NA,"j",NA),
                 C=c("a","b","c","b","g","h",NA,NA,NA))

> DT
   A  B  C
1: a  a  a
2: a  b  b
3: b  c  c
4: d  c  b
5: e  f  g
6: f  g  h
7: h NA NA
8: i  j NA
9: j NA NA
</code>```

I would like to add a column D that compares a row with the row above, and compare whether any values of the two rows are identical (regardless of the order). So the desired output would be:

```<code> > DT
   A  B  C  D
1: a  a  a  0 #No row above to compare; could be either NA or 0
2: a  b  b  1 #row 2 has "a", which is in row 1; returns 1
3: b  c  c  1 #row 3 has "b", which is in row 2; returns 1
4: d  c  b  1 #row 4 has "b" and "c", which are in row 3; returns 1
5: e  f  g  0 #row 5 has nothing that is in row 4; returns 0
6: f  g  h  1 #row 6 has "f" and "g", which are in row 5; returns 1
7: h NA NA  1 #row 7 has "h", which is in row 6; returns 1
8: i  j NA  0 #row 8 has nothing that is in row 7 (NA doesn't count)
9: j NA NA  1 #row 9 has "j", which is in row 8; returns 1 (NA doesn't count)
</code>```

The main idea is that I would like to compare a row (or a vector) with another row (vector), and define two rows to be identical if any of the elements in each row (vector) are.  (without reiterating to compare each element)

答:
Using a combination of intersect and mapply you could do:

```<code>#list of unique elements in each row
tableList = apply(DT,1,function(x) unique(na.omit(x)))

#a lagged list to be compared with above list
tableListLag = c(NA,tableList[2:length(tableList)-1])

#find common elements using intersect function
#if length > 0 implies common elements hence set value as 1 else 0
DT$D = mapply(function(x,y) ifelse(length(intersect(x,y))>0,1,0) ,tableList,tableListLag,
             SIMPLIFY = TRUE)

DT
#   A  B  C D
#1: a  a  a 0
#2: a  b  b 1
#3: b  c  c 1
#4: d  c  b 1
#5: e  f  g 0
#6: f  g  h 1
#7: h NA NA 1
#8: i  j NA 0
#9: j NA NA 1
</code>```

Body:
Is there a way to compare whether "any value of" a row is identical to "any value" of the row above -- regardless of the order? Below is a very random input data table.

DT <- data.table(A=c("a","a","b","d","e","f","h","i","j"),
                 B=c("a","b","c","c","f","g",NA,"j",NA),
                 C=c("a","b","c","b","g","h",NA,NA,NA))

> DT
   A  B  C
1: a  a  a
2: a  b  b
3: b  c  c
4: d  c  b
5: e  f  g
6: f  g  h
7: h NA NA
8: i  j NA
9: j NA NA

I would like to add a column D that compares a row with the row above, and compare whether any values of the two rows are identical (regardless of the order). So the desired output would be:

 > DT
   A  B  C  D
1: a  a  a  0 #No row above to compare; could be either NA or 0
2: a  b  b  1 #row 2 has "a", which is in row 1; returns 1
3: b  c  c  1 #row 3 has "b", which is in row 2; returns 1
4: d  c  b  1 #row 4 has "b" and "c", which are in row 3; returns 1
5: e  f  g  0 #row 5 has nothing that is in row 4; returns 0
6: f  g  h  1 #row 6 has "f" and "g", which are in row 5; returns 1
7: h NA NA  1 #row 7 has "h", which is in row 6; returns 1
8: i  j NA  0 #row 8 has nothing that is in row 7 (NA doesn't count)
9: j NA NA  1 #row 9 has "j", which is in row 8; returns 1 (NA doesn't count)

The main idea is that I would like to compare a row (or a vector) with another row (vector), and define two rows to be identical if any of the elements in each row (vector) are.  (without reiterating to compare each element)

Body:
Using a combination of intersect and mapply you could do:

#list of unique elements in each row
tableList = apply(DT,1,function(x) unique(na.omit(x)))

#a lagged list to be compared with above list
tableListLag = c(NA,tableList[2:length(tableList)-1])

#find common elements using intersect function
#if length > 0 implies common elements hence set value as 1 else 0
DT$D = mapply(function(x,y) ifelse(length(intersect(x,y))>0,1,0) ,tableList,tableListLag,
             SIMPLIFY = TRUE)

DT
#   A  B  C D
#1: a  a  a 0
#2: a  b  b 1
#3: b  c  c 1
#4: d  c  b 1
#5: e  f  g 0
#6: f  g  h 1
#7: h NA NA 1
#8: i  j NA 0
#9: j NA NA 1


问:
How to clone button between tabs C# Visual Studio 2015
Example

Hi! How can I clone a button on other tabs? I need the same button in many tabs, the same button with the same proprieties, same code, same events, same name, ect.

"Compress file" button is going to be the same in Tab1, Tab4, Tab6 and Tab8... is going to do the same thing in many tabs, therebefore I don't want to make a new button every time. I don't want to make 10000 buttons which do the same thing.

I need to clone many buttons, not just "compress file", that's why I can't just put "Compress file" outside the TabControl and make it invisible or visible.

I'm working on Visual Studio 2015 with C#.

答:
Add new User Control to your project and a button to with Click event.
Code behind:

```<code>public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();
    }

    // Add some public properties to Caculate
    public string SomeProperties { get; set; }

    private void button1_Click(object sender, EventArgs e)
    {
        // Some tasks that you often do ...........

    }
}
</code>```

You could use it in any where you want.

Body:
Add new User Control to your project and a button to with Click event.
Code behind:

public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();
    }

    // Add some public properties to Caculate
    public string SomeProperties { get; set; }

    private void button1_Click(object sender, EventArgs e)
    {
        // Some tasks that you often do ...........

    }
}

You could use it in any where you want.


问:
angular 2 - how to hide nav bar in some components
I am created nav bar separately in nav.component.html ,how to hide nav bar in some components like login.component.

nav.component.html

```<code><nav class="navbar navbar-default navbar-fixed-top navClass">
    <div class="container-fluid">
        <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed"
                        (click)="toggleState()">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

        </div>
         <div class="collapse navbar-collapse"
              [ngClass]="{ 'in': isIn }">
          enter code here   <ul class="nav navbar-nav">
               <li class="active"><a href="#">Home</a></li>
               <li><a href="#">about</a></li>

            </ul>

        </div>
    </div>
</nav>
</code>```

答:
Add *ngIf='!showNav' in template

```<code><nav class="navbar navbar-default navbar-fixed-top navClass" *ngIf='!showNav' >
</code>```

And in LoginComponent

```<code>showNav = true;
</code>```

This will show nav rest of the all the pages , if you want to hide in any pages just put showNav = true; in that component.

How it works :

First for it will check for showNav variable but it will not be available , so it will return false for the other pages where we want to show menu , so need to declare that variable any other pages.

In login page we set the value to true, so it will make it false and hide the nav.

Body:
I am created nav bar separately in nav.component.html ,how to hide nav bar in some components like login.component.

nav.component.html

                <button type="button" class="navbar-toggle collapsed"
                        (click)="toggleState()">
                Toggle navigation

            </button>

          enter code here

Home

about

Body:
Add *ngIf='!showNav' in template

<nav class="navbar navbar-default navbar-fixed-top navClass" *ngIf='!showNav' >

And in LoginComponent

showNav = true;

This will show nav rest of the all the pages , if you want to hide in any pages just put showNav = true; in that component.

How it works :

First for it will check for showNav variable but it will not be available , so it will return false for the other pages where we want to show menu , so need to declare that variable any other pages.

In login page we set the value to true, so it will make it false and hide the nav.


问:
Clear the value in a datetimepicker field
I'm sure this is simple and it's my understanding of jquery/javascript that is holding me back - but I can't get this to work.

All I need to do - is - When a button on the screen is clicked, clear some of the input field on the form back to their original values.

This is working fine, for all fields except a datetimepicker field.

Here is the relevant bits of code, that defines the input field :

```<code><div class='form-group' id='START_DATEFormGroup'>
<label for='START_DATE' class='col-sm-2 control-label' data-toggle='tooltip' data-placement='top' title=''>Start Date</label>
<div class='col-sm-8'>
<div class='input-group date form_date col-sm-3'  data-date-format='dd M yyyy' data-link-field='START_DATE' data-link-format='yyyy-mm-dd'>
<input class='form-control' size='16' type='text'  />
<input type='hidden' id='START_DATE' name='START_DATE' />
<span class='input-group-addon'>
<span class='glyphicon glyphicon-calendar'>
</span> // group-addon
</span> // calendar
</div> // form_date
</div> // col-sm-8
</div> // form-group
</code>```

I am initializing datetimepicker as follows :

```<code>function enableDatepicker(){
    $( document ).ready(function() {
         $('.form_date').datetimepicker({
            format: 'dd M yyyy',
            minView: 2,
            autoclose: 1,
            })
    });
}
</code>```

To clear the input fields down I have :

```<code>function clearActionForm(){
     // code here to clear the various input fields to null or their initial values.
     // Need statements to clear the datetimepicker field to null.

}
</code>```

So, can someone give me the line(s) of code I need to insert into clearActionForm() in order to clear the START_DATE field to null.

Thanks.

答:
If you are using the eonasdan datetimepicker use the following:</p>

```<code>// clears
$j(".form_date").data("DateTimePicker").setDate(null);

// updates to now
$j(".form_date").data("DateTimePicker").setDate(new Date());

// or update to a given date
var myCoolDate = "05/27/1975";
$j(".form_date").data("DateTimePicker").setDate(myCoolDate);
</code>```

Body:
I'm sure this is simple and it's my understanding of jquery/javascript that is holding me back - but I can't get this to work.

All I need to do - is - When a button on the screen is clicked, clear some of the input field on the form back to their original values.

This is working fine, for all fields except a datetimepicker field.

Here is the relevant bits of code, that defines the input field :

Start Date

<input class='form-control' size='16' type='text'  />
<input type='hidden' id='START_DATE' name='START_DATE' />

 // group-addon
 // calendar

 // form_date

 // col-sm-8

 // form-group

I am initializing datetimepicker as follows :

function enableDatepicker(){
    $( document ).ready(function() {
         $('.form_date').datetimepicker({
            format: 'dd M yyyy',
            minView: 2,
            autoclose: 1,
            })
    });
}

To clear the input fields down I have :

function clearActionForm(){
     // code here to clear the various input fields to null or their initial values.
     // Need statements to clear the datetimepicker field to null.

}

So, can someone give me the line(s) of code I need to insert into clearActionForm() in order to clear the START_DATE field to null.

Thanks.

Body:
If you are using the eonasdan datetimepicker use the following:

// clears
$j(".form_date").data("DateTimePicker").setDate(null);

// updates to now
$j(".form_date").data("DateTimePicker").setDate(new Date());

// or update to a given date
var myCoolDate = "05/27/1975";
$j(".form_date").data("DateTimePicker").setDate(myCoolDate);


问:
Android application crashes on Volley JsonObject POST request
I'm trying write a splash screen that attempts to authenticate the users' credentials if they exist already in SharedPreference, but the application shuts itself down without warning on the line the request is added to the RequestQueue. What should I do to resolve this issue? </p>

```<code>File prefFile = new File("/data/data/"+getPackageName()+"/shared_prefs/"+getPackageName()
            +"_preferences.xml");
    System.out.println(prefFile.toString());
    if(prefFile.exists()) {
        System.out.println("Found Preference File");
       final SharedPreferences pref = new SecurePreferences(getApplicationContext());

        Map<String, String> authParams = new HashMap<String, String>();
        authParams.put("key", pref.getString("key",""));
        authParams.put("action", "validate");

        System.out.println("now authenticating");
        JsonObjectRequest authRequest = new JsonObjectRequest(Request.Method.POST, AUTH_URL,
                new JSONObject(authParams), new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
              /*  Intent intent = new Intent(LaunchScreen.this, BaseActivity.class);
                startActivity(intent); */
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                NetworkResponse response = error.networkResponse;
                System.out.println(response.toString());
                System.out.println(error.getMessage());
                error.printStackTrace();
            }
        }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> headers = new HashMap<String, String>();
                headers.put("Accept", "application/json");
                headers.put("Authorization", "Token " + pref.getString("key",""));

                return headers;
            }

            @Override
            public String getBodyContentType() {
                return "application/json";
            }
        };
        System.out.println("adding to queue");
        Volley.newRequestQueue(getApplicationContext()).add(authRequest);
    } else {
        System.out.println("Opening Login Activity");
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
    }
</code>```

答:
You could try this in the onErrorResponse method:

```<code>VolleyLog.e(error.getMessage());
</code>```

Then, check your logs in Android ADB monitor

Body:
I'm trying write a splash screen that attempts to authenticate the users' credentials if they exist already in SharedPreference, but the application shuts itself down without warning on the line the request is added to the RequestQueue. What should I do to resolve this issue?

File prefFile = new File("/data/data/"+getPackageName()+"/shared_prefs/"+getPackageName()
            +"_preferences.xml");
    System.out.println(prefFile.toString());
    if(prefFile.exists()) {
        System.out.println("Found Preference File");
       final SharedPreferences pref = new SecurePreferences(getApplicationContext());

        Map<String, String> authParams = new HashMap<String, String>();
        authParams.put("key", pref.getString("key",""));
        authParams.put("action", "validate");

        System.out.println("now authenticating");
        JsonObjectRequest authRequest = new JsonObjectRequest(Request.Method.POST, AUTH_URL,
                new JSONObject(authParams), new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
              /*  Intent intent = new Intent(LaunchScreen.this, BaseActivity.class);
                startActivity(intent); */
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                NetworkResponse response = error.networkResponse;
                System.out.println(response.toString());
                System.out.println(error.getMessage());
                error.printStackTrace();
            }
        }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> headers = new HashMap<String, String>();
                headers.put("Accept", "application/json");
                headers.put("Authorization", "Token " + pref.getString("key",""));

                return headers;
            }

            @Override
            public String getBodyContentType() {
                return "application/json";
            }
        };
        System.out.println("adding to queue");
        Volley.newRequestQueue(getApplicationContext()).add(authRequest);
    } else {
        System.out.println("Opening Login Activity");
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
    }

Body:
You could try this in the onErrorResponse method:

VolleyLog.e(error.getMessage());

Then, check your logs in Android ADB monitor


问:
Why must a:hover come after a:link and a:visited in the CSS?
Why does w3schools say that when we write anchor pseudo-classes in CSS we should write a:link first then a:visited followed by a:hover and finally a:active to be effective?

From: https://www.w3schools.com/css/tryit.asp?filename=trycss_link

How does the order of pseudo-classes effect the effectiveness?

答:
From SitePoint

This isn’t the only useful order, nor is it in any way the “right” order. The order in which you specify your pseudo-classes will depend on the effects you want to show with different combinations of states.


问:
nodejs - Parameters I am sending via POST are undefined
server.js:

```<code>    var express = require('express');
    var bodyParser = require('body-parser');
    var app = express();
    loggedIn = {};

    app.use('/',express.static('www')); // static files
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: true }));

    app.listen(8080, function () {
      console.log('Port 8080!');
    });

    app.get('/user', function(req, res) {
        if (typeof req.query.user != 'undefined') {
            user = req.query.user;
            res.status(200).send('Works');
        }
    });

    app.post('/user', function(req, res) {
            user = req.body.user;
            if (typeof users[user] != 'undefined') {
                return res.status(405).send('Access Forbidden');
            } else {
                   loggedIn.push(user);
                   res.status(201).send('New User');
            }
        }
    });
</code>```

client.js requests:

```<code>    $.ajax({
        method: "GET",
        url: "/user",
        data: {"user" : user},
        dataType: "application/json",
        success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });

    $.ajax({
        method: "POST",
        url: "/user",
        data: {"user" : user},
        dataType: "application/json",
        success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });
</code>```

Even though the GET request works exactly as expected but POST doesn't. Whenever I try to pass a POST request through, it hangs in limbo, even though all the parameters show up in Firebug. When I try to force ContentType to application/json, I get an "Unexpected token u" error an 400 Bad Request, meaning what I am sending through is undefined, even though there are clearly parameters with values visible in Firebug when I check the POST request there and I know for a fact I am passing something given the fact that in Firebug, the variables I am passing have values as seen in the DOM section and those same values pop up in the POST request under Firebug (parameters - user = "some text here").

答:
Try to send your data in string

```<code> $.ajax({
        method: "POST",
        url: "/user",
        data: JSON.stringify({"user" : user}),
        contentType: "application/json; charset=utf-8",
          success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });
</code>```

Hope it works!

Body:
server.js:

    var express = require('express');
    var bodyParser = require('body-parser');
    var app = express();
    loggedIn = {};

    app.use('/',express.static('www')); // static files
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: true }));

    app.listen(8080, function () {
      console.log('Port 8080!');
    });

    app.get('/user', function(req, res) {
        if (typeof req.query.user != 'undefined') {
            user = req.query.user;
            res.status(200).send('Works');
        }
    });

    app.post('/user', function(req, res) {
            user = req.body.user;
            if (typeof users[user] != 'undefined') {
                return res.status(405).send('Access Forbidden');
            } else {
                   loggedIn.push(user);
                   res.status(201).send('New User');
            }
        }
    });

client.js requests:

    $.ajax({
        method: "GET",
        url: "/user",
        data: {"user" : user},
        dataType: "application/json",
        success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });

    $.ajax({
        method: "POST",
        url: "/user",
        data: {"user" : user},
        dataType: "application/json",
        success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });

Even though the GET request works exactly as expected but POST doesn't. Whenever I try to pass a POST request through, it hangs in limbo, even though all the parameters show up in Firebug. When I try to force ContentType to application/json, I get an "Unexpected token u" error an 400 Bad Request, meaning what I am sending through is undefined, even though there are clearly parameters with values visible in Firebug when I check the POST request there and I know for a fact I am passing something given the fact that in Firebug, the variables I am passing have values as seen in the DOM section and those same values pop up in the POST request under Firebug (parameters - user = "some text here").

Body:
Try to send your data in string

 $.ajax({
        method: "POST",
        url: "/user",
        data: JSON.stringify({"user" : user}),
        contentType: "application/json; charset=utf-8",
          success: function(data) {
            // success
        },
        error: function() {
            // error case
        }
    });

Hope it works!


问:
how to convert PHP generated Feed to XML
I've generated a Feed in xml-feed.php file using PHP SimpleXML, how can I "transfer" properly the output to XML file xml-feed.xml ? </p>

```<code>  $xmlFeed = simplexml_load_file('https://feed_URL.com');
  echo "<products>";
  foreach ($xmlFeed->product as $prod) {
    echo "<product>";
    echo "<merchant_id>".$prod->merchant_id."</merchant_id>";
    echo "<upc_ean>".$prod->upc_ean."</upc_ean>";
    echo "<product_url>".$prod->product_url."</product_url>";
    echo "<image_url>".$prod->image_url."</image_url>";
    echo "<designation>".$prod->designation."</designation>";
    echo "<description>".$prod->description."</description>";
    echo "<brand>".$prod->brand."</brand>";
    echo "<category>".$prod->category."</category>";
    echo "<price>".convertCurrency($prod->price, "USD", "PLN")."</price>";
    echo "<availability>".$prod->availability."</availability>";
    echo "<condition>".$prod->condition."</condition>";
    echo "</product>";
  }
  echo "</products>";
</code>```

答:
Thanks! I'v made another approach :)
To xml-feed.xml on top I've added:

```<code><?php
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
</code>```

and to .htaccess:

```<code>AddHandler application/x-httpd-php56 .xml
</code>```

Body:
I've generated a Feed in xml-feed.php file using PHP SimpleXML, how can I "transfer" properly the output to XML file xml-feed.xml ?

  $xmlFeed = simplexml_load_file('https://feed_URL.com');
  echo "<products>";
  foreach ($xmlFeed->product as $prod) {
    echo "<product>";
    echo "<merchant_id>".$prod->merchant_id."</merchant_id>";
    echo "<upc_ean>".$prod->upc_ean."</upc_ean>";
    echo "<product_url>".$prod->product_url."</product_url>";
    echo "<image_url>".$prod->image_url."</image_url>";
    echo "<designation>".$prod->designation."</designation>";
    echo "<description>".$prod->description."</description>";
    echo "<brand>".$prod->brand."</brand>";
    echo "<category>".$prod->category."</category>";
    echo "<price>".convertCurrency($prod->price, "USD", "PLN")."</price>";
    echo "<availability>".$prod->availability."</availability>";
    echo "<condition>".$prod->condition."</condition>";
    echo "</product>";
  }
  echo "</products>";

Body:
Thanks! I'v made another approach :)
To xml-feed.xml on top I've added:

<?php
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

and to .htaccess:

AddHandler application/x-httpd-php56 .xml


问:
Change IronPython version in Edge.js?
I am testing Edge.JS since I need to run Python functions from Node.js. The problem is that Edge seems to want another version of IronPython:

Could not load file or assembly 'IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies. The system cannot find the file specified.

I have 2.7.6.3 installed, should I downgrade? Or is there a way to set the version in edge?

答: The problem come from Edge, where the version number is hardcoded.</p>

Title: Change IronPython version in Edge.js?