问:
Bing custom search apis returning only limited results from one location and full result from different location
I am trying to use Bing Custom Search's API for documents from Cognitive Services. The strange thing is that when I run it from India, it gives me more than a thousand results, but when I run it from a US server, it returns only 25 (sometimes 50 results). Here is the sample code for that:

var totalCount = 0;
var filetypes = new List<string> { "pdf", "docx", "doc" };
foreach (var filetype in filetypes)
{
    var searchTerm = "microsoft%20.net%20resume+filetype%3a" + filetype;
    Console.WriteLine("Searching for : " + filetype);

    for (var i = 0; i < 40; i++)
    {
        var nextCount = 0;
        var url = "https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?" +
                  "q=" + searchTerm +
                  "&customconfig=" + customConfigId +
                  "&count=25" + "&offset=" + ((i * 25) + nextCount);

        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
            var httpResponseMessage = client.GetAsync(url).Result;
            var responseContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
            BingCustomSearchResponse response =
                JsonConvert.DeserializeObject<BingCustomSearchResponse>(responseContent);

            if (response.webPages == null || response.webPages.value.Length <= 0)
            {
                Console.WriteLine("response.webPages is null ");
                break;
            }

            foreach (var webPage in response.webPages.value)
            {
                Console.WriteLine("name: " + webPage.name);
                Console.WriteLine("url: " + webPage.url);
                Console.WriteLine("displayUrl: " + webPage.displayUrl);
                Console.WriteLine("snippet: " + webPage.snippet);
                Console.WriteLine("dateLastCrawled: " + webPage.dateLastCrawled);
                Console.WriteLine();
            }
            totalCount = totalCount + response.webPages.value.Length;
        }
    }
}
```

The subscription key I am using is a trial key.

答:
Two things you can try: 1) In searchTerm, no need to use %20 and %3a, just use punctuations as you type in Bing, e.g. var searchTerm = "microsoft.net resume filetype::"+filetype, and 2) Enforce market by appending mkt=en-in (for India) or en-us (for US) in the query. You can do this by appending +"&mkt=en-in" at the end of url.

I presume for custom search you have selected domains (for both en-in and en-us markets) that return thousands of results for this query.

Body:
I am trying to use Bing Custom Search's API for documents from Cognitive Services. The strange thing is that when I run it from India, it gives me more than a thousand results, but when I run it from a US server, it returns only 25 (sometimes 50 results). Here is the sample code for that:

var totalCount = 0;
var filetypes = new List<string> { "pdf", "docx", "doc" };
foreach (var filetype in filetypes)
{
    var searchTerm = "microsoft%20.net%20resume+filetype%3a" + filetype;
    Console.WriteLine("Searching for : " + filetype);

    for (var i = 0; i < 40; i++)
    {
        var nextCount = 0;
        var url = "https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?" +
                  "q=" + searchTerm +
                  "&customconfig=" + customConfigId +
                  "&count=25" + "&offset=" + ((i * 25) + nextCount);

        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
            var httpResponseMessage = client.GetAsync(url).Result;
            var responseContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
            BingCustomSearchResponse response =
                JsonConvert.DeserializeObject<BingCustomSearchResponse>(responseContent);

            if (response.webPages == null || response.webPages.value.Length <= 0)
            {
                Console.WriteLine("response.webPages is null ");
                break;
            }

            foreach (var webPage in response.webPages.value)
            {
                Console.WriteLine("name: " + webPage.name);
                Console.WriteLine("url: " + webPage.url);
                Console.WriteLine("displayUrl: " + webPage.displayUrl);
                Console.WriteLine("snippet: " + webPage.snippet);
                Console.WriteLine("dateLastCrawled: " + webPage.dateLastCrawled);
                Console.WriteLine();
            }
            totalCount = totalCount + response.webPages.value.Length;
        }
    }
}

The subscription key I am using is a trial key.


来源: stackexchange

问:
JSON stub string delivered via php
I would like to make a web service stub where I can test my client. I have written down
some JSON like this:

```<code>{
    "response": {
        "success": true,
        "meta" : "tags",
        "data": [
            {
                "first_name" : "John",
                "last_name" : "Doe",
                "age" : 30
            },
            {
                "first_name" : "Jane",
                "last_name" : "Doe",
                "age" : 25
            }
        ]
    }
}
</code>```

I have no PHP experience to talk about.
How can I make a

webserver.com/get_names.php?first_name=john&last_name=doe&age=30

script that returns the above JSON.

It should not do any evaluation on the parameters, that is just how it will end up being called when implemented against a server, I would just like it to return the JSON string correctly so my JSON parser can run through it as if it was the actual server response.

Hope someone can help me out, thank you in advance.

答:
You could save this as get_names.php on your web server.

```<code><?php

$my_associative_array = array(
    'response' => array(
        'success' => true,
        'meta' => 'tags',
        'data' => array(
            array(
                'first_name' => 'John',
                'last-name' => 'Doe',
                'age' => 30,
            ),
            array(
                'first_name' => 'Jane',
                'last_name' => 'Doe',
                'age' => 25
            ),
        ),
    ),
);

echo json_encode($my_associative_array);
</code>```

Alternatively, you could just create a .txt file that looks precisely like your JSON.

You could also just point it to my server, where the above script is operational: http://dorkitude.com/example_4725873.php

ContentLicense: CC BY-SA 2.5

Title: JSON stub string delivered via php

Body:
I would like to make a web service stub where I can test my client. I have written down
some JSON like this:

{
    "response": {
        "success": true,
        "meta" : "tags",
        "data": [
            {
                "first_name" : "John",
                "last_name" : "Doe",
                "age" : 30
            },
            {
                "first_name" : "Jane",
                "last_name" : "Doe",
                "age" : 25
            }
        ]
    }
}

I have no PHP experience to talk about.
How can I make a

webserver.com/get_names.php?first_name=john&last_name=doe&age=30

script that returns the above JSON.

It should not do any evaluation on the parameters, that is just how it will end up being called when implemented against a server, I would just like it to return the JSON string correctly so my JSON parser can run through it as if it was the actual server response.

Hope someone can help me out, thank you in advance.

Body:
You could save this as get_names.php on your web server.

<?php

$my_associative_array = array(
    'response' => array(
        'success' => true,
        'meta' => 'tags',
        'data' => array(
            array(
                'first_name' => 'John',
                'last-name' => 'Doe',
                'age' => 30,
            ),
            array(
                'first_name' => 'Jane',
                'last_name' => 'Doe',
                'age' => 25
            ),
        ),
    ),
);

echo json_encode($my_associative_array);

Alternatively, you could just create a .txt file that looks precisely like your JSON.

You could also just point it to my server, where the above script is operational: http://dorkitude.com/example_4725873.php


问:
Install DataStax DevCenter on MAC
does anyone know how to install DataStax DevCenter on Mac?

I am taking a NoSQL class where we were asked to install Cassandra. All the windows users installed Cassandra and DevCenter. I did install Cassandra on my computer using HomeBrew, but I was having problem running cqlch commands due file path not found. I was thinking if I could install DataStax DevCenter, it would be easier for me to run command. Can anyone advise please?

Regarding the error message I received of path not found, below is an example of what I encountered:

```<code>cqlsh:stockwatcher> source '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql';

Could not open '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql': [Errno 2]
No such file or directory: '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql'
</code>```

答:
This link should have all the tools and versions.
https://academy.datastax.com/all-downloads

Not sure, why this page has been hidden from Datastax download page.

ContentLicense: CC BY-SA 3.0

Title: Install DataStax DevCenter on MAC

Body:
does anyone know how to install DataStax DevCenter on Mac?

I am taking a NoSQL class where we were asked to install Cassandra. All the windows users installed Cassandra and DevCenter. I did install Cassandra on my computer using HomeBrew, but I was having problem running cqlch commands due file path not found. I was thinking if I could install DataStax DevCenter, it would be easier for me to run command. Can anyone advise please?

Regarding the error message I received of path not found, below is an example of what I encountered:

cqlsh:stockwatcher> source '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql';

Could not open '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql': [Errno 2]
No such file or directory: '/Users/UserName/Downloads/Stockwatcher/labs/lab6b/insertusers.cql'


问:
Trying to install Tizen Studio for the purpose of designing a smart watch face. Encountering an error when installing Tizen Studio
I bought a Samsung Gear S3 Frontier smart watch and would like to design a custom watch face. I have downloaded and installed the required Java SE Development Kit 9 from Oracle. When attempting to install Tizen Studio, I encounter the following error:

```<code>Cannot find the 64-Bit Java Development Kit (JDK). Check if the installed 64-Bit JDK version is 8 and over, or the JAVA_HOME environment variable is configured correctly.
</code>```

screenshot

I found a helpful post regarding environment variables, but I still encounter the same error when trying to install Tizen Studio.

Edit environment variable

Do you have any advice?

答:
You need to uninstall new version of Java (9) and install Java 8 (JRE 1.8) from oracle. Set the path or environment variable.
Install Tizen Studio again. Hopefully it will work. so far Tizen studio installer can't recognize new version of Java.

For Watch face design you can also try Gear Watch Designer (GWD) from Samsung Developer site. It is more easier tool for watch face design. http://developer.samsung.com/gear/design/watch-designer

Body:
I bought a Samsung Gear S3 Frontier smart watch and would like to design a custom watch face. I have downloaded and installed the required Java SE Development Kit 9 from Oracle. When attempting to install Tizen Studio, I encounter the following error:

Cannot find the 64-Bit Java Development Kit (JDK). Check if the installed 64-Bit JDK version is 8 and over, or the JAVA_HOME environment variable is configured correctly.

screenshot

I found a helpful post regarding environment variables, but I still encounter the same error when trying to install Tizen Studio.

Edit environment variable

Do you have any advice?


问:
Returning ArrayFormula from multiple sheets, in the same cell
I have two Google sheets with different Marvel characters (column A) and their corresponding home universe (column C).

Sheet1

```<code>| Heroes            | Count         | Universe           |
|:------------------|--------------:|:------------------:|
| Spider Ham        | 365           | Earth-8311         |
| Iron Man          | 467           | Earth-616          |
| Hulk Bunny        | 24            | Earth-8311         |
</code>```

Sheet2

```<code>| Heroes            | Count         | Universe           |
|:------------------|--------------:|:------------------:|
| Spider Ham        | 234           | Earth-8311         |
| Iron Man          | 998           | Earth-616          |
| May Porker        | 11            | Earth-8311         |
</code>```

In Sheet3 this formula in each row =ArrayFormula(TEXTJOIN(", ";1;REPT(Sheet1!A:A;1*(Sheet1!C:C=A$2)))) (placed in column B) grabs the data from Sheet1 and return in like this:

```<code>| Universe         | Heroes                              |
|:-----------------|------------------------------------:|
| Earth-8311       | Spider Ham, Hulk Bunny              |
| Earth-616        | Iron Man                            |
</code>```

Which is great. But I also want combine the data from Sheet2 in the formula - so Sheet3 looks like this (without duplicates):

```<code>| Universe         | Heroes                              |
|:-----------------|------------------------------------:|
| Earth-8311       | Spider Ham, Hulk Bunny, May Porker  |
| Earth-616        | Iron Man                            |
</code>```

I want to modify the ArrayFormula to search in Sheet1 AND Sheet2 - is this possible to do in a single Spreadsheet-formula?

Tried =ArrayFormula(TEXTJOIN(", ";1;REPT(Sheet1:Sheet2!A:A;1*(Sheet1Sheet2!C:C=A$2)))) but it only returns #NAME?

答:
Please try:

=ArrayFormula(TEXTJOIN(", ",1,UNIQUE(filter({Sheet1!A:A;Sheet2!A:A},{Sheet1!C:C;Sheet2!C:C}=A2))))

Used arrays {} in Google Sheets, and filter formula. Unique is to get rid of duplicates.

Body:
I have two Google sheets with different Marvel characters (column A) and their corresponding home universe (column C).

Sheet1

| Heroes            | Count         | Universe           |
|:------------------|--------------:|:------------------:|
| Spider Ham        | 365           | Earth-8311         |
| Iron Man          | 467           | Earth-616          |
| Hulk Bunny        | 24            | Earth-8311         |

Sheet2

| Heroes            | Count         | Universe           |
|:------------------|--------------:|:------------------:|
| Spider Ham        | 234           | Earth-8311         |
| Iron Man          | 998           | Earth-616          |
| May Porker        | 11            | Earth-8311         |

In Sheet3 this formula in each row =ArrayFormula(TEXTJOIN(", ";1;REPT(Sheet1!A:A;1*(Sheet1!C:C=A$2)))) (placed in column B) grabs the data from Sheet1 and return in like this:

| Universe         | Heroes                              |
|:-----------------|------------------------------------:|
| Earth-8311       | Spider Ham, Hulk Bunny              |
| Earth-616        | Iron Man                            |

Which is great. But I also want combine the data from Sheet2 in the formula - so Sheet3 looks like this (without duplicates):

| Universe         | Heroes                              |
|:-----------------|------------------------------------:|
| Earth-8311       | Spider Ham, Hulk Bunny, May Porker  |
| Earth-616        | Iron Man                            |

I want to modify the ArrayFormula to search in Sheet1 AND Sheet2 - is this possible to do in a single Spreadsheet-formula?

Tried =ArrayFormula(TEXTJOIN(", ";1;REPT(Sheet1:Sheet2!A:A;1*(Sheet1Sheet2!C:C=A$2)))) but it only returns #NAME?


问:
How to create new git repository with SourceTree?
Here is what I did so far (in SourceTree):

Choose "Create New Repository"

choose a destination path ("hallo")

create a file in the "hallo" directory

commit that file (which creates a local master branch)

create a new remote (ssh://xxx@192.168.162.20:22/srv/git/hallo)

push to remote branch

Now I get an error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master

Pushing to ssh://xxx@192.168.162.20:22/srv/git/hallo

fatal: '/srv/git/hallo' does not appear to be a git repository

fatal: Could not read from remote repository.

I am working with a a dozen of other repositiories without any difficulties on that server. So it can't be an access or ssh problem. I also double checked the ip address of the server.

If I start the terminal and write "git remote -v" I get:

origin  ssh://xxx@192.168.162.20:22/srv/git/hallo (fetch)

origin  ssh://xxx@192.168.162.20:22/srv/git/hallo (push)

If I try to push ("git push origin master") I get:

fatal: '/srv/git/hallo' does not appear to be a git repository

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have no clue what I'm missing.
Can you help?

答:
No, I didn't. Do I have to? I thought pushing a commit will do this for me.

Yes you should create a remote repo first.

Connect to ssh://xxx@192.168.162.20:22, and create a bare repo:

```<code>cd /srv/git/
git init --bare hallo
</code>```

Body:
No, I didn't. Do I have to? I thought pushing a commit will do this for me.

Yes you should create a remote repo first.

Connect to ssh://xxx@192.168.162.20:22, and create a bare repo:

cd /srv/git/
git init --bare hallo


问:
Version Control on Mac
I am a student and my uses of source control are mostly academic (HW assignments, 2-4 person projects and so on).

Until now I have been using Subversion hosted in google code, and used the eclipse plugin to manage my repository.

Recently I heard of git, which to my understanding needs to be synced between each two collaborates each time, and something called Mercurial.

So basically my question has 3 parts:

Which source control system is recommended and what benefits does git offer? Is it worth learning it?

Which is a good free host that will support this system?

What is the best tool to manage my repository? Is using the command line better in any way than the Eclipse plugin? or is there some other software that is recommended?

If my question is to vague please comment and I'll be glad to revise it.

答:
github is a good free repository for git.

bitbucket is a good free repository for mercurial.

I prefer tooling that integrates with my IDE so I recommend that route but many people rave about using the command line for git and how awesome it is. I think they're just more hard core than I want to be.

git and mercurial are similar enough to each other that it makes very little difference which one you choose especially if you are new to DVCS. Choose the one that has tools that work well with your setup.

Title: Version Control on Mac


问:
How to set authorization header in node js?
Hello I am working on node application in which I am working on jsonwebtokens,passport-jwt.I created application backend side and working fine on postman but I stuck on front end side. when i send token in headers in postman then token based page open on postman fine but on front side display unauthorized.How can i send token in header so that this page also open on front end side.
My code:

```<code>app.post("/login", function(req, res) {
  if(req.body.name && req.body.password){
    var name = req.body.name;
    var password = req.body.password;
  }

  var user = users[_.findIndex(users, {name: name})];
  if( ! user ){
    res.status(401).json({message:"no such user found"});
  }

  if(user.password === req.body.password) {
    // from now on we'll identify the user by the id and the id is the only personalized value that goes into our token
    var payload = {id: user.id};
    var token = jwt.sign(payload, jwtOptions.secretOrKey);
    //res.json({message: "ok", token: token});
   res.redirect('/secret')
  } else {
    res.status(401).json({message:"passwords did not match"});
  }
});

app.get("/secret", passport.authenticate('jwt', { session: false }), function(req, res){
    res.json("Success! You can not see this without a token");

  });
</code>```

Where am i doing wrong??

答:
in your /login you can save them tokens in a sessionStorage for future use...

something like this

```<code> if(user.password === req.body.password) {
  ....
        var payload = {id: user.id};
        var token = jwt.sign(payload, jwtOptions.secretOrKey);
        req.session.token = token ;
    }

}
</code>```

use this session to update sessionStorage on client side

here is an article that is what you need for keeping logged in post login...

also  you need to destroy the cookies on Logout

Body:
Hello I am working on node application in which I am working on jsonwebtokens,passport-jwt.I created application backend side and working fine on postman but I stuck on front end side. when i send token in headers in postman then token based page open on postman fine but on front side display unauthorized.How can i send token in header so that this page also open on front end side.
My code:

app.post("/login", function(req, res) {
  if(req.body.name && req.body.password){
    var name = req.body.name;
    var password = req.body.password;
  }

  var user = users[_.findIndex(users, {name: name})];
  if( ! user ){
    res.status(401).json({message:"no such user found"});
  }

  if(user.password === req.body.password) {
    // from now on we'll identify the user by the id and the id is the only personalized value that goes into our token
    var payload = {id: user.id};
    var token = jwt.sign(payload, jwtOptions.secretOrKey);
    //res.json({message: "ok", token: token});
   res.redirect('/secret')
  } else {
    res.status(401).json({message:"passwords did not match"});
  }
});

app.get("/secret", passport.authenticate('jwt', { session: false }), function(req, res){
    res.json("Success! You can not see this without a token");

  });

Where am i doing wrong??

Body:
in your /login you can save them tokens in a sessionStorage for future use...

something like this

 if(user.password === req.body.password) {
  ....
        var payload = {id: user.id};
        var token = jwt.sign(payload, jwtOptions.secretOrKey);
        req.session.token = token ;
    }

}

use this session to update sessionStorage on client side

here is an article that is what you need for keeping logged in post login...

also  you need to destroy the cookies on Logout


问:
Browser closes after completing the first scenario in Specflow
In my Specflow project, I have defined two scenarios in my feature file. But When I execute my program, browser closes after the first scenario. Then It fails the test, since there is no connection with the remote server.

How Can I solve this?

```<code>Feature: Check functionality of dashboard

@SmokeTest
@Browser:Chrome
Scenario: Check dashboard page is loaded
    Given I have navigated to application
    And I typed emailid and password
    | Email           | Password |
    | qa02@example.com | test1234 |
    When I clicked login button
    Then I should see dashboard

Scenario: Check trading partners page is loaded
    Given I am on Trading Partner page
    When I click on trading partners link
    Then I should see trading partners page
</code>```

Following is my Package.config

```<code><?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Autofac" version="3.1.1" targetFramework="net461" />
  <package id="Autofac.Configuration" version="3.1.0" targetFramework="net461" />
  <package id="Baseclass.Contrib.SpecFlow.Selenium.NUnit" version="1.3.1" targetFramework="net461" />
  <package id="ExcelDataReader" version="2.1.2.3" targetFramework="net461" />
  <package id="ImpromptuInterface" version="5.6.2" targetFramework="net461" />
  <package id="MSTest.TestAdapter" version="1.1.18" targetFramework="net461" />
  <package id="MSTest.TestFramework" version="1.1.18" targetFramework="net461" />
  <package id="NUnit" version="2.6.0.12054" targetFramework="net461" />
  <package id="NUnitTestAdapter.WithFramework" version="2.0.0" targetFramework="net461" />
  <package id="Selenium.Chrome.WebDriver" version="2.30" targetFramework="net461" />
  <package id="Selenium.Support" version="3.4.0" targetFramework="net461" />
  <package id="Selenium.WebDriver" version="3.4.0" targetFramework="net461" />
  <package id="SharpZipLib" version="0.86.0" targetFramework="net461" />
  <package id="SpecFlow" version="1.9.0" targetFramework="net461" />
  <package id="SpecFlow.Assist.Dynamic" version="1.0.2" targetFramework="net461" />
</packages>
</code>```

Please see the related step file.

```<code>namespace DX2Functional.Steps
{
    [Binding]
    class DashboardSteps
    {

        [Given(@"I have navigated to application")]
        public void GivenIHaveNavigatedToLoginUrl()
        {
            Browser.Current.Navigate().GoToUrl(ConfigurationManager.AppSettings["seleniumBaseUrl"]);
            CommonMethods.driver = Browser.Current;
            PropertiesCollection.currentPage = new Login();
        }

        [Given(@"I typed emailid and password")]
        public void GivenITypedEmailidAndPassword(Table table)
        {
            dynamic tableDetails = table.CreateDynamicInstance();
            string email = tableDetails.Email;
            Console.Write("Email is " + email);
            string passowrd = tableDetails.Password;
            Console.Write("password is " + passowrd);

            PropertiesCollection.currentPage.As<Login>().enterUerEmailAndPassword(email, passowrd);
        }

        [When(@"I clicked login button")]
        public void WhenIClickedLoginButton()
        {
            PropertiesCollection.currentPage = PropertiesCollection.currentPage.As<Login>().clickLoginButton();
        }

        [Then(@"I should see dashboard")]
        public void ThenIShouldSeeDashboard()
        {
            PropertiesCollection.currentPage.As<Dashboard>().IsloadedIn();
        }

        [Given(@"I am on Trading Partner page")]
        public void GivenIamOnTradingPartnerPage()
        {
            PropertiesCollection.currentPage.As<Dashboard>().IsloadedIn();
        }

        [When(@"I click on trading partners link")]
        public void WhenIClickOnTradingPartnersLink()
        {
            PropertiesCollection.currentPage.As<Dashboard>().clickTradingPrtnersLink();
        }

        [Then(@"I should see trading partners page")]
        public void ThenIShouldSeeTradingPartnersPage()
        {
            PropertiesCollection.currentPage.As<TradingPartners>().IsTPListLoaded();
        }

    }
}
</code>```

答:
One way of solving this issue is to use a Background instead of a Scenario for the first part of your feature file which logs in the user.

For example:

```<code>Feature: Check functionality of dashboard

@SmokeTest
@Browser:Chrome
Background:
    Given I have navigated to application
    And I typed emailid and password
    | Email           | Password |
    | qa02@example.com | test1234 |
    When I clicked login button

Scenario: Check dashboard page is loaded
    Then I should see dashboard

Scenario: Check trading partners page is loaded
    Given I am on Trading Partner page
    When I click on trading partners link
    Then I should see trading partners page
</code>```

Body:
In my Specflow project, I have defined two scenarios in my feature file. But When I execute my program, browser closes after the first scenario. Then It fails the test, since there is no connection with the remote server.

How Can I solve this?

Feature: Check functionality of dashboard

@SmokeTest
@Browser:Chrome
Scenario: Check dashboard page is loaded
    Given I have navigated to application
    And I typed emailid and password
    | Email           | Password |
    | qa02@example.com | test1234 |
    When I clicked login button
    Then I should see dashboard

Scenario: Check trading partners page is loaded
    Given I am on Trading Partner page
    When I click on trading partners link
    Then I should see trading partners page

Following is my Package.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Autofac" version="3.1.1" targetFramework="net461" />
  <package id="Autofac.Configuration" version="3.1.0" targetFramework="net461" />
  <package id="Baseclass.Contrib.SpecFlow.Selenium.NUnit" version="1.3.1" targetFramework="net461" />
  <package id="ExcelDataReader" version="2.1.2.3" targetFramework="net461" />
  <package id="ImpromptuInterface" version="5.6.2" targetFramework="net461" />
  <package id="MSTest.TestAdapter" version="1.1.18" targetFramework="net461" />
  <package id="MSTest.TestFramework" version="1.1.18" targetFramework="net461" />
  <package id="NUnit" version="2.6.0.12054" targetFramework="net461" />
  <package id="NUnitTestAdapter.WithFramework" version="2.0.0" targetFramework="net461" />
  <package id="Selenium.Chrome.WebDriver" version="2.30" targetFramework="net461" />
  <package id="Selenium.Support" version="3.4.0" targetFramework="net461" />
  <package id="Selenium.WebDriver" version="3.4.0" targetFramework="net461" />
  <package id="SharpZipLib" version="0.86.0" targetFramework="net461" />
  <package id="SpecFlow" version="1.9.0" targetFramework="net461" />
  <package id="SpecFlow.Assist.Dynamic" version="1.0.2" targetFramework="net461" />
</packages>

Please see the related step file.

namespace DX2Functional.Steps
{
    [Binding]
    class DashboardSteps
    {

        [Given(@"I have navigated to application")]
        public void GivenIHaveNavigatedToLoginUrl()
        {
            Browser.Current.Navigate().GoToUrl(ConfigurationManager.AppSettings["seleniumBaseUrl"]);
            CommonMethods.driver = Browser.Current;
            PropertiesCollection.currentPage = new Login();
        }

        [Given(@"I typed emailid and password")]
        public void GivenITypedEmailidAndPassword(Table table)
        {
            dynamic tableDetails = table.CreateDynamicInstance();
            string email = tableDetails.Email;
            Console.Write("Email is " + email);
            string passowrd = tableDetails.Password;
            Console.Write("password is " + passowrd);

            PropertiesCollection.currentPage.As<Login>().enterUerEmailAndPassword(email, passowrd);
        }

        [When(@"I clicked login button")]
        public void WhenIClickedLoginButton()
        {
            PropertiesCollection.currentPage = PropertiesCollection.currentPage.As<Login>().clickLoginButton();
        }

        [Then(@"I should see dashboard")]
        public void ThenIShouldSeeDashboard()
        {
            PropertiesCollection.currentPage.As<Dashboard>().IsloadedIn();
        }

        [Given(@"I am on Trading Partner page")]
        public void GivenIamOnTradingPartnerPage()
        {
            PropertiesCollection.currentPage.As<Dashboard>().IsloadedIn();
        }

        [When(@"I click on trading partners link")]
        public void WhenIClickOnTradingPartnersLink()
        {
            PropertiesCollection.currentPage.As<Dashboard>().clickTradingPrtnersLink();
        }

        [Then(@"I should see trading partners page")]
        public void ThenIShouldSeeTradingPartnersPage()
        {
            PropertiesCollection.currentPage.As<TradingPartners>().IsTPListLoaded();
        }

    }
}

Body:
One way of solving this issue is to use a Background instead of a Scenario for the first part of your feature file which logs in the user.

For example:

Feature: Check functionality of dashboard

@SmokeTest
@Browser:Chrome
Background:
    Given I have navigated to application
    And I typed emailid and password
    | Email           | Password |
    | qa02@example.com | test1234 |
    When I clicked login button

Scenario: Check dashboard page is loaded
    Then I should see dashboard

Scenario: Check trading partners page is loaded
    Given I am on Trading Partner page
    When I click on trading partners link
    Then I should see trading partners page


问:
How do I query for an object with an object array property in MySQL?
I have seen this asked before in different ways, but I'm hoping for a straight answer.

If I have two classes, Parent and Child, stored in two different MySQL tables, what is the best way of querying for a complete Parent object, with a list of all Children?

e.g.

```<code>class Parent {
   id: number;
   name: string;
   Children: Child[]
}

class Child {
   id: number;
   name: string;
   age: number;
}
</code>```

How do I get a list of matching Parents by name, with a list of children for each?

Do I have to write a query to grab all matching Parents, and then an additional query for each Parent to get all the Child elements?

This is obviously pseudo-SQL, but I'm hoping for something like this:

```<code>SELECT p.id, p.name,
(SELECT * from c) as children from parent p LEFT JOIN child c on p.id = c.parent_id
</code>```

答:
A subquery in the select-list like you show in your pseudocode won't work because a subquery in that context must be a scalar subquery—in other words, it must return only one row and one column.

You can return a joined result set:

```<code>SELECT p.id, p.name, c.id, c.name
FROM parent p LEFT JOIN child c on p.id = c.parent_id;
</code>```

But that will repeat the same p.id and p.name for each of the rows. Some developers find that hard to deal with (see my answer in How to separate data in SQL table)

The alternative is to do two queries:

```<code>SELECT p.id, p.name FROM parent p;

SELECT c.id, c.name FROM child c WHERE c.parent_id = ?;
</code>```

Supply the p.id value as the parameter to the second query.

Body:
I have seen this asked before in different ways, but I'm hoping for a straight answer.

If I have two classes, Parent and Child, stored in two different MySQL tables, what is the best way of querying for a complete Parent object, with a list of all Children?

e.g.

class Parent {
   id: number;
   name: string;
   Children: Child[]
}

class Child {
   id: number;
   name: string;
   age: number;
}

How do I get a list of matching Parents by name, with a list of children for each?

Do I have to write a query to grab all matching Parents, and then an additional query for each Parent to get all the Child elements?

This is obviously pseudo-SQL, but I'm hoping for something like this:

SELECT p.id, p.name,
(SELECT * from c) as children from parent p LEFT JOIN child c on p.id = c.parent_id

Body:
A subquery in the select-list like you show in your pseudocode won't work because a subquery in that context must be a scalar subquery—in other words, it must return only one row and one column.

You can return a joined result set:

SELECT p.id, p.name, c.id, c.name
FROM parent p LEFT JOIN child c on p.id = c.parent_id;

But that will repeat the same p.id and p.name for each of the rows. Some developers find that hard to deal with (see my answer in How to separate data in SQL table)

The alternative is to do two queries:

SELECT p.id, p.name FROM parent p;

SELECT c.id, c.name FROM child c WHERE c.parent_id = ?;

Supply the p.id value as the parameter to the second query.


问:
Null Pointer exception while writing into the file
hey when i create a file the logs show that file is created but it not existed in system, and while writing into that file it says null pointer exception is there anyone can help me please

```<code>try {
  File root = android.os.Environment.getExternalStorageDirectory();
  File dir = new File (root.getAbsolutePath()+ "/Sniffiing");
  dir.mkdirs();
  File file1 = new File(dir,"dump1.txt");
  file1.createNewFile();
  System.out.println(file1);
 System.out.println("Hello Buddy what are upto.....##########################");
  OutputStreamWriter os = new OutputStreamWriter(
                                        new FileOutputStream(file1));
  bw = new BufferedWriter(os);
  Process process = Runtime.getRuntime().exec(
                                        "logcat -v threadtime -s ServiceMode");
   int length = process.toString().length();

   System.out.println("Length" + length);

   BufferedReader reader = new BufferedReader(
                                        new InputStreamReader(process.getInputStream()));

   StringBuffer output1 = new StringBuffer();

   while ((line = reader.readLine()) != null) {
     bw.write(line);
     bw.newLine();
   }

} catch (IOException e) {
 }
</code>```

here is Logcat

```<code>D/action: 0
D/ACTION:: BOTH
D/Log3GState:: Accessing  file
D/Create file: /data/user/0/com.services.snifspoof.snifspoof/C_packetCapture
D/Log3GState:: Write executable  file
D/EGL_emulation: eglMakeCurrent: 0x9ef850c0: ver 2 0 (tinfo 0x9ef831f0)
D/EGL_emulation: eglMakeCurrent: 0x9ef850c0: ver 2 0 (tinfo 0x9ef831f0)
D/CLOSING: BOTH
I/System.out: *********#############
I/System.out: *********############# File Created :- /storage/emulated/0/Sniffing/dump1.txt
I/System.out: Length34

          --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: Thread-2
 Process: com.services.snifspoof.snifspoof, PID: 2389
 java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference
 at com.services.snifspoof.snifspoof.MainActivity$3$1.run(MainActivity.java:167)
 at java.lang.Thread.run(Thread.java:761)
</code>```

答:
Hope this might be useful to you.

Make sure you have added the permission to read external storage in your manifest file.

```<code> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</code>```

Write File:

```<code>private void writeToFile(String data,Context context) {
    try {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("dump1.txt", Context.MODE_PRIVATE));
        outputStreamWriter.write(data);
        outputStreamWriter.close();
    }
    catch (IOException e) {
        Log.e("Exception", "File write failed: " + e.toString());
    }
}
</code>```

Read File:

```<code>private String readFromFile(Context context) {

    String ret = "";

    try {
        InputStream inputStream = context.openFileInput("dump1.txt");

        if ( inputStream != null ) {
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            String receiveString = "";
            StringBuilder stringBuilder = new StringBuilder();

            while ( (receiveString = bufferedReader.readLine()) != null ) {
                stringBuilder.append(receiveString);
            }

            inputStream.close();
            ret = stringBuilder.toString();
        }
    }
    catch (FileNotFoundException e) {
        Log.e("login activity", "File not found: " + e.toString());
    } catch (IOException e) {
        Log.e("login activity", "Can not read file: " + e.toString());
    }

    return ret;
}
</code>```

Body:
hey when i create a file the logs show that file is created but it not existed in system, and while writing into that file it says null pointer exception is there anyone can help me please

try {
  File root = android.os.Environment.getExternalStorageDirectory();
  File dir = new File (root.getAbsolutePath()+ "/Sniffiing");
  dir.mkdirs();
  File file1 = new File(dir,"dump1.txt");
  file1.createNewFile();
  System.out.println(file1);
 System.out.println("Hello Buddy what are upto.....##########################");
  OutputStreamWriter os = new OutputStreamWriter(
                                        new FileOutputStream(file1));
  bw = new BufferedWriter(os);
  Process process = Runtime.getRuntime().exec(
                                        "logcat -v threadtime -s ServiceMode");
   int length = process.toString().length();

   System.out.println("Length" + length);

   BufferedReader reader = new BufferedReader(
                                        new InputStreamReader(process.getInputStream()));

   StringBuffer output1 = new StringBuffer();

   while ((line = reader.readLine()) != null) {
     bw.write(line);
     bw.newLine();
   }

} catch (IOException e) {
 }

here is Logcat

D/action: 0
D/ACTION:: BOTH
D/Log3GState:: Accessing  file
D/Create file: /data/user/0/com.services.snifspoof.snifspoof/C_packetCapture
D/Log3GState:: Write executable  file
D/EGL_emulation: eglMakeCurrent: 0x9ef850c0: ver 2 0 (tinfo 0x9ef831f0)
D/EGL_emulation: eglMakeCurrent: 0x9ef850c0: ver 2 0 (tinfo 0x9ef831f0)
D/CLOSING: BOTH
I/System.out: *********#############
I/System.out: *********############# File Created :- /storage/emulated/0/Sniffing/dump1.txt
I/System.out: Length34

          --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: Thread-2
 Process: com.services.snifspoof.snifspoof, PID: 2389
 java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference
 at com.services.snifspoof.snifspoof.MainActivity$3$1.run(MainActivity.java:167)
 at java.lang.Thread.run(Thread.java:761)

Body:
Hope this might be useful to you.

Make sure you have added the permission to read external storage in your manifest file.

 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Write File:

private void writeToFile(String data,Context context) {
    try {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("dump1.txt", Context.MODE_PRIVATE));
        outputStreamWriter.write(data);
        outputStreamWriter.close();
    }
    catch (IOException e) {
        Log.e("Exception", "File write failed: " + e.toString());
    }
}

Read File:

private String readFromFile(Context context) {

    String ret = "";

    try {
        InputStream inputStream = context.openFileInput("dump1.txt");

        if ( inputStream != null ) {
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            String receiveString = "";
            StringBuilder stringBuilder = new StringBuilder();

            while ( (receiveString = bufferedReader.readLine()) != null ) {
                stringBuilder.append(receiveString);
            }

            inputStream.close();
            ret = stringBuilder.toString();
        }
    }
    catch (FileNotFoundException e) {
        Log.e("login activity", "File not found: " + e.toString());
    } catch (IOException e) {
        Log.e("login activity", "Can not read file: " + e.toString());
    }

    return ret;
}


问:
Connect an independent Ionic2+Angular2 based app with a Meteor server via DDP client library
I have an independent Ionic2+Angular2 based mobile application. Also I have an existing Meteor server running on the other hand. I want to use the services of that Meteor Server in my Ionic2+Angular2 application. Is there any way to create a connection via some Meteor DDP client library??</p>

答:
This works well: https://github.com/thomasgazzoni/rxjs-ddp-client

We generally crate a global service with a custom DDP Implementation, subscribes to publications easily.

You just connect to your Meteor Server via the websocket url, default is generally

ws://127.0.0.1:3000/websocket/


问:
How to send variable to modal to show value that query from database php
I am trying to send value to modal to query in table from database  and display the value that come from WHERE clause that sent from variable I assign it to modal with 'id' attribute
I try to save it with javascript in cookie but it show random value and not working correct

here is the link that i click on it to show modal it is in loop in table

```<code><td>
    <a data-toggle="modal" href="#gurantorname" id="'.$payment_row["GuarantorID"].'"> Guarantor Discount</a>
</td>
</code>```

and here is my modal :

```<code><!-- gurarntour modal-->
<div id="gurantorname" class="modal fade" tabindex="-1" data-width="400">
    <div class="modal-header red">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h4 class="modal-title"> اسم الكفيل  </h4>
    </div>
    <div class="modal-body">
        <?php
        if(isset($_COOKIE['myJavascriptVar'])) {
            $_COOKIE['myJavascriptVar'];
            echo $_COOKIE['myJavascriptVar'];
            $guarantor_sth = $guarantorobj->getguarantorapplicationbyid($_COOKIE['myJavascriptVar']);
            $guarantor_row = $guarantor_sth->fetch();
        ?>
        <label class=" font-blue-dark text-center">
            <strong>
            <?php
                echo $guarantor_row["GuarantorFirstNameAR"].' '.$guarantor_row["GuarantorSecondNameAR"] .' '.$guarantor_row["GuarantorThirdNameAR"].' '.$guarantor_row["GuarantorLastNameAR"] ;
            ?>
            </strong>
        </label>
        <?php
        }
        ?>
    </div>
    <div class="modal-footer text-right">
        <a target="_blank"  class="btn green" href="index.php?action=guarantorinfo&guarantorid=<?php echo $payment_row["GuarantorID"];?>" >معلومات الكفيل</a>
        <button type="submit" data-dismiss="modal" class="btn btn-outline dark" >اخفاء</button>
    </div>
</div>
<!--end of gurarntour modal-->
</code>```

and here is my javascript that send cookie to modal :

```<code><script type="text/javascript">
    $('#gurantorname').on('show.bs.modal', function(e) {
        var $modal = $(this),
        esseyId = e.relatedTarget.id;
        document.cookie = "myJavascriptVar ="+esseyId ;
        alert(esseyId)
    });
</script>
</code>```

答:
I think you should using ajax when user clicks on a link

```<code><a href="javascript:void(0)" class="link" id="'.$payment_row["GuarantorID"].'"> Guarantor Discount</a>
</code>```

and add the id attribute to label for showing guarantor_row by $payment_row["GuarantorID"]

```<code><label id="guarantor_row" class=" font-blue-dark text-center">
</code>```

let's create the ajax script

```<code> $('body').on('click','.link',function(){
    var id = $(this).attr('id');
    $.ajax({
        method: "POST",
        url: "getguarantorapplicationbyid.php",
        data: { id:id  }
    })
    .done(function( json_response) {
        var guarantor_row = $.parseJSON(json_response);
        //set the data to modal and display
        //guarantor_row.GuarantorFirstNameAR
        //guarantor_row.GuarantorSecondNameAR
        $('#guarantor_row').text(guarantor_row.GuarantorFirstNameAR+" "+guarantor_row.GuarantorSecondNameAR);
        $('#gurantorname').modal('show');

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

getguarantorapplicationbyid.php

```<code>$guarantor_sth = $guarantorobj->getguarantorapplicationbyid($_POST['id']);
$guarantor_row = $guarantor_sth->fetch();
echo json_encode(guarantor_row);
</code>```

Body:
I am trying to send value to modal to query in table from database  and display the value that come from WHERE clause that sent from variable I assign it to modal with 'id' attribute
I try to save it with javascript in cookie but it show random value and not working correct

here is the link that i click on it to show modal it is in loop in table

     Guarantor Discount

and here is my modal :

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

 اسم الكفيل

        <?php
        if(isset($_COOKIE['myJavascriptVar'])) {
            $_COOKIE['myJavascriptVar'];
            echo $_COOKIE['myJavascriptVar'];
            $guarantor_sth = $guarantorobj->getguarantorapplicationbyid($_COOKIE['myJavascriptVar']);
            $guarantor_row = $guarantor_sth->fetch();
        ?>

            <?php
                echo $guarantor_row["GuarantorFirstNameAR"].' '.$guarantor_row["GuarantorSecondNameAR"] .' '.$guarantor_row["GuarantorThirdNameAR"].' '.$guarantor_row["GuarantorLastNameAR"] ;
            ?>

        <?php
        }
        ?>

        <a target="_blank"  class="btn green" href="index.php?action=guarantorinfo&guarantorid=<?php echo $payment_row["GuarantorID"];?>" >معلومات الكفيل
        <button type="submit" data-dismiss="modal" class="btn btn-outline dark" >اخفاء</button>

and here is my javascript that send cookie to modal :

Body:
I think you should using ajax when user clicks on a link

<a href="javascript:void(0)" class="link" id="'.$payment_row["GuarantorID"].'"> Guarantor Discount</a>

and add the id attribute to label for showing guarantor_row by $payment_row["GuarantorID"]

<label id="guarantor_row" class=" font-blue-dark text-center">

let's create the ajax script

 $('body').on('click','.link',function(){
    var id = $(this).attr('id');
    $.ajax({
        method: "POST",
        url: "getguarantorapplicationbyid.php",
        data: { id:id  }
    })
    .done(function( json_response) {
        var guarantor_row = $.parseJSON(json_response);
        //set the data to modal and display
        //guarantor_row.GuarantorFirstNameAR
        //guarantor_row.GuarantorSecondNameAR
        $('#guarantor_row').text(guarantor_row.GuarantorFirstNameAR+" "+guarantor_row.GuarantorSecondNameAR);
        $('#gurantorname').modal('show');

    });
 });

getguarantorapplicationbyid.php

$guarantor_sth = $guarantorobj->getguarantorapplicationbyid($_POST['id']);
$guarantor_row = $guarantor_sth->fetch();
echo json_encode(guarantor_row);


问:
Temp Table usuage in a Multi User Environment
here's the situation:

I have an SSRS report that uses an SP as a Dataset.  The SP creates a Temp Table, inserts a bunch of data into it, and select's it back out for SSRS to report. Pretty straight forward.

Question:

If multiple users run the report with different parameters selected, will the temp table created by the SP collide in the tempdb and potentially not return the data set expected?

答:
Most likely not. If the temp table is defined as #temp or @temp, then you're safe, as those kind of temp tables can only be accessed by the creating connection, and will only last for the duration of the execution of the stored procedure. If, however, you're using ##temp tables (two "pound" signs), while those tables also only last for as long as the creating stored procedure runs, they are exposed to and accessible by all connections to that SQL instance.

Odds are good that you're not using ##tables, so you are probably safe.


问:
C# Send PDF to printer
I have to send a PDF file ( CAD drawing ) to a specific printer in the network. I also have to set the papersize for the document.

Has anyone an idea how to code this in C# without using any 3rd party library ?

Tried this => https://support.microsoft.com/en-us/help/322091/how-to-send-raw-data-to-a-printer-by-using-visual-c--net

But this is not working ( only printing some cryptical signs ).

答:
If you don't want to use a 3rd party, you can use this pure C# code which created a Process with arguments to print any file:

```<code>using System.Diagnostics;

Process proc = new Process();
proc.StartInfo = new ProcessStartInfo()
{
    CreateNoWindow = true,
    Verb = "print",
    // Path to your PDF
    FileName = pathToPDF
};
proc.Start();
</code>```

Title: C# Send PDF to printer

Body:
If you don't want to use a 3rd party, you can use this pure C# code which created a Process with arguments to print any file:

using System.Diagnostics;

Process proc = new Process();
proc.StartInfo = new ProcessStartInfo()
{
    CreateNoWindow = true,
    Verb = "print",
    // Path to your PDF
    FileName = pathToPDF
};
proc.Start();


问:
Azure Automation or Azure Function when creating an Azure SQL database
We are creating a SaaS application, where each client has it's own database.  I would like to automate the creation of the clients environment, which will be triggered from our website.

I am investigating using either Azure Automation or Azure Functions to create our client databases.

If anyone has some experience with these tools, I would appreciate your input.

Regards
Remeez

答:
You haven't specified any constraints that you have, so there are many ways to do that. One scenario could be:

Send a message to a Queue from your website.

Create an Azure Function which will listen to that queue, and run a script to create a new database.

Make sure that your database creation is below 5 minutes (10 minutes max), otherwise you won't be able to use Consumption Plan for Function App.


问:
Open Facebook app from other app
Is there a way to open the Facebook app from my own application?

For example, I'm using the Facebook-api to post something on the logged in users wall. When I get a call back that the post was successfully added I would like to open the Facebook app (if application is installed on the device) on the users wall to show them their post is there.

Answers for iPhone or Android or both would be much appreciated.

答:
For the iphone, you can launch the Facebook app if installed by using a url starting with fb://

More information can be found here: http://iphonedevtools.com/?p=302 also here: http://wiki.akosma.com/IPhone_URL_Schemes#Facebook

Stolen from the above site:

fb://profile – Open Facebook app to the user’s profile

fb://friends – Open Facebook app to the friends list

fb://notifications – Open Facebook app to the notifications list (NOTE:  there appears to be a bug with this URL.  The Notifications page opens.  However, it’s not possible to navigate to anywhere else in the Facebook app)

fb://feed – Open Facebook app to the News Feed

fb://events – Open Facebook app to the Events page

fb://requests – Open Facebook app to the Requests list

fb://notes - Open Facebook app to the Notes page

fb://albums – Open Facebook app to Photo Albums list

To Launch:

```<code>NSURL *theURL = [NSURL URLWithString:@"fb://<insert function here>"];
[[UIApplication sharedApplication] openURL:theURL];
</code>```

Title: Open Facebook app from other app

Body:
For the iphone, you can launch the Facebook app if installed by using a url starting with fb://

More information can be found here: http://iphonedevtools.com/?p=302 also here: http://wiki.akosma.com/IPhone_URL_Schemes#Facebook

Stolen from the above site:

fb://profile – Open Facebook app to the user’s profile

fb://friends – Open Facebook app to the friends list

fb://notifications – Open Facebook app to the notifications list (NOTE:  there appears to be a bug with this URL.  The Notifications page opens.  However, it’s not possible to navigate to anywhere else in the Facebook app)

fb://feed – Open Facebook app to the News Feed

fb://events – Open Facebook app to the Events page

fb://requests – Open Facebook app to the Requests list

fb://notes - Open Facebook app to the Notes page

fb://albums – Open Facebook app to Photo Albums list

To Launch:

NSURL *theURL = [NSURL URLWithString:@"fb://<insert function here>"];
[[UIApplication sharedApplication] openURL:theURL];


问:
i want the link style like in the picture
html code:

```<code> <ul class="info-link">
   <li><a href="#"><i class="fa fa-map-marker"></i>  3588 N Stelling road, Brooklyn, NYC, United State.</a> </li>
   <li><a href="#"><i class="fa fa-phone"></i>  1900-167-168-99 EXT: 001</a></li>
   <li><a href="#"><i class="fa fa-mobile"></i>  (05) 132-564-3333</a></li>
   <li><a href="#"><i class="fa fa-envelope"></i>  logohere@support.com</a></li>
 </ul>
</code>```

css code :

```<code>ul li {
  list-style: none;
}
</code>```

result picture:
code-result

desire result picture:
desire-result

答:
We have just make css using "position". no need to change in code. also as per image your all icon in align to text so make it also.

.info-link{
  width:280px;
}

ul.info-link li {
  list-style: none;
  margin-bottom:10px;
  position:relative;
  padding-left: 25px;
}

ul.info-link li i{
  position:absolute;
  top:0px;
  left:0px;
  display:block;
  width:20px;
  text-align:right;

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

 <ul class="info-link">
   <li><i class="fa fa-map-marker"></i>3588 N Stelling road, Brooklyn, NYC, United State. </li>
   <li><i class="fa fa-phone"></i>1900-167-168-99 EXT: 001</li>
   <li><i class="fa fa-mobile"></i>(05) 132-564-3333</li>
   <li><i class="fa fa-envelope"></i>logohere@support.com</li>
 </ul></code>```

Note: .info-link its just temp. class so when you use it if not required then remove it.

Body:
html code:

  3588 N Stelling road, Brooklyn, NYC, United State.

  1900-167-168-99 EXT: 001

  (05) 132-564-3333

  logohere@support.com

css code :

ul li {
  list-style: none;
}

result picture:
code-result

desire result picture:
desire-result

Body:
We have just make css using "position". no need to change in code. also as per image your all icon in align to text so make it also.

.info-link{
  width:280px;
}

ul.info-link li {
  list-style: none;
  margin-bottom:10px;
  position:relative;
  padding-left: 25px;
}

ul.info-link li i{
  position:absolute;
  top:0px;
  left:0px;
  display:block;
  width:20px;
  text-align:right;

}

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

 <ul class="info-link">
   <li><a href="#"><i class="fa fa-map-marker"></i>3588 N Stelling road, Brooklyn, NYC, United State.</a> </li>
   <li><a href="#"><i class="fa fa-phone"></i>1900-167-168-99 EXT: 001</a></li>
   <li><a href="#"><i class="fa fa-mobile"></i>(05) 132-564-3333</a></li>
   <li><a href="#"><i class="fa fa-envelope"></i>logohere@support.com</a></li>
 </ul>

Note: .info-link its just temp. class so when you use it if not required then remove it.


问:
CSS Positioning: Fixed and relative interchangeable regarding absolute?
With regards to absolute positioning, fixed seems to work like relative.

.fixed, .relative {
  border: 1px solid;
  width: 150px;
  height: 150px;
}

.fixed {
  border-color: red;
  position: fixed;
}

.relative {
  border-color: blue;
  margin-left: 200px;
  position: relative;
}

.absolute {
  background-color: rgba(0, 0, 0, 0.2);
  position: absolute;
}

.a {
  top: 0;
  left: 0;
}

.b {
  bottom: 0;
  right: 0;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="fixed">
  <span class="absolute a">Left Top</span>
  <span class="absolute b">Right Bottom</span>
</div>

<div class="relative">
  <span class="absolute a">Left Top</span>
  <span class="absolute b">Right Bottom</span>
</div></code>```

Unfortunately, I don't understand why. I expect this to be defined somewhere, but I was only able to find resources discussing absolute and relative, not absolute and fixed.

This leads the to the question: Is it even true that, in regards to absolute position, I can treat fixed and relative elements the same, being able to use top/left/right/bottom to control offset amount to parent?

答:
I reckon anything other than position:static sets off a new parent context for the positioned children.

This can be verified in the MDN docs for Absolute Positioning

The absolutely positioned element is positioned relative to its nearest positioned ancestor (i.e., the nearest ancestor that is not static).

So  setting position:fixed does cause absolute child elements to follow the new context.

This can be seen it the fiddle here . Changing the position of the .rel div moves the set of red divs , but the absolutely positioned blue div moves with it.

Another good source is the w3.org which says

An essential concept when it comes to absolute positioning is the containing block: the block box that the position and dimensions of the absolutely positioned box are relative to. For static boxes and relatively positioned boxes the containing block is the nearest block-level ancestor—the parent element in other words. For absolutely positioned elements however it’s a little more complicated. In this case the containing block is the nearest positioned ancestor. By “positioned” I mean an element whose position property is set to relative, absolute or fixed—in other words, anything except normal static elements.

Sources :
MDN Positon , w3org absolute position

Body:
With regards to absolute positioning, fixed seems to work like relative.

.fixed, .relative {
  border: 1px solid;
  width: 150px;
  height: 150px;
}

.fixed {
  border-color: red;
  position: fixed;
}

.relative {
  border-color: blue;
  margin-left: 200px;
  position: relative;
}

.absolute {
  background-color: rgba(0, 0, 0, 0.2);
  position: absolute;
}

.a {
  top: 0;
  left: 0;
}

.b {
  bottom: 0;
  right: 0;
}

  Left Top
  Right Bottom

  Left Top
  Right Bottom

Unfortunately, I don't understand why. I expect this to be defined somewhere, but I was only able to find resources discussing absolute and relative, not absolute and fixed.

This leads the to the question: Is it even true that, in regards to absolute position, I can treat fixed and relative elements the same, being able to use top/left/right/bottom to control offset amount to parent?


问:
How to do an insert in an update trigger?
I have an UPDATE trigger that occurs when a record is inserted into a table but would like to create an INSERT at the same time the trigger is fired.

The original INSERT puts a record into the BatchQueue table and when this occurs the trigger is fired to update a second table [Call].

I want to be able to add a record in the BatchQueue table that is basically similar to the initial record being inserted but differs on the time columns and one other column. I could technically do it on the original insert but would need to do a WHEN or IF, for only when SFlags = 11

The original INSERT statement:

```<code>BEGIN
    INSERT INTO BatchQueue (TimeToExecute, Operation,
    Parameter,RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID, @FilterID,
        @SFlags FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0
       OR (Flags&POWER(2,26)=POWER(2,26)))
 END
</code>```

This is the insert I would like to do:

```<code>BEGIN
   INSERT INTO [dbo].[BatchQueue]
   VALUES(DateAdd(mi,2,getutcdate()),1,Call.ID,2,null,9,0,0,0)
   WHEN Call.SFlags = 11
END
</code>```

The trigger statement:

```<code>BEGIN
IF @@ROWCOUNT > 0
BEGIN
   SET NOCOUNT ON
   UPDATE Call SET StoreReqCount = StoreReqCount + CallCount.actionCount
   FROM Call, (SELECT Parameter, [actionCount] = COUNT(*) FROM inserted
   GROUP BY Parameter ) AS CallCount
   WHERE Call.ID = CallCount.Parameter
END
</code>```

Can someone advise how best to do this? I hope I have clarified. To reiterate, either add the second INSERT to the first with the condition of SFlags=11 or do the insert with the trigger. Which is better?

EDIT:

Tried the following:

```<code>   SELECT @StoreActionID = [ID] FROM BatchQueue
   WHERE Parameter=@Parameter AND RuleID=@RuleID AND
    SFlags=@SFlags
   IF @StoreActionID IS NOT NULL
   BEGIN
     UPDATE BatchQueue SET FilterID = @FilterID WHERE [ID] =
     @StoreActionID
   END
ELSE
BEGIN
   INSERT INTO BatchQueue (TimeToExecute, Operation, Parameter,
      RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID,
     @FilterID, @SFlags FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0 OR
     (Flags&POWER(2,26)=POWER(2,26))) --bit26 indicates META-DATA-ONLY
END
-- ADDED ADDITIONAL INSERT TO INSERT ACTION BASED ON STOREFLAGS
BEGIN
    IF @SFlags = 11
    BEGIN
        INSERT INTO BatchQueue (TimeToExecute, Operation, Parameter,
        RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID,
        @FilterID, 9 FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0 OR
        (Flags&POWER(2,26)=POWER(2,26))) --bit26 indicates META-DATA-ONLY
    END
END
</code>```

答:
One of the good options you can take is write a stored procedure, and within the stored procedure include the original INSERT statement and then the special INSERT into same table as first INSERT. But, only execute the special INSERT if the first INSERT was successful.

Let the UPDATE happen through your existing trigger.  You don't want to disturb the trigger if its being used in production successfully.

Also,it would be good if you can wrap these two INSERTstatements within a transaction.

This will satisfy your requirement.

Put following T-SQL code into your stored precedure

```<code>SET NOCOUNT ON;
BEGIN TRY

 Declare @insertedID int;

  --original INSERT
  INSERT INTO BatchQueue (TimeToExecute, Operation,
  Parameter, RuleID, FilterID, SFlags)
    SELECT
      @TimeToExecute,
      @Operation,
      @Parameter,
      @RuleID,
      @FilterID,
      @SFlags
    FROM Call
    WHERE [ID] = @Parameter
    AND Active = 0
    AND (OnlineCount > 0
    OR OnlineScreenCount > 0
    OR (Flags & POWER(2, 26) = POWER(2, 26));

  Set @insertedID = scope_identity() ;

  ---- INSERT if a row is successfully inserted
  IF @@ROWCOUNT > 0
  BEGIN

    INSERT INTO [dbo].[BatchQueue]
      SELECT DATEADD(mi, 2, GETUTCDATE()), 1, @parameter, 2, NULL, 9, 0, 0, 0)
      WHERE @SFlags = 11;

  END

  --commit tran
  IF @@trancount > 0
  BEGIN
    COMMIT TRAN
  END

END TRY

BEGIN CATCH
  --get error details, which you can log to some table
  DECLARE @ErrorMessage nvarchar(4000);
  DECLARE @ErrorSeverity int;
  DECLARE @ErrorState int;

  SELECT
    @ErrorMessage = ERROR_MESSAGE(),
    @ErrorSeverity = ERROR_SEVERITY(),
    @ErrorState = ERROR_STATE();

  --roll back tran
  IF @@trancount > 0
  BEGIN
    ROLLBACK TRAN
  END

END CATCH
</code>```

Body:
I have an UPDATE trigger that occurs when a record is inserted into a table but would like to create an INSERT at the same time the trigger is fired.

The original INSERT puts a record into the BatchQueue table and when this occurs the trigger is fired to update a second table [Call].

I want to be able to add a record in the BatchQueue table that is basically similar to the initial record being inserted but differs on the time columns and one other column. I could technically do it on the original insert but would need to do a WHEN or IF, for only when SFlags = 11

The original INSERT statement:

BEGIN
    INSERT INTO BatchQueue (TimeToExecute, Operation,
    Parameter,RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID, @FilterID,
        @SFlags FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0
       OR (Flags&POWER(2,26)=POWER(2,26)))
 END

This is the insert I would like to do:

BEGIN
   INSERT INTO [dbo].[BatchQueue]
   VALUES(DateAdd(mi,2,getutcdate()),1,Call.ID,2,null,9,0,0,0)
   WHEN Call.SFlags = 11
END

The trigger statement:

BEGIN
IF @@ROWCOUNT > 0
BEGIN
   SET NOCOUNT ON
   UPDATE Call SET StoreReqCount = StoreReqCount + CallCount.actionCount
   FROM Call, (SELECT Parameter, [actionCount] = COUNT(*) FROM inserted
   GROUP BY Parameter ) AS CallCount
   WHERE Call.ID = CallCount.Parameter
END

Can someone advise how best to do this? I hope I have clarified. To reiterate, either add the second INSERT to the first with the condition of SFlags=11 or do the insert with the trigger. Which is better?

EDIT:

Tried the following:

   SELECT @StoreActionID = [ID] FROM BatchQueue
   WHERE Parameter=@Parameter AND RuleID=@RuleID AND
    SFlags=@SFlags
   IF @StoreActionID IS NOT NULL
   BEGIN
     UPDATE BatchQueue SET FilterID = @FilterID WHERE [ID] =
     @StoreActionID
   END
ELSE
BEGIN
   INSERT INTO BatchQueue (TimeToExecute, Operation, Parameter,
      RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID,
     @FilterID, @SFlags FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0 OR
     (Flags&POWER(2,26)=POWER(2,26))) --bit26 indicates META-DATA-ONLY
END
-- ADDED ADDITIONAL INSERT TO INSERT ACTION BASED ON STOREFLAGS
BEGIN
    IF @SFlags = 11
    BEGIN
        INSERT INTO BatchQueue (TimeToExecute, Operation, Parameter,
        RuleID, FilterID, SFlags)
        SELECT @TimeToExecute, @Operation, @Parameter, @RuleID,
        @FilterID, 9 FROM Call WHERE [ID]=@Parameter AND Active=0
               AND (OnlineCount>0 OR OnlineScreenCount>0 OR
        (Flags&POWER(2,26)=POWER(2,26))) --bit26 indicates META-DATA-ONLY
    END
END

Body:
One of the good options you can take is write a stored procedure, and within the stored procedure include the original INSERT statement and then the special INSERT into same table as first INSERT. But, only execute the special INSERT if the first INSERT was successful.

Let the UPDATE happen through your existing trigger.  You don't want to disturb the trigger if its being used in production successfully.

Also,it would be good if you can wrap these two INSERTstatements within a transaction.

This will satisfy your requirement.

Put following T-SQL code into your stored precedure

SET NOCOUNT ON;
BEGIN TRY

 Declare @insertedID int;

  --original INSERT
  INSERT INTO BatchQueue (TimeToExecute, Operation,
  Parameter, RuleID, FilterID, SFlags)
    SELECT
      @TimeToExecute,
      @Operation,
      @Parameter,
      @RuleID,
      @FilterID,
      @SFlags
    FROM Call
    WHERE [ID] = @Parameter
    AND Active = 0
    AND (OnlineCount > 0
    OR OnlineScreenCount > 0
    OR (Flags & POWER(2, 26) = POWER(2, 26));

  Set @insertedID = scope_identity() ;

  ---- INSERT if a row is successfully inserted
  IF @@ROWCOUNT > 0
  BEGIN

    INSERT INTO [dbo].[BatchQueue]
      SELECT DATEADD(mi, 2, GETUTCDATE()), 1, @parameter, 2, NULL, 9, 0, 0, 0)
      WHERE @SFlags = 11;

  END

  --commit tran
  IF @@trancount > 0
  BEGIN
    COMMIT TRAN
  END

END TRY

BEGIN CATCH
  --get error details, which you can log to some table
  DECLARE @ErrorMessage nvarchar(4000);
  DECLARE @ErrorSeverity int;
  DECLARE @ErrorState int;

  SELECT
    @ErrorMessage = ERROR_MESSAGE(),
    @ErrorSeverity = ERROR_SEVERITY(),
    @ErrorState = ERROR_STATE();

  --roll back tran
  IF @@trancount > 0
  BEGIN
    ROLLBACK TRAN
  END

END CATCH


问:
_i64toa_ function and equivalent in Java
can someone explain me what does _i64toa_s function does in c++ ?
and what is the equivalent in Java?

I didn't find any documentation on this function.

答:
It converts a 64-bit integer into a string. The java equivalent is Long.toString(value).

Oh, and there is some documentation here: https://msdn.microsoft.com/en-us/library/0we9x30h.aspx


问:
Media Query Styles Not Overriding Original Styles
I'm attempting to use some media queries for a website I'm building. The problem I'm having however, is while the media query styles are actually being applied, they're being overridden. I can't for the life of me tell why because I'm using the same exact selectors. Can anyone point out something that I'm not seeing?

ORIGINAL CSS

```<code>#global-wrapper-outer > #global-wrapper-inner {
    width: 85%;
    height: 100%;
    margin: 0 auto;
    position: relative;
}
#global-wrapper-outer > #global-wrapper-inner > nav {
    background: #fff;
    padding-bottom: 20px;
    box-shadow: 0 4px 2px -2px gray;
}
</code>```

MEDIA QUERY CSS

```<code>@media screen and (max-width:1024px) {
    #global-wrapper-outer > #global-wrapper-inner {
        width: 100%;
    }
    #global-wrapper-outer > #global-wrapper-inner > nav {
        display: none;
    }
}
</code>```

The second media query is working fine, where I set the nav to have a display of none. However, when I try to set the width of #global-wrapper-inner to 100% it doesn't apply. I can see the style being "applied" when I press F12 and select that element. However, the style itself is crossed out and not actually applied and it still has the original width of 85%.

答: You need to link the media query file (queries.css) later than the normal css file (style.css). That way the rules in the queries.css will override those in style.css.</p>

ContentLicense: CC BY-SA 4.0

Body:
I'm attempting to use some media queries for a website I'm building. The problem I'm having however, is while the media query styles are actually being applied, they're being overridden. I can't for the life of me tell why because I'm using the same exact selectors. Can anyone point out something that I'm not seeing?

ORIGINAL CSS

#global-wrapper-outer > #global-wrapper-inner {
    width: 85%;
    height: 100%;
    margin: 0 auto;
    position: relative;
}
#global-wrapper-outer > #global-wrapper-inner > nav {
    background: #fff;
    padding-bottom: 20px;
    box-shadow: 0 4px 2px -2px gray;
}

MEDIA QUERY CSS

@media screen and (max-width:1024px) {
    #global-wrapper-outer > #global-wrapper-inner {
        width: 100%;
    }
    #global-wrapper-outer > #global-wrapper-inner > nav {
        display: none;
    }
}

The second media query is working fine, where I set the nav to have a display of none. However, when I try to set the width of #global-wrapper-inner to 100% it doesn't apply. I can see the style being "applied" when I press F12 and select that element. However, the style itself is crossed out and not actually applied and it still has the original width of 85%.


问:
Global structure in Header files
i have a question regarding structure in c and there declaration in header file.
i am writing a code in which there are 3 variables which have another two variables linked with it. so i decided to declare a structure. below i'm writing a Pseudo-code

```<code>//----------registers.h---------
#ifndef __REG__H__
#define __REG__H__

struct ADE_reg_type
{
    unsigned int i : 4;
    unsigned int j : 4;
};

extern struct ADE_reg_type AIRMS_reg;
extern struct ADE_reg_type BIRMS_reg;
extern struct ADE_reg_type CIRMS_reg;
#endif

//-----------registers.c-------------------
#include "registers.h"

struct ADE_reg_type AIRMS_reg = {.i = 4,.j = 5};  //initializing
struct ADE_reg_type BIRMS_reg = {.i = 3,.j = 4};  //initializing
struct ADE_reg_type CIRMS_reg = {.i = 1,.j = 9};  //initializing

//-----------main.c-------------------
#include "registers.h"

int main()
{
   display_numbers(AIRMS_reg);  //display_numbers(struct ADE_reg_type) has
                              //defined in another .c file which also includes
                              // registers.h
}
</code>```

What i'm want is that i should have a variable which i can access in any .c file. scope of variable should be global. so is it a right way to use a global structure or i'm making some mistake here ?

答:
Define one global variable(of each type of course) somewhere and all the rest will be extern...
Structure has to be in header file, but never initialize or define a variable in header file - it's a bad habit.

for example:

```<code>//----------registers.h---------
#ifndef __REG__H__
#define __REG__H__

struct ADE_reg_type
{
    unsigned int i : 4;
    unsigned int j : 4;
};

#endif

//-----------registers.c-------------------
#include "registers.h"

struct ADE_reg_type AIRMS_reg = {.i = 4,.j = 5};  //initializing
struct ADE_reg_type BIRMS_reg = {.i = 3,.j = 4};  //initializing
struct ADE_reg_type CIRMS_reg = {.i = 1,.j = 9};  //initializing

//-----------main.c-------------------
#include "registers.h"

extern struct ADE_reg_type AIRMS_reg;

extern struct ADE_reg_type BIRMS_reg;

extern struct ADE_reg_type CIRMS_reg;

int main()
{
   display_numbers(AIRMS_reg);
}
</code>```

Title: Global structure in Header files

Body:
i have a question regarding structure in c and there declaration in header file.
i am writing a code in which there are 3 variables which have another two variables linked with it. so i decided to declare a structure. below i'm writing a Pseudo-code

//----------registers.h---------
#ifndef __REG__H__
#define __REG__H__

struct ADE_reg_type
{
    unsigned int i : 4;
    unsigned int j : 4;
};

extern struct ADE_reg_type AIRMS_reg;
extern struct ADE_reg_type BIRMS_reg;
extern struct ADE_reg_type CIRMS_reg;
#endif

//-----------registers.c-------------------
#include "registers.h"

struct ADE_reg_type AIRMS_reg = {.i = 4,.j = 5};  //initializing
struct ADE_reg_type BIRMS_reg = {.i = 3,.j = 4};  //initializing
struct ADE_reg_type CIRMS_reg = {.i = 1,.j = 9};  //initializing

//-----------main.c-------------------
#include "registers.h"

int main()
{
   display_numbers(AIRMS_reg);  //display_numbers(struct ADE_reg_type) has
                              //defined in another .c file which also includes
                              // registers.h
}

What i'm want is that i should have a variable which i can access in any .c file. scope of variable should be global. so is it a right way to use a global structure or i'm making some mistake here ?

Body:
Define one global variable(of each type of course) somewhere and all the rest will be extern...
Structure has to be in header file, but never initialize or define a variable in header file - it's a bad habit.

for example:

//----------registers.h---------
#ifndef __REG__H__
#define __REG__H__

struct ADE_reg_type
{
    unsigned int i : 4;
    unsigned int j : 4;
};

#endif

//-----------registers.c-------------------
#include "registers.h"

struct ADE_reg_type AIRMS_reg = {.i = 4,.j = 5};  //initializing
struct ADE_reg_type BIRMS_reg = {.i = 3,.j = 4};  //initializing
struct ADE_reg_type CIRMS_reg = {.i = 1,.j = 9};  //initializing

//-----------main.c-------------------
#include "registers.h"

extern struct ADE_reg_type AIRMS_reg;

extern struct ADE_reg_type BIRMS_reg;

extern struct ADE_reg_type CIRMS_reg;

int main()
{
   display_numbers(AIRMS_reg);
}


问:
using pyteserract 0.1.5 i get the following error after i use print image_to_string(img)what file is it not able to find?
I'm new to coding in python .i am using Pillow .  The following is the code:</p>

```<code>    >>> from PIL import Image
    >>> from pytesseract import*
    >>> img=Image.open("C:\image.jpg")
    >>> print image_to_string(img)
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        print image_to_string(img)
      File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 142, in         image_to_string
    config=config)
      File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 75, in run_tesseract
    stderr=subprocess.PIPE)
      File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
      File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified
</code>```

答:
I had the same problem when running while using Pytesseract. It is not working because of the following reasons:

Since the image is in C:\, maybe you do not have access rights. Try running the Python IDLE or cmd in Administrator mode.

The Tesseract is not installed. The pytesseract is just a python interface. You need to download and install the exe. You can download it from here.

Add this code pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' or you could add your path upto the exe file for teserract in your python script. Then try running.

Body:
I'm new to coding in python .i am using Pillow .  The following is the code:

    >>> from PIL import Image
    >>> from pytesseract import*
    >>> img=Image.open("C:\image.jpg")
    >>> print image_to_string(img)
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        print image_to_string(img)
      File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 142, in         image_to_string
    config=config)
      File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 75, in run_tesseract
    stderr=subprocess.PIPE)
      File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
      File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified


问:
How to make logcat tag editor bigger in android studio 3.0?
unable to scroll within it or can't even see my log tag

答:
I think the developers of android studio are unaware of this situation.

Currently, there isn't any apparent possible solution.

Consider using floating mode or windowed mode for now and wait for the developers to fix this.

Or you may enable full-screen mode for the android studio so that the editor will be slightly enlarged.


问:
ng test fail after adding 'ng2-dateime '
I have added ng2-datetime module in my Angular 4 project.

Now problem I am facing with ng test.

Currently it throws error like below.

```<code>'Cannot find name 'jQuery'
'Cannot find name '$'
</code>```

EDIT:

I did tried same way as most of answer below which is adding below lines in typings.d.ts

```<code>declare var jQuery: any;
declare var $: any;
</code>```

this will start 'ng test' but it will throw error while making build using ng build --prod.

```<code>Cannot redeclare block-scoped variable 'jQuery'
Cannot redeclare block-scoped variable '$'
</code>```

TIA

答:
In index.html put in a tag and declare this variables in the component.ts where you are using them

```<code>declare var jquery:any;
declare var $ :any;
</code>```

Body:
I have added ng2-datetime module in my Angular 4 project.

Now problem I am facing with ng test.

Currently it throws error like below.

'Cannot find name 'jQuery'
'Cannot find name '$'

EDIT:

I did tried same way as most of answer below which is adding below lines in typings.d.ts

declare var jQuery: any;
declare var $: any;

this will start 'ng test' but it will throw error while making build using ng build --prod.

Cannot redeclare block-scoped variable 'jQuery'
Cannot redeclare block-scoped variable '$'

TIA

Body:
In index.html put <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>in a tag and declare this variables in the component.ts where you are using them

declare var jquery:any;
declare var $ :any;


问:
How to use CA certificate to connect to database in java
Currently I'm connecting to Database that doesn't need a CA certificate as follows:

```<code>input = new FileInputStream("path/to/properties/file");
prop.load(input);

Class.forName(prop.getProperty("JDBC_DRIVER"));
conn = DriverManager.getConnection(prop.getProperty("DB_URL"), prop.getProperty("USER"), prop.getProperty("PASS"));
</code>```

Now the requirements have changed and i have to connect to the database using CA certificate which i have.
Now I'm trying the following:

```<code>String url = prop.getProperty("DB_URL")+"?verifyServerCertificate=false"+"&useSSL=true"+"&requireSSL=true";
Class.forName(prop.getProperty("JDBC_DRIVER"));
conn = DriverManager.getConnection(url, prop.getProperty("USER"), prop.getProperty("PASS"));
</code>```

Could you tell me how I can provide the path to the CA certificate and successfully connect to the database.

答:
I was able to figure out how to connect to the database using SSL(CA certificate):

```<code>input = new FileInputStream("path/to/properties/file");
    prop.load(input);

    Class.forName(prop.getProperty("JDBC_DRIVER"));
    System.getProperties().setProperty("javax.net.ssl.trustStore",
            "/path_to_certificate");
    String url = prop.getProperty("DB_URL")
            + "?verifyServerCertificate=false" + "&useSSL=true"
            + "&requireSSL=true";
    return DriverManager.getConnection(url, prop.getProperty("USER"),
            prop.getProperty("PASS"));
</code>```

This one worked for me.

Body:
Currently I'm connecting to Database that doesn't need a CA certificate as follows:

input = new FileInputStream("path/to/properties/file");
prop.load(input);

Class.forName(prop.getProperty("JDBC_DRIVER"));
conn = DriverManager.getConnection(prop.getProperty("DB_URL"), prop.getProperty("USER"), prop.getProperty("PASS"));

Now the requirements have changed and i have to connect to the database using CA certificate which i have.
Now I'm trying the following:

String url = prop.getProperty("DB_URL")+"?verifyServerCertificate=false"+"&useSSL=true"+"&requireSSL=true";
Class.forName(prop.getProperty("JDBC_DRIVER"));
conn = DriverManager.getConnection(url, prop.getProperty("USER"), prop.getProperty("PASS"));

Could you tell me how I can provide the path to the CA certificate and successfully connect to the database.

Body:
I was able to figure out how to connect to the database using SSL(CA certificate):

input = new FileInputStream("path/to/properties/file");
    prop.load(input);

    Class.forName(prop.getProperty("JDBC_DRIVER"));
    System.getProperties().setProperty("javax.net.ssl.trustStore",
            "/path_to_certificate");
    String url = prop.getProperty("DB_URL")
            + "?verifyServerCertificate=false" + "&useSSL=true"
            + "&requireSSL=true";
    return DriverManager.getConnection(url, prop.getProperty("USER"),
            prop.getProperty("PASS"));

This one worked for me.


问:
What areas of C++ are most useful to a C programmer?
I don't like C++, I like C, but I found I have to know something about C++ just like STL etc., to do some C-like C++.

What should I know about C++ at least? (language specification, API, libs etc.)

答:
You should learn Object-oriented programming concepts. It helps you to reuse source code and is easier to do maintenance and fix bugs. Object-oriented programming is very important if you want to develop a large project.

From C++, you should learn:

classes and objects: it helps you to abstract what you want to represent.

inheritance and virtual functions: Object-oriented programming features.

exceptions: it helps you to find and handle errors.

templates: you can write classes and functions for any data type.

stl containers: linked list, binary tree,


问:
Maps not showing in my jquery
My problem is the google maps not showing when i trying to wrap my javascript code to jquery in my laravel app,
this is screenshot:

but my console is not show the error code

this is my layout (master code)

master.blade.php

```<code><!DOCTYPE html>
        <html>
            <head>
                <title>Laravel Maps</title>
                <meta name="viewport" content="initial-scale=1.0">
                <meta charset="utf-8">
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
                <link rel="stylesheet" type="text/css" href="{{ asset('css/common.css') }}">
                @yield('style')
            </head>
            <body>

                @yield('content')

                <!-- JQuery -->
                <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
                <!--Common js -->
                <script src="{{ asset('js/common.js') }}"></script>
                <!-- Google maps js -->
                <script async defer src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDNqwhqdjvjjHzaiYNh-T8layzr-pQBcAs"></script>
                <!-- Bootstrap js -->
                <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
            </body>
        </html>
</code>```

My style code

common.css

```<code>#map {
        max-width: 100%;
        height: 500px;
        width: 600px;
        margin: 0 auto;
    }
</code>```

index.blade.php

```<code>@extends('layouts.master')

    @section('content')
        <div class="container">
            <div id="map">

            </div>
        </div>
    @endsection
</code>```

common.js

```<code>$(document).ready(function() {
        //initialize map
        var map;
        var myLat = new google.maps.LatLng(-33.8665433,151.1956316);
        //core map
        function createMap(myLat) {
            map = new google.maps.Map(document.getElementById('map'), {
                center: myLat,
                zoom: 12
            });
        }

        //marker
        function createMarker(latlng, icn, title) {
            var marker = new google.maps.Marker({
              position: latlng,
              icon: icn,
              Map: map,
              title: title
            });
        }

        function nearby(myLat, types) {
                //request location nearby
            var request = {
                location: myLat,
                radius: '2500',
                type: [types]
              };

            service = new google.maps.places.PlacesService(map);
            service.nearbySearch(request, callback);

            function callback(results, status) {
                if (status == google.maps.places.PlacesServiceStatus.OK) {
                    for (var i = 0; i < results.length; i++) {
                        var place   = results[i];
                        latlng      = place.geometry.location;
                        icn         = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
                        title       = place.name;

              createMarker(latlng,icn,title);
                    }
                }
            }
        }

    });
</code>```

I hope you can help me

答:
Call to initiate createMap

        var map;
        var myLat = new google.maps.LatLng(-33.8665433,151.1956316);
        function createMap(myLat) {
            map = new google.maps.Map(document.getElementById('map'), {
                center: myLat,
                zoom: 12
            });
        }

        //marker
        function createMarker(latlng, icn, title) {
            var marker = new google.maps.Marker({
              position: latlng,
              icon: icn,
              Map: map,
              title: title
            });
        }

        function nearby(myLat, types) {
                //request location nearby
            var request = {
                location: myLat,
                radius: '2500',
                type: [types]
              };

            service = new google.maps.places.PlacesService(map);
            service.nearbySearch(request, callback);

            function callback(results, status) {
                if (status == google.maps.places.PlacesServiceStatus.OK) {
                    for (var i = 0; i < results.length; i++) {
                        var place   = results[i];
                        latlng      = place.geometry.location;
                        icn         = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
                        title       = place.name;

              createMarker(latlng,icn,title);
                    }
                }
            }
        }
        //to call createMap function
        createMap(myLat);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#map {
        max-width: 100%;
        height: 500px;
        width: 600px;
        margin: 0 auto;
    }</code>```

```

Title: Maps not showing in my jquery

Body:
My problem is the google maps not showing when i trying to wrap my javascript code to jquery in my laravel app,
this is screenshot:

but my console is not show the error code

this is my layout (master code)

master.blade.php

<!DOCTYPE html>

                <title>Laravel Maps</title>
                <meta name="viewport" content="initial-scale=1.0">
                <meta charset="utf-8">
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
                <link rel="stylesheet" type="text/css" href="{{ asset('css/common.css') }}">
                @yield('style')

                @yield('content')

My style code

common.css

#map {
        max-width: 100%;
        height: 500px;
        width: 600px;
        margin: 0 auto;
    }

index.blade.php

@extends('layouts.master')

    @section('content')

    @endsection

common.js

$(document).ready(function() {
        //initialize map
        var map;
        var myLat = new google.maps.LatLng(-33.8665433,151.1956316);
        //core map
        function createMap(myLat) {
            map = new google.maps.Map(document.getElementById('map'), {
                center: myLat,
                zoom: 12
            });
        }

        //marker
        function createMarker(latlng, icn, title) {
            var marker = new google.maps.Marker({
              position: latlng,
              icon: icn,
              Map: map,
              title: title
            });
        }

        function nearby(myLat, types) {
                //request location nearby
            var request = {
                location: myLat,
                radius: '2500',
                type: [types]
              };

            service = new google.maps.places.PlacesService(map);
            service.nearbySearch(request, callback);

            function callback(results, status) {
                if (status == google.maps.places.PlacesServiceStatus.OK) {
                    for (var i = 0; i < results.length; i++) {
                        var place   = results[i];
                        latlng      = place.geometry.location;
                        icn         = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
                        title       = place.name;

              createMarker(latlng,icn,title);
                    }
                }
            }
        }

    });

I hope you can help me

Body:
Call to initiate createMap

        var map;
        var myLat = new google.maps.LatLng(-33.8665433,151.1956316);
        function createMap(myLat) {
            map = new google.maps.Map(document.getElementById('map'), {
                center: myLat,
                zoom: 12
            });
        }

        //marker
        function createMarker(latlng, icn, title) {
            var marker = new google.maps.Marker({
              position: latlng,
              icon: icn,
              Map: map,
              title: title
            });
        }

        function nearby(myLat, types) {
                //request location nearby
            var request = {
                location: myLat,
                radius: '2500',
                type: [types]
              };

            service = new google.maps.places.PlacesService(map);
            service.nearbySearch(request, callback);

            function callback(results, status) {
                if (status == google.maps.places.PlacesServiceStatus.OK) {
                    for (var i = 0; i < results.length; i++) {
                        var place   = results[i];
                        latlng      = place.geometry.location;
                        icn         = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
                        title       = place.name;

              createMarker(latlng,icn,title);
                    }
                }
            }
        }
        //to call createMap function
        createMap(myLat);

#map {
        max-width: 100%;
        height: 500px;
        width: 600px;
        margin: 0 auto;
    }

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDNqwhqdjvjjHzaiYNh-T8layzr-pQBcAs"></script>

<div class="container">
 <div id="map">

 </div>
</div>


问:
Scrape the
 tag using Python Selenium
I have a requirement to extract the
 tag from the HTML. However I am not able to get it done.
This is the HTML:

        Press "New Word"

```

<p>I tried using the following, but I dont get the text.</p>

<pre class="lang-python prettyprint-override"><code>word = driver.find_element_by_xpath('//*[@id="gennedword"]')
print(word.get_attribute('text'))
print(word.get_attribute('innerHTML'))
</code>```

All it returns was None and for innerHtml I get -

```

答:
As per your Question you are trying to scrape the
 tag and extract the text Press "New Word". To achieve that you can use the following line of code :

```<code>print(driver.find_element_by_xpath("//div[@id='gennedword-container' and @class='small-12 columns']/p[@id='gennedword' and @class='text-center']").get_attribute('innerHTML'))
</code>```

Title: Scrape the <p> tag using Python Selenium

Body:
I have a requirement to extract the
 tag from the HTML. However I am not able to get it done.
This is the HTML:

        Press "New Word"

I tried using the following, but I dont get the text.

word = driver.find_element_by_xpath('//*[@id="gennedword"]')
print(word.get_attribute('text'))
print(word.get_attribute('innerHTML'))

All it returns was None and for innerHtml I get -

Body:
As per your Question you are trying to scrape the <p> tag and extract the text Press "New Word". To achieve that you can use the following line of code :

print(driver.find_element_by_xpath("//div[@id='gennedword-container' and @class='small-12 columns']/p[@id='gennedword' and @class='text-center']").get_attribute('innerHTML'))


问:
Fetch array value - JQuery
Consider that i have the following html

```<code><input type="text" id="other_floor_plans" name="other_floor_plans[]" value="["Pool","Office","Sprinkler","Boiler"]">
</code>```

To fetch the values i use

```<code>a = $('#other_floor_plans').val()
</code>```

It returns the following

```<code>"["Pool","Office","Sprinkler","Boiler"]"
</code>```

If i use a[0], it returns "[" as output. I need to get "Pool" as the first value.

How to accomplish this?

答:
You can use eval function to convert string to array and get the value.

```<code>var a = "['Pool','Office','Sprinkler','Boiler']"; // or you can also assign like this var a ='["Pool","Office","Sprinkler","Boiler"]'
var firstItem = eval(a)[0];
console.log(firstItem);  //output will be "Pool"
</code>```

Title: Fetch array value - JQuery

Body:
Consider that i have the following html

<input type="text" id="other_floor_plans" name="other_floor_plans[]" value="["Pool","Office","Sprinkler","Boiler"]">

To fetch the values i use

a = $('#other_floor_plans').val()

It returns the following

"["Pool","Office","Sprinkler","Boiler"]"

If i use a[0], it returns "[" as output. I need to get "Pool" as the first value.

How to accomplish this?

Body:
You can use eval function to convert string to array and get the value.

var a = "['Pool','Office','Sprinkler','Boiler']"; // or you can also assign like this var a ='["Pool","Office","Sprinkler","Boiler"]'
var firstItem = eval(a)[0];
console.log(firstItem);  //output will be "Pool"