问:
how use const in try catch block
const is a block level variable so when i try suspect code

```<code>try{
   const foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}
</code>```

const is hide in the {}

but

```<code>const foo ;
try{
    foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}
</code>```

not working either because const must be init on declaration.

So how should I using const in try..catch block ?

答:
You've hit the nail on the head, because of block scoping you can't declare a const in a try catch block and use it outside the block.

You have <s>2</s> 3 options:

Use let:

```<code>let foo;
try{
    foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}
</code>```

Or if there is very little code to come after the try catch block, and it all depends on the success of the try, you can put the rest of the code in the try:

```<code>try{
    const foo = bar[global.name].foofoo[global.name2];
    return foo;
}catch (err){
    console.log(error(err.message));
}
</code>```

EDIT

Option 3 inspired by @Yury Tarabanko's comment: if possible modularise the try catch part into its own function, the output of which should be the value of the new const:

```<code>function trycatch() {
    try {
        return bar[global.name].foofoo[global.name2];
    } catch (err) {
        console.log(error(err.message));
        return undefined; // or whatever you want
    }
}

const foo = trycatch(); // === bar[global.name]... if succeeded, otherwise === the return value from the catch block
</code>```

Title: how use const in try catch block

Body:
const is a block level variable so when i try suspect code

try{
   const foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}

const is hide in the {}

but

const foo ;
try{
    foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}

not working either because const must be init on declaration.

So how should I using const in try..catch block ?

Body:
You've hit the nail on the head, because of block scoping you can't declare a const in a try catch block and use it outside the block.

You have <s>2</s> 3 options:

Use let:

let foo;
try{
    foo = bar[global.name].foofoo[global.name2];
}catch (err){
    console.log(error(err.message));
}

Or if there is very little code to come after the try catch block, and it all depends on the success of the try, you can put the rest of the code in the try:

try{
    const foo = bar[global.name].foofoo[global.name2];
    return foo;
}catch (err){
    console.log(error(err.message));
}

EDIT

Option 3 inspired by @Yury Tarabanko's comment: if possible modularise the try catch part into its own function, the output of which should be the value of the new const:

function trycatch() {
    try {
        return bar[global.name].foofoo[global.name2];
    } catch (err) {
        console.log(error(err.message));
        return undefined; // or whatever you want
    }
}

const foo = trycatch(); // === bar[global.name]... if succeeded, otherwise === the return value from the catch block


来源: stackexchange

问:
Date format not working correctly
Im submitting a form that has a date range picker in it.

I have the code to get the value of the picker from the form, which is in this format:

```<code>01/03/2017 - 01/03/2017
</code>```

I also have it so that it splits the date range into two variables.

```<code>$one = 20/01/2017
$two = 13/03/2017
</code>```

Im now trying to format the date of these variables into the one that MYSQL uses.

My problem is that the end date will fail and be displayed as 1970-01-01 all the time.

```<code>// Get the range from the form
$daterange = $_POST["daterange"];

// Split the range into a start and end date
list($one, $two) = explode("-", "$daterange", 2);

// Test the split worked
echo $one;
echo $two;

// Format the start date into MySQL style
$StartDate = date("Y-m-d", strtotime($one));

// Test date
echo $StartDate;

// Format the end date into MySQL style
$EndDate = date("Y-m-d", strtotime($two));

//Test date
echo $EndDate;
</code>```

答:
Personnaly, I prefer the date_create_from_format that does not presume anything.

One-liner :

```<code>$StartDate = date_create_from_format( "d/m/Y" , $one )->format("Y-m-d");
</code>```

ContentLicense: CC BY-SA 3.0

Title: Date format not working correctly

Body:
Im submitting a form that has a date range picker in it.

I have the code to get the value of the picker from the form, which is in this format:

01/03/2017 - 01/03/2017

I also have it so that it splits the date range into two variables.

$one = 20/01/2017
$two = 13/03/2017

Im now trying to format the date of these variables into the one that MYSQL uses.

My problem is that the end date will fail and be displayed as 1970-01-01 all the time.

// Get the range from the form
$daterange = $_POST["daterange"];

// Split the range into a start and end date
list($one, $two) = explode("-", "$daterange", 2);

// Test the split worked
echo $one;
echo $two;

// Format the start date into MySQL style
$StartDate = date("Y-m-d", strtotime($one));

// Test date
echo $StartDate;

// Format the end date into MySQL style
$EndDate = date("Y-m-d", strtotime($two));

//Test date
echo $EndDate;

Body:
Personnaly, I prefer the date_create_from_format that does not presume anything.

One-liner :

$StartDate = date_create_from_format( "d/m/Y" , $one )->format("Y-m-d");


问:
Sequential Search Java
I have a problem with sequentially searching, this is the exercise:

You are testing the physical endurance of a type of brick. The test is made to find the max height the brick can fall without breaking from and N stories building. You have k bricks and two cases:

Case 1. When k = 1 the tries begin from the current floor upwards, sequentially, until the brick breaks.

Case 2. For k > 1 one brick is dropped from floor N/2. If it breaks, case 2 is applied again between floors 1 and N/2 -1. If the brick does not break, case 2 is applied again between floors N/2 + 1 and N.

I have a problem with the CASE 1 cause as I don't know how to approach it:

Initially you call dropBricks(k,1,N); Being k, and N introduced by the User(Keyboard).

```<code>public static boolean breakingFloor(int floor){
    boolean breaks;
    Random r =new Random();
    int breakingFloor= r.nextInt(floor)+1;

    if(floor>=breakingFloor){
        breaks=true;
    }else{
        breaks=false;
    }

  return breaks;
}
</code>```

dropBricks receives k(number of remaining bricks, first (first floor),last (last floor = N)) and the output would be the breakingFloor

```<code>public static int dropBricks(int k,int first,int last){
    int result=0;

    if (k==1){//CASE 1
        //I KNOW THIS CODE IS WRONG, IS JUST O NOT LEAVE IT IN EMPTY
         do{
             dropBricks(k,first,last);
             first++;
         }while(breakingFloor(first));
         System.out.println("Floor brick broke "+floor);

    }else{//CASE 2
        if(last-first<=1){
            if(last==first){
                result=first;
                System.out.println("Floor brick broke "+result);
            }else{
                if(breakingFloor(first)){
                    result=first;
                    k--;
                    System.out.println("Floor brick broke "+result);
                }else{
                    result=last;
                    k--;
                    System.out.println("Floor brick broke "+result);
                }
            }
        }else{
            int mid=((first+last)/2);
            if(breakingFloor(mid)){
                result=dropBricks(k-1,first,mid);
                System.out.println("Floor brick broke "+result);
            }else{
                result=dropBricks(k,mid,last);
                System.out.println("Floor brick broke "+result);
            }
        }
    }
    return result;
}
</code>```

答:
Your issue - or at least one of them - is that every time you go around this loop...

```<code>do{
    dropBricks(k,first,last);
    first++;
} while( breakingFloor(first) );
</code>```

... you are choosing a new random floor at which it will break (which happens in the breakingFloor method):

```<code>Random r =new Random();
int breakingFloor= r.nextInt(floor)+1;
</code>```

This will definitely give you very inconsistent behaviour. It may actually work some of the time by a fluke.

You want to choose the floor at which it will break at the start and for it to remain constant.

A sensible way to test your application might be to hard-code a breaking floor to start with and then introduce the randomness later.

Title: Sequential Search Java

Body:
I have a problem with sequentially searching, this is the exercise:

You are testing the physical endurance of a type of brick. The test is made to find the max height the brick can fall without breaking from and N stories building. You have k bricks and two cases:

Case 1. When k = 1 the tries begin from the current floor upwards, sequentially, until the brick breaks.

Case 2. For k > 1 one brick is dropped from floor N/2. If it breaks, case 2 is applied again between floors 1 and N/2 -1. If the brick does not break, case 2 is applied again between floors N/2 + 1 and N.

I have a problem with the CASE 1 cause as I don't know how to approach it:

Initially you call dropBricks(k,1,N); Being k, and N introduced by the User(Keyboard).

public static boolean breakingFloor(int floor){
    boolean breaks;
    Random r =new Random();
    int breakingFloor= r.nextInt(floor)+1;

    if(floor>=breakingFloor){
        breaks=true;
    }else{
        breaks=false;
    }

  return breaks;
}

dropBricks receives k(number of remaining bricks, first (first floor),last (last floor = N)) and the output would be the breakingFloor

public static int dropBricks(int k,int first,int last){
    int result=0;

    if (k==1){//CASE 1
        //I KNOW THIS CODE IS WRONG, IS JUST O NOT LEAVE IT IN EMPTY
         do{
             dropBricks(k,first,last);
             first++;
         }while(breakingFloor(first));
         System.out.println("Floor brick broke "+floor);

    }else{//CASE 2
        if(last-first<=1){
            if(last==first){
                result=first;
                System.out.println("Floor brick broke "+result);
            }else{
                if(breakingFloor(first)){
                    result=first;
                    k--;
                    System.out.println("Floor brick broke "+result);
                }else{
                    result=last;
                    k--;
                    System.out.println("Floor brick broke "+result);
                }
            }
        }else{
            int mid=((first+last)/2);
            if(breakingFloor(mid)){
                result=dropBricks(k-1,first,mid);
                System.out.println("Floor brick broke "+result);
            }else{
                result=dropBricks(k,mid,last);
                System.out.println("Floor brick broke "+result);
            }
        }
    }
    return result;
}

Body:
Your issue - or at least one of them - is that every time you go around this loop...

do{
    dropBricks(k,first,last);
    first++;
} while( breakingFloor(first) );

... you are choosing a new random floor at which it will break (which happens in the breakingFloor method):

Random r =new Random();
int breakingFloor= r.nextInt(floor)+1;

This will definitely give you very inconsistent behaviour. It may actually work some of the time by a fluke.

You want to choose the floor at which it will break at the start and for it to remain constant.

A sensible way to test your application might be to hard-code a breaking floor to start with and then introduce the randomness later.


问:
Conditional chaining of promises
I want to chain my promises depending upon if the previous call was resolved or rejected. I am making  a call to server in all promises.
So, I am writing it like-

```<code>apiServices.patientsSearch(id)
.then(function(data){
    return callback(null,data);
},function(err){
    return apiServices.studiesSearch(id);
}).then(function(data){
    return callback(null,data);
},function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    return callback(null,data);
})
.catch(function(err){
    return callback(false,err);
});
</code>```

As every then returns a promise object, problem is that catch is always being called if any promise except the last one calls resolve. One way I am thinking is to check if err is empty and ignore it. Is it the right way to do it ?

I am using request module, if I set forever: true, I start getting-

```<code>{ [Error: socket hang up] code: 'ECONNRESET' }
</code>```

With forever false, it works. Why my socket is still busy even after the request has ended ? As the next request will go only when reject is called, so socket should be free by that time.

答:
You should only call the callback once. Don't pass it as the onfulfilled-handler after each promise, call it once in the end:

```<code>apiServices.patientsSearch(id).then(null, function(err){
    return apiServices.studiesSearch(id);
}).then(null, function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    callback(null,data);
}, function(err){
    callback(false,err);
});
</code>```

or

```<code>apiServices.patientsSearch(id).catch(function(err){
    return apiServices.studiesSearch(id);
}).catch(function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    callback(null,data);
}, function(err){
    callback(false,err);
});
</code>```

Of course, you shouldn't be calling any callbacks at all in promise-based code, so use this only if you have to interface with legacy code. Otherwise, don't take a callback parameter and just return the promise:

```<code>return apiServices.patientsSearch(id).catch(function(err){
    return apiServices.studiesSearch(id);
}).catch(function(){
    return apiServices.seriesSearch(id);
});
</code>```

Title: Conditional chaining of promises

Body:
I want to chain my promises depending upon if the previous call was resolved or rejected. I am making  a call to server in all promises.
So, I am writing it like-

apiServices.patientsSearch(id)
.then(function(data){
    return callback(null,data);
},function(err){
    return apiServices.studiesSearch(id);
}).then(function(data){
    return callback(null,data);
},function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    return callback(null,data);
})
.catch(function(err){
    return callback(false,err);
});

As every then returns a promise object, problem is that catch is always being called if any promise except the last one calls resolve. One way I am thinking is to check if err is empty and ignore it. Is it the right way to do it ?

I am using request module, if I set forever: true, I start getting-

{ [Error: socket hang up] code: 'ECONNRESET' }

With forever false, it works. Why my socket is still busy even after the request has ended ? As the next request will go only when reject is called, so socket should be free by that time.

Body:
You should only call the callback once. Don't pass it as the onfulfilled-handler after each promise, call it once in the end:

apiServices.patientsSearch(id).then(null, function(err){
    return apiServices.studiesSearch(id);
}).then(null, function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    callback(null,data);
}, function(err){
    callback(false,err);
});

or

apiServices.patientsSearch(id).catch(function(err){
    return apiServices.studiesSearch(id);
}).catch(function(){
    return apiServices.seriesSearch(id);
}).then(function(data){
    callback(null,data);
}, function(err){
    callback(false,err);
});

Of course, you shouldn't be calling any callbacks at all in promise-based code, so use this only if you have to interface with legacy code. Otherwise, don't take a callback parameter and just return the promise:

return apiServices.patientsSearch(id).catch(function(err){
    return apiServices.studiesSearch(id);
}).catch(function(){
    return apiServices.seriesSearch(id);
});


问:
AngularJS app in GAE gets CORS error
I have a number of apps on GAE for Python and one based on AngularJS. The others are working fine, and the AngularJS one used to work OK. Now I get the following error:

XMLHttpRequest cannot load xxxxxxxxx/rest/loadlocale?locale=en.
  Redirect from 'xxxxxxxxxxxxx/rest/loadlocale?locale=en' to
  'https://www.google.com/accounts/ServiceLogin?service=ah&passive=true&......
  has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
  header is present on the requested resource. Origin 'xxxxxxxx' is
  therefore not allowed access.

If I go to ServiceLogin explicitly from Chrome, the the app will work OK for a while. After a while (I assume when the login expires) the error crops up again.

app.yaml has the following section:

```<code>- url: /rest/.*
  script: main.APP
  login: required
  secure: always
</code>```

but removing "secure: always" makes no difference.

The error occurs at the first client http request, but the Python server code for the request handler shows no sign of ever being
accessed.

答:
This occurs due the fact you have login: required in your app.yaml meaning that all XMLHttpRequest request will require a valid session.

GAE's login is handled by Google Accounts. So you can't change your settings.

Try removing login from app.yaml. If you only want certain request to be allowed without a valid Google session you need to specify what are allow and not. For instance:

```<code>- url: /rest/loadlocale
  script: main.APP
  login: optional # this is the default value and can be removed.
  secure: always

- url: /rest/.*
  script: main.APP
  login: required
  secure: always
</code>```

Title: AngularJS app in GAE gets CORS error

Body:
I have a number of apps on GAE for Python and one based on AngularJS. The others are working fine, and the AngularJS one used to work OK. Now I get the following error:

XMLHttpRequest cannot load xxxxxxxxx/rest/loadlocale?locale=en.
  Redirect from 'xxxxxxxxxxxxx/rest/loadlocale?locale=en' to
  'https://www.google.com/accounts/ServiceLogin?service=ah&passive=true&......
  has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
  header is present on the requested resource. Origin 'xxxxxxxx' is
  therefore not allowed access.

If I go to ServiceLogin explicitly from Chrome, the the app will work OK for a while. After a while (I assume when the login expires) the error crops up again.

app.yaml has the following section:

- url: /rest/.*
  script: main.APP
  login: required
  secure: always

but removing "secure: always" makes no difference.

The error occurs at the first client http request, but the Python server code for the request handler shows no sign of ever being
accessed.

Body:
This occurs due the fact you have login: required in your app.yaml meaning that all XMLHttpRequest request will require a valid session.

GAE's login is handled by Google Accounts. So you can't change your settings.

Try removing login from app.yaml. If you only want certain request to be allowed without a valid Google session you need to specify what are allow and not. For instance:

- url: /rest/loadlocale
  script: main.APP
  login: optional # this is the default value and can be removed.
  secure: always

- url: /rest/.*
  script: main.APP
  login: required
  secure: always


问:
TSQL find number of correspondences
I have the following table:

```<code>SenderName  ReceiverName    NumberOfTime
Ajay          Vijay             1
Anthony       Mark              3
Anthony       John              5
David         Mark              2
David         John              5
David         John              3
David         John              1
John          David             2
John          David             2
John          Anthony           5
Mark          Anthony           1
</code>```

Test Data:

```<code>CREATE TABLE [dbo].[tblMyTempTable](
[SenderName] [varchar](20) NULL,
[ReceiverName] [varchar](10) NULL,
[NumberOfTime] [int] NULL
) ON [PRIMARY]
GO

INSERT [dbo].[tblMyTempTable]
  ([SenderName], [ReceiverName], [NumberOfTime])
VALUES
  (N'David', N'John', 1)
  ,(N'Mark', N'Anthony', 1)
  ,(N'Ajay', N'Vijay', 1)
  ,(N'John', N'David', 2)
  ,(N'Anthony', N'Mark', 3)
  ,(N'David', N'John', 5)
  ,(N'David', N'John', 3)
  ,(N'John', N'David', 2)
  ,(N'David', N'Mark', 2)
  ,(N'John', N'Anthony', 5)
  ,(N'Anthony', N'John', 5)
</code>```

I need to find out how many times correspondence has been between each pair. For example, Anthony has contacted John 5 times, John has contacted Anthony 5 times. So total correspondence between John and Anthony has been 10 times.

Similarly, David has contacted John total of 9 times, John has contacted David 4 times. So total will be 13. I have tried many things including swapping columns using substring, repalce etc. I was wondering if anyone had interesting way to achieve the wanted results. Thanks in advance.

答:
Get the least of the names into one column and the greater of them into another, so you can aggregate for each pair.</p>

```<code>select
case when sender_name<receiver_name then sender_name else receiver_name end as name1,
case when sender_name>receiver_name then sender_name else receiver_name end as name2,
sum(numberoftime)
from t
group by case when sender_name<receiver_name then sender_name else receiver_name end,
case when sender_name>receiver_name then sender_name else receiver_name end
</code>```

Title: TSQL find number of correspondences

Body:
I have the following table:

SenderName  ReceiverName    NumberOfTime
Ajay          Vijay             1
Anthony       Mark              3
Anthony       John              5
David         Mark              2
David         John              5
David         John              3
David         John              1
John          David             2
John          David             2
John          Anthony           5
Mark          Anthony           1

Test Data:

CREATE TABLE [dbo].[tblMyTempTable](
[SenderName] [varchar](20) NULL,
[ReceiverName] [varchar](10) NULL,
[NumberOfTime] [int] NULL
) ON [PRIMARY]
GO

INSERT [dbo].[tblMyTempTable]
  ([SenderName], [ReceiverName], [NumberOfTime])
VALUES
  (N'David', N'John', 1)
  ,(N'Mark', N'Anthony', 1)
  ,(N'Ajay', N'Vijay', 1)
  ,(N'John', N'David', 2)
  ,(N'Anthony', N'Mark', 3)
  ,(N'David', N'John', 5)
  ,(N'David', N'John', 3)
  ,(N'John', N'David', 2)
  ,(N'David', N'Mark', 2)
  ,(N'John', N'Anthony', 5)
  ,(N'Anthony', N'John', 5)

I need to find out how many times correspondence has been between each pair. For example, Anthony has contacted John 5 times, John has contacted Anthony 5 times. So total correspondence between John and Anthony has been 10 times.

Similarly, David has contacted John total of 9 times, John has contacted David 4 times. So total will be 13. I have tried many things including swapping columns using substring, repalce etc. I was wondering if anyone had interesting way to achieve the wanted results. Thanks in advance.

Body:
Get the least of the names into one column and the greater of them into another, so you can aggregate for each pair.

select
case when sender_name<receiver_name then sender_name else receiver_name end as name1,
case when sender_name>receiver_name then sender_name else receiver_name end as name2,
sum(numberoftime)
from t
group by case when sender_name<receiver_name then sender_name else receiver_name end,
case when sender_name>receiver_name then sender_name else receiver_name end


问:
Could you easily switch from SoapClient to pear's Soap_Client
I recently changed hosts and found that they only support Pear's Soap_Client class and not the standard PHP SoapClient class and the opposite was said in the forums I looked through before making the switch. Is there a specific syntax that I could use to easily switch from one to the other? I'm not as familiar with the PEAR Soap_Client class to know the differences enough to make the conversion. So even a clear distinction between the two would be greatly appreciated. I've already got several classes/functions/methods running based off of this and it would be a pretty fair waste of money to have to switch hosts at this point. Thanks in advance!

EDIT

Here is a small snippet of where I am calling the class:

```<code>        try {
        $soapClient = new SoapClient(
            $this->webserviceWsdl,
            array(
                'exceptions'    => 1,
                'trace'             => 1
            )
        );
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }

    try {
        $soapClient->__setLocation(str_replace(
            '%%foo%%',
            $this->responseConfig['foo'],
            $this->webserviceEndpoint
        ));
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }

    try {
        $soapClient->__setSoapHeaders($this->buildSoapHeader($function));
        return $soapClient->__soapCall($function, array($params));
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }
</code>```

答:
No, there is no easy way to make your code use PEAR's SoapClient class instead of PHP's built-in class. Their APIs are too different.

That said, you should not use PEAR's SOAP client lib because it's unmaintained.

Try to convince the hoster to install the php-soap package on their server - that is not hard.

Body:
I recently changed hosts and found that they only support Pear's Soap_Client class and not the standard PHP SoapClient class and the opposite was said in the forums I looked through before making the switch. Is there a specific syntax that I could use to easily switch from one to the other? I'm not as familiar with the PEAR Soap_Client class to know the differences enough to make the conversion. So even a clear distinction between the two would be greatly appreciated. I've already got several classes/functions/methods running based off of this and it would be a pretty fair waste of money to have to switch hosts at this point. Thanks in advance!

EDIT

Here is a small snippet of where I am calling the class:

        try {
        $soapClient = new SoapClient(
            $this->webserviceWsdl,
            array(
                'exceptions'    => 1,
                'trace'             => 1
            )
        );
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }

    try {
        $soapClient->__setLocation(str_replace(
            '%%foo%%',
            $this->responseConfig['foo'],
            $this->webserviceEndpoint
        ));
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }

    try {
        $soapClient->__setSoapHeaders($this->buildSoapHeader($function));
        return $soapClient->__soapCall($function, array($params));
    } catch (SoapFault $fault) {
        return json_decode(json_encode(array('status' => 'invalid', 'msg' => "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})")),1);
    }


问:
css show hide jump issue
I want to implement "show/hide" text using css only. I tried following code in fiddle.

https://jsfiddle.net/phvt8g5w/

```<code>.show-hide-text {
  display: flex;
  flex-wrap: wrap;
}

.show-hide-text a {
  order: 2;
}

.show-hide-text p {
  position: relative;
  overflow: hidden;
  max-height: 60px; // The Height of 3 rows
}

.show-hide-text p {
  display: -webkit-box;
  -webkit-line-clamp: 3; // 3 Rows of text
  -webkit-box-orient: vertical;
}

.show-less {
  display: none;
}

.show-less:target {
  display: block;
}

.show-less:target ~ p {
  display: block;
  max-height: 100%;
}

.show-less:target + a {
  display: none;
}
</code>```

Effects are good. But I faced one problem. If I click "show more" link, it will scroll to bottom of the page. Again I go to the top of the page and click the show less link. How can I fix this problem?

答:
Here is a simplified answer . Hope this is what you need ;)

Just changed the target elements and simplified the css to get the
  desired result !

body {
  margin: 0px;
  padding: 0px;
}

.show-hide-text {
  display: flex;
  flex-wrap: wrap;
}

.show-hide-text a {
  order: 2;
}

.show-hide-text p {
  position: relative;
  overflow: hidden;
  max-height: 60px; // The Height of 3 rows
}

.show-hide-text p {
  display: -webkit-box;
  -webkit-line-clamp: 3; // 3 Rows of text
  -webkit-box-orient: vertical;
}

.show-less {
  display: none;
}

/* Simplified Css For Show Hide */

#a1:target a.show-less {
  display: block
}

#a1:target a.show-more {
  display: none
}

#a1:target p {
  display: block;
  max-height: 100%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="show-hide-text" id="a1">
  Show more
  Show less

  <p>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
</div>
<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>

<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>

<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p></code>```

Title: css show hide jump issue

Body:
I want to implement "show/hide" text using css only. I tried following code in fiddle.

https://jsfiddle.net/phvt8g5w/

.show-hide-text {
  display: flex;
  flex-wrap: wrap;
}

.show-hide-text a {
  order: 2;
}

.show-hide-text p {
  position: relative;
  overflow: hidden;
  max-height: 60px; // The Height of 3 rows
}

.show-hide-text p {
  display: -webkit-box;
  -webkit-line-clamp: 3; // 3 Rows of text
  -webkit-box-orient: vertical;
}

.show-less {
  display: none;
}

.show-less:target {
  display: block;
}

.show-less:target ~ p {
  display: block;
  max-height: 100%;
}

.show-less:target + a {
  display: none;
}

Effects are good. But I faced one problem. If I click "show more" link, it will scroll to bottom of the page. Again I go to the top of the page and click the show less link. How can I fix this problem?

Body:
Here is a simplified answer . Hope this is what you need ;)

Just changed the target elements and simplified the css to get the
  desired result !

body {
  margin: 0px;
  padding: 0px;
}

.show-hide-text {
  display: flex;
  flex-wrap: wrap;
}

.show-hide-text a {
  order: 2;
}

.show-hide-text p {
  position: relative;
  overflow: hidden;
  max-height: 60px; // The Height of 3 rows
}

.show-hide-text p {
  display: -webkit-box;
  -webkit-line-clamp: 3; // 3 Rows of text
  -webkit-box-orient: vertical;
}

.show-less {
  display: none;
}

/* Simplified Css For Show Hide */

#a1:target a.show-less {
  display: block
}

#a1:target a.show-more {
  display: none
}

#a1:target p {
  display: block;
  max-height: 100%;
}

<div class="show-hide-text" id="a1">
  <a class="show-more" href="#a1">Show more</a>
  <a class="show-less" href="#">Show less</a>

  <p>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
</div>
<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>

<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>

<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
<p>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
  software like Aldus PageMaker including versions of Lorem Ipsum.
</p>


问:
New column in ng2-smart-table created from Object datatype
Does anyone know how to create new column from Object datatype ?
How I able to to do it ?
Code of my setting and data below for more clearly understanding
Thanks in Advance!
    private settings = {

```<code>columns: {
      firstName: {
        title: 'First name',
        type: 'text'
      },
      lastName: {
        title: 'Last name',
        type: 'text'
      },
      userType: {
        // This is correct way only when there is string in response from API named - userType
        // But when I'm trying to type something like - userType.value i get an error
        title: 'User type',
        type: 'text'
      },
}
</code>```

data from API:

```<code>.......
    {
      firstName: 'Jacob',
      lastName: '',
      middleName: '',
      userType: {value: 'superAdmin', display: 'Super Administrator'},
      login: '',
      password: '',
      phoneNumber: '066-233-77-34',
      city: 'Rome',
      address: 'someStreet',
      salary: '0',
    },
......
</code>```

答:
There is a valuePrepareFunction property on the column, so that you could specify a formatter for a value before it will be inserted in a cell like this:

```<code>{
your_column: {
  title: 'some',
  valuePrepareFunction: (value) => { return value === 1 ? 'true' : 'false' }
}
}
</code>```

I got an idea invoke myCustomFunc in valuePrepareFunction. By myCustomFunc I redefinition value to what i need to get

Body:
Does anyone know how to create new column from Object datatype ?
How I able to to do it ?
Code of my setting and data below for more clearly understanding
Thanks in Advance!
    private settings = {

columns: {
      firstName: {
        title: 'First name',
        type: 'text'
      },
      lastName: {
        title: 'Last name',
        type: 'text'
      },
      userType: {
        // This is correct way only when there is string in response from API named - userType
        // But when I'm trying to type something like - userType.value i get an error
        title: 'User type',
        type: 'text'
      },
}

data from API:

.......
    {
      firstName: 'Jacob',
      lastName: '',
      middleName: '',
      userType: {value: 'superAdmin', display: 'Super Administrator'},
      login: '',
      password: '',
      phoneNumber: '066-233-77-34',
      city: 'Rome',
      address: 'someStreet',
      salary: '0',
    },
......

Body:
There is a valuePrepareFunction property on the column, so that you could specify a formatter for a value before it will be inserted in a cell like this:

{
your_column: {
  title: 'some',
  valuePrepareFunction: (value) => { return value === 1 ? 'true' : 'false' }
}
}

I got an idea invoke myCustomFunc in valuePrepareFunction. By myCustomFunc I redefinition value to what i need to get


问:
There is no Action mapped for namespace / and action name reg. - [unknown location]
What type of errror in my code? This is my Project Screenshots
Any Jar File issue?or a code issue?
Any Jar File issue?or a code issue?
Any Jar File issue?or a code issue?

index.jsp

```<code><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@taglib uri="/struts-tags" prefix="s" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
        <s:form action="reg" method="post">
            <s:textfield name="firstname" label="FirstName"/>
            <s:textfield name="lastname" label="LastName"/>
            <s:submit value="submit"/>
        </s:form>
    </body>
    </html>
</code>```

web.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>StrutsAnnotation</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
   <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
                org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>

  </filter>
  <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>
</code>```

User.java

```<code>package com.entity;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

@Results({
       @Result(name="success", location="/welcome.jsp"),
       @Result(name="input", location="/index.jsp")
    })

public class User extends ActionSupport {

    private String firstname;

    private String lastname;

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }
    @Action(value="reg")
    public String execute(){
        return SUCCESS;
    }

}
</code>```

welcome.jsp

```<code><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Welcome
</body>
</html>
</code>```

please help me this code what is error is in this code??

答:
In user.java file change

```<code>@Action(value="reg")
public String execute(){
    return SUCCESS;
}
</code>```

to

```<code>@Action(value="/reg")
public String execute(){
    return SUCCESS;
}
</code>```

And still not work then please check your filter class in web.xml based on the used struts jars.

Body:
What type of errror in my code? This is my Project Screenshots
Any Jar File issue?or a code issue?
Any Jar File issue?or a code issue?
Any Jar File issue?or a code issue?

index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@taglib uri="/struts-tags" prefix="s" %>

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>

        <s:form action="reg" method="post">
            <s:textfield name="firstname" label="FirstName"/>
            <s:textfield name="lastname" label="LastName"/>
            <s:submit value="submit"/>
        </s:form>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>StrutsAnnotation</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
   <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
                org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>

  </filter>
  <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>

User.java

package com.entity;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

@Results({
       @Result(name="success", location="/welcome.jsp"),
       @Result(name="input", location="/index.jsp")
    })

public class User extends ActionSupport {

    private String firstname;

    private String lastname;

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }
    @Action(value="reg")
    public String execute(){
        return SUCCESS;
    }

}

welcome.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

Welcome

please help me this code what is error is in this code??

Body:
In user.java file change

@Action(value="reg")
public String execute(){
    return SUCCESS;
}

to

@Action(value="/reg")
public String execute(){
    return SUCCESS;
}

And still not work then please check your filter class in web.xml based on the used struts jars.


问:
select statement to get values between two strings in Oracle
I have table with two VARCHAR2 columns:

```<code>trs_no trs_name
------ --------
JV1    ddd
 .      .
 .      .
 .      .
JV580  deee
</code>```

I want to select for example all trs_no between JV280 and JV320

I tried the normal between but didn't work because I found JV29 in the results

So I tried also to get the length of the JV280 and JV320 in between it worked but it failed when the length is different.

How can I fix this ??

答:
Split the trs_no into a two-character string prefix and the numeric postfix and compare them seperately:

```<code>SELECT *
FROM   your_table
WHERE  SUBSTR( trs_no, 1, 2 ) = 'JV'
AND    TO_NUMBER( SUBSTR( trs_no, 3 ) ) BETWEEN 280 AND 320
</code>```

If trs_no can have different sized string prefixes then you could use a regular expression:

```<code>SELECT *
FROM   your_table
WHERE  REGEXP_SUBSTR( trs_no, '^(\D+)(\d+)$', 1, 1, NULL, 1 ) = 'JV'
AND    TO_NUMBER( REGEXP_SUBSTR( trs_no, '^(\D+)(\d+)$', 1, 1, NULL, 2 ) )
         BETWEEN 280 AND 320;
</code>```

Body:
I have table with two VARCHAR2 columns:

trs_no trs_name
------ --------
JV1    ddd
 .      .
 .      .
 .      .
JV580  deee

I want to select for example all trs_no between JV280 and JV320

I tried the normal between but didn't work because I found JV29 in the results

So I tried also to get the length of the JV280 and JV320 in between it worked but it failed when the length is different.

How can I fix this ??

Body:
Split the trs_no into a two-character string prefix and the numeric postfix and compare them seperately:

SELECT *
FROM   your_table
WHERE  SUBSTR( trs_no, 1, 2 ) = 'JV'
AND    TO_NUMBER( SUBSTR( trs_no, 3 ) ) BETWEEN 280 AND 320

If trs_no can have different sized string prefixes then you could use a regular expression:

SELECT *
FROM   your_table
WHERE  REGEXP_SUBSTR( trs_no, '^(\D+)(\d+)$', 1, 1, NULL, 1 ) = 'JV'
AND    TO_NUMBER( REGEXP_SUBSTR( trs_no, '^(\D+)(\d+)$', 1, 1, NULL, 2 ) )
         BETWEEN 280 AND 320;


问:
Wildfly error: Could not start http listener
I'm new to Wildfly and I hope you guys can help me with this problem:

I'm following this tutorial on how to Install Wildfly 8 and when I'm trying to execute step 4 I get the following errors:

I've been googling for a while now and I can't find an answer. I've tryed with JDK 7 and 8, no changes, I'm using admin permissions, I've even tried to download Wildfly again and still no changes.
More experienced co-workers have seen this and don't have a clue about what's going on.
Can you help me? Thanks

答: try restart the machine or enable IPV6 in the machine, this error will be resolved</p>


问:
Lucene : Delete by ID not working
I am working on integrating Lucene into our project. Currently I have no issues with saving and searching, but delete by id is not working. Any ideas what I am doing wrong?

Saving code :

```<code>  @Override
    public void saveIndexes(String text,String filePath, long groupId, boolean type, int objectId)

    Directory directory = org.apache.lucene.store.FSDirectory.open(path);
            IndexWriterConfig config = new IndexWriterConfig(new SimpleAnalyzer());
            IndexWriter indexWriter = new IndexWriter(directory, config);
            doc.add(new TextField("id",String.valueOf(objectId),Field.Store.YES));
  indexWriter.addDocument(doc);
            indexWriter.commit();
            indexWriter.close();
            directory.close();
}
</code>```

Delete code :

```<code> @Override
    public void deleteById(long groupId,int objectId, boolean type) {
        try {
            Path path = //Path to index directory;
            Directory directory = org.apache.lucene.store.FSDirectory.open(path);
            IndexWriterConfig config = new IndexWriterConfig(new SimpleAnalyzer());
            IndexWriter indexWriter = new IndexWriter(directory, config);
            indexWriter.deleteDocuments(new Term("id",String.valueOf(objectId)));
            indexWriter.commit();
            indexWriter.close();
            directory.close();
        }catch (Exception e){
            e.printStackTrace();
        }

    }
</code>```

答:
Propably because you're using a Textfield for indexing your ID. Use a Stringfield for indexing an ID.

Reason: Stringfields are not going to be tokenized as the doc said so:

A field that is indexed but not tokenized: the entire String value is indexed as a single token. For example this might be used for a 'country' field or an 'id' field

see here: http://lucene.apache.org/core/6_4_1/core/org/apache/lucene/document/StringField.html

Title: Lucene : Delete by ID not working

Body:
I am working on integrating Lucene into our project. Currently I have no issues with saving and searching, but delete by id is not working. Any ideas what I am doing wrong?

Saving code :

  @Override
    public void saveIndexes(String text,String filePath, long groupId, boolean type, int objectId)

    Directory directory = org.apache.lucene.store.FSDirectory.open(path);
            IndexWriterConfig config = new IndexWriterConfig(new SimpleAnalyzer());
            IndexWriter indexWriter = new IndexWriter(directory, config);
            doc.add(new TextField("id",String.valueOf(objectId),Field.Store.YES));
  indexWriter.addDocument(doc);
            indexWriter.commit();
            indexWriter.close();
            directory.close();
}

Delete code :

 @Override
    public void deleteById(long groupId,int objectId, boolean type) {
        try {
            Path path = //Path to index directory;
            Directory directory = org.apache.lucene.store.FSDirectory.open(path);
            IndexWriterConfig config = new IndexWriterConfig(new SimpleAnalyzer());
            IndexWriter indexWriter = new IndexWriter(directory, config);
            indexWriter.deleteDocuments(new Term("id",String.valueOf(objectId)));
            indexWriter.commit();
            indexWriter.close();
            directory.close();
        }catch (Exception e){
            e.printStackTrace();
        }

    }


问:
VBscripting _error
My requirement is to search entire c:\ drive and export the entries to a .txt file format. The challange is user needs to input the filename in a dialog box.

Following is the script that I created, when I run this I am getting an error permission denied.

```<code>'On Error Resume Next
Option Explicit 'force all variables to be declared

Const ForWriting = 2
Dim objFSO
Dim wshell
Set wshell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

wshell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")

Dim objTS 'Text Stream Object
Set objTS = objFSO.OpenTextFile("C:\Eurofins\Logs\Output.txt", ForWriting, True)

Recurse objFSO.GetFolder("%SYSTEMDRIVE%")
objTS.Close()

Sub Recurse(objFolder)
    Dim objFile, objSubFolder

    For Each objFile In objFolder.Files
        If LCase(objFSO.GetExtensionName(objFile.Name)) = "ini" Then
            objTS.WriteLine(objfile.Path)
        End If
    Next

    For Each objFile In objFolder.Files
        If LCase(objFSO.GetExtensionName(objFile.Name)) = "txt" Then
            objTS.WriteLine(objfile.Path)
        End If
    Next

    For Each objSubFolder In objFolder.SubFolders
        Recurse objSubFolder
    Next
End Sub
</code>```

答:
There are some folders on the system drive where you don't have access. Not even as an administrator. This behavior is by design.

Probably the simplest way to deal with this would be to enable error handling inside your procedure:

```<code>Sub Recurse(objFolder)
    On Error Resume Next
    ...
End Sub
</code>```

Note, however, that this would suppress all errors, leaving you completely in the dark if anything goes wrong. A better way would be to only ignore specific error numbers:

```<code>...
For Each objFile In objFolder.Files
    ...
Next
If Err.Number <> 0 Then
    If Err.Number <> 70 Then
        WScript.Echo Hex(Err.Number) & ": " & Err.Description
        'further error handling goes here
    End If
End If
...
</code>```

Title: VBscripting _error

Body:
My requirement is to search entire c:\ drive and export the entries to a .txt file format. The challange is user needs to input the filename in a dialog box.

Following is the script that I created, when I run this I am getting an error permission denied.

'On Error Resume Next
Option Explicit 'force all variables to be declared

Const ForWriting = 2
Dim objFSO
Dim wshell
Set wshell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

wshell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")

Dim objTS 'Text Stream Object
Set objTS = objFSO.OpenTextFile("C:\Eurofins\Logs\Output.txt", ForWriting, True)

Recurse objFSO.GetFolder("%SYSTEMDRIVE%")
objTS.Close()

Sub Recurse(objFolder)
    Dim objFile, objSubFolder

    For Each objFile In objFolder.Files
        If LCase(objFSO.GetExtensionName(objFile.Name)) = "ini" Then
            objTS.WriteLine(objfile.Path)
        End If
    Next

    For Each objFile In objFolder.Files
        If LCase(objFSO.GetExtensionName(objFile.Name)) = "txt" Then
            objTS.WriteLine(objfile.Path)
        End If
    Next

    For Each objSubFolder In objFolder.SubFolders
        Recurse objSubFolder
    Next
End Sub

Body:
There are some folders on the system drive where you don't have access. Not even as an administrator. This behavior is by design.

Probably the simplest way to deal with this would be to enable error handling inside your procedure:

Sub Recurse(objFolder)
    On Error Resume Next
    ...
End Sub

Note, however, that this would suppress all errors, leaving you completely in the dark if anything goes wrong. A better way would be to only ignore specific error numbers:

...
For Each objFile In objFolder.Files
    ...
Next
If Err.Number <> 0 Then
    If Err.Number <> 70 Then
        WScript.Echo Hex(Err.Number) & ": " & Err.Description
        'further error handling goes here
    End If
End If
...


问:
Visual Studio 6 can't load a COM dll compiled in .net 2.0
I have created a strongly signed assembly in Visual Studio 2008 against the .NET 3.5 framework (I tried 2.0 framework as well).  I exposed a class as COM visible, and I am able to find this dll in the object browser of Visual Studio 6 for Visual Basic.  I can create an exe in VB6 and run that exe directly from windows explorer, and everything works fine.  However, when I try to run the VB6 project inside Visual Studio 6 the .net assembly doesn't want to load and fails with the following error:

```<code>ActiveX component can't create object
</code>```

I also get this error instead of the one above, depending on how I register the dll:

```<code>-2147024894 File or assembly name (myComponentName), or one of its dependencies, was not found.
</code>```

Or this:

```<code>-2146233082 Automation error
</code>```

I have tried everything I can think of.  It seems that this would be a problem with the way VS6 runs in debug mode.  Maybe the environment is different with a missing path to this or another dll.  I have this problem on two different development machines.  I can also reference a COM .net dll that was built by another developer using an older version of visual studio .net.  I even opened the dll with dependency walker and I didn't get any obvious errors.

UPDATE:
Proc monitor is saying that VB6 is looking for my dll in the vb6 studio home directory "C:\Program Files\Microsoft Visual Studio\VB98\MyDLL.DLL" instead of where the DLL is registered. I placed the dll there and registered it, now I'm getting a new error:

```<code>-2146234105 (80131107) "The format of the file 'MyDllName' is invalid."
</code>```

So, why is studio looking for my DLL there and not where it's registered?  How can I fix that?  At the very least, how can I get the dll to work in the "C:\Program Files\Microsoft Visual Studio\VB98\" folder

Final Update/SOLUTION:
Ok, so I figured out the problem.  This has to do with VB6.exe being locked out of the .net framework version I was using (2.0 or 3.5).  I found this file "C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe.config" that contained the following entry:

```<code><configuration>
  <startup>
      <supportedRuntime version="v1.1.4322" />
  </startup>
</code>```

As soon as I removed this file the dll started working fine from the visual studio 6 environment.  Thanks to everyone who responded to help.

ContentLicense: CC BY-SA 2.5

Body:
I have created a strongly signed assembly in Visual Studio 2008 against the .NET 3.5 framework (I tried 2.0 framework as well).  I exposed a class as COM visible, and I am able to find this dll in the object browser of Visual Studio 6 for Visual Basic.  I can create an exe in VB6 and run that exe directly from windows explorer, and everything works fine.  However, when I try to run the VB6 project inside Visual Studio 6 the .net assembly doesn't want to load and fails with the following error:

ActiveX component can't create object

I also get this error instead of the one above, depending on how I register the dll:

-2147024894 File or assembly name (myComponentName), or one of its dependencies, was not found.

Or this:

-2146233082 Automation error

I have tried everything I can think of.  It seems that this would be a problem with the way VS6 runs in debug mode.  Maybe the environment is different with a missing path to this or another dll.  I have this problem on two different development machines.  I can also reference a COM .net dll that was built by another developer using an older version of visual studio .net.  I even opened the dll with dependency walker and I didn't get any obvious errors.

UPDATE:
Proc monitor is saying that VB6 is looking for my dll in the vb6 studio home directory "C:\Program Files\Microsoft Visual Studio\VB98\MyDLL.DLL" instead of where the DLL is registered. I placed the dll there and registered it, now I'm getting a new error:

-2146234105 (80131107) "The format of the file 'MyDllName' is invalid."

So, why is studio looking for my DLL there and not where it's registered?  How can I fix that?  At the very least, how can I get the dll to work in the "C:\Program Files\Microsoft Visual Studio\VB98\" folder

Final Update/SOLUTION:
Ok, so I figured out the problem.  This has to do with VB6.exe being locked out of the .net framework version I was using (2.0 or 3.5).  I found this file "C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe.config" that contained the following entry:

<configuration>
  <startup>
      <supportedRuntime version="v1.1.4322" />
  </startup>

As soon as I removed this file the dll started working fine from the visual studio 6 environment.  Thanks to everyone who responded to help.


问:
Dynamic PHP Email with All Values from Database Table in HTML using Mysqli
I'm a noob here, but I all I want to do here is to generate a PHP Mail using all the rows and their values from a Database Table using MYSQLi method.

My Table Format
ndr_confirm_id | order_id (INT) | tracking_no (BIGINT) | status (0,1) | update_time
Estimated Rows in the Table : 50-100

I want to generate a table within the PHP Mail which lists values from ALL rows available in the table.

```<code><?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$con=mysqli_connect("localhost","admin","ABC1234!","my_krty");//database connection

$date = date('Y-m-d');
$e_date = date('d-m-Y');

//Email Receiver//
   $to = "xxx@example.com";

   //From Header//
   $header = "From: MyKrty<undelivered@example.com>"."\r\n";
   $header .= "MIME-Version: 1.0" . "\r\n";
$header .= "Content-type:text/html; charset=ISO-8859-1" . "\r\n";

   // Subject //
   $subject = "Request";

   // Message //
   $message = "<html>
    <head>
        <title></title>
        <link href='https://fonts.googleapis.com/css?family=Pacifico|Varela+Round' rel='stylesheet' />
    </head>
    <body style='font-family: ' varela=''>

        <table align='center' border='0' cellpadding='5' style='background-color:#f2f2f2; border-radius:5px; color:#333333; padding:7px; width:85%;'>
            <tbody>
                <tr>
                    <td style='text-align: center;'>
                        <strong>Tracking AWB</strong></td>
                    <td style='text-align: center;'><strong>
                        Order ID #</strong></td>

                </tr>";
$get_ndr = mysqli_query($con,"SELECT * FROM `oc_ndr_confirm` WHERE `status`='0'");
while ($row = mysqli_fetch_array($get_ndr))
{
$order_id = $row['order_id'];
$tracking_no = $row['tracking_no'];
foreach($row as $value){

$message. = "<tr><td style='text-align:center;'><strong>".$value['tracking_no']."</td><td style='text-align:center;'>".$value['order_id']."</td></tr>";
        }}

$message.= "            </tbody>
        </table>
        <p>
             </p>
        <p>
             </p>

        <p>
            We request you to kindly re-schedule the following above at your earliest.</p>

    </body>
</html> \r\n";

   //Send Mail//
   $mail_send = mail($to,$subject,$message,$header);
</code>```

I've tried a lot of Threads, but unable to figure out, as I don't understand arrays much. The mail function is working fine, but I'm just receiving one row only in the table, with values as 2 in both columns.

The last thread I referred to was How to Send Email with all Products in the Cart .

Though, I couldn't make it referring the above mentioned thread as it was too confusing.

答:
Here are 2 small edits to your code.
First a small error in your html.
Secondly you have a while loop already where you set your db values in your variables. No extra foreach loop is needed.</p>

```<code> <body style='font-family:  varela'>

while ($row = mysqli_fetch_array($get_ndr)) {
  $order_id = $row['order_id'];
  $tracking_no = $row['tracking_no'];
  $message. = "<tr><td style='text-align:center;'><strong>".$tracking_no."</td><td style='text-align:center;'>".$order_id."</td></tr>";
}
</code>```

Body:
I'm a noob here, but I all I want to do here is to generate a PHP Mail using all the rows and their values from a Database Table using MYSQLi method.

My Table Format
ndr_confirm_id | order_id (INT) | tracking_no (BIGINT) | status (0,1) | update_time
Estimated Rows in the Table : 50-100

I want to generate a table within the PHP Mail which lists values from ALL rows available in the table.

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$con=mysqli_connect("localhost","admin","ABC1234!","my_krty");//database connection

$date = date('Y-m-d');
$e_date = date('d-m-Y');

//Email Receiver//
   $to = "xxx@example.com";

   //From Header//
   $header = "From: MyKrty<undelivered@example.com>"."\r\n";
   $header .= "MIME-Version: 1.0" . "\r\n";
$header .= "Content-type:text/html; charset=ISO-8859-1" . "\r\n";

   // Subject //
   $subject = "Request";

   // Message //
   $message = "

        <title></title>
        <link href='https://fonts.googleapis.com/css?family=Pacifico|Varela+Round' rel='stylesheet' />

                        Tracking AWB

                        Order ID #

";
$get_ndr = mysqli_query($con,"SELECT * FROM `oc_ndr_confirm` WHERE `status`='0'");
while ($row = mysqli_fetch_array($get_ndr))
{
$order_id = $row['order_id'];
$tracking_no = $row['tracking_no'];
foreach($row as $value){

$message. = "
".$value['tracking_no']."	".$value['order_id']."
";
        }}

$message.= "

            We request you to kindly re-schedule the following above at your earliest.

 \r\n";

   //Send Mail//
   $mail_send = mail($to,$subject,$message,$header);

I've tried a lot of Threads, but unable to figure out, as I don't understand arrays much. The mail function is working fine, but I'm just receiving one row only in the table, with values as 2 in both columns.

The last thread I referred to was How to Send Email with all Products in the Cart .

Though, I couldn't make it referring the above mentioned thread as it was too confusing.

Body:
Here are 2 small edits to your code.
First a small error in your html.
Secondly you have a while loop already where you set your db values in your variables. No extra foreach loop is needed.

 <body style='font-family:  varela'>

while ($row = mysqli_fetch_array($get_ndr)) {
  $order_id = $row['order_id'];
  $tracking_no = $row['tracking_no'];
  $message. = "<tr><td style='text-align:center;'><strong>".$tracking_no."</td><td style='text-align:center;'>".$order_id."</td></tr>";
}


问:
set back button title text in iOS Xamarin
I want to set the BackButton Title text to ""(means empty). I am using below code to set the Title but it is not working.

Try 1 :

```<code>this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null);
</code>```

Try 2 :

```<code>this.NavigationItem.BackBarButtonItem.Title = "";
</code>```

it is give the object is not set to instance.

Is there any way to set the Back button title null in iOS.

Any Help Will be Appreciated.

答:
Back Title depends on Title property of ViewController .

and it could be set as below , here vc is the instance of controller which is pushed inside UINavigationController .

```<code>vc.NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem(
UIImage.FromFile("29_icon.png"), UIBarButtonItemStyle.Plain, (sender, args) => {
    NavigationController.PopViewControllerAnimated(true);
}), true);
</code>```

https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/change_the_back_button/

Above link explains in details .
Let me know after this also if you find problem doing it .

Body:
I want to set the BackButton Title text to ""(means empty). I am using below code to set the Title but it is not working.

Try 1 :

this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null);

Try 2 :

this.NavigationItem.BackBarButtonItem.Title = "";

it is give the object is not set to instance.

Is there any way to set the Back button title null in iOS.

Any Help Will be Appreciated.

Body:
Back Title depends on Title property of ViewController .

and it could be set as below , here vc is the instance of controller which is pushed inside UINavigationController .

vc.NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem(
UIImage.FromFile("29_icon.png"), UIBarButtonItemStyle.Plain, (sender, args) => {
    NavigationController.PopViewControllerAnimated(true);
}), true);

https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/change_the_back_button/

Above link explains in details .
Let me know after this also if you find problem doing it .


问:
How to go back to the previous page and restore the scroll position after an animation?
```<code>$('a').click(function (e) {
    e.preventDefault();

    var newLocation = this.href;

    $('body').fadeOut(250, newPage);

    function newPage() {
        window.location = newLocation;
    }
});
</code>```

The intention is to fade out the page whenever a link is clicked. The problem is with links like this:

```<code><a href='javascript:history.back()'>Link</a>
</code>```

Normally, when href is 'javascript:history.back()', it goes back to the scroll position on the previous page, which is what I want. With this code, it goes to the top of the page. How can i fix this?

答:
history.back is a function. You have to call it as a function. Going back in the navigation history by assigning to window.location does not work.

Have your code behave differently based on the href of the clicked link.

```<code>$('a').click(function (e)
{
    e.preventDefault();
    var newLocation = this.href;
    $('body').fadeOut(250, newPage);

    function newPage()
    {
        if(newLocation == "javascript:history.back()")
        {
          history.back();
        }
        else
        {
           window.location = newLocation;
        }
    }
});
</code>```

Complete test set:

Caller.html

```<code><html>
<head><title>Caller</title></head>
<body>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>

<a href="Callee.html">Go to Callee</a>

</body>
</html>
</code>```

Callee.html

```<code><html>
<head><title>Callee</title></head>
<body>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <a href="javascript:history.back()">Go back</a>

<script>
$('a').click(function (e)
{
    e.preventDefault();
    var newLocation = this.href;
    $('body').fadeOut(250, newPage);

    function newPage()
    {
        if(newLocation == "javascript:history.back()")
        {
          history.back();
        }
        else
        {
           window.location = newLocation;
        }
    }
});
</script>

  </body>
</html>
</code>```

Body:
$('a').click(function (e) {
    e.preventDefault();

    var newLocation = this.href;

    $('body').fadeOut(250, newPage);

    function newPage() {
        window.location = newLocation;
    }
});

The intention is to fade out the page whenever a link is clicked. The problem is with links like this:

Link

Normally, when href is 'javascript:history.back()', it goes back to the scroll position on the previous page, which is what I want. With this code, it goes to the top of the page. How can i fix this?

Body:
history.back is a function. You have to call it as a function. Going back in the navigation history by assigning to window.location does not work.

Have your code behave differently based on the href of the clicked link.

$('a').click(function (e)
{
    e.preventDefault();
    var newLocation = this.href;
    $('body').fadeOut(250, newPage);

    function newPage()
    {
        if(newLocation == "javascript:history.back()")
        {
          history.back();
        }
        else
        {
           window.location = newLocation;
        }
    }
});

Complete test set:

Caller.html

<html>
<head><title>Caller</title></head>
<body>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>
<div>XXXXXXXXXXXXX</div>

<a href="Callee.html">Go to Callee</a>

</body>
</html>

Callee.html

<html>
<head><title>Callee</title></head>
<body>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <a href="javascript:history.back()">Go back</a>

<script>
$('a').click(function (e)
{
    e.preventDefault();
    var newLocation = this.href;
    $('body').fadeOut(250, newPage);

    function newPage()
    {
        if(newLocation == "javascript:history.back()")
        {
          history.back();
        }
        else
        {
           window.location = newLocation;
        }
    }
});
</script>

  </body>
</html>

ContentLicense: CC BY-SA 4.0


问:
Android-Command to run dmtracedump
how to run dmtracedump in android.what is the exact command to run it in linux.</p>

答:
Run it with no arguments, and it'll print a "usage" line.

Depending on what release you're using, some of the options may crash or hang indefinitely.  You should be safe with "dmtracedump -o ", which just formats the raw data into human-readable format.

It's really only useful for debugging the tracing mechanism.  "traceview" is much easier to work with.

Title: Android-Command to run dmtracedump


问:
How to clear File Input
Below is part of the jquery code I have which displays the file input and a "Clear File" button.

```<code>var $imagefile = $('<input />').attr({
    type: 'file',
    name: 'imageFile',
    class: 'imageFile'
});

$image.append($imagefile);

var $imageclear = $('<input />').attr({
    type: 'button',
    name: 'imageClear',
    class: 'imageClear',
    value: 'Clear File'
});

$image.append($imageclear);
</code>```

Now the reason I have the "Clear File" button is because if you click on the button, then it will clear anything that is in the file input. How do I code it so that it actually clears the file input when I click on the "Clear File" button?

答:
I have done something like this and it's working for me</p>

```<code>$('#fileInput').val(null);
</code>```

Title: How to clear File Input

Body:
Below is part of the jquery code I have which displays the file input and a "Clear File" button.

var $imagefile = $('<input />').attr({
    type: 'file',
    name: 'imageFile',
    class: 'imageFile'
});

$image.append($imagefile);

var $imageclear = $('<input />').attr({
    type: 'button',
    name: 'imageClear',
    class: 'imageClear',
    value: 'Clear File'
});

$image.append($imageclear);

Now the reason I have the "Clear File" button is because if you click on the button, then it will clear anything that is in the file input. How do I code it so that it actually clears the file input when I click on the "Clear File" button?

Body:
I have done something like this and it's working for me

$('#fileInput').val(null);


问:
SQL query get last value
I want to get the last time (by date) that appears a (Empleado) where the value "Entrar" is 1
enter image description here

```<code>SELECT '20498090R'
FROM fichajes
WHERE fecha IN (SELECT MAX(fecha) FROM fichajes)
  AND entrada = '1'
</code>```

But this give me the las register where entrada= '1' and I just want to return information if the last entry is 1, not the las entry where entrada ='1'

In this case my last register entrada = "0" so i need no information
What is wrong?

答:
Use a subquery to identify the most recent record for a given employee, and the just check the value of entrada.

```<code>SELECT CASE WHEN entrada = '1' THEN 'Yes' ELSE 'No' END AS result
FROM fichejes
WHERE Fecha = (SELECT MAX(Fecha) FROM fichejes WHERE empleado = '20498090R')
</code>```

Title: SQL query get last value

Body:
I want to get the last time (by date) that appears a (Empleado) where the value "Entrar" is 1
enter image description here

SELECT '20498090R'
FROM fichajes
WHERE fecha IN (SELECT MAX(fecha) FROM fichajes)
  AND entrada = '1'

But this give me the las register where entrada= '1' and I just want to return information if the last entry is 1, not the las entry where entrada ='1'

In this case my last register entrada = "0" so i need no information
What is wrong?

Body:
Use a subquery to identify the most recent record for a given employee, and the just check the value of entrada.

SELECT CASE WHEN entrada = '1' THEN 'Yes' ELSE 'No' END AS result
FROM fichejes
WHERE Fecha = (SELECT MAX(Fecha) FROM fichejes WHERE empleado = '20498090R')


Title: Check whether a value appeared within the last n minutes

Body:
If we have the following data:

timestamp = ['2016-01-09_14-49-18','2016-01-10_09-48-59','2016-01-10_09-50-29','2016-01-10_09-59-08','2016-01-10_10-33-01','2016-01-10_10-35-01','2016-01-10_10-39-05','2016-01-10_10-40-38','2016-01-10_10-50-55','2016-01-10_12-28-35','2016-01-10_15-13-34','2016-01-10_17-02-44','2016-01-10_17-05-48','2016-01-10_17-13-44','2016-01-10_17-15-52']
feature = ['A','A','B','C','B','C','C','A','A','A','B','A','C','C','A']
df = pd.DataFrame({'timestamp':timestamp, 'feature':feature})

How can one create a new column for each feature that represents whether or not that class appeared in, let's say, the last 15 minutes?

Result:

   feature    timestamp              A    B    C
0       A  2016-01-09_14-49-18       1    0    0
1       A  2016-01-10_09-48-59       1    0    0
2       B  2016-01-10_09-50-29       1    1    0
3       C  2016-01-10_09-59-08       1    1    1
4       B  2016-01-10_10-33-01       0    1    0
5       C  2016-01-10_10-35-01       0    1    1
6       C  2016-01-10_10-39-05       0    1    1
7       A  2016-01-10_10-40-38       1    1    1
8       A  2016-01-10_10-50-55       1    0    1
9       A  2016-01-10_12-28-35       1    0    0
10      B  2016-01-10_15-13-34       0    1    0
11      A  2016-01-10_17-02-44       1    0    0
12      C  2016-01-10_17-05-48       1    0    1
13      C  2016-01-10_17-13-44       1    0    1
14      A  2016-01-10_17-15-52       1    0    1

Where 1 = the class appeared in the last 15 minutes, and 0 = the class did not appear.

Body:
Here is an example for one of the features. You can repeat this for the other columns/features in a loop:

df = df.set_index(pd.to_datetime(df['timestamp'], format='%Y-%m-%d_%H-%M-%S'))
df['A'] = df.index
df['A'].loc[df['feature'] != 'A'] = np.NaN
df['A'] = df['A'].ffill()
df['A'] = df.index - df['A']
df['A'] = df['A'] < pd.to_timedelta('15m')

This results in the following data frame:

                    feature            timestamp      A
timestamp
2016-01-09 14:49:18       A  2016-01-09_14-49-18   True
2016-01-10 09:48:59       A  2016-01-10_09-48-59   True
2016-01-10 09:50:29       B  2016-01-10_09-50-29   True
2016-01-10 09:59:08       C  2016-01-10_09-59-08   True
2016-01-10 10:33:01       B  2016-01-10_10-33-01  False
2016-01-10 10:35:01       C  2016-01-10_10-35-01  False
2016-01-10 10:39:05       C  2016-01-10_10-39-05  False
2016-01-10 10:40:38       A  2016-01-10_10-40-38   True
2016-01-10 10:50:55       A  2016-01-10_10-50-55   True
2016-01-10 12:28:35       A  2016-01-10_12-28-35   True
2016-01-10 15:13:34       B  2016-01-10_15-13-34  False
2016-01-10 17:02:44       A  2016-01-10_17-02-44   True
2016-01-10 17:05:48       C  2016-01-10_17-05-48   True
2016-01-10 17:13:44       C  2016-01-10_17-13-44   True
2016-01-10 17:15:52       A  2016-01-10_17-15-52   True

If you want 0 and 1 instead of bools, just use astype(int) on the column.


问:
how to disable jenkins autorun in windows
I have installed Jenkins on my PC with Windows 10. And every time when I run my PC - Jenkins runs automatically too.
I couldn't find any config file in Jenkins folder when i can disable automatically  run.
Thanks.</p>

答:
run 'services.msc' from the command line.

Then find the service called Jenkins.

Select this, right click select properties and select start manually from the drop down list, or disable it if you prefer.


问:
Push Xcode Project to TFS Git repository
Trying to push Xcode project to TFS (Git repository), i created local repository for my project in Xcode, then install Git Credential Manager from GitHub, then trying to connect repository from Xcode by adding remote or connect to git repository, but the error message is "Authentication failed because the authentication credentials were rejected."
Would you please provide me with the correct steps.
Knowing that TFS 2015 & Xcode 8.2</p>

答:
The easiest solution for me was to just add your local repository with command line.

```<code>git remote add origin ADRESSOFREPO
</code>```

Afterwards you can use the version control in Xcode to push and pull

Body:
The easiest solution for me was to just add your local repository with command line.

git remote add origin ADRESSOFREPO

Afterwards you can use the version control in Xcode to push and pull


问:
How can I retrieve the content of a specific stashed file after have pull the new version of my project form GIT?
I am not so into GIT and I have the following problem.

I have some uncommitted file in my project that I have stashed by this statment:

```<code>git stash
</code>```

Then I have pull the repository taking the work of a coolegue, that seems have correctly overwrite the changes of my stashed file.

Now I want to retrieve the content of a specific stashed file without lose the modification of my collegue.

I don't want to override the pulled version but only access to the code of the stashed version of a specific file.

Performing git stash list I obtain:

```<code>$ git stash list
stash@{0}: WIP on master: fd2a59b First version of iterate/aggregate for data received from dataservice
stash@{1}: WIP on master: 4910263 DSS project added
</code>```

How can I do it from the shell?

答:
I don't know if it's possible to display the diff of a specific file into a stash easily.

However, to display the stashed code of stash@{0}

```<code>git stash show stash@{0} -p
</code>```

If you're not satisfied with the output of the previous command, and since your working tree is clean, you can start by getting the wanted stash

```<code># say you want to see diff of file my/file1.txt in stash{0}
git stash pop stash@{0}

# To Check your file by showing the diff between your work and your collegue's
git diff my/file1.txt
</code>```

To go back to the first step

```<code>git stash
</code>```

Hope that helps

Body:
I am not so into GIT and I have the following problem.

I have some uncommitted file in my project that I have stashed by this statment:

git stash

Then I have pull the repository taking the work of a coolegue, that seems have correctly overwrite the changes of my stashed file.

Now I want to retrieve the content of a specific stashed file without lose the modification of my collegue.

I don't want to override the pulled version but only access to the code of the stashed version of a specific file.

Performing git stash list I obtain:

$ git stash list
stash@{0}: WIP on master: fd2a59b First version of iterate/aggregate for data received from dataservice
stash@{1}: WIP on master: 4910263 DSS project added

How can I do it from the shell?

Body:
I don't know if it's possible to display the diff of a specific file into a stash easily.

However, to display the stashed code of stash@{0}

git stash show stash@{0} -p

If you're not satisfied with the output of the previous command, and since your working tree is clean, you can start by getting the wanted stash

# say you want to see diff of file my/file1.txt in stash{0}
git stash pop stash@{0}

# To Check your file by showing the diff between your work and your collegue's
git diff my/file1.txt

To go back to the first step

git stash

Hope that helps


问:
User Friendly Log
We have developed a Project in Developer Studio everything is working fine and our Custom log is creating Custom messages in Carbon log. Our requirement is that our custom log should write in a separate file like 'Interfacing Exceptions Report' so that user can easily track the error instead of reviewing the whole Carbon log because it has too much contents as well.

Currently we have source as follows for custom log:

```<code><property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="OrderNumber"
                   expression="//ns11:OrderNumber"
                   scope="default"
                   type="STRING"/>
         <property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="OrderStatus"
                   expression="//ns11:OrderStatus"
                   scope="default"
                   type="STRING"/>
         <property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="ReturnStatus"
                   expression="//ns11:ReturnStatus"
                   scope="default"
                   type="STRING"/>
         <log level="custom">
            <property name="prop1" expression="get-property('OrderNumber')"/>
            <property name="prop2" expression="get-property('OrderStatus')"/>
         </log>
         <filter source="get-property('ReturnStatus')" regex="SUCCESS">
            <then>
               <log level="custom">
                  <property name="message" value="Your order has been created successfully "/>
               </log>
            </then>
            <else>
               <log level="custom">
                  <property name="errormessage" value="Sorry,there was an issue in order creation"/>
               </log>
            </else>
         </filter>
</code>```

答: What you're looking for sounds like  per service logging or per api logging. </p>

Title: User Friendly Log

Body:
We have developed a Project in Developer Studio everything is working fine and our Custom log is creating Custom messages in Carbon log. Our requirement is that our custom log should write in a separate file like 'Interfacing Exceptions Report' so that user can easily track the error instead of reviewing the whole Carbon log because it has too much contents as well.

Currently we have source as follows for custom log:

<property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="OrderNumber"
                   expression="//ns11:OrderNumber"
                   scope="default"
                   type="STRING"/>
         <property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="OrderStatus"
                   expression="//ns11:OrderStatus"
                   scope="default"
                   type="STRING"/>
         <property xmlns:ns11="http://xmlns.oracle.com/apps/scm/doo/decomposition/receiveTransform/receiveSalesOrder/model/"
                   name="ReturnStatus"
                   expression="//ns11:ReturnStatus"
                   scope="default"
                   type="STRING"/>
         <log level="custom">
            <property name="prop1" expression="get-property('OrderNumber')"/>
            <property name="prop2" expression="get-property('OrderStatus')"/>
         </log>
         <filter source="get-property('ReturnStatus')" regex="SUCCESS">
            <then>
               <log level="custom">
                  <property name="message" value="Your order has been created successfully "/>
               </log>
            </then>
            <else>
               <log level="custom">
                  <property name="errormessage" value="Sorry,there was an issue in order creation"/>
               </log>
            </else>
         </filter>


问:
C++ Line into Vector
Wow I've been all over the place with questions today and I apologize if they seem to overlap, but for every question comes another question...Since one thing wont work......but I should use something else......etc.

Anyways, I have a text file:

```<code>6
3.0 2.5 -1.5 0.0 1.7 4.0
6 10
</code>```

6 is the Number of "floats" in the second line (the 3.0,2.5 etc...)
3.0,2.5,-1.5 are all a series of floats.
6 and 10 are just 2 integers.

I have a Vector

```<code>std::vector<double> numbers;
</code>```

All i need to do, is get the Second line put into numbers.
So right now I have

```<code>ifstream myfile (filename.c_str());
</code>```

I can simply just do a myfile>> to get the first value (6)
but how would I go about putting the second line in my vector? Remember I ONLY know how big line 2 is, by reading in the first line (the 6 in this case).

Also the last 2 numbers aren't supposed to be in this vector, but two seperate values.
Which i can just do myfile >> a >> b.

Sorry again for sooo many questions. but I've literally been looking everywhere and asking probably the wrong questions.

答:
I'm going to start from the point where you've already read in the line from the file, since it seems like you're OK with that.  This is the most basic approach.  My code below illustrates this approach using very straightforward code that could be used to understand how this works.

Get the line you want to parse in to a string, this is line in my code below.

Search the string for tokens, where each token is seperated by anything that isn't either a digit, a decimal, or a negative sign

For each token, convert the string to a double by using stringstream.

Add the converted double to your vector

At the end of the loop, I also dump the vector to the screen for inspection.

```<code>#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <iterator>
using namespace std;

int main()
{
    string line = "3.0 2.5 -1.5 0.0 1.7 4.0";
    vector<double> doubles;

    string::size_type n_begin = 0;
    string::size_type n_end = line.find_first_not_of("-.0123456789", n_begin);
    while( n_begin != string::npos )
    {
        string cur_token = line.substr(n_begin, n_end-n_begin);
        stringstream ss;
        ss << cur_token;
        double cur_val = 0.0;
        ss >> cur_val;
        doubles.push_back(cur_val);
        // set up the next loop
        if( n_end == string::npos )
            n_begin = n_end = string::npos;
        else
        {
            n_begin = n_end + 1;
            n_end = line.find_first_not_of("-.0123456789", n_begin);
        }
    }

    copy(doubles.begin(), doubles.end(), ostream_iterator<double>(cout, "\n"));
}
</code>```

Title: C++ Line into Vector

Body:
Wow I've been all over the place with questions today and I apologize if they seem to overlap, but for every question comes another question...Since one thing wont work......but I should use something else......etc.

Anyways, I have a text file:

6
3.0 2.5 -1.5 0.0 1.7 4.0
6 10

6 is the Number of "floats" in the second line (the 3.0,2.5 etc...)
3.0,2.5,-1.5 are all a series of floats.
6 and 10 are just 2 integers.

I have a Vector

std::vector<double> numbers;

All i need to do, is get the Second line put into numbers.
So right now I have

ifstream myfile (filename.c_str());

I can simply just do a myfile>> to get the first value (6)
but how would I go about putting the second line in my vector? Remember I ONLY know how big line 2 is, by reading in the first line (the 6 in this case).

Also the last 2 numbers aren't supposed to be in this vector, but two seperate values.
Which i can just do myfile >> a >> b.

Sorry again for sooo many questions. but I've literally been looking everywhere and asking probably the wrong questions.

Body:
I'm going to start from the point where you've already read in the line from the file, since it seems like you're OK with that.  This is the most basic approach.  My code below illustrates this approach using very straightforward code that could be used to understand how this works.

Get the line you want to parse in to a string, this is line in my code below.

Search the string for tokens, where each token is seperated by anything that isn't either a digit, a decimal, or a negative sign

For each token, convert the string to a double by using stringstream.

Add the converted double to your vector

At the end of the loop, I also dump the vector to the screen for inspection.

#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <iterator>
using namespace std;

int main()
{
    string line = "3.0 2.5 -1.5 0.0 1.7 4.0";
    vector<double> doubles;

    string::size_type n_begin = 0;
    string::size_type n_end = line.find_first_not_of("-.0123456789", n_begin);
    while( n_begin != string::npos )
    {
        string cur_token = line.substr(n_begin, n_end-n_begin);
        stringstream ss;
        ss << cur_token;
        double cur_val = 0.0;
        ss >> cur_val;
        doubles.push_back(cur_val);
        // set up the next loop
        if( n_end == string::npos )
            n_begin = n_end = string::npos;
        else
        {
            n_begin = n_end + 1;
            n_end = line.find_first_not_of("-.0123456789", n_begin);
        }
    }

    copy(doubles.begin(), doubles.end(), ostream_iterator<double>(cout, "\n"));
}