问:
how to make navigation bar slide from right slide

function openNav() {
     document.getElementsByClassName("menu-overlay").style.width = "50%";
}
function closeNav() {
     document.getElementsByClassName("menu-overlay").style.width = "0";
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.menu-overlay {
 display: none;
 top: 0;
    height: 100%;
    width: 0%;
 position: absolute;
 z-index: 1;
 right: 0;
 background-color: #ef4f50;
 overflow-x: hidden;
 transition: 0.5s;
}

.menu-body{
 position: fixed;
    top: 0;
    z-index: 99999;
    right: 0;
    height: 100%;
 background-color: #ef4f51;
 width: 35%;
 float: right;
}

span.closer {
    font-size: 50px;
    float: right;
    color: white;
    padding: 30px;
}

.menu-pan{
    width: 100%;
    float: left;
    padding: 0 80px;
}
.menu-pan li {
 padding: 10px 0;
}
.menu-pan li a {
    color: white;
    text-decoration: none;
    font-size: 32px;
}</code>```

<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css" rel="stylesheet"/>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

        DONATE NOW

Home

About

Our Purpose

HOME

Contact

    ```

hello this is my menu bar code.i want my navigation bar to be open when i click on the hamburger icon from right side with transition (smooth) effect with width 50% & remaining part will be overlay.
"https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay" this link has the same effect but from left right.

答:
getElementsByClassName function returns an array so using getElementsByClassName("menu-overlay").style would be incorrect. Instead use it like so:

```<code>function openNav() {
     document.getElementsByClassName("menu-overlay")[0].style.width = "50%";
}
function closeNav() {
     document.getElementsByClassName("menu-overlay")[0].style.width = "0";
}
</code>```

Body:
function openNav() {
     document.getElementsByClassName("menu-overlay").style.width = "50%";
}
function closeNav() {
     document.getElementsByClassName("menu-overlay").style.width = "0";
}

.menu-overlay {
 display: none;
 top: 0;
    height: 100%;
    width: 0%;
 position: absolute;
 z-index: 1;
 right: 0;
 background-color: #ef4f50;
 overflow-x: hidden;
 transition: 0.5s;
}

.menu-body{
 position: fixed;
    top: 0;
    z-index: 99999;
    right: 0;
    height: 100%;
 background-color: #ef4f51;
 width: 35%;
 float: right;
}

span.closer {
    font-size: 50px;
    float: right;
    color: white;
    padding: 30px;
}

.menu-pan{
    width: 100%;
    float: left;
    padding: 0 80px;
}
.menu-pan li {
 padding: 10px 0;
}
.menu-pan li a {
    color: white;
    text-decoration: none;
    font-size: 32px;
}

<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css" rel="stylesheet"/>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

        DONATE NOW

Home

About

Our Purpose

HOME

Contact

hello this is my menu bar code.i want my navigation bar to be open when i click on the hamburger icon from right side with transition (smooth) effect with width 50% & remaining part will be overlay.
"https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay" this link has the same effect but from left right.

Body:
getElementsByClassName function returns an array so using getElementsByClassName("menu-overlay").style would be incorrect. Instead use it like so:

function openNav() {
     document.getElementsByClassName("menu-overlay")[0].style.width = "50%";
}
function closeNav() {
     document.getElementsByClassName("menu-overlay")[0].style.width = "0";
}


来源: stackexchange

问:
Termination issue on recursive template function in variadic template
I am trying to create a utility class that will call a specific function on all classes in a list. The purpose behind this is to automate an element of reflection within a hierarchy of classes.

I'm using Visual Studio 2015 to compile some C++ code and I'm getting a compile error when the recursive template function is unfolded because the compiler is having trouble distinguishing between the recursive function and the terminating function.

I've extracted out the core of the class to a simple test case:

```<code>#include <iostream>

template< typename ... BaseClasses >
class Meta
{
public:
    virtual ~Meta() {}

    template< typename T >
    void call(const T& val)
    {
        callOnAllClasses<T, BaseClasses...>(val);
    }

private:
    template< typename T, typename HeadClass >
    void callOnAllClasses(const T& val)
    {
        auto pObj = dynamic_cast<HeadClass*>(this);
        if ( pObj )
            pObj->HeadClass::doSomething(val);
    }

    template< typename T, typename HeadClass, typename ... TailClasses >
    void callOnAllClasses(const T& val)
    {
        auto pObj = dynamic_cast<HeadClass*>(this);
        if ( pObj )
            pObj->HeadClass::doSomething(val);
        callOnAllClasses<T, TailClasses...>(val);
    }
};

class A
{
public:
    void doSomething(int i)
    {
        std::cout << "A:" << i << std::endl;
    }
};

class B
{
public:
    void doSomething(int i)
    {
        std::cout << "B:" << i << std::endl;
    }
};

class C : public B, public A, public Meta<C,B,A>
{
    public:
    void doSomething(int i)
    {
        std::cout << "C:" << i << std::endl;
    }
};

int main()
{
    C c;
    c.call(5);
}
</code>```

This results in the following error when compiled in Visual Studio 2015:

```<code>error C2668: 'Meta<C,B,A>::callOnAllClasses': ambiguous call to overloaded function
could be 'void Meta<C,B,A>::callOnAllClasses<T,A,>(const T &)'
or       'void Meta<C,B,A>::callOnAllClasses<T,A>(const T &)'
</code>```

I've never used variadic templates before so I'm at a bit of a loss as to why this might be going wrong. Any help would be much appreciated!

答:
You problem can be minimized as follows:

```<code>template< typename ... Bases >
struct Meta
{
    template< typename T >
    void call(const T& val)
    {
        callOnAllClasses<T, Bases...>(val);
    }

    template< typename T, typename HeadClass >
    void callOnAllClasses(const T& val)
    {

    }

    template< typename T, typename HeadClass, typename ... TailClasses >
    void callOnAllClasses(const T& val)
    {
        callOnAllClasses<T, TailClasses...>(val);
    }
};

struct C : Meta<int, int, int> { };

int main()
{
    C{}.call(5);
}
</code>```

When TailClasses is empty, both these signatures are ambiguous to the compiler:

```<code>template< typename T, typename HeadClass >
void callOnAllClasses(const T& val);

template< typename T, typename HeadClass, typename ... TailClasses >
void callOnAllClasses(const T& val);
</code>```

Adding an extra template argument to the recursive case helps the compiler disambiguate between the variadic and non-variadic overloads when TailClasses is empty.

```<code>template< typename T, typename HeadClass, typename T1, typename ... TailClasses >
void callOnAllClasses(const T& val)
{
    auto pObj = dynamic_cast<HeadClass*>(this);
    if ( pObj )
        pObj->HeadClass::doSomething(val);
    callOnAllClasses<T, T1, TailClasses...>(val);
}
</code>```

live example on godbolt

ContentLicense: CC BY-SA 3.0

Body:
I am trying to create a utility class that will call a specific function on all classes in a list. The purpose behind this is to automate an element of reflection within a hierarchy of classes.

I'm using Visual Studio 2015 to compile some C++ code and I'm getting a compile error when the recursive template function is unfolded because the compiler is having trouble distinguishing between the recursive function and the terminating function.

I've extracted out the core of the class to a simple test case:

#include <iostream>

template< typename ... BaseClasses >
class Meta
{
public:
    virtual ~Meta() {}

    template< typename T >
    void call(const T& val)
    {
        callOnAllClasses<T, BaseClasses...>(val);
    }

private:
    template< typename T, typename HeadClass >
    void callOnAllClasses(const T& val)
    {
        auto pObj = dynamic_cast<HeadClass*>(this);
        if ( pObj )
            pObj->HeadClass::doSomething(val);
    }

    template< typename T, typename HeadClass, typename ... TailClasses >
    void callOnAllClasses(const T& val)
    {
        auto pObj = dynamic_cast<HeadClass*>(this);
        if ( pObj )
            pObj->HeadClass::doSomething(val);
        callOnAllClasses<T, TailClasses...>(val);
    }
};

class A
{
public:
    void doSomething(int i)
    {
        std::cout << "A:" << i << std::endl;
    }
};

class B
{
public:
    void doSomething(int i)
    {
        std::cout << "B:" << i << std::endl;
    }
};

class C : public B, public A, public Meta<C,B,A>
{
    public:
    void doSomething(int i)
    {
        std::cout << "C:" << i << std::endl;
    }
};

int main()
{
    C c;
    c.call(5);
}

This results in the following error when compiled in Visual Studio 2015:

error C2668: 'Meta<C,B,A>::callOnAllClasses': ambiguous call to overloaded function
could be 'void Meta<C,B,A>::callOnAllClasses<T,A,>(const T &)'
or       'void Meta<C,B,A>::callOnAllClasses<T,A>(const T &)'

I've never used variadic templates before so I'm at a bit of a loss as to why this might be going wrong. Any help would be much appreciated!

Body:
You problem can be minimized as follows:

template< typename ... Bases >
struct Meta
{
    template< typename T >
    void call(const T& val)
    {
        callOnAllClasses<T, Bases...>(val);
    }

    template< typename T, typename HeadClass >
    void callOnAllClasses(const T& val)
    {

    }

    template< typename T, typename HeadClass, typename ... TailClasses >
    void callOnAllClasses(const T& val)
    {
        callOnAllClasses<T, TailClasses...>(val);
    }
};

struct C : Meta<int, int, int> { };

int main()
{
    C{}.call(5);
}

When TailClasses is empty, both these signatures are ambiguous to the compiler:

template< typename T, typename HeadClass >
void callOnAllClasses(const T& val);

template< typename T, typename HeadClass, typename ... TailClasses >
void callOnAllClasses(const T& val);

Adding an extra template argument to the recursive case helps the compiler disambiguate between the variadic and non-variadic overloads when TailClasses is empty.

template< typename T, typename HeadClass, typename T1, typename ... TailClasses >
void callOnAllClasses(const T& val)
{
    auto pObj = dynamic_cast<HeadClass*>(this);
    if ( pObj )
        pObj->HeadClass::doSomething(val);
    callOnAllClasses<T, T1, TailClasses...>(val);
}

live example on godbolt


问:
IBM Workload Scheduler: importing thousands of jobs and job streams takes a long time
I'm trying to import a huge number of jobs and job streams (I'm looking at several thousands...) using either composer replace or the datamigrate utility. However, it takes a looong time.... Anyone out there can offer any suggestions?</p>

答:
You can try the following steps:

1. increase the WAS java heap size to 4GB (at least)

2. Change the TIMEOUT property contained in the localopts file related to the TWS component (MDM or FTA) from which you have to perform the import process to a convenient value (so that the timeout does not expire while the import is ongoing.


问:
Find index value of a dataframe by comparing with another series
I am having problem while extracting index value from a data frame by comparing a dataframe column values with another list.</p>

```<code>list=[a,b,c,d]

  data frame
by comparing list with column X
   X Y Z
0  a r t
1  e t y
2  c f h
3  d r t
4  b g q
this should return the index values like

  X
0 a
4 b
2 c
3 d
I tried this method

z=dataframe.loc[(dataframe['X'] == list)]
</code>```

答:
You should use isin as you are comparing to a list of elements:

```<code>dataframe = pd.DataFrame(columns = ['X','Y','Z'])
dataframe['X'] = ['a','e','c','d','b']
dataframe['Y'] = ['r','t','f','r','g']
dataframe['Z'] = ['t','y','h','y','k']
mylist = ['a','b','c','d']
</code>```

(always post a way to create your dataframe in your question, it will be faster to answer)

```<code>dataframe[dataframe['X'].isin(mylist)].X

0    a
2    c
3    d
4    b
Name: X, dtype: object
</code>```

Body:
I am having problem while extracting index value from a data frame by comparing a dataframe column values with another list.

list=[a,b,c,d]

  data frame
by comparing list with column X
   X Y Z
0  a r t
1  e t y
2  c f h
3  d r t
4  b g q
this should return the index values like

  X
0 a
4 b
2 c
3 d
I tried this method

z=dataframe.loc[(dataframe['X'] == list)]

Body:
You should use isin as you are comparing to a list of elements:

dataframe = pd.DataFrame(columns = ['X','Y','Z'])
dataframe['X'] = ['a','e','c','d','b']
dataframe['Y'] = ['r','t','f','r','g']
dataframe['Z'] = ['t','y','h','y','k']
mylist = ['a','b','c','d']

(always post a way to create your dataframe in your question, it will be faster to answer)

dataframe[dataframe['X'].isin(mylist)].X

0    a
2    c
3    d
4    b
Name: X, dtype: object


问:
how to update to a specific commit in git?
I am new to git and I would like to know if I can update my local repository to a specific commit.
Is this possible using checkout?

```<code>git checkout <commitId>
</code>```

exp

```<code>git checkout 55215860452c5c6fb11eac6f51d63abb187e7
</code>```

Thanks in advance!

答:
Yes, you can use git checkout <sha1>.

As stated in the comments, you can use:

The full SHA1 hash of the commit

Any prefix of the SHA1 that isn't ambiguous

Any ref that also points to this specific commit

Body:
I am new to git and I would like to know if I can update my local repository to a specific commit.
Is this possible using checkout?

git checkout <commitId>

exp

git checkout 55215860452c5c6fb11eac6f51d63abb187e7

Thanks in advance!


问:
Google BigQuery, I lost null row when using 'unnest' function
```<code>#StandardSQL
WITH tableA AS (
SELECT ["T001", "T002", "T003"] AS T_id, [1, 5] AS L_id
UNION ALL
SELECT ["T008", "T009"] AS T_id, NULL AS L_id
)

SELECT * FROM tableA, UNNEST(L_id) AS unnest
</code>```

When I executed this code, I expected the result such as that below.

```<code>RowNumber  T-id            L-id  unnest
1          T001,T002,T003  1,5   1
2          T001,T002,T003  1,5   5
3          T004,T005       NULL  NULL
</code>```

But I get this result instead:

```<code>RowNumber  T-id            L-id  unnest
1          T001,T002,T003  1,5   1
2          T001,T002,T003  1,5   5
</code>```

I lost the third row.
Then, I saw the official Google documentation, which states the following:

```<code>UNNEST treats NULL as follows.
 ・NULL and empty ARRAY generate zero rows.
 ・An ARRAY containing NULL generates a row containing a NULL value.
</code>```

But I don't want to lose my null row.

How can I keep the null row?

Please tell me the solution...

答:
Instead of CROSS JOIN, use LEFT JOIN. This will return a row with nulls for an empty array. You may also be interested in the working with arrays topic from the documentation.</p>

```<code>#StandardSQL
WITH tableA AS (
  SELECT ["T001", "T002", "T003"] AS T_id, [1, 5] AS L_id
  UNION ALL
  SELECT ["T008", "T009"] AS T_id, NULL AS L_id
)
SELECT * FROM tableA
LEFT JOIN UNNEST(L_id) AS value;
</code>```

ContentLicense: CC BY-SA 4.0

Body:
#StandardSQL
WITH tableA AS (
SELECT ["T001", "T002", "T003"] AS T_id, [1, 5] AS L_id
UNION ALL
SELECT ["T008", "T009"] AS T_id, NULL AS L_id
)

SELECT * FROM tableA, UNNEST(L_id) AS unnest

When I executed this code, I expected the result such as that below.

RowNumber  T-id            L-id  unnest
1          T001,T002,T003  1,5   1
2          T001,T002,T003  1,5   5
3          T004,T005       NULL  NULL

But I get this result instead:

RowNumber  T-id            L-id  unnest
1          T001,T002,T003  1,5   1
2          T001,T002,T003  1,5   5

I lost the third row.
Then, I saw the official Google documentation, which states the following:

UNNEST treats NULL as follows.
 ・NULL and empty ARRAY generate zero rows.
 ・An ARRAY containing NULL generates a row containing a NULL value.

But I don't want to lose my null row.

How can I keep the null row?

Please tell me the solution...

Body:
Instead of CROSS JOIN, use LEFT JOIN. This will return a row with nulls for an empty array. You may also be interested in the working with arrays topic from the documentation.

#StandardSQL
WITH tableA AS (
  SELECT ["T001", "T002", "T003"] AS T_id, [1, 5] AS L_id
  UNION ALL
  SELECT ["T008", "T009"] AS T_id, NULL AS L_id
)
SELECT * FROM tableA
LEFT JOIN UNNEST(L_id) AS value;


问:
Multistep console inputs for a command in Batch File
I have 10 text files in a folder and a jar file which will take three inputs one by one.

Text file path

Vendor Name

Model

I want to execute the Jar file 10 times (num of text files). I have a code that will execute 10 times and feed the first input "text file path"

```<code>@echo off
for %%a in (*.txt) do (
    echo %%a|java -jar C:\Generator.jar
)
pause
</code>```

I want to give the remaining two "Vendor name and Model" as console inputs one by one automatically. The vendor name and model should be populated by splitting text file name using underscore. Is there a way to achieve this ?

答:
You can use for /f to split the file name into two tokens at the _ delimiter. You don't want to include the .txt extension, so you need to split %%~nA instead of %%A.

You could use dir with findstr to verify that the file name has valid format, and change the outer for loop to for /f to process that result. For example, you don't want to process a file name that looks like "vendor_.txt". My findstr command verifies there is only one _ and there is at least one non-underscore character both before and after.

One would think that the following would work

```<code>@echo off
:: This does not work - each line of input to java has an unwanted trailing space
for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_ tokens=1*" %%B in ("%%~nA") do (
  echo %%A
  echo %%B
  echo %%C
) | java -jar c:\generator.jar
</code>```

But there is an insidious problem due to the fact that each side of the pipe is executed in a new cmd.exe process. Each side of the pipe must be parsed and packaged up into a cmd /c .... command. The left side ends up looking something like:

 C:\Windows\system32\cmd.exe /S /D /C"echo fileName &echo vendor &echo model ",

with an unwanted space at the end of each line. Adding parentheses like (echo %%A) does not help.

There is another potential problem if any of the file names contain a poison character like &. If your vendor name is "Bell&Howell", then the left side process would attempt to execute

echo Bell&Howell. The "Bell" would echo properly, but the "Howell" would be interpreted as a command and would almost surely fail with an error, but in any case would not give the desired result.

See Why does delayed expansion fail when inside a piped block of code? for more information about potential issues with pipes, along with strategies for dealing with them.

Below is an enhancement to my original code that should fix the problems. I solve the poison character issue by putting the string literals within quotes, and then use a for statement that executes within the child cmd.exe process to safely strip the quotes before ECHOing the value.

I solve the unwanted trailing space issue by delaying parsing of the command by using an %%echoX%% "macro". The double percents delays expansion of the "macro" until after we are in the child process.

```<code>@echo off
setlocal disableDelayedExpansion

:: This echoX "macro" delays parsing of the echo command to avoid the unwanted trailing space
set "echoX=(echo %%~X)"

for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  (for %%X in ("%%~A" "%%B" "%%C") do @%%echoX%%) | java -jar c:\generator.jar
)
</code>```

Another option is to define a multi-line variable with embedded linefeeds, and then use CMD /V:ON to enable delayed expansion in the child process.

```<code>@echo off
setlocal disableDelayedExpansion

for %%L in (^"^
%= This creates a quoted linefeed character in the FOR variable L =%
^") do for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  set "str=%%A%%~L%%B%%~L%%C"
  cmd /v:on /c "(echo !str!)" | java -jar c:\generator.jar
)
</code>```

Here is a simpler alternative that uses a temporary file instead of a pipe. It avoids the many issues that can arise with pipes.

```<code>@echo off
for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  >temp.txt (
    (echo %%~A)
    (echo %%B)
    (echo %%C)
  )
  <temp.txt java -jar c:\generator.jar
  del temp.txt
)
</code>```

Body:
I have 10 text files in a folder and a jar file which will take three inputs one by one.

Text file path

Vendor Name

Model

I want to execute the Jar file 10 times (num of text files). I have a code that will execute 10 times and feed the first input "text file path"

@echo off
for %%a in (*.txt) do (
    echo %%a|java -jar C:\Generator.jar
)
pause

I want to give the remaining two "Vendor name and Model" as console inputs one by one automatically. The vendor name and model should be populated by splitting text file name using underscore. Is there a way to achieve this ?

Body:
You can use for /f to split the file name into two tokens at the _ delimiter. You don't want to include the .txt extension, so you need to split %%~nA instead of %%A.

You could use dir with findstr to verify that the file name has valid format, and change the outer for loop to for /f to process that result. For example, you don't want to process a file name that looks like "vendor_.txt". My findstr command verifies there is only one _ and there is at least one non-underscore character both before and after.

One would think that the following would work

@echo off
:: This does not work - each line of input to java has an unwanted trailing space
for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_ tokens=1*" %%B in ("%%~nA") do (
  echo %%A
  echo %%B
  echo %%C
) | java -jar c:\generator.jar

But there is an insidious problem due to the fact that each side of the pipe is executed in a new cmd.exe process. Each side of the pipe must be parsed and packaged up into a cmd /c .... command. The left side ends up looking something like:

 C:\Windows\system32\cmd.exe /S /D /C"echo fileName &echo vendor &echo model ",

with an unwanted space at the end of each line. Adding parentheses like (echo %%A) does not help.

There is another potential problem if any of the file names contain a poison character like &. If your vendor name is "Bell&Howell", then the left side process would attempt to execute

echo Bell&Howell. The "Bell" would echo properly, but the "Howell" would be interpreted as a command and would almost surely fail with an error, but in any case would not give the desired result.

See Why does delayed expansion fail when inside a piped block of code? for more information about potential issues with pipes, along with strategies for dealing with them.

Below is an enhancement to my original code that should fix the problems. I solve the poison character issue by putting the string literals within quotes, and then use a for statement that executes within the child cmd.exe process to safely strip the quotes before ECHOing the value.

I solve the unwanted trailing space issue by delaying parsing of the command by using an %%echoX%% "macro". The double percents delays expansion of the "macro" until after we are in the child process.

@echo off
setlocal disableDelayedExpansion

:: This echoX "macro" delays parsing of the echo command to avoid the unwanted trailing space
set "echoX=(echo %%~X)"

for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  (for %%X in ("%%~A" "%%B" "%%C") do @%%echoX%%) | java -jar c:\generator.jar
)

Another option is to define a multi-line variable with embedded linefeeds, and then use CMD /V:ON to enable delayed expansion in the child process.

@echo off
setlocal disableDelayedExpansion

for %%L in (^"^
%= This creates a quoted linefeed character in the FOR variable L =%
^") do for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  set "str=%%A%%~L%%B%%~L%%C"
  cmd /v:on /c "(echo !str!)" | java -jar c:\generator.jar
)

Here is a simpler alternative that uses a temporary file instead of a pipe. It avoids the many issues that can arise with pipes.

@echo off
for /f "delims=" %%A in (
  'dir /a-d /b *_*.txt ^| findstr /i "^[^_][^_]*_[^_][^_]*\.txt$"'
) do for /f "delims=_" tokens=1*" %%B in ("%%~nA") do (
  >temp.txt (
    (echo %%~A)
    (echo %%B)
    (echo %%C)
  )
  <temp.txt java -jar c:\generator.jar
  del temp.txt
)


问:
How to destroy ckeditor in Angular application?
I'm using the ckeditor4 in my Angular application. When I navigate away from the page the console gives a warning like this:

[CKEDITOR] Error code: editor-destroy-iframe.

      ckeditor.js:21 [CKEDITOR] For more information about this error go to http://docs.ckeditor.com/#!/guide/dev_errors-section-editor-destroy-iframe

How should I safely unload the ckeditor component?

答:
This is how I solved the problem:

Add the plugins 'divarea' in your html like this:

<ckeditor [config]={extraPlugins: 'divarea'}></ckeditor>

At this point the console will still have have a 404 error:

Failed to load resource: the server responded with a status of 404
  (Not Found)

Finally, you need to change the package address in your index.html from "full" to "full-all".

reference

Body:
This is how I solved the problem:

Add the plugins 'divarea' in your html like this:

<ckeditor [config]={extraPlugins: 'divarea'}></ckeditor>

At this point the console will still have have a 404 error:

Failed to load resource: the server responded with a status of 404
  (Not Found)

Finally, you need to change the package address in your index.html from "full" to "full-all".

<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>

reference


问:
Inferring member of a set given incomplete facts about the set
Given a bunch of facts like:
Set contains at least 1 of (A,B,C)
Set does not contain any of (D,E,F)

about a finite set where each member can be a finite number of values(say integers 1...m), how can I enumerate all the possible sets which satisfy the list of facts?

I realize that this algorithm is exponential in nature, but I'd like to improve on my current naive implementation which is to list all possible sets, and eliminate those which do not satisfy every condition in the facts list. I thought that perhaps I could use dynamic programming and iterate over the finite values. i.e. first consider only facts relating to value 1, then values 1,2, then values 1,2,3  and so on.

答: Your facts sound like they would be easily translatable to a SAT (boolean satisfiability) instance.  You can then use a SAT solver to find all possible solutions (get one solution, add a clause that eliminates that solution, and repeat).  There are a lot of good SAT solvers out there, e.g. zChaff.</p>

ContentLicense: CC BY-SA 2.5


问:
C# Protobuf Wcf
I want to test protobuf with wcf.
I configured my service and client with the protobuf attirbutes and in the app-config added the extension and told the service and client to use the protobufBehavior now I want to check what the client sends to the service (List ob Class Person).
Without protobuf the client would send xml style object list to the service.
But wiht protobuf its more compact.
problem is, when i look into it (with fiddler/wireshark) it still looks like xml
example:

```<code><s:Envelope
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <SavePersons
            xmlns="http://tempuri.org/">
            <persons
                xmlns:a="http://schemas.datacontract.org/2004/07/TestInterface"
                xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:Person>
                    <a:Id>0</a:Id>
                    <a:Name>4RAZIW</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4356535+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>1</a:Id>
                    <a:Name>NZORLT</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4366538+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>2</a:Id>
                    <a:Name>WP0IYX</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4366538+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>3</a:Id>
                    <a:Name>ZRJ0X7</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4376546+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>4</a:Id>
                    <a:Name>G1X55H</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4376546+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>5</a:Id>
                    <a:Name>EVV90Q</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4386542+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>6</a:Id>
                    <a:Name>OCERM0</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4386542+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>7</a:Id>
                    <a:Name>4A4XBA</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4396545+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>8</a:Id>
                    <a:Name>P60Y28</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4396545+02:00</a:nextGift>
                </a:Person>
                <a:Person>
                    <a:Id>9</a:Id>
                    <a:Name>3XNBLI</a:Name>
                    <a:aDouble>0.61364615364635655</a:aDouble>
                    <a:addressCollection>
                        <a:Address/>
                    </a:addressCollection>
                    <a:addressList>
                        <a:Address/>
                    </a:addressList>
                    <a:bytearray i:nil="true"/>
                    <a:dataTable i:nil="true"/>
                    <a:nextGift>2017-07-05T13:23:57.4396545+02:00</a:nextGift>
                </a:Person>
            </persons>
        </SavePersons>
    </s:Body>
</s:Envelope>
</code>```

Any ideas why that is?
I have no clue.
I addded protobut and setup the behavior.
What am i doing wrong, anyone got an idea?
Thanks for help in advance.
BTW: this is what i used as example to get an idea. https://whinery.wordpress.com/2014/10/28/wcf-with-protobuf-serialization/

This is how i host my service:

```<code>try
    {
        //RuntimeTypeModel.Default.Add(typeof(Person), false).Add(1,  nameof(Person.Id)).Add(2, "Name").Add(3, "addressList").Add(4, "nextGift").Add(5, "aDouble").Add(6, "bytearray").Add(7, "addressCollection");

        string address = "http://localhost:8080/SelfHost";

        BasicHttpBinding binding = new BasicHttpBinding();
        ServiceHost host = new ServiceHost(typeof(SelfHost));

        host.AddServiceEndpoint(typeof(ISelfHostTest), binding, address);
        host.Open();
        Console.WriteLine("Host is {0}.\n{1} \nPress enter to close.", host.State, address);
        if (!File.Exists("person.bin"))
            File.Create("person.bin").Dispose();
        if (!File.Exists("Person.bin"))
            File.Create("Person.bin").Dispose();
        Console.ReadLine();

        host.Close();
    }
    catch (Exception ex)
    {
        Console.WriteLine("???" + ex.Message + "???");
        Console.ReadLine();
    }
</code>```

This is how i consume my service:

```<code>        private ISelfHostTest Connect()
    {
        string address = serviceAdress;//"http://localhost:8080/SelfHost";
        BasicHttpBinding binding = new BasicHttpBinding();
        ChannelFactory<ISelfHostTest> factory = new ChannelFactory<ISelfHostTest>(binding, address);

        ISelfHostTest client = factory.CreateChannel();
        return client;
    }

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="protoEndpointBehavior">
          <protobuf/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ISelfHostTest" receiveTimeout="00:10:00" sendTimeout="0:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8080/SelfHost"
          binding="netNamedPipeBinding" bindingConfiguration="BasicHttpBinding_ISelfHostTest"
          contract="TestInterface.ISelfHostTest" name="BasicHttpBinding_ISelfHostTest" behaviorConfiguration="protoEndpointBehavior">
      </endpoint>
    </client>

    <extensions>
      <behaviorExtensions>
        <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net"/>
      </behaviorExtensions>
    </extensions>
  </system.serviceModel>
</configuration>
</code>```

答:
You're not using the settings from the config files at all. You'll need a different overload of the ChannelFactory constructor on your client for a start:

```<code>// first argument must match with a name in the app.config file
var factory = new ChannelFactory<ISelfHostTest>("BasicHttpBinding_ISelfHostTest");
</code>```

because this is in your config:

<endpoint address="http://localhost:8080/SelfHost"
          binding="netNamedPipeBinding"
          bindingConfiguration="BasicHttpBinding_ISelfHostTest"
          contract="TestInterface.ISelfHostTest"
          name="BasicHttpBinding_ISelfHostTest"
          behaviorConfiguration="protoEndpointBehavior">
  </endpoint>
```

<p>A similar issue exist for your service. I don't see a config there so I assume you want to programmatically add the behavior. You can do so by adding the EndpointBehavior to the ServiceDescription Endpoints found on the instance of your ServiceHost:</p>

```var host = new ServiceHost(typeof(SelfHost));

var address = "http://localhost:87/SelfHost";
var binding = new BasicHttpBinding();

host.AddServiceEndpoint(typeof(ISelfHostTest), binding, address);

// add EndpointBehavior
host.Description.Endpoints[0].EndpointBehaviors.Add(
     new ProtoBuf.ServiceModel.ProtoEndpointBehavior());

host.Open();
```

Title: C# Protobuf Wcf

Body:
I want to test protobuf with wcf.
I configured my service and client with the protobuf attirbutes and in the app-config added the extension and told the service and client to use the protobufBehavior now I want to check what the client sends to the service (List ob Class Person).
Without protobuf the client would send xml style object list to the service.
But wiht protobuf its more compact.
problem is, when i look into it (with fiddler/wireshark) it still looks like xml
example:

<s:Envelope
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <SavePersons
            xmlns="http://tempuri.org/">
            <persons
                xmlns:a="http://schemas.datacontract.org/2004/07/TestInterface"
                xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

                    0
                    4RAZIW
                    0.61364615364635655

                    2017-07-05T13:23:57.4356535+02:00

                    1
                    NZORLT
                    0.61364615364635655

                    2017-07-05T13:23:57.4366538+02:00

                    2
                    WP0IYX
                    0.61364615364635655

                    2017-07-05T13:23:57.4366538+02:00

                    3
                    ZRJ0X7
                    0.61364615364635655

                    2017-07-05T13:23:57.4376546+02:00

                    4
                    G1X55H
                    0.61364615364635655

                    2017-07-05T13:23:57.4376546+02:00

                    5
                    EVV90Q
                    0.61364615364635655

                    2017-07-05T13:23:57.4386542+02:00

                    6
                    OCERM0
                    0.61364615364635655

                    2017-07-05T13:23:57.4386542+02:00

                    7
                    4A4XBA
                    0.61364615364635655

                    2017-07-05T13:23:57.4396545+02:00

                    8
                    P60Y28
                    0.61364615364635655

                    2017-07-05T13:23:57.4396545+02:00

                    9
                    3XNBLI
                    0.61364615364635655

                    2017-07-05T13:23:57.4396545+02:00

            </persons>
        </SavePersons>
    </s:Body>
</s:Envelope>

Any ideas why that is?
I have no clue.
I addded protobut and setup the behavior.
What am i doing wrong, anyone got an idea?
Thanks for help in advance.
BTW: this is what i used as example to get an idea. https://whinery.wordpress.com/2014/10/28/wcf-with-protobuf-serialization/

This is how i host my service:

try
    {
        //RuntimeTypeModel.Default.Add(typeof(Person), false).Add(1,  nameof(Person.Id)).Add(2, "Name").Add(3, "addressList").Add(4, "nextGift").Add(5, "aDouble").Add(6, "bytearray").Add(7, "addressCollection");

        string address = "http://localhost:8080/SelfHost";

        BasicHttpBinding binding = new BasicHttpBinding();
        ServiceHost host = new ServiceHost(typeof(SelfHost));

        host.AddServiceEndpoint(typeof(ISelfHostTest), binding, address);
        host.Open();
        Console.WriteLine("Host is {0}.\n{1} \nPress enter to close.", host.State, address);
        if (!File.Exists("person.bin"))
            File.Create("person.bin").Dispose();
        if (!File.Exists("Person.bin"))
            File.Create("Person.bin").Dispose();
        Console.ReadLine();

        host.Close();
    }
    catch (Exception ex)
    {
        Console.WriteLine("???" + ex.Message + "???");
        Console.ReadLine();
    }

This is how i consume my service:

        private ISelfHostTest Connect()
    {
        string address = serviceAdress;//"http://localhost:8080/SelfHost";
        BasicHttpBinding binding = new BasicHttpBinding();
        ChannelFactory<ISelfHostTest> factory = new ChannelFactory<ISelfHostTest>(binding, address);

        ISelfHostTest client = factory.CreateChannel();
        return client;
    }

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="protoEndpointBehavior">
          <protobuf/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ISelfHostTest" receiveTimeout="00:10:00" sendTimeout="0:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8080/SelfHost"
          binding="netNamedPipeBinding" bindingConfiguration="BasicHttpBinding_ISelfHostTest"
          contract="TestInterface.ISelfHostTest" name="BasicHttpBinding_ISelfHostTest" behaviorConfiguration="protoEndpointBehavior">
      </endpoint>
    </client>

    <extensions>
      <behaviorExtensions>
        <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net"/>
      </behaviorExtensions>
    </extensions>
  </system.serviceModel>
</configuration>

Body:
You're not using the settings from the config files at all. You'll need a different overload of the ChannelFactory constructor on your client for a start:

// first argument must match with a name in the app.config file
var factory = new ChannelFactory<ISelfHostTest>("BasicHttpBinding_ISelfHostTest");

because this is in your config:

<endpoint address="http://localhost:8080/SelfHost"
          binding="netNamedPipeBinding"
          bindingConfiguration="BasicHttpBinding_ISelfHostTest"
          contract="TestInterface.ISelfHostTest"
          name="BasicHttpBinding_ISelfHostTest" <!-- This goes into ChannelFactory -->
          behaviorConfiguration="protoEndpointBehavior">
  </endpoint>

A similar issue exist for your service. I don't see a config there so I assume you want to programmatically add the behavior. You can do so by adding the EndpointBehavior to the ServiceDescription Endpoints found on the instance of your ServiceHost:

var host = new ServiceHost(typeof(SelfHost));

var address = "http://localhost:87/SelfHost";
var binding = new BasicHttpBinding();

host.AddServiceEndpoint(typeof(ISelfHostTest), binding, address);

// add EndpointBehavior
host.Description.Endpoints[0].EndpointBehaviors.Add(
     new ProtoBuf.ServiceModel.ProtoEndpointBehavior());

host.Open();


问:
Cannot fetch data in view #codeigniter
Whats wrong wth my code?

This is my controller

```<code>//...
function index()
    {
        $data['tampilkan'] = $this->mymodel->tampil();
        $this->load->view('client/homepage', $data);
    }
//...
</code>```

This is my model

```<code>//...
function tampil()
    {
        $this->db->select("id_konfirmasi,atas_nama_konfirmasi,jumlah");
        $this->db->from('konfirmasi');
        $query = $this->db->get();
        return $query->result();
    }
//...
</code>```

And this is my view

```<code>//...
<?php
             if (!empty($tampilkan)):
               foreach ($tampilkan as $row): ?>

                   <span class="label label-success">New Donatur</span> <?php echo $row->atas_nama_konfirmasi; ?> Send us <?php echo $row->jumlah; ?><br/>

               <?php endforeach;
                else:
                    echo "No donatur";
                endif
            ?>
//...
</code>```

Why always show "No donatur". in my tables have 2 donatur. Pls help

答:
on function tampil()   replace return $query->result(); with

```<code>return $query->result_array();
</code>```

OR... second option (that's how I write code)

on function tampil()   replace return $query->result(); with

```<code> return $query;
</code>```

then in view replace   foreach ($tampilkan as $row): with

```<code>foreach($tampilkan->result_array() as $row):
</code>```

Title: Cannot fetch data in view #codeigniter

Body:
Whats wrong wth my code?

This is my controller

//...
function index()
    {
        $data['tampilkan'] = $this->mymodel->tampil();
        $this->load->view('client/homepage', $data);
    }
//...

This is my model

//...
function tampil()
    {
        $this->db->select("id_konfirmasi,atas_nama_konfirmasi,jumlah");
        $this->db->from('konfirmasi');
        $query = $this->db->get();
        return $query->result();
    }
//...

And this is my view

//...
<?php
             if (!empty($tampilkan)):
               foreach ($tampilkan as $row): ?>

                   New Donatur <?php echo $row->atas_nama_konfirmasi; ?> Send us <?php echo $row->jumlah; ?>

               <?php endforeach;
                else:
                    echo "No donatur";
                endif
            ?>
//...

Why always show "No donatur". in my tables have 2 donatur. Pls help

Body:
on function tampil()   replace return $query->result(); with

return $query->result_array();

OR... second option (that's how I write code)

on function tampil()   replace return $query->result(); with

 return $query;

then in view replace   foreach ($tampilkan as $row): with

foreach($tampilkan->result_array() as $row):


问:
How to use some Jackson Deserializer in own custom Deserializer?
I am struggling with mentioned in the question issue.

I need to create some custom deserializer which is more or less type conversion from the standard deserializer (reason is that ZonedDateTime is working for my input, but I don't want to change the type to ZonedDateTime, but keep LocalDateTime).

Bascially what I want to do in my deserializer is to:

Deserialize using ZonedDateTime deserializer (which I found, in reality, is custom InstantDeserializer )

Use .toLocalDateTime and return it.

How can I use it?
Was trying to find it but I can't.

答:
If your input represents a ZonedDateTime and you want to convert it to a LocalDateTime, you can do the following.

I've created a sample class with a LocalDateTime field:

```<code>public class ZoneToLocalTest {

    @JsonDeserialize(using = CustomZonedToLocalDeserializer.class)
    private LocalDateTime date;

    // getter and setter
}
</code>```

And also created the deserializer class:

```<code>public class CustomZonedToLocalDeserializer extends LocalDateTimeDeserializer {
    public CustomZonedToLocalDeserializer() {
        super(DateTimeFormatter.ISO_ZONED_DATE_TIME);
    }
}
</code>```

I've tested with the input 2017-07-05T14:10:45.432+01:00[Europe/London] and the result was a LocalDateTime with the value 2017-07-05T14:10:45.432.

If the input is in a different format, then you need to use this format in the CustomZonedToLocalDeserializer class (instead of using DateTimeFormatter.ISO_ZONED_DATE_TIME, you'd use DateTimeFormatter.ofPattern(pattern)).

Body:
If your input represents a ZonedDateTime and you want to convert it to a LocalDateTime, you can do the following.

I've created a sample class with a LocalDateTime field:

public class ZoneToLocalTest {

    @JsonDeserialize(using = CustomZonedToLocalDeserializer.class)
    private LocalDateTime date;

    // getter and setter
}

And also created the deserializer class:

public class CustomZonedToLocalDeserializer extends LocalDateTimeDeserializer {
    public CustomZonedToLocalDeserializer() {
        super(DateTimeFormatter.ISO_ZONED_DATE_TIME);
    }
}

I've tested with the input 2017-07-05T14:10:45.432+01:00[Europe/London] and the result was a LocalDateTime with the value 2017-07-05T14:10:45.432.

If the input is in a different format, then you need to use this format in the CustomZonedToLocalDeserializer class (instead of using DateTimeFormatter.ISO_ZONED_DATE_TIME, you'd use DateTimeFormatter.ofPattern(pattern)).


问:
How to Execute Windows Commands Using Java - Change Network Settings
In Java, I want to be able to execute a Windows command.

The command in question is netsh. This will enable me to set/reset my IP address.

Note that I do not want to execute a batch file.

Instead of using a batch file, I want to execute such commands directly. Is this possible?

Here is my implemented Solution for Future Reference:

```<code>public class JavaRunCommand {
    private static final String CMD =
        "netsh int ip set address name = \"Local Area Connection\" source = static addr = 192.168.222.3 mask = 255.255.255.0";
    public static void main(String args[]) {

        try {
            // Run "netsh" Windows command
            Process process = Runtime.getRuntime().exec(CMD);

            // Get input streams
            BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
            BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

            // Read command standard output
            String s;
            System.out.println("Standard output: ");
            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }

            // Read command errors
            System.out.println("Standard error: ");
            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
}
</code>```

答: You can run the command with Runtime.getRuntime().exec("<command>") (eg. Runtime.getRuntime().exec("tree")). But, this will only run executables found in path, not commands like echo, del, ... But only stuff like tree.com, netstat.com, ... To run regular commands, you will have to put cmd /c before the command (eg Runtime.getRuntime().exec("cmd /c echo echo"))

Body:
In Java, I want to be able to execute a Windows command.

The command in question is netsh. This will enable me to set/reset my IP address.

Note that I do not want to execute a batch file.

Instead of using a batch file, I want to execute such commands directly. Is this possible?

Here is my implemented Solution for Future Reference:

public class JavaRunCommand {
    private static final String CMD =
        "netsh int ip set address name = \"Local Area Connection\" source = static addr = 192.168.222.3 mask = 255.255.255.0";
    public static void main(String args[]) {

        try {
            // Run "netsh" Windows command
            Process process = Runtime.getRuntime().exec(CMD);

            // Get input streams
            BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
            BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

            // Read command standard output
            String s;
            System.out.println("Standard output: ");
            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }

            // Read command errors
            System.out.println("Standard error: ");
            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
}


问:
Does this function return the same pointer as its argument?
I have written this function in C:

```<code>void *PWNRetain(void *object) {
  PWNObject *obj = (PWNObject *)object; // <-- looks stupid, I know :)
  obj->retainCount++;
  return obj;
}
</code>```

It's important that this will return the same pointer as it's argument. Is obj equal to object, or did I make another pointer mistake? Thanks. :)

答: Typically, people will use a forward declaration of their struct to enable type-safety, but your code will function as expected and does indeed return the same pointer.</p>

Body:
I have written this function in C:

void *PWNRetain(void *object) {
  PWNObject *obj = (PWNObject *)object; // <-- looks stupid, I know :)
  obj->retainCount++;
  return obj;
}

It's important that this will return the same pointer as it's argument. Is obj equal to object, or did I make another pointer mistake? Thanks. :)


答:
Found the answer here. Solution:

plot.zoo(XTS2, xaxt ='n')

i.e. need to use plot.zoo rather than plot given that it is an XTS object.

Title: Plotting without x-axis not working

Body:
According to R's documentation and to this SO answer, adding clause xaxt='n' to plot function would remove the x-axis. But it is not working. How can I remove the x-axis? Note the data of the reproducible example is purposely large as otherwise the issue may not become apparent.

library(xts)

#Data
XTS2 <- structure(c(0.219372625180095, 0.219621309002056, 0.219672138096205, 0.219802192670588, 0.219864845456527, 0.219903875450378, 0.219878284684927, 0.219864700919602, 0.21985651328177, 0.219857825136631, 0.219884473722915, 0.219898694923239, 0.219885043080517, 0.219854528884288, 0.219891391116462,
0.220009076372192, 0.220043450189938, 0.219875677981711, 0.219721321036969, 0.219758828022141, 0.219849042254386, 0.219879876725454, 0.219878646418273, 0.219894602486828, 0.219811609428382, 0.219793531899719, 0.219797131429743, 0.219855825952923, 0.219875561367165, 0.219858651084074, 0.219864158100624, 0.21986763110722, 0.219910853386158, 0.219814296888465, 0.219859611637469, 0.219918996841639, 0.219963561983058, 0.219994304642825, 0.220029191160333, 0.219758957034546, 0.219687680441127, 0.219633056927772, 0.219598040619723, 0.21934030011892, 0.219394314552813, 0.219578706291011, 0.219814709531839, 0.219684116969818, 0.219784045583737, 0.219751237724798, 0.219833014585797, 0.219807141408044, 0.219753066207534, 0.219718012325876, 0.21973771018932, 0.219803162803865, 0.219733737959443, 0.219688542058595, 0.219689360991042, 0.219818376281643, 0.21984708712555, 0.219820116196723, 0.219846725602203,
0.219669833445315, 0.219861667333268, 0.219976424596682, 0.219970605220939, 0.220022350371598, 0.220091127852274, 0.220098017537939, 0.219793881178817, 0.219146686479004, 0.219270493990701, 0.219446599806344, 0.219356112506615, 0.21907529149545, 0.218978996562748, 0.219304317202003, 0.219326175023805, 0.219350894629431, 0.219316608166634, 0.219413886418147, 0.219052756629217, 0.219057431850469, 0.218926977685616, 0.218970132003055, 0.219061600571713, 0.219053251218667, 0.219017407867393, 0.218987520940269, 0.2190060296344, 0.21902931390176, 0.219102079717272, 0.219136627753565, 0.219233819022479, 0.219228483314638, 0.219204780731664, 0.219214972196354, 0.219340375121465, 0.219303759835192, 0.219308537580622, 0.219305529334513, 0.219404905815325, 0.219403019314926, 0.219302596668474, 0.219333591104669, 0.219339691330575, 0.219138199582819, 0.218808232394892, 0.21862547568137, 0.217813259798987, 0.218071071020893, 0.218126099353004, 0.21801371238704, 0.218217144602222, 0.218186406055183, 0.218160214186533, 0.217613149482091, 0.217297311719424, 0.216921598836798, 0.216886531831567, 0.216869443189717, 0.216895243273095, 0.216992451407759, 0.216779869099981, 0.216715362406786, 0.216782476229447, 0.216628059262821, 0.216469933413926, 0.216470605917547, 0.216409392265033, 0.216537300706589, 0.216262240592122, 0.216172533946436, 0.215698974382028, 0.215466640822865, 0.215720328515775, 0.215195583643126, 0.217806277785717, 0.2178311807524, 0.217244068883317, 0.218187732589532, 0.218218958791764, 0.218016932562116, 0.217811629505962, 0.217732987527718, 0.217873250837996, 0.217985226015088, 0.217989357268364, 0.217557116840282, 0.217444425402065, 0.217426023665022, 0.217524570013801, 0.217247146089949, 0.217266721381979, 0.217093020878191, 0.216952587309252, 0.216878350328864, 0.217209585456646, 0.217087040447174, 0.217009465770626, 0.216840267866476, 0.216828987518491, 0.21693827916567, 0.217166553613278, 0.217180207445256, 0.217373695022239, 0.217322541728757, 0.217324637266103, 0.217327550926527, 0.217451974602723, 0.217490605071071, 0.217571815956399, 0.217468213076912, 0.217297079835864, 0.217319940335529, 0.217370081965867, 0.217410758979974, 0.217365347472455, 0.217312297866112, 0.216894972514671, 0.216916971378834, 0.216927929423001, 0.216880915768745, 0.216881319378257, 0.217009238500502, 0.217003165315578, 0.217004748863254, 0.21701650039403, 0.217015054543806, 0.217048421169708, 0.217049418219586, 0.217007912594355, 0.217025915167897, 0.216871925083452, 0.216927497446706, 0.216934230243114, 0.216951557834727, 0.216991958366158, 0.217029362820244, 0.217083290051199, 0.217048390782159, 0.217171159922855, 0.217280374330946, 0.217276026547555, 0.217216744154985, 0.217273660122334, 0.217276041496074, 0.217220793243445, 0.217226734383279, 0.217223959703248, 0.217250964478871, 0.217087682311829, 0.217044071461808, 0.217172832136015, 0.216499622360394, 0.21638996008073, 0.216812667802217, 0.216697472780232, 0.216708436238815, 0.216736311300962, 0.216692232493857, 0.216907050812607, 0.217118813214285, 0.217023338083543, 0.217038423787153, 0.217414052331065, 0.217407201483883, 0.217461369006772, 0.217543822171223, 0.217523360383044, 0.217734048158787, 0.217973112513555, 0.217985432846306, 0.217987739289465, 0.217937914607489, 0.217884729648709, 0.217916880143048, 0.217806347927511, 0.217731842768728, 0.217808164646269, 0.217852077037923, 0.217892146727977, 0.217936872820116, 0.217950293184636, 0.217932486010376, 0.217919910834581, 0.217568927742625, 0.217709881646753, 0.217599751053336, 0.217611475281775,
0.217600923654268, 0.217642544277135, 0.217475885262979, 0.217480569755149, 0.217530844080224, 0.217580856021759, 0.217618818578885, 0.217601266054404, 0.217463078336142, 0.21745321406011, 0.217566465029886, 0.21755916928927, 0.217551187576845, 0.217637555979833, 0.217651980019569, 0.217850758706321, 0.21783465919771, 0.217825968389065, 0.217807458511111, 0.217814751827357, 0.217783507963404, 0.217791494478799, 0.217785839303163, 0.217835058517766, 0.21786632869287, 0.217858017613214, 0.217872029949717, 0.217867798573574, 0.217873846406077, 0.217844637803948, 0.217859763062461, 0.217855605999771, 0.217882113955261, 0.217891974770414, 0.217882163641107, 0.217880237683436, 0.217894939213953, 0.217949684259951, 0.217959319929622, 0.21797285377485, 0.218041172186086, 0.218111517060791, 0.218149654590506, 0.218139356733247, 0.218196329620811, 0.218188890309925, 0.218201662940889, 0.218245731308144, 0.21827276107351, 0.218258473021243, 0.218322741884883, 0.218310529948176, 0.218313959458195, 0.218313754439997, 0.218306842504346, 0.218300726378134, 0.218313622595547, 0.21842865600127, 0.218405505443825, 0.218393168047389, 0.218410519856679, 0.218210003107985, 0.21813897530049, 0.21791514127928, 0.217871073814684, 0.217863581458704, 0.217845073659016, 0.217882752664317, 0.217894890637032, 0.217909393512176, 0.217904226593551, 0.217911995780017, 0.217985467653295, 0.218051390386744, 0.218107202619451, 0.218115624813903, 0.21811247637043, 0.218130738352036, 0.218082739092671, 0.218101190004053, 0.218055966519318, 0.218173787132293, 0.218163587654213, 0.218106790838072, 0.218151024789873, 0.218174863745909, 0.218464617823987, 0.218408325949648, 0.218333169984797, 0.218341954587723, 0.218459133444117, 0.218497432127628,
0.218529285621723, 0.218466066087278, 0.218450443639925, 0.218612312950178, 0.218625551236129, 0.21856979358855, 0.218591553801471, 0.218586822585285, 0.218495201782765, 0.218475674882667, 0.218443134178296, 0.217964977512337, 0.217994106593569, 0.217268169016181, 0.217065818677276, 0.217062871205704, 0.217049602028031, 0.217089226618341, 0.217096201916788, 0.217260166177692, 0.21724823755094, 0.217124090777664, 0.217074650739589, 0.216901677906322, 0.216843134095403, 0.216926131814381, 0.216921395172546, 0.216886595101649, 0.216911419925289, 0.21687066690479, 0.216846773984469, 0.216854956667436, 0.216829805334953, 0.216780090203657, 0.216574863507063, 0.216483471959826, 0.216392133097005, 0.21643230103607, 0.216378918436113, 0.216369359131274, 0.216293516942139, 0.216392681904286, 0.216374472108616, 0.216436234824582, 0.216429065193724, 0.215977538253493, 0.21606072690004, 0.2160041111478, 0.215986089851722, 0.215887585357417, 0.215796267262591, 0.21574942206974, 0.215912495000918, 0.215876477977751, 0.215900468700505, 0.215931783785417, 0.216320452068163, 0.216302712674563, 0.216352012767308, 0.216540000404463, 0.216344243248879, 0.216100530101306, 0.216119038067417, 0.216189861095482, 0.216317879855449, 0.2162757385979, 0.216236768244242, 0.216243919447051, 0.21627444599059, 0.216036331100952, 0.215688201108565, 0.21578017312545, 0.215800674490674, 0.215829697447784, 0.215886276467156, 0.215906263063857, 0.215921470375255, 0.215937155987692, 0.216121572990104, 0.216119325344087, 0.216163959784774, 0.216021607022737, 0.21589927040904, 0.215917573768703, 0.215836900089163, 0.215830835442458, 0.215619556258814, 0.216031647923587, 0.216308694959281, 0.216274277309817, 0.215828139436584, 0.216567015269705, 0.216513905374993, 0.216325896030464, 0.216332994414471, 0.216399722002687, 0.216916951319404, 0.216902022632257, 0.216812500295495, 0.216857229130599, 0.216789861197808, 0.216728853597145, 0.216729535564657, 0.216693707328252, 0.216705663416225, 0.217465940232614, 0.217369186877776, 0.217489820869247,
0.217609835942369, 0.217577298840701, 0.217659257692806, 0.217945467359325, 0.217949225914142, 0.217996570823813, 0.218014569201486, 0.217813679728475, 0.217749088150262, 0.217764456918024, 0.217790086541941, 0.217639462521519, 0.217531361828044, 0.217532229263885, 0.217568213817858, 0.217665629436662, 0.217357423107243, 0.217368890936016, 0.217286425636845, 0.216983492990029,
0.216906909423506, 0.216844270456614, 0.217131743735174, 0.217118003085994, 0.217054356297036, 0.216953656908279, 0.216847663612646, 0.216840382538953, 0.216634208189167, 0.217782319457363, 0.217647329575814, 0.21763286498373, 0.217701678671705, 0.217686527700144, 0.218395347933348, 0.218393945274687, 0.218347058273995, 0.218981043910263, 0.218995332899675, 0.219161186211194, 0.219229760291369, 0.219290834675094, 0.219269333866627, 0.219335781789526, 0.219331470868454, 0.219263854889853, 0.219187305253529, 0.21861049643452, 0.218635279435254, 0.218733799741655, 0.218720558757573, 0.218846320683796, 0.218943126369255, 0.218869896312965, 0.219026774447187, 0.219019790017436, 0.219101416310773, 0.218748489009591, 0.218754432178698, 0.218746308795306, 0.21877238898308, 0.218626306241118, 0.218714632122058, 0.218908892611659, 0.218909215693087, 0.218931943105087, 0.218947517313813, 0.218673537058913, 0.218680004881372, 0.219514083717882, 0.219490205712695, 0.218710936475516, 0.218896188657438, 0.218927355858217, 0.219305597184599, 0.219468848782022, 0.219523566898569, 0.219584306556309, 0.219765769851883, 0.219612335286181, 0.219483383834189, 0.219333361436551, 0.219394870428097, 0.219340704596692, 0.219379633002215, 0.219400947654446, 0.219457599652927, 0.219493010839121, 0.219714351602803, 0.219720319777292, 0.219692666899645, 0.21974547323626, 0.219863847195214, 0.220250276053365, 0.220267997707088, 0.220399813566856, 0.220450421825232, 0.22045982654679, 0.221044547253648, 0.221029841297845, 0.221025983876479, 0.221028759537789, 0.22102677124964, 0.221354382991021, 0.221344030026005, 0.221411463707881, 0.221410383904904, 0.221351240150523, 0.22134741522313, 0.221307182199527, 0.221336454002443, 0.221530466136706, 0.221409770913285, 0.221418835637027, 0.221428150074142, 0.22140811916689, 0.221490341815545, 0.221538370438024, 0.221535631176995, 0.221539261584083, 0.221529826035606, 0.221517876991509, 0.221439329491863, 0.221527433748103, 0.221363306676618, 0.222152029773528, 0.222133790083725, 0.222119240276656, 0.222571292308224, 0.222617173715808, 0.222594801448108, 0.222543958702342, 0.222378977295096, 0.222618278839072, 0.222569667092097, 0.222577039759024, 0.222553623949827, 0.222265459019078, 0.221898293857706, 0.221987404868731, 0.222029300543936, 0.222012113749821, 0.221802188211151, 0.221784962074043, 0.220117545918147, 0.220170692505279, 0.220182746530293, 0.220138863190637, 0.22019792190325, 0.220123650155717, 0.220124010003244, 0.220105742126731,
0.220035648875497, 0.220033022967086, 0.219864818105582, 0.219927626221313, 0.219725739782521, 0.219980247408379, 0.219944444246673, 0.219994716128738, 0.219648350515785, 0.220625606609322, 0.220912135065688, 0.220930714464572, 0.220695988989445, 0.220964998108486, 0.221102599732216, 0.221092431487128, 0.221069132070843, 0.221232559883904, 0.221283483924733, 0.221321783246303, 0.221261060985152, 0.221208586050713, 0.221204169326017, 0.221204605642686, 0.221125158236573, 0.221111684931975, 0.22113947042425, 0.221260192181588, 0.221345286073646, 0.221545108117072, 0.221379226715751, 0.221456396871684, 0.221386892051213, 0.221375125543904, 0.22137743182452, 0.221457918362917, 0.22146931187736, 0.222467461639641, 0.222307471429918, 0.22216320489858, 0.222406990929612, 0.222440451237491, 0.222435855511242, 0.222375166736779, 0.222347057192669, 0.222366250557855, 0.222555795670714, 0.222253405047739, 0.222109623091949, 0.221838463384401, 0.221741425149466, 0.221722973894889, 0.221684712025732, 0.221709488940705, 0.221682257931999, 0.221078385509961, 0.220248719078039, 0.220075429727283, 0.220030574040273, 0.219380152052451, 0.21921760987394, 0.219040552382267, 0.219068820554604, 0.21845531346404, 0.218468390294094, 0.218677698001889, 0.218751809055679, 0.218888305177651, 0.218896819047292, 0.219129366665515, 0.219294467929545, 0.219256343425503, 0.219255558048601, 0.219033469029315, 0.21960672216628, 0.219679935694736, 0.219655115056687, 0.219722801204956, 0.219660639999841, 0.219814632291836, 0.219575297131235, 0.219542852572835, 0.219604535115636, 0.219649146443274, 0.219661477117102, 0.219660508505485, 0.219578495045341, 0.219811731302366, 0.219799074857979, 0.219822327964996, 0.219812096776713, 0.219738206538913, 0.219741417968515, 0.219756007251922, 0.220445947457748, 0.220449236614984, 0.22045382706585, 0.220699626586048, 0.220891076077203, 0.220647002967448, 0.220966590464419, 0.221076858099077, 0.221199588991738, 0.221020391194367, 0.220998886431973, 0.220729177241402, 0.220683999425887, 0.220438230650005, 0.220391035920173, 0.220384489832452, 0.220293648086094, 0.220476337692587, 0.220521874607574, 0.220586632548807, 0.220475047542727, 0.22058093679145, 0.220588596846972, 0.220536742956465, 0.220529116998138, 0.22053664648333, 0.220604250898976, 0.220639690013959, 0.220612202949496, 0.220675995370244, 0.220809024460941, 0.220964425976945, 0.221008683870512, 0.220919701062125, 0.22089294173481, 0.220949176616655, 0.220940912550212, 0.220909643723448, 0.220873096503, 0.220922002533922, 0.220997825168621, 0.22100180264718, 0.221067453249175, 0.22102388951016, 0.221011403700056, 0.220988821510404, 0.221028340929608, 0.220965946576269, 0.220973172201268, 0.221027534158611, 0.221016672103757, 0.221019958215058, 0.221104130865256, 0.221216510402052, 0.221207730873675, 0.221230263105236, 0.221521359877835, 0.221510182239683, 0.221269292929683, 0.221280033477113, 0.221348591454748, 0.221390706287107, 0.22130635351869, 0.221319587689095, 0.221332312207507, 0.221558631098318, 0.221463042511544, 0.221555138764276, 0.221442686461275, 0.221360824631536, 0.221534930659912, 0.221543822102166, 0.221651859072522, 0.22170380924255, 0.221679007224324, 0.221767849533625, 0.221738380580738, 0.221710234314812, 0.221730355088888, 0.221727608130189, 0.221781404204836, 0.221787112540176, 0.221760261940851, 0.22175715357493, 0.221739660101365, 0.221774561834118, 0.221790143738379, 0.22178860739854, 0.221783799474442, 0.221799957941379, 0.2217704727755, 0.221795764497748, 0.221709263808821, 0.221619719206199, 0.221836449438405, 0.221779992682008, 0.221631744840436, 0.221674473942542, 0.221687766166408, 0.222061508274093, 0.222136253445234, 0.222255310462222
), .indexCLASS = c("POSIXct", "POSIXt"), .indexTZ = "", tclass = c("POSIXct", "POSIXt"), tzone = "", class = c("xts", "zoo"), .CLASS = structure("double", class = "CLASS"), formattable = structure(list(formatter = "formatC", format = structure(list(format = "f", digits = 2), .Names = c("format", "digits")), preproc = "percent_preproc", postproc = "percent_postproc"), .Names = c("formatter", "format", "preproc", "postproc")), index = structure(c(1495597500, 1495598400,
1495599300, 1495600200, 1495601100, 1495602000, 1495602900, 1495603800, 1495604700, 1495605600, 1495606500, 1495607400, 1495608300, 1495609200, 1495610100, 1495611000, 1495611900, 1495612800, 1495613700, 1495614600, 1495615500, 1495616400, 1495617300, 1495618200, 1495619100, 1495620000, 1495620900, 1495621800, 1495622700, 1495623600, 1495624500, 1495625400, 1495626300, 1495627200, 1495628100, 1495629000, 1495629900, 1495630800, 1495631700, 1495632600, 1495633500, 1495634400, 1495635300, 1495636200, 1495637100, 1495638000, 1495638900, 1495639800, 1495640700, 1495641600, 1495642500, 1495643400, 1495644300, 1495645200, 1495646100, 1495647000, 1495647900, 1495648800, 1495649700, 1495650600, 1495651500, 1495652400, 1495653300, 1495654200, 1495655100, 1495656000, 1495657800, 1495658700, 1495663200, 1495664100, 1495665000, 1495665900, 1495666800, 1495667700, 1495668600, 1495669500, 1495670400, 1495671300, 1495672200, 1495673100, 1495674000, 1495674900, 1495675800, 1495676700, 1495677600, 1495678500, 1495679400, 1495680300, 1495681200, 1495682100, 1495683000, 1495683900, 1495684800, 1495685700, 1495686600, 1495687500, 1495688400, 1495689300, 1495690200, 1495691100, 1495692000, 1495692900, 1495693800, 1495694700, 1495695600, 1495696500, 1495697400, 1495698300, 1495699200, 1495700100, 1495701000, 1495701900, 1495702800, 1495703700, 1495704600, 1495705500, 1495706400, 1495707300, 1495708200, 1495709100, 1495710000, 1495710900, 1495711800, 1495712700, 1495713600, 1495714500, 1495715400, 1495716300,
1495717200, 1495718100, 1495719000, 1495719900, 1495720800, 1495721700, 1495722600, 1495723500, 1495724400, 1495725300, 1495726200, 1495727100, 1495728000, 1495728900, 1495729800, 1495730700, 1495731600, 1495732500, 1495733400, 1495734300, 1495735200, 1495736100, 1495737000, 1495737900, 1495738800, 1495739700, 1495740600, 1495741500, 1495742400, 1495744200, 1495745100, 1495749600, 1495750500, 1495751400, 1495752300, 1495753200, 1495754100, 1495755000, 1495755900, 1495756800, 1495757700, 1495758600, 1495759500, 1495760400, 1495761300, 1495762200, 1495763100, 1495764000, 1495764900, 1495765800, 1495766700, 1495767600, 1495768500, 1495769400, 1495770300, 1495771200, 1495772100, 1495773000, 1495773900, 1495774800, 1495775700, 1495776600, 1495777500, 1495778400, 1495779300, 1495780200, 1495781100, 1495782000, 1495782900, 1495783800, 1495784700, 1495785600, 1495786500, 1495787400, 1495788300, 1495789200, 1495790100, 1495791000, 1495791900, 1495792800, 1495793700, 1495794600, 1495795500, 1495796400, 1495797300, 1495798200, 1495799100, 1495800000, 1495800900, 1495801800, 1495802700, 1495803600, 1495804500, 1495805400, 1495806300, 1495807200, 1495808100, 1495809000, 1495809900, 1495810800, 1495811700, 1495812600, 1495813500, 1495814400, 1495815300, 1495816200, 1495817100, 1495818000, 1495818900, 1495819800, 1495820700, 1495821600, 1495822500, 1495823400, 1495824300, 1495825200, 1495826100, 1495827000, 1495827900, 1495828800, 1495830600, 1495831500, 1496008800, 1496009700, 1496010600, 1496011500, 1496012400, 1496013300, 1496014200, 1496015100, 1496016000, 1496016900, 1496017800, 1496018700, 1496019600, 1496020500, 1496021400, 1496022300, 1496023200, 1496024100, 1496025000, 1496025900, 1496026800, 1496027700, 1496028600, 1496029500, 1496030400, 1496031300, 1496032200, 1496033100, 1496034000, 1496034900, 1496035800, 1496036700, 1496037600, 1496038500, 1496039400, 1496040300, 1496041200, 1496042100, 1496043000, 1496043900, 1496044800, 1496045700, 1496046600, 1496047500, 1496048400, 1496049300, 1496050200, 1496051100, 1496052000, 1496052900, 1496053800, 1496054700, 1496055600, 1496056500, 1496057400, 1496058300, 1496059200, 1496060100, 1496061000, 1496061900, 1496062800, 1496063700, 1496064600, 1496065500, 1496066400, 1496067300, 1496068200, 1496069100, 1496070000, 1496070900, 1496071800, 1496072700, 1496073600, 1496074500, 1496075400, 1496076300, 1496095200, 1496096100, 1496097000, 1496097900, 1496098800, 1496099700, 1496100600, 1496101500, 1496102400, 1496103300, 1496104200, 1496105100, 1496106000, 1496106900, 1496107800, 1496108700, 1496109600, 1496110500, 1496111400, 1496112300, 1496113200, 1496114100, 1496115000, 1496115900, 1496116800, 1496117700, 1496118600, 1496119500, 1496120400, 1496121300, 1496122200, 1496123100, 1496124000, 1496124900, 1496125800, 1496126700, 1496127600, 1496128500, 1496129400, 1496130300, 1496131200, 1496132100, 1496133000, 1496133900, 1496134800, 1496135700, 1496136600, 1496137500, 1496138400, 1496139300, 1496140200, 1496141100, 1496142000, 1496142900, 1496143800, 1496144700, 1496145600, 1496146500, 1496147400, 1496148300, 1496149200, 1496150100, 1496151000, 1496151900, 1496152800, 1496153700, 1496154600, 1496155500, 1496156400, 1496157300, 1496158200, 1496159100,
1496160000, 1496160900, 1496161800, 1496162700, 1496163600, 1496164500, 1496165400, 1496166300, 1496167200, 1496168100, 1496169000, 1496169900, 1496170800, 1496171700, 1496172600, 1496173500, 1496174400, 1496176200, 1496177100, 1496181600, 1496182500, 1496183400, 1496184300, 1496185200, 1496186100, 1496187000, 1496187900, 1496188800, 1496189700, 1496190600, 1496191500, 1496192400, 1496193300, 1496194200, 1496195100, 1496196000, 1496196900, 1496197800, 1496198700, 1496199600, 1496200500, 1496201400, 1496202300, 1496203200, 1496204100, 1496205000, 1496205900, 1496206800, 1496207700, 1496208600, 1496209500, 1496210400, 1496211300, 1496212200, 1496213100, 1496214000, 1496214900, 1496215800, 1496216700, 1496217600, 1496218500, 1496219400, 1496220300, 1496221200, 1496222100, 1496223000, 1496223900, 1496224800, 1496225700, 1496226600, 1496227500, 1496228400, 1496229300, 1496230200, 1496231100, 1496232000, 1496232900, 1496233800, 1496234700, 1496235600, 1496236500, 1496237400, 1496238300, 1496239200, 1496240100, 1496241000, 1496241900, 1496242800, 1496243700, 1496244600, 1496245500, 1496246400, 1496247300, 1496248200, 1496249100, 1496250000, 1496250900, 1496251800, 1496252700, 1496253600, 1496254500, 1496255400, 1496256300, 1496257200, 1496258100, 1496259000, 1496259900, 1496260800, 1496262600, 1496263500, 1496268000, 1496268900, 1496269800, 1496270700, 1496271600, 1496272500, 1496273400, 1496274300, 1496275200, 1496276100, 1496277000, 1496277900, 1496278800, 1496279700, 1496280600, 1496281500, 1496282400, 1496283300, 1496284200, 1496285100, 1496286000, 1496286900, 1496287800, 1496288700, 1496289600, 1496290500, 1496291400, 1496292300, 1496293200, 1496294100, 1496295000, 1496295900, 1496296800, 1496297700, 1496298600, 1496299500, 1496300400, 1496301300, 1496302200, 1496303100, 1496304000, 1496304900, 1496305800, 1496306700, 1496307600, 1496308500, 1496309400, 1496310300, 1496311200, 1496312100, 1496313000, 1496313900, 1496314800, 1496315700, 1496316600, 1496317500, 1496318400, 1496319300, 1496320200, 1496321100, 1496322000, 1496322900, 1496323800, 1496324700, 1496325600, 1496326500, 1496327400, 1496328300, 1496329200, 1496330100, 1496331000, 1496331900, 1496332800, 1496333700, 1496334600, 1496335500, 1496336400, 1496337300, 1496338200, 1496339100, 1496340000, 1496340900, 1496341800, 1496342700, 1496343600, 1496344500, 1496345400, 1496346300, 1496347200, 1496349000, 1496349900, 1496354400, 1496355300, 1496356200, 1496357100, 1496358000, 1496358900, 1496359800, 1496360700, 1496361600, 1496362500, 1496363400, 1496364300, 1496365200, 1496366100, 1496367000, 1496367900, 1496368800, 1496369700, 1496370600, 1496371500, 1496372400, 1496373300, 1496374200, 1496375100, 1496376000, 1496376900, 1496377800, 1496378700, 1496379600, 1496380500, 1496381400, 1496382300, 1496383200, 1496384100, 1496385000, 1496385900, 1496386800, 1496387700, 1496388600, 1496389500, 1496390400, 1496391300, 1496392200, 1496393100, 1496394000, 1496394900, 1496395800, 1496396700, 1496397600, 1496398500, 1496399400, 1496400300, 1496401200, 1496402100, 1496403000, 1496403900, 1496404800, 1496405700, 1496406600, 1496407500, 1496408400, 1496409300, 1496410200, 1496411100, 1496412000, 1496412900, 1496413800, 1496414700, 1496415600, 1496416500, 1496417400, 1496418300, 1496419200, 1496420100, 1496421000, 1496421900, 1496422800, 1496423700, 1496424600, 1496425500, 1496426400,
1496427300, 1496428200, 1496429100, 1496430000, 1496430900, 1496431800, 1496432700, 1496433600, 1496435400, 1496436300, 1496617200, 1496618100, 1496619000, 1496619900, 1496620800, 1496621700, 1496622600, 1496623500, 1496624400, 1496625300, 1496626200, 1496627100, 1496628000, 1496628900, 1496629800, 1496630700, 1496631600, 1496632500, 1496633400, 1496634300, 1496635200, 1496636100, 1496637000, 1496637900, 1496638800, 1496639700, 1496640600, 1496641500, 1496642400, 1496643300, 1496644200, 1496645100, 1496646000, 1496646900, 1496647800, 1496648700, 1496649600, 1496650500, 1496651400, 1496652300, 1496653200, 1496654100, 1496655000, 1496655900, 1496656800, 1496657700, 1496658600, 1496659500, 1496660400, 1496661300, 1496662200, 1496663100, 1496664000, 1496664900, 1496665800, 1496666700, 1496667600, 1496668500, 1496669400, 1496670300, 1496671200, 1496672100, 1496673000, 1496673900, 1496674800, 1496675700, 1496676600, 1496677500, 1496678400, 1496679300, 1496680200, 1496681100, 1496682000, 1496682900, 1496683800, 1496684700, 1496685600, 1496686500, 1496687400, 1496688300, 1496689200, 1496690100, 1496691000, 1496691900, 1496692800, 1496694600, 1496695500, 1496700000, 1496700900, 1496701800, 1496702700, 1496703600, 1496704500, 1496705400, 1496706300, 1496707200, 1496708100, 1496709000, 1496709900, 1496710800, 1496711700, 1496712600, 1496713500, 1496714400, 1496715300, 1496716200, 1496717100, 1496718000, 1496718900), tzone = "", tclass = c("POSIXct", "POSIXt")), .Dim = c(799L, 1L))

#Plotting with condition to remove x-axis, NOT WORKING
plot(XTS2, xaxt ="n")

Screenshot showing the unwanted x-axis:


问:
git clone all remote branches
I have a repository in github with X number of branches and a repository in a closed network.

I need to move all of the repository to the one on the closed network. How do I clone all the branches (not just the default master), so I could then push it to the closed-network one with all the branches existing.

Entering the repo binary is not the issue here.

I want the same result as if I cloned my repo and did git branch to each branch, so it would be initialized locally.

答:
If it's ok to not create the remote branch refs, and if the clone can be "bare" (no default working tree), then you can use

```<code>git clone --mirror url
</code>```

But you said you want the same result as cloning and then checking out each branch.  Taken literally, that would mean a non-bare repo that has both the remote refs and the local branches.  To do that you could do this:

First, clone normally and cd into the new clone

```<code>git clone url new-repo
cd new-repo
</code>```

Now force detached head state to ensure no "current branch" problems

```<code>git checkout `git rev-parse HEAD`
</code>```

Now get the local branches set up

```<code>git fetch origin +refs/heads/*:refs/heads/*
</code>```

And now of course you can check out whatever branch you should be on, e.g.

```<code>git checkout master
</code>```

Title: git clone all remote branches

Body:
If it's ok to not create the remote branch refs, and if the clone can be "bare" (no default working tree), then you can use

git clone --mirror url

But you said you want the same result as cloning and then checking out each branch.  Taken literally, that would mean a non-bare repo that has both the remote refs and the local branches.  To do that you could do this:

First, clone normally and cd into the new clone

git clone url new-repo
cd new-repo

Now force detached head state to ensure no "current branch" problems

git checkout `git rev-parse HEAD`

Now get the local branches set up

git fetch origin +refs/heads/*:refs/heads/*

And now of course you can check out whatever branch you should be on, e.g.

git checkout master


问:
Can an Access 2007 Macro determine the name of itself..?
Can an Access 2007 macro determine its own object name..?

My database relies heavily on Navigation Pane custom groups, some with hundreds or objects. I would like to create a generic macro that I can copy, rename, and drop into any group, which would perform actions best summarized as "do this task with every other object in this group".

To do so, the macro would need to be aware of its own name, so the MSysNavPane* groups could be queried for that name, and then the work could proceed from there.

I seem to recall that it's difficult if not impossible for VBA procedures to know their own names, but I couldn't find any information on this topic about Access macros.

答:
As far as I know, no. Macros can only execute simple commands.
Things you can do:

List all open macros (open as in currently being edited, not running)

```<code>Public Function AllMacros()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentProject
    ' Search for open AccessObject objects in AllMacros collection.
    For Each obj In dbs.AllMacros
    If obj.IsLoaded = True Then
    ' Print name of obj.
    Debug.Print obj.Name
    End If
    Next obj
End Function
</code>```

Use a form for exactly this purpose

Create a blank form with a timer set to 1, and add the following sub (it runs MyFunction and passes the form name as a parameter)

```<code>Private Sub Form_Timer()
    Me.Visible = False
    Run "MyFunction", Me.Name
    DoCmd.Close acForm, Me.Name
End Sub
</code>```

Should behave exactly as your desired macro, only it's a form not a macro

Body:
As far as I know, no. Macros can only execute simple commands.
Things you can do:

List all open macros (open as in currently being edited, not running)

Public Function AllMacros()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentProject
    ' Search for open AccessObject objects in AllMacros collection.
    For Each obj In dbs.AllMacros
    If obj.IsLoaded = True Then
    ' Print name of obj.
    Debug.Print obj.Name
    End If
    Next obj
End Function

Use a form for exactly this purpose

Create a blank form with a timer set to 1, and add the following sub (it runs MyFunction and passes the form name as a parameter)

Private Sub Form_Timer()
    Me.Visible = False
    Run "MyFunction", Me.Name
    DoCmd.Close acForm, Me.Name
End Sub

Should behave exactly as your desired macro, only it's a form not a macro


问:
Web API authorization for multiple external websites
There is a requirement to have a common web api application to service 3 different MVC web applications. These client web applications have their own databases and own authentication implementations. How do we configure the web api application to provide access to a set of APIs to web app 1 alone and deny to all other web apps, similarly for web app 2 and so on? In other words, is there a way to 'register' each web app with the web api service and also build in a mechanism through which the web app is only allowed access to a set of endpoints? Thanks for all the help..</p>

答:
There are a handful of ways of solving this

Host multiple WebAPI servers in a single process to effectively meet your requirement while making your project easier to organize

Use Authentication and Authorization filters to customize how requests are accepted, denied, and routed

Using a router and/or switch at the hardware level, create a blacklist/whitelist combined with a reverse proxy (beware of MAC spoofing, etc, with this solution)

Use dependency injection to add abstraction to the process and to remove the ability to specify a custom endpoint in an unintended manner programmatically; this solution will only work if you control the client code, however

From the sound of it, the issue you're describing doesn't seem like one regarding the visibility of the endpoints, but of the access control to leverage them. If I'm wrong, please let me know in a comment and I'll update my answer.