问:
using php to send AT commands to a mobile phone over bluetooth
I'm using windows 7 and connected my phone using bluetooth. This connection uses a virtual COM port for communication, which I've configured to specified baud rate, flow control, word length, etc. before I call my php function

```<code>
function sendmsg($str = 'AT\r\n', $device = 'COM5'){
  $handle = fopen($device, "w+b");
  stream_set_blocking($handle, 0);
  fwrite($handle, $str);
  fclose($handle);
  return true;
}
</code>```

Now the problem is fopen() throws me an error saying that it is an invalid argument and it has failed to opened stream and all else fails. But my phone says it is connected to my computer and then flashes an alert that bluetooth connection has failed. When I tried the same configuration parameters over PuTTY I was able to do what I wanted to do.
I've also tried it on C# but that too ended up with the same result :(

答: I have done something similar but in Python and it worked - Windows Vista talking with a Nokia N70 phone. The phone was paired over bluetooth and the communication it was done using a COM port created along with pairing. It was based on a open source project called pySerial</p>

Body:
I'm using windows 7 and connected my phone using bluetooth. This connection uses a virtual COM port for communication, which I've configured to specified baud rate, flow control, word length, etc. before I call my php function

function sendmsg($str = 'AT\r\n', $device = 'COM5'){
  $handle = fopen($device, "w+b");
  stream_set_blocking($handle, 0);
  fwrite($handle, $str);
  fclose($handle);
  return true;
}

Now the problem is fopen() throws me an error saying that it is an invalid argument and it has failed to opened stream and all else fails. But my phone says it is connected to my computer and then flashes an alert that bluetooth connection has failed. When I tried the same configuration parameters over PuTTY I was able to do what I wanted to do.
I've also tried it on C# but that too ended up with the same result :(


来源: stackexchange

问:
How to create a JSONObject from String in Kotlin?
I need to convert a string {\"name\":\"test name\", \"age\":25} to a JSONObject

答:
```<code>val rootObject= JSONObject()
rootObject.put("name","test name")
rootObject.put("age","25")
</code>```

ContentLicense: CC BY-SA 3.0


问:
Single PNG file for multiple icons
I have noticed that Facebook and Instagram uses the same way of displaying icons found on the site, which is to add into a single PNG file all the icons and make the styling based on their position?

Please have a look on the Instagram way of doing it.

I understand that in this way, the client will receive only a single image which will be cached and the user performance will increase. But how do they do it?

Thank you for your time!

答:
What you're looking for is Image Sprites.

The div you are displaying the image in (always as a background image) is set to overflow: hidden; while the background position changes to display the correct part of the sprite.

https://www.w3schools.com/css/css_image_sprites.asp

Title: Single PNG file for multiple icons


问:
Unexpected Subview after adding UIViewContainer
I had a single ViewController, where I had a Table View which loaded data from  a struct and all was well.   I added a segmented controller and then created 2 UIViewContainers.

I moved all of my Tableview code to UIViewContainer 1 and UIViewContainer 2 is currently empty.  I also moved the TableView in the storyboard to the new UIViewContainer 1

in the code velow UIViewcontainer 1 = tableContainer
UIViewController 2 = mapContainer

I have added the code for the segmented view controller as such:

```<code>@IBOutlet weak var mapContainer: UIView!
@IBOutlet weak var tableContainer: UIView!

@IBAction func showContainer(_ sender: UISegmentedControl) {
    if sender.selectedSegmentIndex == 0 {
        UIView.animate(withDuration: 0.5, animations: {
            self.tableContainer.alpha = 1
            self.mapContainer.alpha = 0
        })

    }else {
        UIView.animate(withDuration: 0.5, animations: {
            self.tableContainer.alpha = 0
            self.mapContainer.alpha = 1
        })
    }

}
</code>```

This is more or less the only code in my main View Controller.

When I run, the compile works fine but crashes at load with the following error:

```<code>*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'There are unexpected
subviews in the container view. Perhaps the embed segue has already
fired once or a subview was added programmatically?'
***
</code>```

Have I missed something that I need to do to the tableView or views in general?

答: The problem for me was that I accidentally executed segue.perform() in prepare(for:sender:). Once I removed that line, the error disappeared.

Body:
I had a single ViewController, where I had a Table View which loaded data from  a struct and all was well.   I added a segmented controller and then created 2 UIViewContainers.

I moved all of my Tableview code to UIViewContainer 1 and UIViewContainer 2 is currently empty.  I also moved the TableView in the storyboard to the new UIViewContainer 1

in the code velow UIViewcontainer 1 = tableContainer
UIViewController 2 = mapContainer

I have added the code for the segmented view controller as such:

@IBOutlet weak var mapContainer: UIView!
@IBOutlet weak var tableContainer: UIView!

@IBAction func showContainer(_ sender: UISegmentedControl) {
    if sender.selectedSegmentIndex == 0 {
        UIView.animate(withDuration: 0.5, animations: {
            self.tableContainer.alpha = 1
            self.mapContainer.alpha = 0
        })

    }else {
        UIView.animate(withDuration: 0.5, animations: {
            self.tableContainer.alpha = 0
            self.mapContainer.alpha = 1
        })
    }

}

This is more or less the only code in my main View Controller.

When I run, the compile works fine but crashes at load with the following error:

*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'There are unexpected
subviews in the container view. Perhaps the embed segue has already
fired once or a subview was added programmatically?'
***

Have I missed something that I need to do to the tableView or views in general?


问:
How to transfer the control from one part of the main to another part of the main in java?
I was writing a program which required me to display a set of statements to the

user then ask him whether he would like to return to the main screen.

But since I was using a case I could not transfer control back to the code before it.I want to know how I can do it.Here's the code:

```<code>    import java.io.*;
    public class main
    {
       public static void main() throws IOException
       {
            InputStreamReader isr=new InputStreamReader(System.in);
            BufferedReader br=new BufferedReader(isr);
            System.out.println("START");
            int ch=Integer.parseInt(br.readLine());
            switch(ch)
            {
                 case 1:System.out.println("HI");
                        break;
                       /*I want a way to transfer the control from the case
                         such that it is transferred to
                         the print statement START.*/

            }
       }
    }
</code>```

答:
You should use loop, so that control will be again at first System.out.println(), if ch == 1.

```<code>import java.io.*;
public class main
{
   public static void main() throws IOException
   {
        InputStreamReader isr=new InputStreamReader(System.in);
        BufferedReader br=new BufferedReader(isr);
        int ch;
        do {
            System.out.println("START");
            int ch=Integer.parseInt(br.readLine());
            switch(ch)
            {
                 case 1:System.out.println("HI");
                        break;
            }
       } while (ch == 1);
    }
}
</code>```

Body:
I was writing a program which required me to display a set of statements to the

user then ask him whether he would like to return to the main screen.

But since I was using a case I could not transfer control back to the code before it.I want to know how I can do it.Here's the code:

    import java.io.*;
    public class main
    {
       public static void main() throws IOException
       {
            InputStreamReader isr=new InputStreamReader(System.in);
            BufferedReader br=new BufferedReader(isr);
            System.out.println("START");
            int ch=Integer.parseInt(br.readLine());
            switch(ch)
            {
                 case 1:System.out.println("HI");
                        break;
                       /*I want a way to transfer the control from the case
                         such that it is transferred to
                         the print statement START.*/

            }
       }
    }

Body:
You should use loop, so that control will be again at first System.out.println(), if ch == 1.

import java.io.*;
public class main
{
   public static void main() throws IOException
   {
        InputStreamReader isr=new InputStreamReader(System.in);
        BufferedReader br=new BufferedReader(isr);
        int ch;
        do {
            System.out.println("START");
            int ch=Integer.parseInt(br.readLine());
            switch(ch)
            {
                 case 1:System.out.println("HI");
                        break;
            }
       } while (ch == 1);
    }
}


问:
Visual Studio - Some breakpoints not breaking
I have a solution in Visual Studio 2010 with 9 projects which is under source control with Source Safe. I just recently swiped my hard-drive and upgraded to Win7 x64 from WinXP x86 (long overdue!). When I checked the solution out to the "new" machine, some parts are not working correctly now, so I'm trying to debug it.

Perhaps worth noting is that I was working in VS2008 before. When I upgraded, I first opened the project in VS2008 to make sure it worked and I noticed there were problems that I needed to debug. I set some breakpoints and a couple worked and a couple didn't. I couldn't immediately figure out why some weren't breaking, so I decided to go ahead and upgrade the project to VS2010 hoping it would work itself out. It didn't.

The main project calls a public sub in a public module in a project that is a library referenced by every other project. I have a breakpoint on the main form Form_Load which breaks successfully as soon as the code begins running. The Form_Load calls the aforementioned public sub which also has a breakpoint. But that breakpoint DOES NOT break. In other words, the debugger will stop on the call ProjectStartupActions() but will not stop on the definition Public Sub ProjectStartupActions() or any line in it.

If I "Go To Definition" on the sub call in Form_Load, it jumps to the correct place where I have the breakpoint, so I'm certain I've placed the breakpoint correctly.

My Project >> Debug >> Configuration is set to "Active (Debug)" and Platform is "Active (Any CPU)" for all projects. To further confirm that it should be running in Debug rather than Release, if I open an explorer window to the "Debug" folder for the library project and clean the project, the folder empties out. When I rebuild or run the files are all replaced.

Thanks for any help.

Oh yeah, also I made a change to the code of Public Sub ProjectStartupActions(). I added MsgBox("Hello") to the first line in the sub, but it never pops up.

答:
Oh yeah, also I made a change to the code of Public Sub ProjectStartupActions(). I added MsgBox("Hello") to the first line in the sub, but it never pops up.

Sounds like your project dependencies aren't correct.  Make sure that the main form project  is dependent on the library project that has the ProjectStartupActions() function (and not dependent on some already built library assembly).

This should make it so VS will rebuild the library assembly when necessary and refer to the newly built assembly.

You might need to do a full clean/rebuild to get things sync'ed up again as well. You might also need to check and update any deployment projects/scripts that you might have.

ContentLicense: CC BY-SA 2.5


问:
laravel how yo include on menu button click in the samepage
I have menu on the right and want to display when click on specific item button specific page so how can I make include if only I clicked on this item button</p>

```<code><a href="{{route('customer.package')}}">
    <i class="icon-shopping-cart"></i>
    <span>Update Your Package</span>
</a>
@include('index.customer.customerpackage')
</code>```

答:
You could use the jquery for this. like as:</p>

```<code><a class="custom-menu" href="{{route('customer.package')}}" style="display:none;">
                      <i class="icon-shopping-cart"></i>
                      <span>Update Your Package</span>
                  </a>
<button id="button">Click</button>
<javascript>$(document).ready(function(){$('#button').click(function(){
$('.custom-menu').show();
});})</javascript>
</code>```

Body:
I have menu on the right and want to display when click on specific item button specific page so how can I make include if only I clicked on this item button

    Update Your Package

@include('index.customer.customerpackage')

Body:
You could use the jquery for this. like as:

<a class="custom-menu" href="{{route('customer.package')}}" style="display:none;">
                      <i class="icon-shopping-cart"></i>
                      <span>Update Your Package</span>
                  </a>
<button id="button">Click</button>
<javascript>$(document).ready(function(){$('#button').click(function(){
$('.custom-menu').show();
});})</javascript>


问:
Spring Boot REST Controller returns 404 when deployed on external tomcat 9 server
I have a spring boot rest web application which works perfectly on the embedded server. However after following the steps mentioned in the is blog https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file, I got a 404 error message whan I send a resquest to a resource on the server.I have used java 1.8.0_212 locally and used java 1.8.0_131 and deployed my app on tomcat 9 on the server. One thing that's puzzling me is that the repositories which extends CrudRepository can be accessed. Below is my application's entry point.

```<code>@SpringBootApplication
@ComponentScan(basePackages = "com.dbe.ref")
public class RefmsApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(RefmsApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(RefmsApplication.class, args);
    }
</code>```

and also my pom.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.dbe.ref</groupId>
    <artifactId>refms</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>refms</name>
    <description>project for Rural electrification fund</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>LATEST</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <start-class>com.RefmsApplication</start-class>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>2.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>angularjs</artifactId>
            <version>1.4.10</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.4</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>font-awesome</artifactId>
            <version>4.7.0</version>
        </dependency>
        <dependency>
            <groupId>eu.michael-simons</groupId>
            <artifactId>wro4j-spring-boot-starter</artifactId>
            <version>0.3.4</version>
        </dependency>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.14</version>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.dynamicreports</groupId>
            <artifactId>dynamicreports-core</artifactId>
            <version>5.0.0</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>refms</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
</code>```

Here is part of the log:

```<code>2017-09-19 10:38:20.564  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'errorPageFilter' to: [/*]
2017-09-19 10:38:20.565  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-09-19 10:38:20.566  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-09-19 10:38:20.568  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-09-19 10:38:20.568  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-09-19 10:38:20.571  INFO 6660 --- [           main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-09-19 10:38:20.571  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'configurableWroFilter' to urls: [/wro4j/*]
2017-09-19 10:38:20.572  INFO 6660 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServletRegistration' to [/refms/*]
2017-09-19 10:38:20.573  INFO 6660 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
</code>```

答:
When you deploy your application into Tomcat the URL depends on the context path under which your application gets deployed. Most of the time this is an exact match with the name of the war file which you put into the Tomcat 'webapps' directory. You can see the name by looking at your 'webapps' directory. Your war file is probably also expended into a directory by now.

Since you've put a finalName into your maven build section, your war file should be named: refms.war, so your application will run under:

http://host:port/refms/

My assumption is that you did not rename the war file to ROOT.war before you copied it into tomcat, so your application will not be running on:

http://host:port/

If you would do so your application will run similar to the embedded Tomcat instance; on the root context.

From your log file I can see that your authentication endpoint is mapped on /refms/

```<code>Mapping servlet: 'dispatcherServletRegistration' to [/refms/*]
</code>```

This is relative to the context root of your application.
So in case you did not rename your war file, the authentication endpoint on which you receive a 404 is probably going to be under:

```<code>http://localhost:8080/refms/refms/api/account/authenticate
</code>```

Body:
I have a spring boot rest web application which works perfectly on the embedded server. However after following the steps mentioned in the is blog https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file, I got a 404 error message whan I send a resquest to a resource on the server.I have used java 1.8.0_212 locally and used java 1.8.0_131 and deployed my app on tomcat 9 on the server. One thing that's puzzling me is that the repositories which extends CrudRepository can be accessed. Below is my application's entry point.

@SpringBootApplication
@ComponentScan(basePackages = "com.dbe.ref")
public class RefmsApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(RefmsApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(RefmsApplication.class, args);
    }

and also my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.dbe.ref</groupId>
    <artifactId>refms</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>refms</name>
    <description>project for Rural electrification fund</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>LATEST</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <start-class>com.RefmsApplication</start-class>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>2.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>angularjs</artifactId>
            <version>1.4.10</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.4</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>font-awesome</artifactId>
            <version>4.7.0</version>
        </dependency>
        <dependency>
            <groupId>eu.michael-simons</groupId>
            <artifactId>wro4j-spring-boot-starter</artifactId>
            <version>0.3.4</version>
        </dependency>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.14</version>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.dynamicreports</groupId>
            <artifactId>dynamicreports-core</artifactId>
            <version>5.0.0</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>refms</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Here is part of the log:

2017-09-19 10:38:20.564  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'errorPageFilter' to: [/*]
2017-09-19 10:38:20.565  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-09-19 10:38:20.566  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-09-19 10:38:20.568  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-09-19 10:38:20.568  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-09-19 10:38:20.571  INFO 6660 --- [           main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-09-19 10:38:20.571  INFO 6660 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'configurableWroFilter' to urls: [/wro4j/*]
2017-09-19 10:38:20.572  INFO 6660 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServletRegistration' to [/refms/*]
2017-09-19 10:38:20.573  INFO 6660 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]

Body:
When you deploy your application into Tomcat the URL depends on the context path under which your application gets deployed. Most of the time this is an exact match with the name of the war file which you put into the Tomcat 'webapps' directory. You can see the name by looking at your 'webapps' directory. Your war file is probably also expended into a directory by now.

Since you've put a finalName into your maven build section, your war file should be named: refms.war, so your application will run under:

http://host:port/refms/

My assumption is that you did not rename the war file to ROOT.war before you copied it into tomcat, so your application will not be running on:

http://host:port/

If you would do so your application will run similar to the embedded Tomcat instance; on the root context.

From your log file I can see that your authentication endpoint is mapped on /refms/

Mapping servlet: 'dispatcherServletRegistration' to [/refms/*]

This is relative to the context root of your application.
So in case you did not rename your war file, the authentication endpoint on which you receive a 404 is probably going to be under:

http://localhost:8080/refms/refms/api/account/authenticate


答:
They do it by making a div or span or whatever, with a background of that image and then change the background position.

Example

```<code>.icons {
  height:20px;
  width: 20px;
  background-image: url("path/to/image");
}

.icon1{
  background-position: 0 0
}

.icon2{
  background-position: 30px 0
}
</code>```

JSFiddle: https://jsfiddle.net/qxjyycv2/

Title: Single PNG file for multiple icons

Body:
I have noticed that Facebook and Instagram uses the same way of displaying icons found on the site, which is to add into a single PNG file all the icons and make the styling based on their position?

Please have a look on the Instagram way of doing it.

I understand that in this way, the client will receive only a single image which will be cached and the user performance will increase. But how do they do it?

Thank you for your time!

Body:
They do it by making a div or span or whatever, with a background of that image and then change the background position.

Example

.icons {
  height:20px;
  width: 20px;
  background-image: url("path/to/image");
}

.icon1{
  background-position: 0 0
}

.icon2{
  background-position: 30px 0
}

JSFiddle: https://jsfiddle.net/qxjyycv2/


问:
Shopify App proxy showing "502 Bad Gateway" issue
I am trying to set shopify app proxy url. Although It was working fine before few days back but suddenly I am getting error "502 Bad Gateway".On the store page, it is showing message "There was an error in the third-party application". I also tried to test with different servers and have used both one by one "http" and "https" but I am getting same kind of error in all cases. Please suggest how to set shopify proxy url from shopify developer account. Below are test links:

https://dummy.sdnadev.com/test.html

And I tried to set proxy as :

http://dee1-11.myshopify.com/apps/PG-2C2P

Thanks

答: Bad Gateway error in shopify is often caused when doing large POST or PUT that take longer than 90 seconds.


问:
I use jquery blinking functionality to parent div.but that effects chaild div.please help how to solve
I am using multiple div tags.for the parent div I used jquery blinking functionality.but that effecting my chaild div tags.
I want to blink only parent div.please help me.

Here is the screenshot

答:
fadeOut() and fadeIn() methods from jQuery change opacity.

Whenever you change the opacity of an element, you change the opacity of all its children.

This means that a child with opacity:0.5 placed inside a parent with opacity:0.5 will be rendered exactly as one with opacity:0.25 placed inside a parent with opacity:1.

There is no way around that, except making its children no longer be its children: Put content into a non-blinking container and the blinking part into a blinking container and make them children of the same parent with position:relative;. One of them needs to have position:absolute (normally the blinking one, but it depends on context).

Here's an example:

function blink(selector) {
  $(selector).fadeOut(2000, function(){
    $(this).fadeIn(2000, function(){
      blink(this)
    })
  })
}
blink($('child[blinking]'));```
<pre class="snippet-code-css lang-css prettyprint-override"><code>parent, child {
  position: relative;
  display: block;
  box-sizing: border-box;
}

child[blinking] {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background-color: lightgray;
}

child {
  padding: 2rem;
}</code>```

<parent>
  <child blinking></child>
  <child>
    Place the non-blinking content into a sibling of the blinking element and absolute-position one of them (usually the blinking one).
  </child>
</parent>```

Body:
fadeOut() and fadeIn() methods from jQuery change opacity.

Whenever you change the opacity of an element, you change the opacity of all its children.

This means that a child with opacity:0.5 placed inside a parent with opacity:0.5 will be rendered exactly as one with opacity:0.25 placed inside a parent with opacity:1.

There is no way around that, except making its children no longer be its children: Put content into a non-blinking container and the blinking part into a blinking container and make them children of the same parent with position:relative;. One of them needs to have position:absolute (normally the blinking one, but it depends on context).

Here's an example:

function blink(selector) {
  $(selector).fadeOut(2000, function(){
    $(this).fadeIn(2000, function(){
      blink(this)
    })
  })
}
blink($('child[blinking]'));

parent, child {
  position: relative;
  display: block;
  box-sizing: border-box;
}

child[blinking] {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background-color: lightgray;
}

child {
  padding: 2rem;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<parent>
  <child blinking></child>
  <child>
    Place the non-blinking content into a sibling of the blinking element and absolute-position one of them (usually the blinking one).
  </child>
</parent>


问:
Obtain all filenames in a directory using vim
This is the algorithm of the code:

```<code>for every *file* in a directory
  nnoremap ,*file* <C-o>:read $HOME/*file*
end
</code>```

So the problem is, I don't know how to code the "for every file in a directory".

PS: I am new to vim and I don't know if it's possible

答:
You're looking for glob() function. -> glob($HOME.'/*')

I'm not sure this is a good idea, but hey, who am I to judge? :)

Body:
This is the algorithm of the code:

for every *file* in a directory
  nnoremap ,*file* <C-o>:read $HOME/*file*
end

So the problem is, I don't know how to code the "for every file in a directory".

PS: I am new to vim and I don't know if it's possible


问:
I am using tess-two for image to text conversion
i try to take photo from gallery and stored in viewImage and change to text, its loading for a long time and prompting not responding, if i tried with small size jpg file its converting.

```<code>`findViewById(R.id.gallery).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent photoPickerIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                photoPickerIntent.setType("image/*");
                startActivityForResult(photoPickerIntent, REQUEST_GALLERY);
            }
        });`

for calling gallery
`String language = "eng";
        datapath = getFilesDir()+ "/tesseract";
        mTess = new TessBaseAPI();
        checkFile(new File(datapath + "/tessdata/"));
        mTess.init(datapath, language);`
</code>```

for initialize Tesseract API

```<code>`Uri selectedImage = data.getData();
                    String[] filePathColumn = {MediaStore.Images.Media.DATA};
                    System.out.println("image:" +selectedImage);
                    Cursor cursor = getContentResolver().query(selectedImage,
                            filePathColumn, null, null, null);
                    cursor.moveToFirst();
                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    String picturePath = cursor.getString(columnIndex);
                    Log.d("Thisbuddy",picturePath);
                    photo = BitmapFactory.decodeFile(picturePath);
                    cursor.close();
                  imageV.setImageBitmap(BitmapFactory.decodeFile(picturePath));`
</code>```

for calling function after taking from gallery and kept in viewImage

```<code>`public void processImage(View view){
        String OCRresult = null;
        mTess.setImage(photo);
        OCRresult = mTess.getUTF8Text();
        TextView OCRTextView = (TextView) findViewById(R.id.OCRTextView);
        OCRTextView.setText(OCRresult);
    }
private void checkFile(File dir) {
        if (!dir.exists()&& dir.mkdirs()){
            copyFiles();
        }
        if(dir.exists()) {
            String datafilepath = datapath+ "/tessdata/eng.traineddata";
            File datafile = new File(datafilepath);
        if (!datafile.exists()) {
                copyFiles();
            }
        }
     }
private void copyFiles() {
        try {
            String filepath = datapath + "/tessdata/eng.traineddata";
            AssetManager assetManager = getAssets();
           InputStream instream = assetManager.open("tessdata/eng.traineddata");
            OutputStream outstream = new FileOutputStream(filepath);
            byte[] buffer = new byte[1024];
            int read;
            while ((read = instream.read(buffer)) != -1) {
                outstream.write(buffer, 0, read);
            }
            outstream.flush();
            outstream.close();
            instream.close();
            File file = new File(filepath);
            if (!file.exists()) {
                throw new FileNotFoundException();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }`
</code>```

答:
i am came with a solution,
i just shrink the image using bitmaps

```<code>`  float ratio = Math.min(
                        (float) maxImageSize / photo.getWidth(),
                        (float) maxImageSize / photo.getHeight());
                int width = Math.round((float) ratio * photo.getWidth());
                int height = Math.round((float) ratio * photo.getHeight());

                Bitmap newBitmap = Bitmap.createScaledBitmap(photo, width,
                        height, filter);`
</code>```

Now its working fine for me.

Body:
i try to take photo from gallery and stored in viewImage and change to text, its loading for a long time and prompting not responding, if i tried with small size jpg file its converting.

`findViewById(R.id.gallery).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent photoPickerIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                photoPickerIntent.setType("image/*");
                startActivityForResult(photoPickerIntent, REQUEST_GALLERY);
            }
        });`

for calling gallery
`String language = "eng";
        datapath = getFilesDir()+ "/tesseract";
        mTess = new TessBaseAPI();
        checkFile(new File(datapath + "/tessdata/"));
        mTess.init(datapath, language);`

for initialize Tesseract API

`Uri selectedImage = data.getData();
                    String[] filePathColumn = {MediaStore.Images.Media.DATA};
                    System.out.println("image:" +selectedImage);
                    Cursor cursor = getContentResolver().query(selectedImage,
                            filePathColumn, null, null, null);
                    cursor.moveToFirst();
                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    String picturePath = cursor.getString(columnIndex);
                    Log.d("Thisbuddy",picturePath);
                    photo = BitmapFactory.decodeFile(picturePath);
                    cursor.close();
                  imageV.setImageBitmap(BitmapFactory.decodeFile(picturePath));`

for calling function after taking from gallery and kept in viewImage

`public void processImage(View view){
        String OCRresult = null;
        mTess.setImage(photo);
        OCRresult = mTess.getUTF8Text();
        TextView OCRTextView = (TextView) findViewById(R.id.OCRTextView);
        OCRTextView.setText(OCRresult);
    }
private void checkFile(File dir) {
        if (!dir.exists()&& dir.mkdirs()){
            copyFiles();
        }
        if(dir.exists()) {
            String datafilepath = datapath+ "/tessdata/eng.traineddata";
            File datafile = new File(datafilepath);
        if (!datafile.exists()) {
                copyFiles();
            }
        }
     }
private void copyFiles() {
        try {
            String filepath = datapath + "/tessdata/eng.traineddata";
            AssetManager assetManager = getAssets();
           InputStream instream = assetManager.open("tessdata/eng.traineddata");
            OutputStream outstream = new FileOutputStream(filepath);
            byte[] buffer = new byte[1024];
            int read;
            while ((read = instream.read(buffer)) != -1) {
                outstream.write(buffer, 0, read);
            }
            outstream.flush();
            outstream.close();
            instream.close();
            File file = new File(filepath);
            if (!file.exists()) {
                throw new FileNotFoundException();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }`

Body:
i am came with a solution,
i just shrink the image using bitmaps

`  float ratio = Math.min(
                        (float) maxImageSize / photo.getWidth(),
                        (float) maxImageSize / photo.getHeight());
                int width = Math.round((float) ratio * photo.getWidth());
                int height = Math.round((float) ratio * photo.getHeight());

                Bitmap newBitmap = Bitmap.createScaledBitmap(photo, width,
                        height, filter);`

Now its working fine for me.


问:
Unexpected exception during symbol building (rebuildModuleMaps)
I got a NullPointerException Error while building gradle in android studio, it was fine before, so the error kinda surprise the full error is

```<code>NullPointerException: Unexpected exception during symbol building (rebuildModuleMaps)
</code>```

followed by another NullPointerException

```<code>Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

NullPointerException: null
</code>```

So what went missing exactly ?

Just to make things little bit clearer here is my list of disabled plugin

答:
It appears that this error is due to Android NDK support being disabled. Re-enabling NDK support fixed this issue for me.

To re-enable Android NDK support, go to Settings > Plugins and enable the Android NDK Support and NDK WorkspaceManager Support plugins.

Body:
I got a NullPointerException Error while building gradle in android studio, it was fine before, so the error kinda surprise the full error is

NullPointerException: Unexpected exception during symbol building (rebuildModuleMaps)

followed by another NullPointerException

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

NullPointerException: null

So what went missing exactly ?

Just to make things little bit clearer here is my list of disabled plugin


问:
Add dynamic values for ID, href and aria-controls using Jquery
I want to add the dynamic values for the attributes(href, id, aria-controls), so that i can toggle down the text in multiple places for a single page. Just for your reference i have added "href="#0_read_more", aria-controls="0_read_more", id="0_read_more" in three places in the provided sample code. As well i have increment the values for other two div sections like given in the sample html code. Kindly help me out on this..

Thanks in advance.

                  Read More

                  Read More

                  Read More

```

答:
You can set attribute for any DOM element using Jquery as follows,

```<code><script>
function setAttributesDynamically(){

  $("SELECTOR").attr("href", "YOUR_URL"); // selector may be Id, class, tagname etc.
  $("SELECTOR").attr("id", "YOUR_ID");
  $("SELECTOR").addClass("CLASS_NAME");

}

</script>
</code>```

Call setAttributesDynamically() wherever you want.

Body:
You can set attribute for any DOM element using Jquery as follows,

<script>
function setAttributesDynamically(){

  $("SELECTOR").attr("href", "YOUR_URL"); // selector may be Id, class, tagname etc.
  $("SELECTOR").attr("id", "YOUR_ID");
  $("SELECTOR").addClass("CLASS_NAME");

}

</script>

Call setAttributesDynamically() wherever you want.


问:
Random space being added inside gallery. It's not padding?
Working on this gallery I can't figure out why it is adding the extra space on the right side on the inside of the gallery.  The blue border is just there to show the gallery window and will eventually be taken away. This is all I have in the gallery css.

.gallery {
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  margin: 0 auto;
  border: 2px solid blue;
}
```

<p>Fiddle: https://jsfiddle.net/3crrxdax/5/       Thanks.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
  box-sizing: border-box;
  font-family: Georgia, Arial, sans-serif;
}

html {
  background-color: #FFFF20;
}

body {
  background-color: #FFFF20;
  height: 100%;
}

#wrapper {
  width: 1500px;
  height: 100%;
  margin: auto;
  background-color: #233237;
  color: #FFFF20;
  box-shadow: 5px 5px 5px #000000;
}

header {
  color: #FFFF20;
  font: Georgia, serif;
  text-align: center;
}

h1 {
  background-image: url(ebaylogo.png);
  background-repeat: no-repeat;
  background-position: right;
  height: 72px;
  background-size: 120px;
  line-height: 200%;
  margin-bottom: 0;
}

h3 {
  text-align: center;
  padding-top: 50px;
  padding-bottom: 5px;
}

h3,
.smallp {
  margin: 0;
}

nav {
  text-align: center;
  font-weight: bold;
}

nav a {
  text-decoration: none;
  color: #FFFF20;
}

nav ul li {
  list-style-type: none;
  display: inline;
  margin-right: 30px;
  padding: 2px;
  border: 2px solid #FFFF20;
}

footer {
  padding-top: 50px;
  font-size: .70em;
  font-style: italic;
  text-align: center;
  color: #FFFF20;
  margin: auto;
  text-align: center;
}

footer a {
  color: #FFFF20;
}

main {
  padding: 0px 20px 0px 20px;
  display: block;
}

.unorderedlist {
  display: flex;
  display: -ms-flexbox;
  flex-wrap: wrap;
  -ms-flex-pack: justify;
  border: 1px blue solid;
  justify-content: space-between;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  padding-left: 0px;
  list-style-type: none;
  margin: 100px auto;
  width: 60%;
  height: 100%;
  text-align: center;
}

.list {
  padding-bottom: 50px;
  background-color: #18121E;
  width: 220px;
  height: 375px;
  box-shadow: 5px 5px 5px;
  margin-bottom: 25px;
}

.list a {
  text-decoration: none;
  color: #FFFF20;
}

.smallp {
  color: #FFFF20;
  width: 300px;
}

.smallp2 {
  width: 300px;
}

.secondh3 {
  text-align: center;
  margin-bottom: -15px;
}

.pawnstarimg {
  margin-top: 50px;
  border: 2px solid #FFFF20;
}

.peaceimg {
  border: 2px solid #FFFF20;
  order: 4;
  -ms-flex-order: 4;
}

.malebox a {
  color: #FFFF20;
}

.femalebox a {
  color: #FFFF20;
}

a:hover {
  color: #0000FF;
}

/** a:visited{
 color:#000000;
Able to check a:hover without clearing cache
}**/

a:active {
  color: #00FF00;
}

.test {
  display: flex;
  display: -ms-flexbox;
  flex-wrap: wrap;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  width: 60%;
  margin: auto;
  justify-content: space-around;
  -ms-flex-pack: justify;
}

.testbox2 {
  display: flex;
  display: -ms-flexbox;
  flex-direction: column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.testbox3 {
  display: flex;
  display: -ms-flexbox;
  flex-direction: column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.gallery {
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  margin: 0 auto;
  border: 2px solid blue;
}

.gallery>div {
  padding: 5px;
}

.gallery>div>img {
  display: block;
  transition: .3s transform;
}

.gallery>div:hover {
  z-index: 1;
}

.gallery>div:hover>a>img {
  transform: scale(2.5, 2.5);
  transition: .2s transform;
}

.cf:before,
.cf:after {
  display: table;
  content: "";
  line-height: 0;
}</code>```

CDC Shop

 Home

 Shirts

 Pants

 Jackets

 Shoes

 Contact

      href="angels2.jpg">

    Copyright © 2017 CDCShop

    href="christian@gmail.com">...@gmail.com

```

答:
Remove width: 1500px; and update to make it to good look

* { box-sizing: border-box;
font-family: Georgia, Arial, sans-serif;
}

html{

 background-color:#FFFF20;

}

body{

 background-color:#FFFF20;
 height:100%;
}

#wrapper { //width: 1500px;
     height:100%;
           margin: auto;
     background-color: #233237;
     color: #FFFF20;
     box-shadow: 5px 5px 5px #000000;
}

header{

 color: #FFFF20;
 font: Georgia, serif;
 text-align: center;

}

h1{
 background-image: url(ebaylogo.png);
 background-repeat: no-repeat;
 background-position: right;
 height: 72px;
 background-size: 120px;
 line-height: 200%;
 margin-bottom: 0;

}

h3{
 text-align:center;
 padding-top:50px;
 padding-bottom:5px;
}

h3, .smallp{
margin:0;
}

nav{
 text-align: center;
 font-weight: bold;

}

nav a{
 text-decoration: none;
 color:#FFFF20;
}

nav ul li {
  list-style-type: none;
  margin: 10px 11px;
  padding: 2px;
  border: 2px solid #FFFF20;
  width: fit-content;
  float: left;
}

footer{
 padding-top: 50px;
 font-size: .70em;
 font-style: italic;
 text-align: center;
 color: #FFFF20;
 margin:auto;
 text-align:center;

}
footer a{
 color: #FFFF20;
}

main{
 padding: 0px 20px 0px 20px;
 display: block;
}

.unorderedlist{
 display: flex;
 display:-ms-flexbox;
 flex-wrap:wrap;
 -ms-flex-pack: justify;
 border: 1px blue solid;
 justify-content: space-between;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
 padding-left:0px;
 list-style-type: none;
 margin: 100px auto;
 width:60%;
 height:100%;
 text-align:center;

}

.list{
 padding-bottom: 50px;
 background-color: #18121E;
 width:220px;
 height:375px;
 box-shadow: 5px 5px 5px;
 margin-bottom:25px;
}

.list a{
 text-decoration:none;
 color:#FFFF20;
}

.smallp{
 color: #FFFF20;
 width:300px;
}

.smallp2{
 width:300px;
}

.secondh3{
 text-align:center;
 margin-bottom:-15px;

}

.pawnstarimg{
 margin-top:50px;
 border: 2px solid #FFFF20;

}

.peaceimg{
 border: 2px solid #FFFF20;
order:4;
 -ms-flex-order: 4;
}

.malebox a {
 color:#FFFF20;
}

.femalebox a {
 color:#FFFF20;
}

a:hover{
 color: #0000FF;
}

/** a:visited{
 color:#000000;
Able to check a:hover without clearing cache
}**/

a:active {
    color: #00FF00;
}
.test{
  display:flex;
  display:-ms-flexbox;
  flex-wrap:wrap;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  width:60%;
  margin:auto;
  justify-content:space-around;
-ms-flex-pack: justify;
}

.testbox2{
  display:flex;
  display:-ms-flexbox;
  flex-direction:column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  }

.testbox3{
  display:flex;
  display:-ms-flexbox;
  flex-direction:column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.gallery {
 display:-ms-flexbox;
 display:flex;
 justify-content:space-between;
 -webkit-justify-content: space-around;
 -ms-flex-pack: justify;
 margin:0 auto;
 border:2px solid blue;
  clear: both;

}

.gallery > div {

  padding:5px;
}

.gallery > div > img {

  display: block;
  transition: .3s transform;

}

.gallery > div:hover {
  z-index: 1;
}

.gallery > div:hover > a > img {
  transform: scale(2.5,2.5);
  transition: .2s transform;
}

.cf:before, .cf:after {
  display: table;
  content: "";
  line-height: 0;

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!Doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <title>CDC Shop</title>
 <link rel="stylesheet" type="text/css" href="../test3.css">
</head>

<body>
<main id="wrapper">
<header>
  <h1>CDC Shop</h1>
</header>

<nav>
 <ul>
    <li> Home</li>
   <li> Shirts</li>
      <li> Pants</li>
   <li> Jackets</li>
   <li> Shoes</li>
   <li> Contact</li>
</ul>
</nav>

<div class="gallery">
  <div>
  <img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" />
  </div>
  <div>
  <img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" />
  </div>
</div>

<footer>
 Copyright © 2017 CDCShop <br>
  ccoburn713@gmail.com
</footer>
</main>
</body>
</html></code>```

Body:
Working on this gallery I can't figure out why it is adding the extra space on the right side on the inside of the gallery.  The blue border is just there to show the gallery window and will eventually be taken away. This is all I have in the gallery css.

.gallery {
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  margin: 0 auto;
  border: 2px solid blue;
}

Fiddle: https://jsfiddle.net/3crrxdax/5/       Thanks.

* {
  box-sizing: border-box;
  font-family: Georgia, Arial, sans-serif;
}

html {
  background-color: #FFFF20;
}

body {
  background-color: #FFFF20;
  height: 100%;
}

#wrapper {
  width: 1500px;
  height: 100%;
  margin: auto;
  background-color: #233237;
  color: #FFFF20;
  box-shadow: 5px 5px 5px #000000;
}

header {
  color: #FFFF20;
  font: Georgia, serif;
  text-align: center;
}

h1 {
  background-image: url(ebaylogo.png);
  background-repeat: no-repeat;
  background-position: right;
  height: 72px;
  background-size: 120px;
  line-height: 200%;
  margin-bottom: 0;
}

h3 {
  text-align: center;
  padding-top: 50px;
  padding-bottom: 5px;
}

h3,
.smallp {
  margin: 0;
}

nav {
  text-align: center;
  font-weight: bold;
}

nav a {
  text-decoration: none;
  color: #FFFF20;
}

nav ul li {
  list-style-type: none;
  display: inline;
  margin-right: 30px;
  padding: 2px;
  border: 2px solid #FFFF20;
}

footer {
  padding-top: 50px;
  font-size: .70em;
  font-style: italic;
  text-align: center;
  color: #FFFF20;
  margin: auto;
  text-align: center;
}

footer a {
  color: #FFFF20;
}

main {
  padding: 0px 20px 0px 20px;
  display: block;
}

.unorderedlist {
  display: flex;
  display: -ms-flexbox;
  flex-wrap: wrap;
  -ms-flex-pack: justify;
  border: 1px blue solid;
  justify-content: space-between;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  padding-left: 0px;
  list-style-type: none;
  margin: 100px auto;
  width: 60%;
  height: 100%;
  text-align: center;
}

.list {
  padding-bottom: 50px;
  background-color: #18121E;
  width: 220px;
  height: 375px;
  box-shadow: 5px 5px 5px;
  margin-bottom: 25px;
}

.list a {
  text-decoration: none;
  color: #FFFF20;
}

.smallp {
  color: #FFFF20;
  width: 300px;
}

.smallp2 {
  width: 300px;
}

.secondh3 {
  text-align: center;
  margin-bottom: -15px;
}

.pawnstarimg {
  margin-top: 50px;
  border: 2px solid #FFFF20;
}

.peaceimg {
  border: 2px solid #FFFF20;
  order: 4;
  -ms-flex-order: 4;
}

.malebox a {
  color: #FFFF20;
}

.femalebox a {
  color: #FFFF20;
}

a:hover {
  color: #0000FF;
}

/** a:visited{
 color:#000000;
Able to check a:hover without clearing cache
}**/

a:active {
  color: #00FF00;
}

.test {
  display: flex;
  display: -ms-flexbox;
  flex-wrap: wrap;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  width: 60%;
  margin: auto;
  justify-content: space-around;
  -ms-flex-pack: justify;
}

.testbox2 {
  display: flex;
  display: -ms-flexbox;
  flex-direction: column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.testbox3 {
  display: flex;
  display: -ms-flexbox;
  flex-direction: column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.gallery {
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  margin: 0 auto;
  border: 2px solid blue;
}

.gallery>div {
  padding: 5px;
}

.gallery>div>img {
  display: block;
  transition: .3s transform;
}

.gallery>div:hover {
  z-index: 1;
}

.gallery>div:hover>a>img {
  transform: scale(2.5, 2.5);
  transition: .2s transform;
}

.cf:before,
.cf:after {
  display: table;
  content: "";
  line-height: 0;
}

CDC Shop

 Home

 Shirts

 Pants

 Jackets

 Shoes

 Contact

    Copyright © 2017 CDCShop

    ...@gmail.com

Body:
Remove width: 1500px; and update to make it to good look

* { box-sizing: border-box;
font-family: Georgia, Arial, sans-serif;
}

html{

 background-color:#FFFF20;

}

body{

 background-color:#FFFF20;
 height:100%;
}

#wrapper { //width: 1500px;
     height:100%;
           margin: auto;
     background-color: #233237;
     color: #FFFF20;
     box-shadow: 5px 5px 5px #000000;
}

header{

 color: #FFFF20;
 font: Georgia, serif;
 text-align: center;

}

h1{
 background-image: url(ebaylogo.png);
 background-repeat: no-repeat;
 background-position: right;
 height: 72px;
 background-size: 120px;
 line-height: 200%;
 margin-bottom: 0;

}

h3{
 text-align:center;
 padding-top:50px;
 padding-bottom:5px;
}

h3, .smallp{
margin:0;
}

nav{
 text-align: center;
 font-weight: bold;

}

nav a{
 text-decoration: none;
 color:#FFFF20;
}

nav ul li {
  list-style-type: none;
  margin: 10px 11px;
  padding: 2px;
  border: 2px solid #FFFF20;
  width: fit-content;
  float: left;
}

footer{
 padding-top: 50px;
 font-size: .70em;
 font-style: italic;
 text-align: center;
 color: #FFFF20;
 margin:auto;
 text-align:center;

}
footer a{
 color: #FFFF20;
}

main{
 padding: 0px 20px 0px 20px;
 display: block;
}

.unorderedlist{
 display: flex;
 display:-ms-flexbox;
 flex-wrap:wrap;
 -ms-flex-pack: justify;
 border: 1px blue solid;
 justify-content: space-between;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
 padding-left:0px;
 list-style-type: none;
 margin: 100px auto;
 width:60%;
 height:100%;
 text-align:center;

}

.list{
 padding-bottom: 50px;
 background-color: #18121E;
 width:220px;
 height:375px;
 box-shadow: 5px 5px 5px;
 margin-bottom:25px;
}

.list a{
 text-decoration:none;
 color:#FFFF20;
}

.smallp{
 color: #FFFF20;
 width:300px;
}

.smallp2{
 width:300px;
}

.secondh3{
 text-align:center;
 margin-bottom:-15px;

}

.pawnstarimg{
 margin-top:50px;
 border: 2px solid #FFFF20;

}

.peaceimg{
 border: 2px solid #FFFF20;
order:4;
 -ms-flex-order: 4;
}

.malebox a {
 color:#FFFF20;
}

.femalebox a {
 color:#FFFF20;
}

a:hover{
 color: #0000FF;
}

/** a:visited{
 color:#000000;
Able to check a:hover without clearing cache
}**/

a:active {
    color: #00FF00;
}
.test{
  display:flex;
  display:-ms-flexbox;
  flex-wrap:wrap;
  -webkit-flex-wrap: wrap;
  -ms-flex-flow: row wrap;
  width:60%;
  margin:auto;
  justify-content:space-around;
-ms-flex-pack: justify;
}

.testbox2{
  display:flex;
  display:-ms-flexbox;
  flex-direction:column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  }

.testbox3{
  display:flex;
  display:-ms-flexbox;
  flex-direction:column;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
}

.gallery {
 display:-ms-flexbox;
 display:flex;
 justify-content:space-between;
 -webkit-justify-content: space-around;
 -ms-flex-pack: justify;
 margin:0 auto;
 border:2px solid blue;
  clear: both;

}

.gallery > div {

  padding:5px;
}

.gallery > div > img {

  display: block;
  transition: .3s transform;

}

.gallery > div:hover {
  z-index: 1;
}

.gallery > div:hover > a > img {
  transform: scale(2.5,2.5);
  transition: .2s transform;
}

.cf:before, .cf:after {
  display: table;
  content: "";
  line-height: 0;

}

<!Doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <title>CDC Shop</title>
 <link rel="stylesheet" type="text/css" href="../test3.css">
</head>

<body>
<main id="wrapper">
<header>
  <h1>CDC Shop</h1>
</header>

<nav>
 <ul>
    <li> <a href="../index.html">Home</a></li>
   <li> <a href="../shirts/shirts.html">Shirts</a></li>
      <li> <a href="../pants/pants.html">Pants</a></li>
   <li> <a href="../pants/pants.html">Jackets</a></li>
   <li> <a href="../pants/pants.html">Shoes</a></li>
   <li> <a href="../pants/pants.html">Contact</a></li>
</ul>
</nav>

<div class="gallery">
  <div>
  <a href="angels.gif"><img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" /></a>
  </div>
  <div>
  <a href="angels2.jpg"><img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" /></a>
  </div>
</div>

<footer>
 Copyright &copy; 2017 CDCShop <br>
  <a href="christian@gmail.com">ccoburn713@gmail.com</a>
</footer>
</main>
</body>
</html>


问:
Custom border of view
Good day the community, I have to set the buttons to change the views with custom border, when I click on it, the second view is closed and the view with this border is displayed.

Help me please ;) Thx

答:
UIView has layer property which is in charge of "borders" and inherits from CALayer. All you need to do - write custom CALayer class, customize it in craziest way you can  and then override layer class in your UIView like so:

```<code>override class var layerClass: AnyClass {
        get {
            return YourCustomdLayer.self
        }
    }
</code>```

Hope it will help you. Good day!

Title: Custom border of view

Body:
UIView has layer property which is in charge of "borders" and inherits from CALayer. All you need to do - write custom CALayer class, customize it in craziest way you can  and then override layer class in your UIView like so:

override class var layerClass: AnyClass {
        get {
            return YourCustomdLayer.self
        }
    }

Hope it will help you. Good day!


问:
ionic 2 themeable browser error ""
Things i did :

installed the plugin. Ans here my code for app/app.component :

import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';

app/app.module.ts :
import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';

```<code>providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}ThemeableBrowser]
</code>```

My about.ts :

```<code>import { ThemeableBrowser } from 'ionic-native';

open() {

  const options: ThemeableBrowserOptions = {
        statusbar: {
            color: '#ffffffff'
        },
        toolbar: {
            height: 44,
            color: '#f0f0f0ff'
        },
        title: {
            color: '#003264ff',
            showPageTitle: true
        },
        backButton: {
            image: 'back',
            imagePressed: 'back_pressed',
            align: 'left',
            event: 'backPressed'
        },
        forwardButton: {
            image: 'forward',
            imagePressed: 'forward_pressed',
            align: 'left',
            event: 'forwardPressed'
        },
        closeButton: {
            image: 'close',
            imagePressed: 'close_pressed',
            align: 'left',
            event: 'closePressed'
        },
        customButtons: [
            {
                image: 'share',
                imagePressed: 'share_pressed',
                align: 'right',
                event: 'sharePressed'
            }
        ],
        menu: {
            image: 'menu',
            imagePressed: 'menu_pressed',
            title: 'Test',
            cancel: 'Cancel',
            align: 'right',
            items: [
                {
                    event: 'helloPressed',
                    label: 'Hello World!'
                },
                {
                    event: 'testPressed',
                    label: 'Test!'
                }
            ]
        },
        backButtonCanClose: true
    };

    const browser: ThemeableBrowserObject = this.themeableBrowser.create('https://ionic.io', '_self', options);

  }
</code>```

My html :

```<code><button ion-button icon-only (click)="open()">
        <ion-icon>OPEN PDF</ion-icon>
      </button>
</code>```

So i don't know, what i am doing wrong. I am getting many error :

1. cannot find the module Cannot find module "@ionic-native/core"

please help me out. what i am doing wrong in my code...

Thanks in advance !!

error:

```<code> ionic-hello-world@ /Users/apple/Desktop/ionic2-sidemenu-tabs-master
├── @ionic-native/core@3.7.0
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12

npm WARN @ionic-native/themeable-browser@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic-native/core@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
</code>```

My package.json:

```<code>   "dependencies": {
        "@angular/common": "2.2.1",
        "@angular/compiler": "2.2.1",
        "@angular/compiler-cli": "2.2.1",
        "@angular/core": "2.2.1",
        "@angular/forms": "2.2.1",
        "@angular/http": "2.2.1",
        "@angular/platform-browser": "2.2.1",
        "@angular/platform-browser-dynamic": "2.2.1",
        "@angular/platform-server": "2.2.1",
        "@ionic-native/core": "^3.7.0",
        "@ionic-native/themeable-browser": "^3.7.0",
        "@ionic/storage": "1.1.7",
        "ionic-angular": "2.0.0",
        "ionic-native": "2.4.1",
        "ionicons": "3.0.0",
        "rxjs": "5.0.0-beta.12",
        "sw-toolbox": "3.4.0",
        "zone.js": "0.6.26"
}
</code>```

update :

error:

1 Can't resolve all parameters for ThemeableBrowser: (?, ?, ?).

2.Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/app/app.component.ts

this line :import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/app/app.module.ts

this line : import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/pages/about/about.ts

this line: import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Property 'create' does not exist on type 'typeof ThemeableBrowser'.
src/pages/about/about.ts

const browser: ThemeableBrowserObject = ThemeableBrowser.create('https://ionic.io', '_self', options);

答:
This code:

```<code>import { ThemeableBrowser } from 'ionic-native';
</code>```

Will give an import error

Try this instead:

```<code>import { ThemeableBrowser } from '@ionic-native/themeable-browser';
</code>```

Title: ionic 2 themeable browser error ""

Body:
Things i did :

installed the plugin. Ans here my code for app/app.component :

import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';

app/app.module.ts :
import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';

providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}ThemeableBrowser]

My about.ts :

import { ThemeableBrowser } from 'ionic-native';

open() {

  const options: ThemeableBrowserOptions = {
        statusbar: {
            color: '#ffffffff'
        },
        toolbar: {
            height: 44,
            color: '#f0f0f0ff'
        },
        title: {
            color: '#003264ff',
            showPageTitle: true
        },
        backButton: {
            image: 'back',
            imagePressed: 'back_pressed',
            align: 'left',
            event: 'backPressed'
        },
        forwardButton: {
            image: 'forward',
            imagePressed: 'forward_pressed',
            align: 'left',
            event: 'forwardPressed'
        },
        closeButton: {
            image: 'close',
            imagePressed: 'close_pressed',
            align: 'left',
            event: 'closePressed'
        },
        customButtons: [
            {
                image: 'share',
                imagePressed: 'share_pressed',
                align: 'right',
                event: 'sharePressed'
            }
        ],
        menu: {
            image: 'menu',
            imagePressed: 'menu_pressed',
            title: 'Test',
            cancel: 'Cancel',
            align: 'right',
            items: [
                {
                    event: 'helloPressed',
                    label: 'Hello World!'
                },
                {
                    event: 'testPressed',
                    label: 'Test!'
                }
            ]
        },
        backButtonCanClose: true
    };

    const browser: ThemeableBrowserObject = this.themeableBrowser.create('https://ionic.io', '_self', options);

  }

My html :

<button ion-button icon-only (click)="open()">
        <ion-icon>OPEN PDF</ion-icon>
      </button>

So i don't know, what i am doing wrong. I am getting many error :

1. cannot find the module Cannot find module "@ionic-native/core"

please help me out. what i am doing wrong in my code...

Thanks in advance !!

error:

 ionic-hello-world@ /Users/apple/Desktop/ionic2-sidemenu-tabs-master
├── @ionic-native/core@3.7.0
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12

npm WARN @ionic-native/themeable-browser@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic-native/core@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.

My package.json:

   "dependencies": {
        "@angular/common": "2.2.1",
        "@angular/compiler": "2.2.1",
        "@angular/compiler-cli": "2.2.1",
        "@angular/core": "2.2.1",
        "@angular/forms": "2.2.1",
        "@angular/http": "2.2.1",
        "@angular/platform-browser": "2.2.1",
        "@angular/platform-browser-dynamic": "2.2.1",
        "@angular/platform-server": "2.2.1",
        "@ionic-native/core": "^3.7.0",
        "@ionic-native/themeable-browser": "^3.7.0",
        "@ionic/storage": "1.1.7",
        "ionic-angular": "2.0.0",
        "ionic-native": "2.4.1",
        "ionicons": "3.0.0",
        "rxjs": "5.0.0-beta.12",
        "sw-toolbox": "3.4.0",
        "zone.js": "0.6.26"
}

update :

error:

1 Can't resolve all parameters for ThemeableBrowser: (?, ?, ?).

2.Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/app/app.component.ts

this line :import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/app/app.module.ts

this line : import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'.
src/pages/about/about.ts

this line: import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from 'ionic-native';

Typescript Error
Property 'create' does not exist on type 'typeof ThemeableBrowser'.
src/pages/about/about.ts

const browser: ThemeableBrowserObject = ThemeableBrowser.create('https://ionic.io', '_self', options);

Body:
This code:

import { ThemeableBrowser } from 'ionic-native';

Will give an import error

Try this instead:

import { ThemeableBrowser } from '@ionic-native/themeable-browser';


问:
CTreeCtrl save items added at runtime
I need to keep CTreeCtrl items dynamically added

Serialize is indeed should do it?
Would only need to convert if yes how variable type

If not how to do it?

Serialize function

```<code>if (ar.IsStoring())
{
    ar >> m_tree1;
}
else
{
    ar << m_tree1;
}
</code>```

答:
Serializing a tree isn't as complicated. Here a function with some pseudocode and without error cheching.

The only thing you have to do, is to serialize the nodes data...

This code is not checked against a compiler but should show the way how to achieve this. The code is documented.

```<code>...
SerializeTree(m_tree.GetRootItem(), ar);
...

void SerializeTree(CTreeCtrl &tree, HTREEITEM hItem, CArchive &ar)
{
  if ar.IsStoring())
  {
    // Count items on this level
    DWORD dwCnt = 0;
    for (HTREEITEM hNext = hItem; hNext; hNext = tree.GetNextItem(hNext,TVGN_NEXT)
      ++dwCnt;
    // output data on this level
    ar << dwCnt;
    for (HTREEITEM hNext = hItem; hNext; hNext = tree.GetNextItem(hNext,TVGN_NEXT)
    {
      // Output data of this node
      OutputDataOfNode(tree,hNext,ar);
      // Stream children of this node
      SerializeTree(tree,tree.GetChildItem(hNext),ar);
    }
  }
  else
  {
    // Get number of nodes on this level
    DWORD dwCnt;
    ar >> dwCnt;
    while (dwCnt--)
    {
      // Insert a new node
      HTREEITEM hNext = tree.InsertItem(_T(""),hItem ? hItem : TVI_ROOT, TVI_LAST);
      // Read data of node into the new node hNext
      ReadDataOfNode(tree,hNext,ar);
      // Now read all children
      SerializeTree(tree,hNext,ar);
    }
  }
}
</code>```

Title: CTreeCtrl save items added at runtime

Body:
I need to keep CTreeCtrl items dynamically added

Serialize is indeed should do it?
Would only need to convert if yes how variable type

If not how to do it?

Serialize function

if (ar.IsStoring())
{
    ar >> m_tree1;
}
else
{
    ar << m_tree1;
}

Body:
Serializing a tree isn't as complicated. Here a function with some pseudocode and without error cheching.

The only thing you have to do, is to serialize the nodes data...

This code is not checked against a compiler but should show the way how to achieve this. The code is documented.

...
SerializeTree(m_tree.GetRootItem(), ar);
...

void SerializeTree(CTreeCtrl &tree, HTREEITEM hItem, CArchive &ar)
{
  if ar.IsStoring())
  {
    // Count items on this level
    DWORD dwCnt = 0;
    for (HTREEITEM hNext = hItem; hNext; hNext = tree.GetNextItem(hNext,TVGN_NEXT)
      ++dwCnt;
    // output data on this level
    ar << dwCnt;
    for (HTREEITEM hNext = hItem; hNext; hNext = tree.GetNextItem(hNext,TVGN_NEXT)
    {
      // Output data of this node
      OutputDataOfNode(tree,hNext,ar);
      // Stream children of this node
      SerializeTree(tree,tree.GetChildItem(hNext),ar);
    }
  }
  else
  {
    // Get number of nodes on this level
    DWORD dwCnt;
    ar >> dwCnt;
    while (dwCnt--)
    {
      // Insert a new node
      HTREEITEM hNext = tree.InsertItem(_T(""),hItem ? hItem : TVI_ROOT, TVI_LAST);
      // Read data of node into the new node hNext
      ReadDataOfNode(tree,hNext,ar);
      // Now read all children
      SerializeTree(tree,hNext,ar);
    }
  }
}


问:
java.sql.SQLException: Failed to start database '/var/lib/hive/metastore/metastore_db' in hive
I am a starter to hive. When I try to execute any hive commands:

hive>SHOW TABLES;

it's showing the below error:

```<code>FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
</code>```

答: I've encountered similar error when I forgot about another instance of spark-shell running on same node.

Body:
I am a starter to hive. When I try to execute any hive commands:

hive>SHOW TABLES;

it's showing the below error:

FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask


问:
Align content in the middle of div
I'd like to align the content of my second column in the middle of the div. I did try in a lot of different ways but so far I haven't found how.

I'm using Bootstrap 4.

Could you tell me how to do it ?

```<code><div class="card">
   <div class="card-body">
      <div class="row">
         <div class="col-md-1">
            <img class="rounded-circle img-thumbnail d-inline"
                 src="..."
                 height="65px"
                 width="65px"
                 alt="User image">
         </div>
         <div class="col-md-11">
            <p class="d-inline">...</p>
            <button class="close" type="button"><span class="fa fa-times" aria-hidden="true"></span></button>
         </div>
      </div>
   </div>
</div>
</code>```

I'm sure I miss something very simple but don't know what.

JSFiddle exemple

Thanks for your help :)

答:
Use text-center class.

```<code> <div class="card">
  <div class="card-body">
    <div class="row">
      <div class="col-md-1">
        <img class="rounded-circle img-thumbnail d-inline" src="https://4fi8v2446i0sw2rpq2a3fg51-wpengine.netdna-ssl.com/wp-content/uploads/2016/06/KittenProgression-Darling-week7.jpg" height="65px" width="65px" alt="User image">
      </div>
      <div class="col-md-11 text-center"><!--Modification here -->
        <p class="d-inline">Kitten</p>
        <button class="close" type="button"><span class="fa fa-times" aria-hidden="true"></span></button>
      </div>
    </div>
  </div>
</div>
</code>```

Demo: https://jsfiddle.net/2hjxszck/1/

Title: Align content in the middle of div

Body:
I'd like to align the content of my second column in the middle of the div. I did try in a lot of different ways but so far I haven't found how.

I'm using Bootstrap 4.

Could you tell me how to do it ?

...

            <button class="close" type="button"></button>

I'm sure I miss something very simple but don't know what.

JSFiddle exemple

Thanks for your help :)

Body:
Use text-center class.

 <div class="card">
  <div class="card-body">
    <div class="row">
      <div class="col-md-1">
        <img class="rounded-circle img-thumbnail d-inline" src="https://4fi8v2446i0sw2rpq2a3fg51-wpengine.netdna-ssl.com/wp-content/uploads/2016/06/KittenProgression-Darling-week7.jpg" height="65px" width="65px" alt="User image">
      </div>
      <div class="col-md-11 text-center"><!--Modification here -->
        <p class="d-inline">Kitten</p>
        <button class="close" type="button"><span class="fa fa-times" aria-hidden="true"></span></button>
      </div>
    </div>
  </div>
</div>

Demo: https://jsfiddle.net/2hjxszck/1/


问:
Need help with text box input
It's actually a grid column but it functions just like a textbox. I need it to be able to accept numbers only, but it has to be able to accept numbers with leading 0's. What would I use as a mask to get this result? If I do any kind of numeric mask then it will cut off the leading 0's, eg 002456841. If I don't use a numeric mask, then characters will be accepted which is unacceptable.

Am I not thinking outside of the box enough with this? I was also thinking like maybe instead of a mask using a loop or something to make sure it's only numbers and erase/pop up a message if it's not...but I just don't know, I would rather just have the box so it only accepts numbers but any number.

答:
Well, you have couple options here:

First, use a regular expression to validate

Second, use a jQuery's Masked input plugin.

http://digitalbush.com/projects/masked-input-plugin/#demo

Updated Text
hmm, I am not sure why will you have to use Java, I was just suggesting you to try use the jQuery plugin with a regular expression to mask with. I think that should solve your issue... also if you have doubts on your regex then you can always test it through
http://www.regextester.com/

Hope this helps.

Title: Need help with text box input


问:
Is there a predicate for #inst?
Is there a predicate for #inst?

```<code>dev:cljs.user=> #inst "1985-04-12"
#inst "1985-04-12T00:00:00.000-00:00"

dev:cljs.user=> (type #inst "1985-04-12")
#object[Date]

dev:cljs.user=> (tagged-literal? #inst "1985-04-12")
false
</code>```

, so that (answer-to-this-question? #inst "1985-04-12") returns true?

If such a predicate does not exist, can one be made?

So far I've come up with:

```<code>(= "function Date() { [native code] }" (-> #inst "1985-04-12" type str))
;; -> true
</code>```

答:
Also you can use instance? function in any version of ClojureScript:

```<code>(instance? js/Date #inst "2017-11-14")
;; -> true
</code>```

Title: Is there a predicate for #inst?

Body:
Is there a predicate for #inst?

dev:cljs.user=> #inst "1985-04-12"
#inst "1985-04-12T00:00:00.000-00:00"

dev:cljs.user=> (type #inst "1985-04-12")
#object[Date]

dev:cljs.user=> (tagged-literal? #inst "1985-04-12")
false

, so that (answer-to-this-question? #inst "1985-04-12") returns true?

If such a predicate does not exist, can one be made?

So far I've come up with:

(= "function Date() { [native code] }" (-> #inst "1985-04-12" type str))
;; -> true

Body:
Also you can use instance? function in any version of ClojureScript:

(instance? js/Date #inst "2017-11-14")
;; -> true


问:
unable to add meta data in orderitem using Woo commerce update order REST API
How to add meta data to every suborder (new data in order_item_meta table) using woocommerce rest API version v2? I have tried a lot but unable to see any changes in response on postman. I also tried to change the version but still no change.</p>

答:
resolved this by using hook:</p>

```<code>function action_woocommerce_api_edit_order( $order_get_id, $data, $instance ) {
    // make action magic happen here...
    //$data = $response->get_data();

        for($i=0;$i<count($data['line_items']);$i++){
                for($y=0;$y<count($data['line_items'][$i]['meta']);$y++){
                    //echo "key";echo($res['line_items'][$i]['meta'][$y]['key']);echo "<br>";
                    //echo ($res['line_items'][$i]['meta'][$y]['value']);echo "value";
                    wc_update_order_item_meta($data['line_items'][$i]['id'],$data['line_items'][$i]['meta'][$y]['key'],$data['line_items'][$i]['meta'][$y]['value']);

                };

            }
};

// add the action
add_action( 'woocommerce_api_edit_order', 'action_woocommerce_api_edit_order', 10, 3 );
this will add data inside order_item_meta table w.r.t to every order_item.
</code>```

Body:
resolved this by using hook:

function action_woocommerce_api_edit_order( $order_get_id, $data, $instance ) {
    // make action magic happen here...
    //$data = $response->get_data();

        for($i=0;$i<count($data['line_items']);$i++){
                for($y=0;$y<count($data['line_items'][$i]['meta']);$y++){
                    //echo "key";echo($res['line_items'][$i]['meta'][$y]['key']);echo "<br>";
                    //echo ($res['line_items'][$i]['meta'][$y]['value']);echo "value";
                    wc_update_order_item_meta($data['line_items'][$i]['id'],$data['line_items'][$i]['meta'][$y]['key'],$data['line_items'][$i]['meta'][$y]['value']);

                };

            }
};

// add the action
add_action( 'woocommerce_api_edit_order', 'action_woocommerce_api_edit_order', 10, 3 );
this will add data inside order_item_meta table w.r.t to every order_item.