问:
How to use output parameter with StringBuilder?
I pass a stringbuild out variable to function which parameter type is out stringbuild, but compiler tel me

"Before leave function, You must assign value to sbValue"

```<code>    public void FuncOutParamString(out StringBuilder sbValue)
    {
        sbValue.Append("wold!");
    }

    private void btnOutParam_Click(object sender, RoutedEventArgs e)
    {
        Console.WriteLine("=================== Out Parameter ===================");
        // Declare a variable but don't assign a value to it ******************************
        int y = 0;

        // Pass it in as an output parameter, even though its value is unassigned
        FuncOutParamInt(out y);

        // It's now assigned a value, so we can write it out:
        Console.WriteLine(y);

        // Declare a variable but don't assign a value to it ******************************
        StringBuilder sb = new StringBuilder();
        sb.Append("Hello ");
        FuncOutParamString(out sb);

        Console.WriteLine(sb);
    }
</code>```

Sorry, I need 10 reputation to post image

答:
When declaring the variable sb as StringBuilder you must pass in a value to the constructor else it would be initialized as null. Since it needs to allocate memory from the heap it requires a parameter to use append later on.

You can check here for the type of constructor parameter StringBuilder class supports.

This should work:

```<code>public void FuncOutParamString(StringBuilder sbValue)
{
    sbValue.Append("wold!");
    return sbValue;
}

private void btnOutParam_Click(object sender, RoutedEventArgs e)
{
    Console.WriteLine("=================== Out Parameter ===================");
    // Declare a variable but don't assign a value to it ******************************
    int y = 0;

    // Pass it in as an output parameter, even though its value is unassigned
    FuncOutParamInt(out y);

    // It's now assigned a value, so we can write it out:
    Console.WriteLine(y);

    // Declare a variable but don't assign a value to it ******************************
    StringBuilder sb = new StringBuilder(50);
    sb.Append("Hello ");
    sb = FuncOutParamString(sb);

    Console.WriteLine(sb);
}
</code>```

Also you must return the sbValue variable from the FuncOutParamString function.

Body:
I pass a stringbuild out variable to function which parameter type is out stringbuild, but compiler tel me

"Before leave function, You must assign value to sbValue"

    public void FuncOutParamString(out StringBuilder sbValue)
    {
        sbValue.Append("wold!");
    }

    private void btnOutParam_Click(object sender, RoutedEventArgs e)
    {
        Console.WriteLine("=================== Out Parameter ===================");
        // Declare a variable but don't assign a value to it ******************************
        int y = 0;

        // Pass it in as an output parameter, even though its value is unassigned
        FuncOutParamInt(out y);

        // It's now assigned a value, so we can write it out:
        Console.WriteLine(y);

        // Declare a variable but don't assign a value to it ******************************
        StringBuilder sb = new StringBuilder();
        sb.Append("Hello ");
        FuncOutParamString(out sb);

        Console.WriteLine(sb);
    }

Sorry, I need 10 reputation to post image

Body:
When declaring the variable sb as StringBuilder you must pass in a value to the constructor else it would be initialized as null. Since it needs to allocate memory from the heap it requires a parameter to use append later on.

You can check here for the type of constructor parameter StringBuilder class supports.

This should work:

public void FuncOutParamString(StringBuilder sbValue)
{
    sbValue.Append("wold!");
    return sbValue;
}

private void btnOutParam_Click(object sender, RoutedEventArgs e)
{
    Console.WriteLine("=================== Out Parameter ===================");
    // Declare a variable but don't assign a value to it ******************************
    int y = 0;

    // Pass it in as an output parameter, even though its value is unassigned
    FuncOutParamInt(out y);

    // It's now assigned a value, so we can write it out:
    Console.WriteLine(y);

    // Declare a variable but don't assign a value to it ******************************
    StringBuilder sb = new StringBuilder(50);
    sb.Append("Hello ");
    sb = FuncOutParamString(sb);

    Console.WriteLine(sb);
}

Also you must return the sbValue variable from the FuncOutParamString function.


来源: stackexchange

问:
Thymeleaf with Spring MVC + Swagger
I would like to know how I can integrate these three technologies.
I am currently working on a web application build with Spring MVC and Thymeleaf template revolver for my web views. My web MVC+Thymeleaf configuration is completely XML free and here is the most relevant part for the web configuration:

```<code>@Configuration
@EnableWebMvc
public class ConfigWebMVC extends WebMvcConfigurerAdapter
{
/**
 * Thymeleaf config - Spring will use Thymeleaf to render the HTML views
 * @return The Thymeleaf resolver
 */
@Bean
public ServletContextTemplateResolver templateResolver() {
    LOGGER.info("CREATING TEMPLATE RESOLVER");
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix( environment.getProperty("web.template_prefix") );
    resolver.setSuffix( environment.getProperty("web.template_suffix") );
    resolver.setTemplateMode( environment.getProperty("web.template_style") );
    resolver.setCacheable(true);
    return resolver;
}

/**
 * Thymeleaf config - Thymeleaf will use templateEngine to understand
 * Spring MVC, Spring Security dialects and th: tags
 * @return The Thymeleaf engine
 */
@Bean
public SpringTemplateEngine templateEngine() {
    LOGGER.info("CREATING TEMPLATE ENGINE");
    SpringTemplateEngine engine = new SpringTemplateEngine();
    engine.setDialect( new SpringStandardDialect() );
    engine.setTemplateResolver(templateResolver());
    return engine;
}

/**
 * Thymeleaf config - Spring MVC will use thymeleafViewResolver to set the correct template resolver
 * @return The Thymeleaf resolver
 */
@Bean
public ThymeleafViewResolver thymeleafViewResolver() {
    LOGGER.info("CREATING TEMPLATE ENGINE RESOLVER");
    ThymeleafViewResolver resolver = new ThymeleafViewResolver();
    resolver.setTemplateEngine(templateEngine());
    return resolver;
}
}
</code>```

At this moment, I would like to add some rest controllers and its documentation made with swagger / swagger UI but I have no idea about the integration with thymeleaf. I know that is possible to integrate with Spring MVC and I have a working example WITHOUT thymeleaf.

It is not mandatory to use swagger but I am looking for a practical and visual-friendly documentation tool to integrate with these technologies.

答:
Follow these steps to integrate Swagger with thymeleaf and spring MVC

1- Add the required dependencies to your pom file

```<code><!-- swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>

       <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.2</version>
        </dependency>
    </dependencies>
</code>```

2- Extend the WebMvcConfigurerAdapter to addResourceHandlers

```<code>@Configuration
@EnableAsync
public class WebConfig extends WebMvcConfigurerAdapter {

    public WebConfig() {
        super();
    }

    @Override
    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");

        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}
</code>```

3- Create the swagger config file

```<code>@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {

        return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.ant("/**")).build().apiInfo(apiInfo()).useDefaultResponseMessages(false);

    }

    private ApiInfo apiInfo() {
        ApiInfo apiInfo = new ApiInfo("Application name", "API description", "API TOS", "Terms of service", new Contact("Hany Sakr", "website", "email"), "License of API", "API license URL", Collections.emptyList());
        return apiInfo;
    }
}
</code>```

4-After running the app, access swagger using the following links

```<code>http://localhost:8080/{YourApplication}/v2/api-docs
http://localhost:8080/{YourApplication}/swagger-ui.html
</code>```

I hope it can help.

ContentLicense: CC BY-SA 3.0

Title: Thymeleaf with Spring MVC + Swagger

Body:
I would like to know how I can integrate these three technologies.
I am currently working on a web application build with Spring MVC and Thymeleaf template revolver for my web views. My web MVC+Thymeleaf configuration is completely XML free and here is the most relevant part for the web configuration:

@Configuration
@EnableWebMvc
public class ConfigWebMVC extends WebMvcConfigurerAdapter
{
/**
 * Thymeleaf config - Spring will use Thymeleaf to render the HTML views
 * @return The Thymeleaf resolver
 */
@Bean
public ServletContextTemplateResolver templateResolver() {
    LOGGER.info("CREATING TEMPLATE RESOLVER");
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix( environment.getProperty("web.template_prefix") );
    resolver.setSuffix( environment.getProperty("web.template_suffix") );
    resolver.setTemplateMode( environment.getProperty("web.template_style") );
    resolver.setCacheable(true);
    return resolver;
}

/**
 * Thymeleaf config - Thymeleaf will use templateEngine to understand
 * Spring MVC, Spring Security dialects and th: tags
 * @return The Thymeleaf engine
 */
@Bean
public SpringTemplateEngine templateEngine() {
    LOGGER.info("CREATING TEMPLATE ENGINE");
    SpringTemplateEngine engine = new SpringTemplateEngine();
    engine.setDialect( new SpringStandardDialect() );
    engine.setTemplateResolver(templateResolver());
    return engine;
}

/**
 * Thymeleaf config - Spring MVC will use thymeleafViewResolver to set the correct template resolver
 * @return The Thymeleaf resolver
 */
@Bean
public ThymeleafViewResolver thymeleafViewResolver() {
    LOGGER.info("CREATING TEMPLATE ENGINE RESOLVER");
    ThymeleafViewResolver resolver = new ThymeleafViewResolver();
    resolver.setTemplateEngine(templateEngine());
    return resolver;
}
}

At this moment, I would like to add some rest controllers and its documentation made with swagger / swagger UI but I have no idea about the integration with thymeleaf. I know that is possible to integrate with Spring MVC and I have a working example WITHOUT thymeleaf.

It is not mandatory to use swagger but I am looking for a practical and visual-friendly documentation tool to integrate with these technologies.

Body:
Follow these steps to integrate Swagger with thymeleaf and spring MVC

1- Add the required dependencies to your pom file

<!-- swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>

       <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.2</version>
        </dependency>
    </dependencies>

2- Extend the WebMvcConfigurerAdapter to addResourceHandlers

@Configuration
@EnableAsync
public class WebConfig extends WebMvcConfigurerAdapter {

    public WebConfig() {
        super();
    }

    @Override
    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");

        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}

3- Create the swagger config file

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {

        return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.ant("/**")).build().apiInfo(apiInfo()).useDefaultResponseMessages(false);

    }

    private ApiInfo apiInfo() {
        ApiInfo apiInfo = new ApiInfo("Application name", "API description", "API TOS", "Terms of service", new Contact("Hany Sakr", "website", "email"), "License of API", "API license URL", Collections.emptyList());
        return apiInfo;
    }
}

4-After running the app, access swagger using the following links

http://localhost:8080/{YourApplication}/v2/api-docs
http://localhost:8080/{YourApplication}/swagger-ui.html

I hope it can help.


问:
NativeScript border-radius for UI element is not working
I am using the VS telerik extension to develop my mobile application. However, I am trying to curve the borders of my UI elements by using CSS border-radius:3px-52px and it is not working. I have used several methods to resolve it, but non actually worked. I assume it is a bug with the VS telerik extension.</p>

答:
By adding a class to the image then remove the px it should work.

Example

```<code>.avatar{
    background-color: #ffffff;
    border-radius: 150;
    width: 100
  }

<Image src="https://pbs.twimg.com/profile_images/677158239851646976/l-mkCSMK.jpg"  class="avatar"></Image>
</code>```

Body:
By adding a class to the image then remove the px it should work.

Example

.avatar{
    background-color: #ffffff;
    border-radius: 150;
    width: 100
  }

<Image src="https://pbs.twimg.com/profile_images/677158239851646976/l-mkCSMK.jpg"  class="avatar"></Image>


问:
Using the Python gnupg package, I am getting the error "Homedir ''C:/Users/...' needs read/write permissions"
I am running Windows 7 with Python version 3.6.1 in Anaconda. I installed the python package gnupg, using pip install gnupg.

I downloaded the gnupg Windows executable 2.1.23  from ftp://ftp.gnupg.org/gcrypt/binary/.

When I run the code with either of the two lines below it fails with the following error.

```<code>import gnupg

gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe',
               homedir='C:/Users/Alex/Desktop/SFTP Connection')

# gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe')
</code>```

However when I run the Python code with either of the two lines it fails.

```<code>import gnupg
# gpg = gnupg.GPG(homedir='C:/Program Files (x86)/GnuPG')
gpg = gnupg.GPG(homedir='C:/Program Files (x86)/GnuPG/bin')

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in _homedir_setter(self, directory)
    434                 assert _util._has_readwrite(hd), \
--> 435                     "Homedir '%s' needs read/write permissions" % hd
    436             except AssertionError as ae:

AssertionError: Homedir ''C:/Users/Alex/Desktop/SFTP Connection'' needs read/write permissions

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-4-ae272cb064fb> in <module>()
      1 gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe',
----> 2                homedir='C:/Users/Alex/Desktop/SFTP Connection')

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\gnupg.py in __init__(self, binary, homedir, verbose, use_agent, keyring, secring, ignore_homedir_permissions, options)
    123             verbose=verbose,
    124             use_agent=use_agent,
--> 125             ignore_homedir_permissions=ignore_homedir_permissions,
    126         )
    127

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in __init__(self, binary, home, keyring, secring, use_agent, default_preference_list, ignore_homedir_permissions, verbose, options)
    181         self.ignore_homedir_permissions = ignore_homedir_permissions
    182         self.binary  = _util._find_binary(binary)
--> 183         self.homedir = os.path.expanduser(home) if home else _util._conf
    184         pub = _parsers._fix_unsafe(keyring) if keyring else 'pubring.gpg'
    185         sec = _parsers._fix_unsafe(secring) if secring else 'secring.gpg'

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_util.py in __set__(self, obj, value)
    763             self.fset(obj, value)
    764         else:
--> 765             getattr(obj, self.fset.__name__)(value)
    766
    767     def __delete__(self, obj):

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in _homedir_setter(self, directory)
    438                 log.debug("GPGBase.homedir.setter(): %s" % msg)
    439                 log.debug(str(ae))
--> 440                 raise RuntimeError(str(ae))
    441             else:
    442                 log.info("Setting homedir to '%s'" % hd)

RuntimeError: Homedir ''C:/Users/Alex/Desktop/SFTP Connection'' needs read/write permissions
</code>```

I've ran the following two commands and verified the folder has read and write access.

```<code>>>> os.access('C:/Users/Alex/Desktop/SFTP Connection', os.W_OK)
True
>>> os.access('C:/Users/Alex/Desktop/SFTP Connection', os.R_OK)
True
>>>
</code>```

答: With regards to the new permissions error, I guess it is actually a bug of gnupg, I have submitted a patch.</p>

Body:
I am running Windows 7 with Python version 3.6.1 in Anaconda. I installed the python package gnupg, using pip install gnupg.

I downloaded the gnupg Windows executable 2.1.23  from ftp://ftp.gnupg.org/gcrypt/binary/.

When I run the code with either of the two lines below it fails with the following error.

import gnupg

gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe',
               homedir='C:/Users/Alex/Desktop/SFTP Connection')

# gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe')

However when I run the Python code with either of the two lines it fails.

import gnupg
# gpg = gnupg.GPG(homedir='C:/Program Files (x86)/GnuPG')
gpg = gnupg.GPG(homedir='C:/Program Files (x86)/GnuPG/bin')

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in _homedir_setter(self, directory)
    434                 assert _util._has_readwrite(hd), \
--> 435                     "Homedir '%s' needs read/write permissions" % hd
    436             except AssertionError as ae:

AssertionError: Homedir ''C:/Users/Alex/Desktop/SFTP Connection'' needs read/write permissions

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-4-ae272cb064fb> in <module>()
      1 gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe',
----> 2                homedir='C:/Users/Alex/Desktop/SFTP Connection')

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\gnupg.py in __init__(self, binary, homedir, verbose, use_agent, keyring, secring, ignore_homedir_permissions, options)
    123             verbose=verbose,
    124             use_agent=use_agent,
--> 125             ignore_homedir_permissions=ignore_homedir_permissions,
    126         )
    127

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in __init__(self, binary, home, keyring, secring, use_agent, default_preference_list, ignore_homedir_permissions, verbose, options)
    181         self.ignore_homedir_permissions = ignore_homedir_permissions
    182         self.binary  = _util._find_binary(binary)
--> 183         self.homedir = os.path.expanduser(home) if home else _util._conf
    184         pub = _parsers._fix_unsafe(keyring) if keyring else 'pubring.gpg'
    185         sec = _parsers._fix_unsafe(secring) if secring else 'secring.gpg'

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_util.py in __set__(self, obj, value)
    763             self.fset(obj, value)
    764         else:
--> 765             getattr(obj, self.fset.__name__)(value)
    766
    767     def __delete__(self, obj):

C:\ProgramData\Anaconda3\lib\site-packages\gnupg\_meta.py in _homedir_setter(self, directory)
    438                 log.debug("GPGBase.homedir.setter(): %s" % msg)
    439                 log.debug(str(ae))
--> 440                 raise RuntimeError(str(ae))
    441             else:
    442                 log.info("Setting homedir to '%s'" % hd)

RuntimeError: Homedir ''C:/Users/Alex/Desktop/SFTP Connection'' needs read/write permissions

I've ran the following two commands and verified the folder has read and write access.

>>> os.access('C:/Users/Alex/Desktop/SFTP Connection', os.W_OK)
True
>>> os.access('C:/Users/Alex/Desktop/SFTP Connection', os.R_OK)
True
>>>


问:
How to bind string in square bracket?
I'm using like this:  master.Name=entity.Name; // let it be Prashant

I want to append Name in Square bracket Like [Prashant]

答:
You should use Name as a property in class Master and use it's getter for do this job:

```<code>private string _Name;

public string Name
{
    get { return "[" + _Name + "]"; } // Or String.Format("[{0}]",_Name)
    set { _Name = value; }
}
</code>```

So that when ever you access master.Name it will give you the output in desired format. ie., [Prashant]

Usage example is added here Or else format them whenever you use those properties like this:

```<code> Console.WriteLine(String.Format("[{0}]",masterInstace.Name));
</code>```

Title: How to bind string in square bracket?

Body:
You should use Name as a property in class Master and use it's getter for do this job:

private string _Name;

public string Name
{
    get { return "[" + _Name + "]"; } // Or String.Format("[{0}]",_Name)
    set { _Name = value; }
}

So that when ever you access master.Name it will give you the output in desired format. ie., [Prashant]

Usage example is added here Or else format them whenever you use those properties like this:

 Console.WriteLine(String.Format("[{0}]",masterInstace.Name));


答:
Old way of doing that would be:

```<code>master.Name = '[' + entity.Name + ']';
</code>```

A relatively better way is:

```<code>master.Name = string.Format("[{0}]", entity.Name);
</code>```

And if you're using C# 6.0 or above:

```<code>master.Name = $"[{entity.Name}]";
</code>```

Title: How to bind string in square bracket?

Body:
I'm using like this:  master.Name=entity.Name; // let it be Prashant

I want to append Name in Square bracket Like [Prashant]

Body:
Old way of doing that would be:

master.Name = '[' + entity.Name + ']';

A relatively better way is:

master.Name = string.Format("[{0}]", entity.Name);

And if you're using C# 6.0 or above:

master.Name = $"[{entity.Name}]";


问:
Navigation Controller Loop

I'm making an app which has a shopping cart feature. The shopping cart VC is accessible from several VCs via a button on the navigation bar. So far I only have one Navigation Controller and as shown in the image, each VC takes me to the next one, nothing fancy. The 3rd VC (blue arrow pointing to) is a VC that shows the product/item's details and enables me to add it to the cart.

Problem comes with the Shopping Cart VC. To edit the item, I'd like to re-use the same product/item's details (blue arrow pointing to) VC I used earlier.

Right now, I don't really have an issue but I have noticed that once I created the blue segue, the Navigation Bar of the 3rd VC disappeared in the Storyboard however I was still able to see it when I ran the app.

NOTE:

All the segues in the picture are "Show"

The shopping cart VC doesn't have a button to show itself like the other 3 does. So technically I prevented endless/loop of the shopping cart VC - product/item details VC showing one another.

My questions are:

Is it wrong to design the app that way with a VC going to another VC and that other VC can go back to the first VC? Am I going to face issues down the road, perhaps memory leaks of some sort?

Is there a better way to achieve what I am trying to achieve?

If someone needs further explanation please let me know and I'll edit my question.

EDIT: To clarify, the blue segue is basically a button in a UITableView in the cart VC. If you tap that button, it should open the product/item details VC and lets you edit the item's color, etc. In the item details VC, instead of adding the item as a new item to the cart, I'd show an Edit button which would send the edit request to the API and dismiss the VC back to the shopping cart, or I could use the back button in the navigation controller to get back to the shopping cart.

EDIT2: @beshio

Thanks for the answer. However VC1 is actually my root VC where all the app starts. I didn't get why removed VCs from the Navigation Controller's stack. I would like the Back button to work as intended.

So far I have achieved what I wanted but I'm afraid that having two VCs segue-ing to each other would cause a problem. I have already disabled the Cart button in VC3 in case VC3 was presented from the Cart so loops would be prevented. I am only worried about any memory leaks down the road.

答:
It's possible to achieve this kinda transition.

Here, I describe how to implement this with your chart.
As your chart shows, assume you have VC1, VC2, VC3 (top to bottom) and VCX (w/ blue box). You need to define transitions and associated animation directions (push: right-to-left or pop:left-to-right). As your chart, if you define the transitions and animations as:

VC1 to : VC2(push), VCX(push)

VC2 to : VC3(push), VCX(push)

VC3 to : VCX(push)

VCX to : VC3(pop)

and assume we have all of the view controllers instantiated already, then,

VC1 to VC2 transition

at VC1:

```<code>navigationController!.pushViewController(VC2, animated: true)
</code>```

at VC2:

```<code>override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    // remove VC1 from navigation stack (I assume VC1 is not a root VC)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    allControllers.removeObject(at: allControllers.count - 2)
    navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
 }
</code>```

VC1 to VCX transition

at VC1:

```<code>navigationController!.pushViewController(VCX, animated: true)
</code>```

at VCX: (A)

```<code>override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    if (navigationController!.viewControllers[allControllers.count-2] != VC3) {
        // if not from VC3, remove VC from stack and put VC3
        allControllers.removeObject(at: allControllers.count - 2)
        allControllers.insert(VC3, at: allControllers.count - 1)
        navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
    }
</code>```

VC2 to VC3 transition

at VC2:

```<code>navigationController!.pushViewController(VC3, animated: true)
</code>```

at VC3: (B)

```<code>override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    if (navigationController!.viewControllers[allControllers.count-2] == VC2) {
        // if from VC2, remove it
        allControllers.removeObject(at: allControllers.count - 2)
        navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
    }
}
</code>```

VC2 to VCX transition

at VC2:

```<code>navigationController!.pushViewController(VCX, animated: true)
</code>```

at VCX: same as (A)

VCX to VC3 transition

at VCX:

```<code>navigationController!.popViewController(animated: true)
</code>```

at VC3: same as (B)

Note viewDidAppear is called when users swipe (left-to-right) to go back and cancel it on the way (== swipe back to left). So, you need some more small code at viewDidAppear against that situation.

If you want the different animation direction, by manipulating stack and using push/pop, you can easily achieve it. This explains how.

Title: Navigation Controller Loop

Body:
It's possible to achieve this kinda transition.

Here, I describe how to implement this with your chart.
As your chart shows, assume you have VC1, VC2, VC3 (top to bottom) and VCX (w/ blue box). You need to define transitions and associated animation directions (push: right-to-left or pop:left-to-right). As your chart, if you define the transitions and animations as:

VC1 to : VC2(push), VCX(push)

VC2 to : VC3(push), VCX(push)

VC3 to : VCX(push)

VCX to : VC3(pop)

and assume we have all of the view controllers instantiated already, then,

VC1 to VC2 transition

at VC1:

navigationController!.pushViewController(VC2, animated: true)

at VC2:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    // remove VC1 from navigation stack (I assume VC1 is not a root VC)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    allControllers.removeObject(at: allControllers.count - 2)
    navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
 }

VC1 to VCX transition

at VC1:

navigationController!.pushViewController(VCX, animated: true)

at VCX: (A)

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    if (navigationController!.viewControllers[allControllers.count-2] != VC3) {
        // if not from VC3, remove VC from stack and put VC3
        allControllers.removeObject(at: allControllers.count - 2)
        allControllers.insert(VC3, at: allControllers.count - 1)
        navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
    }

VC2 to VC3 transition

at VC2:

navigationController!.pushViewController(VC3, animated: true)

at VC3: (B)

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let allControllers = NSMutableArray(array: navigationController!.viewControllers)
    if (navigationController!.viewControllers[allControllers.count-2] == VC2) {
        // if from VC2, remove it
        allControllers.removeObject(at: allControllers.count - 2)
        navigationController!.setViewControllers(allControllers as [AnyObject] as! [UIViewController], animated: false)
    }
}

VC2 to VCX transition

at VC2:

navigationController!.pushViewController(VCX, animated: true)

at VCX: same as (A)

VCX to VC3 transition

at VCX:

navigationController!.popViewController(animated: true)

at VC3: same as (B)

Note viewDidAppear is called when users swipe (left-to-right) to go back and cancel it on the way (== swipe back to left). So, you need some more small code at viewDidAppear against that situation.

If you want the different animation direction, by manipulating stack and using push/pop, you can easily achieve it. This explains how.


问:
How to create column which is generated automatically in relation to primary key which is the foreign key fro
In SQL Server Management Studio, I am creating this table:

```<code>CREATE TABLE Purchase
(
     PurchaseID INT NOT NULL
         FOREIGN KEY REFERENCES Product(ProductID) PRIMARY KEY,
     TotalQuantity INT NOT NULL,
     Price AS (PurchaseID.PRICE),
     TotalPrice AS (TotalQuantity*Price),
     SalesAssistantID INT NOT NULL
         FOREIGN KEY REFERENCES SalesAssistant(SalesAssistantID),
     CashierID INT NOT NULL
         FOREIGN KEY REFERENCES Cashier(CashierID)
)
</code>```

Above code only represents what I want to achieve (Price AS (PurchaseID.PRICE)), Price should be created whenever the PurchaseID is specified so that TotalCost can also function automatically, I could not solve this problem. How to do it?

答:
```<code>PurchaseID int identity(1,1) Primary key
</code>```

This makes purchaseID primary key, and (1,1) Means it will start at 1 and increment by 1.

Body:
In SQL Server Management Studio, I am creating this table:

CREATE TABLE Purchase
(
     PurchaseID INT NOT NULL
         FOREIGN KEY REFERENCES Product(ProductID) PRIMARY KEY,
     TotalQuantity INT NOT NULL,
     Price AS (PurchaseID.PRICE),
     TotalPrice AS (TotalQuantity*Price),
     SalesAssistantID INT NOT NULL
         FOREIGN KEY REFERENCES SalesAssistant(SalesAssistantID),
     CashierID INT NOT NULL
         FOREIGN KEY REFERENCES Cashier(CashierID)
)

Above code only represents what I want to achieve (Price AS (PurchaseID.PRICE)), Price should be created whenever the PurchaseID is specified so that TotalCost can also function automatically, I could not solve this problem. How to do it?

Body:
PurchaseID int identity(1,1) Primary key

This makes purchaseID primary key, and (1,1) Means it will start at 1 and increment by 1.


问:
Mouse scroll wheel with selenium webdriver, on element without scrollbar?
I'm trying to drive part of a web map akin to Google Maps, where zoom in/out is done by scrolling while moused over. Ideally, I'd like to be able to do something like this:

```<code>someElement.scroll(-50)
</code>```

The closest methods I saw in the documentation were click and send_keys, but neither of those do scrolling. I've also tried sending scrolls to the page via Javascript, e.g. driver.execute_script("scroll(0,-50)") This doesn't seem to do anything though.

How can I do this?

答:
On google map, there is a zoom in/out button. You can use it instead of mouse scroll.

//To click on zoom in

```<code>driver.find_element_by_id('widget-zoom-in').click()
</code>```

//To click on zoom out

```<code>driver.find_element_by_id('widget-zoom-out').click()
</code>```

Body:
I'm trying to drive part of a web map akin to Google Maps, where zoom in/out is done by scrolling while moused over. Ideally, I'd like to be able to do something like this:

someElement.scroll(-50)

The closest methods I saw in the documentation were click and send_keys, but neither of those do scrolling. I've also tried sending scrolls to the page via Javascript, e.g. driver.execute_script("scroll(0,-50)") This doesn't seem to do anything though.

How can I do this?

Body:
On google map, there is a zoom in/out button. You can use it instead of mouse scroll.

//To click on zoom in

driver.find_element_by_id('widget-zoom-in').click()

//To click on zoom out

driver.find_element_by_id('widget-zoom-out').click()


问:
Combine Multiple Tables Rows Into Master Table
Happy Monday Everyone!

Have a question and hope you can help. I have a budget spreadsheet that has a budget tab. On this tab is about 8 tables broken down into different categories. Every table in the tab has the exact same columns. Is there a non-vbscript/marco way to create a master table that combines all of the tables into a single table in a different tab. This seems like it would be a no brainer but I have tried everything I can think of and find online and there doesn't seem to be a decent solution without an addon called power query.

答:
You can use the functionality of the pivottable wizard to consolidate multiple ranges (which are your tables) together into one pivottable.

When it prompts for you to add your ranges use the table names with the following syntax: Table4[#All]

You need the [#All] to get all the data associated with the table. Just repeat this for each of your tables names you want to consolidate.

Full description i have given in my answer here:

combining data from two sheets and generating pivot table in another sheet

Note: If you want to keep the original table names or table numbers you will need to select the option:

1) "I will create the Page Fields"

2) Enter the Ranges using the table name e.g. Table4[#All]

3) Select how many page fields do you want 1-4 and add item label used to identify the selected ranges below e.g. Table4.

I am not sure if 4 items is the maximum or if this can be extended through VBA. However you can also use PowerQuery or UnionQuery.

The following quotes are from here: http://www.contextures.com/xlPivot08.html

I include some outline in case links are lost.

PowerQuery:

If you have a version of Excel that supports Microsoft's Power Query add-in, you can use it to combine the data in two or more tables. The tables can be in the same workbook, or in different files.

http://www.contextures.com/xlPivot08.html#videopowerquery

Union Query:

If you can't combine your data on a single worksheet, another solution is to create named ranges in an Excel file, and use Microsoft Query (MS Query) to combine the data.

http://www.contextures.com/xlPivot08.html#union01


问:
How to upgrade from entity framework 4 to EF6?
I want to create an EntityDataModel with Entity Framework 6 but every time I try I get this error:

Your project references an older version of Entity Framework.

I'm using Visual Studio 2013 and my project is Asp.net 4.5.1 web forms project. this is my web.config file, I deleted some sections of this file in order to solve the problem but all in vain.

```<code><?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please   visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

The following attributes can be set on the <httpRuntime> tag.
  <system.Web>
    <httpRuntime targetFramework="4.5.1" />
  </system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5.1">
  <assemblies/>
</compilation>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>
<system.codedom>
<compilers>
  <!--<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
  -->
</compilers>
</system.codedom>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<connectionStrings>
<add name="tebimir_db_tebimEntities" connectionString="metadata=res://*/DataAccessLayer.tebimir_db_tebim.csdl|res://*/DataAccessLayer.tebimir_db_tebim.ssdl|res://*/DataAccessLayer.tebimir_db_tebim.msl;provider=System.Data.SqlClient;provider connection string="data source=tebim.ir,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
 <add name="tebimir_db_tebimEntities_plain" connectionString="data source=185.94.97.58,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;"/>
 </connectionStrings>
 <system.webServer>
 <defaultDocument>
  <files>
    <clear/>
    <add value="index.aspx"/>
  </files>
</defaultDocument>
 <validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="mssqllocaldb"/>
   </parameters>
  </defaultConnectionFactory>
  <providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
   </providers>
  </entityFramework>
 </configuration>
</code>```

答:
Right Click Solution Explorer => Manage Nuget Package => Install
  Entity Framework

Body:
I want to create an EntityDataModel with Entity Framework 6 but every time I try I get this error:

Your project references an older version of Entity Framework.

I'm using Visual Studio 2013 and my project is Asp.net 4.5.1 web forms project. this is my web.config file, I deleted some sections of this file in order to solve the problem but all in vain.

<?xml version="1.0"?>

<configuration>
<configSections>

</configSections>

<system.web>
<compilation debug="true" targetFramework="4.5.1">
  <assemblies/>
</compilation>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>
<system.codedom>
<compilers>

</compilers>
</system.codedom>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<connectionStrings>
<add name="tebimir_db_tebimEntities" connectionString="metadata=res://*/DataAccessLayer.tebimir_db_tebim.csdl|res://*/DataAccessLayer.tebimir_db_tebim.ssdl|res://*/DataAccessLayer.tebimir_db_tebim.msl;provider=System.Data.SqlClient;provider connection string="data source=tebim.ir,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
 <add name="tebimir_db_tebimEntities_plain" connectionString="data source=185.94.97.58,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;"/>
 </connectionStrings>
 <system.webServer>
 <defaultDocument>
  <files>
    <clear/>
    <add value="index.aspx"/>
  </files>
</defaultDocument>
 <validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="mssqllocaldb"/>
   </parameters>
  </defaultConnectionFactory>
  <providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
   </providers>
  </entityFramework>
 </configuration>


问:
database datatype performance: int or string
I'm storing phone country codes. They range from 1 to about 300. What's going to be more performant for datatype: int or string? I'm using SQL server 2008 and linq-to-sql.

Thanks.

答: They are so few that you don't need to be concerned about this, though it would be simpler to apply a check constraint with an integer type.</p>

ContentLicense: CC BY-SA 2.5


答:
[out] means to be created.
[class] is a reference type.</p>

```<code>public void FuncOutParamString(StringBuilder sbValue)
{
    sbValue.Append("wold!");
}

public void FuncOutParamStringRef(ref StringBuilder sbValue)
{
    //if(...)
        sbValue = new StringBuilder();
}

public void FuncOutParamStringOut(out StringBuilder sbValue)
{
    sbValue = new StringBuilder();
}
</code>```

Title: How to use output parameter with StringBuilder?

Body:
[out] means to be created.
[class] is a reference type.

public void FuncOutParamString(StringBuilder sbValue)
{
    sbValue.Append("wold!");
}

public void FuncOutParamStringRef(ref StringBuilder sbValue)
{
    //if(...)
        sbValue = new StringBuilder();
}

public void FuncOutParamStringOut(out StringBuilder sbValue)
{
    sbValue = new StringBuilder();
}


问:
Postman - How to see request with headers and body data with variables substituted
I am using the Postman Chrome plugin to invoke HTTP requests for software testing. I use the Environments feature with Environment and Global Variables to substitute variables in my requests headers and body.

The variable substitution is working correctly (I can tell as the responses from the HTTP Server indicate that).

However, I would like to be able to see the Request Header and Body values AFTER the variables have been substituted. How can I do that?

答: As of now, Postman comes with its own "Console." Click the terminal-like icon on the bottom left to open the console. Send a request, and you can inspect the request from within Postman's console.

ContentLicense: CC BY-SA 4.0


问:
How to store onchange selected dropdown value into hidden input field?
This is my jquery ajax code where i have done dropdown populated things and storing onchange id into hidden input field.Why is it not storing into id field? I checked in alert if the value is coming or not. Value is coming but it's not storing into hidden field.

```<code><script type="text/javascript">
$(document).ready(function() {
     $("#village").change(function(){
            $('#hiddenVillage').val( $(this).val());// this code to store id into this field
    });
    $('#taluka').change(function()
            {
            var myObject = {talukaid: $(this).val(),districtid: $('#district').val(), state_id:$('#stateDrop').val()};
            var cpytaluka= $(this).val();
            $('#hiddenTaluka').val($(this).val(cpytaluka));// this code to store id into this field
            $.ajax({
                  type : "get",
                  url : "villages.htm",
                  data : myObject,
                  success : function(response) {
                    $('#village').append(response);
             },
                 error : function(e) {
                  alert('Error: ' + e);
                 }
            });
    });
     $('#district').change(function()
                {
                var myObject = {districtid: $(this).val(), state_id:$('#stateDrop').val()};
                var cpydistrict= $(this).val();
                $("#hiddenDistrict").val($(this).val(cpydistrict));// this code to store id into this field
                $.ajax({
                      type : "get",
                      url : "taluka.htm",
                      data : myObject,
                      success : function(response) {
                        $('#taluka').append(response);
                 },
                     error : function(e) {
                      alert('Error: ' + e);
                     }

                });

        });
         $('#stateDrop').change(function()
        {
                     var state = $(this).val();
                    $("#hiddenstate").val(state);// this code to store id into this field
                      $.ajax({
                      type : "get",
                      url : "district.htm",
                      data : "State_ID=" + state,
                      success : function(response) {
                        $('#district').append(response);
                 },
                     error : function(e) {
                      alert('Error: ' + e);
                     }
                });
            });
        });
</script>
</code>```

This is my form where i have included input field below every dropdown field

```<code><form action="search-Leaders-list" id="searchleader" method="GET">
    <div class="row">
        <div class="form-group col-lg-3">
            <select id="stateDrop"
                title="State <i class="fa fa-angle-down"></i>">
                <option value="small">State</option>
                <c:forEach items="${stateList}" var="state">
                    <option value="${state.state_Id}">${state.state_Name}</option>
                </c:forEach>
            </select> <input type="hidden" id="hiddenstate">
        </div>
        <div class="form-group col-lg-3">
            <select id="district">
                <option value="small">District</option>
            </select> <input type="hidden" id="hiddenDistrict">
        </div>
        <div class="form-group col-lg-2">
            <select id="taluka">
                <option value="small">Taluka</option>
            </select> <input type="hidden" id="hiddenTaluka">
        </div>
        <div class="form-group col-lg-2">
            <select id="village"
                title="Villages <i class="fa fa-angle-down"></i>">
                <option value="small">Villages</option>
            </select> <input type="hidden" id="hiddenVillage">
        </div>
        <div class="form-group col-lg-2">
            <input type="submit" value="Search" class="submit">
        </div>
    </div>
</form>
</code>```

Kindly please help me.

答:
i don't really get your question. if you want to get the id of this dropdown box and save it in the hidden field.

```<code>$('#taluka').change(function()
        {

        $('#hiddenTaluka').val(this.id);
</code>```

or
using

```<code> $('#hiddenTaluka').val($(this).attr('id'));
</code>```

if you want to store the value of dropbox selected item.

```<code> var cpydistrict= $(this).val();
            $("#hiddenDistrict").val(cpydistrict);
</code>```

Body:
This is my jquery ajax code where i have done dropdown populated things and storing onchange id into hidden input field.Why is it not storing into id field? I checked in alert if the value is coming or not. Value is coming but it's not storing into hidden field.

This is my form where i have included input field below every dropdown field

<form action="search-Leaders-list" id="searchleader" method="GET">

            <select id="stateDrop"
                title="State ">
                <option value="small">State</option>
                <c:forEach items="${stateList}" var="state">
                    <option value="${state.state_Id}">${state.state_Name}</option>
                </c:forEach>
            </select> <input type="hidden" id="hiddenstate">

            <select id="district">
                <option value="small">District</option>
            </select> <input type="hidden" id="hiddenDistrict">

            <select id="taluka">
                <option value="small">Taluka</option>
            </select> <input type="hidden" id="hiddenTaluka">

            <select id="village"
                title="Villages ">
                <option value="small">Villages</option>
            </select> <input type="hidden" id="hiddenVillage">

            <input type="submit" value="Search" class="submit">

</form>

Kindly please help me.

Body:
i don't really get your question. if you want to get the id of this dropdown box and save it in the hidden field.

$('#taluka').change(function()
        {

        $('#hiddenTaluka').val(this.id);

or
using

 $('#hiddenTaluka').val($(this).attr('id'));

if you want to store the value of dropbox selected item.

 var cpydistrict= $(this).val();
            $("#hiddenDistrict").val(cpydistrict);


问:
How to auto-select the first option in a dropdown list using jquery?
I'm having trouble auto-selecting the first option in a dropdown list.

I've tried using attr and val function (see this jdfiddle link for an example) and it just wouldn't work. As a a test, my example has an  alert code that displays the .text() for the first option and this works fine. So my selector is working.

Thanks a lot!

sample HTML code:

```<code><select id="rt" name="rt" style="width: 300px;">
  <option value="blank" selected="selected">- Select a fruit -</option>
  <option value="20270">Apple</option>
  <option value="20271">Banana</option>
  <option value="20273">Grapes</option>
</select>
<br>
<select id="rs" name="rs" style="width: 300px;">
  <option value="blank" selected="selected">- Select a car -</option>
  <option value="20226">Toyota</option>
  <option value="20227">Chevy</option>
  <option value="20228">Mazda</option>
</select>
</code>```

sample JS  code:

```<code>$("#rs").on("change", function() {
    alert("rt: "+$("#rt option:first-child").text());
    $("#rt option:first-child").attr("selected", "selected");
    //$("#rt option:first-child").val("blank");
});
</code>```

答:
Please try this</p>

```<code>$('select>option:eq(0)').prop('selected', true);
</code>```

Body:
I'm having trouble auto-selecting the first option in a dropdown list.

I've tried using attr and val function (see this jdfiddle link for an example) and it just wouldn't work. As a a test, my example has an  alert code that displays the .text() for the first option and this works fine. So my selector is working.

Thanks a lot!

sample HTML code:

<select id="rt" name="rt" style="width: 300px;">
  <option value="blank" selected="selected">- Select a fruit -</option>
  <option value="20270">Apple</option>
  <option value="20271">Banana</option>
  <option value="20273">Grapes</option>
</select>

<select id="rs" name="rs" style="width: 300px;">
  <option value="blank" selected="selected">- Select a car -</option>
  <option value="20226">Toyota</option>
  <option value="20227">Chevy</option>
  <option value="20228">Mazda</option>
</select>

sample JS  code:

$("#rs").on("change", function() {
    alert("rt: "+$("#rt option:first-child").text());
    $("#rt option:first-child").attr("selected", "selected");
    //$("#rt option:first-child").val("blank");
});

Body:
Please try this

$('select>option:eq(0)').prop('selected', true);


问:
Outer Join using multiple Google Sheets and the QUERY function
As an example, say I have the following sheets in the same workbook of a Google Doc:

```<code> SHEET1            |   SHEET2
 \   A  |  B       |   \   A   |   B   |   C   |   D
1|  ID  |Lookup    |  1| Lookup| Name  |Flavor | Color
2|  123 | 4445     |  2| 1234  |Whizzer|Cherry | Red
3|  234 | 4445     |  3| 4445  |Fizzer |Lemon  | Yellow
4|  124 | 1234     |  4| 9887  |Sizzle |Lime   | Blue
5|  767 | 1234     |
6|  555 | 9887     |
</code>```

Obviously, Google Docs isn't made with relational databases in mind, but I am trying to obtain results similar to the SQL query

```<code>SELECT
  SHEET1.ID,
  SHEET2.*
FROM
  SHEET1
    LEFT JOIN
      SHEET2
    ON SHEET1.Lookup = SHEET2.Lookup
</code>```

resulting in a table that looks like

```<code> SHEET3
 \   A    |   B   |   C   |   D   |   E
1|   ID   |Lookup | Name  |Flavor | Color
2|  123   | 4445  |Fizzer |Lemon  | Yellow
3|  234   | 4445  |Fizzer |Lemon  | Yellow
4|  124   | 1234  |Whizzer|Cherry | Red
5|  767   | 1234  |Whizzer|Cherry | Red
6|  555   | 9887  |Sizzle |Lime   | Blue
</code>```

but this is where I stand currently

```<code> SHEET3
 \   A    |   B   |   C   |   D   |   E
1|        |       |       |       |
2|  123   | 4445  | #N/A  |       |
3|  234   | 4445  |       |       |
4|  124   | 1234  |       |       |
5|  767   | 1234  |       |       |
6|  555   | 9887  |       |       |
</code>```

At the moment I have managed to use the QUERY function to grab the values from SHEET1 and have tried a few different QUERY functions in SHEET3!C1 in an attempt to "LEFT JOIN" the two sheets using this blog post as a reference. At this point, the two functions I am using are as follows.

SHEET3!A2=QUERY(SHEET1!A2:B20, "SELECT A,B")

SHEET3!C2=QUERY(SHEET2!A2:E20, "SELECT B,C,D WHERE A="""&B2&"""")

and hovering over the error in C2 reads "Query completed with an empty output". How can I join these sheets?

Additional references:

Google Docs syntax page for QUERY

答:
Sheet3!A2:     </p>

```<code>=ARRAYFORMULA(Sheet1!A2:B20)
</code>```

<p>Sheet3!C2:    </p>

```<code>=ARRAYFORMULA(VLOOKUP(B2:B20,A1:D50,{2,3,4},0))
</code>```

Body:
As an example, say I have the following sheets in the same workbook of a Google Doc:

 SHEET1            |   SHEET2
 \   A  |  B       |   \   A   |   B   |   C   |   D
1|  ID  |Lookup    |  1| Lookup| Name  |Flavor | Color
2|  123 | 4445     |  2| 1234  |Whizzer|Cherry | Red
3|  234 | 4445     |  3| 4445  |Fizzer |Lemon  | Yellow
4|  124 | 1234     |  4| 9887  |Sizzle |Lime   | Blue
5|  767 | 1234     |
6|  555 | 9887     |

Obviously, Google Docs isn't made with relational databases in mind, but I am trying to obtain results similar to the SQL query

SELECT
  SHEET1.ID,
  SHEET2.*
FROM
  SHEET1
    LEFT JOIN
      SHEET2
    ON SHEET1.Lookup = SHEET2.Lookup

resulting in a table that looks like

 SHEET3
 \   A    |   B   |   C   |   D   |   E
1|   ID   |Lookup | Name  |Flavor | Color
2|  123   | 4445  |Fizzer |Lemon  | Yellow
3|  234   | 4445  |Fizzer |Lemon  | Yellow
4|  124   | 1234  |Whizzer|Cherry | Red
5|  767   | 1234  |Whizzer|Cherry | Red
6|  555   | 9887  |Sizzle |Lime   | Blue

but this is where I stand currently

 SHEET3
 \   A    |   B   |   C   |   D   |   E
1|        |       |       |       |
2|  123   | 4445  | #N/A  |       |
3|  234   | 4445  |       |       |
4|  124   | 1234  |       |       |
5|  767   | 1234  |       |       |
6|  555   | 9887  |       |       |

At the moment I have managed to use the QUERY function to grab the values from SHEET1 and have tried a few different QUERY functions in SHEET3!C1 in an attempt to "LEFT JOIN" the two sheets using this blog post as a reference. At this point, the two functions I am using are as follows.

SHEET3!A2=QUERY(SHEET1!A2:B20, "SELECT A,B")

SHEET3!C2=QUERY(SHEET2!A2:E20, "SELECT B,C,D WHERE A="""&B2&"""")

and hovering over the error in C2 reads "Query completed with an empty output". How can I join these sheets?

Additional references:

Google Docs syntax page for QUERY

Body:
Sheet3!A2:

=ARRAYFORMULA(Sheet1!A2:B20)

Sheet3!C2:

=ARRAYFORMULA(VLOOKUP(B2:B20,A1:D50,{2,3,4},0))


问:
Error Kendo UI Chart graph e.slice is not a function
Hi i am trying to graph using Kendo Chart but it gives me a error:

```<code> var datosConFormato={}
            for(var x=0;x<datos.datos.length;x++){
                var dato={};
                dato.DIA=datos.datos[x][0];
                dato.TOTAL=datos.datos[x][1];
                datosConFormato[x]=dato;
            }

            $("#chartEvolucion").kendoChart({
                chartArea: {
                    height: 200
                },
                dataSource: {
                    data: datosConFormato
                },
                legend: {
                     position: "bottom"
                 },
                series: [{
                    type: "column",
                    field: "TOTAL",
                    name: "Total de consultas por días"
                }],
                seriesColors: ["#03a9f4"],
                tooltip: {
                    visible: true,
                    template: "#= dataItem.DIA # - ${ value } Consulta(s)"
                }
            });
</code>```

And the error:

```<code> Uncaught TypeError: e.slice is not a function
at init.success (kendo.all.min.js:11)
at Object.success (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at kendo.all.min.js:11
at init._queueRequest (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at init.query (kendo.all.min.js:11)
at init._query (kendo.all.min.js:11)
at init.fetch (kendo.all.min.js:11)
at init._initDataSource (kendo.all.min.js:58)
</code>```

It does not throw values into the plane
DIA is a String and TOTAL a number, what is wrong?

答:
Can you try to add ".d" to the datasource binding. I had similar issue when i migrated from .net 2.0 to .net 4.5 adding ".d" resolve my issue i don't know why, but you can give a try.</p>

```<code>dataSource: {
                data: datosConFormato.d
            }
</code>```

Body:
Hi i am trying to graph using Kendo Chart but it gives me a error:

 var datosConFormato={}
            for(var x=0;x<datos.datos.length;x++){
                var dato={};
                dato.DIA=datos.datos[x][0];
                dato.TOTAL=datos.datos[x][1];
                datosConFormato[x]=dato;
            }

            $("#chartEvolucion").kendoChart({
                chartArea: {
                    height: 200
                },
                dataSource: {
                    data: datosConFormato
                },
                legend: {
                     position: "bottom"
                 },
                series: [{
                    type: "column",
                    field: "TOTAL",
                    name: "Total de consultas por días"
                }],
                seriesColors: ["#03a9f4"],
                tooltip: {
                    visible: true,
                    template: "#= dataItem.DIA # - ${ value } Consulta(s)"
                }
            });

And the error:

 Uncaught TypeError: e.slice is not a function
at init.success (kendo.all.min.js:11)
at Object.success (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at kendo.all.min.js:11
at init._queueRequest (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at init.query (kendo.all.min.js:11)
at init._query (kendo.all.min.js:11)
at init.fetch (kendo.all.min.js:11)
at init._initDataSource (kendo.all.min.js:58)

It does not throw values into the plane
DIA is a String and TOTAL a number, what is wrong?

Body:
Can you try to add ".d" to the datasource binding. I had similar issue when i migrated from .net 2.0 to .net 4.5 adding ".d" resolve my issue i don't know why, but you can give a try.

dataSource: {
                data: datosConFormato.d
            }


问:
AMP: Accelerated Mobile Pages in an already developed site
I have an umbraco based CMS site and I've been advised to use AMP for fast mobile performance. I have read the demo page from this gitHub link.

But I am not understanding how to set it in an already developed site. Do I need to change all tags according to AMP?

答:
You can have seperate AMP pages and google will handle the rest. I think that is the safest way to approach it, without having a plugin like they have for wordpress.

You can still enable the users to use the CMS functionality by creating custom data types for e.g. amp-img instead of img. The content editors will just have to be briefed on the basics of AMP.

References:

https://carolelogan.net/blog/amp-implementation-in-umbraco/

https://www.ampproject.org/docs/guides/discovery


答:
The following code will select the first element of the #rs after you select one from rt.  I believe this is what you want.  I suspect the names are mixed up (as most forms go from top to bottom). If you desire the reverse, just comment.

$("#rt").on("change", function() {
 $('#rs').find('option:eq(1)').prop('selected', true)
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><select id="rt" name="rt" style="width: 300px;">
  <option value="blank" selected="selected">- Select a fruit -</option>
  <option value="20270">Apple</option>
  <option value="20271">Banana</option>
  <option value="20273">Grapes</option>
</select>
<br>
<select id="rs" name="rs" style="width: 300px;">
  <option value="blank" selected="selected">- Select a car -</option>
  <option value="20226">Toyota</option>
  <option value="20227">Chevy</option>
  <option value="20228">Mazda</option>
</select></code>```

Title: How to auto-select the first option in a dropdown list using jquery?

Body:
The following code will select the first element of the #rs after you select one from rt.  I believe this is what you want.  I suspect the names are mixed up (as most forms go from top to bottom). If you desire the reverse, just comment.

$("#rt").on("change", function() {
 $('#rs').find('option:eq(1)').prop('selected', true)
});

<select id="rt" name="rt" style="width: 300px;">
  <option value="blank" selected="selected">- Select a fruit -</option>
  <option value="20270">Apple</option>
  <option value="20271">Banana</option>
  <option value="20273">Grapes</option>
</select>
<br>
<select id="rs" name="rs" style="width: 300px;">
  <option value="blank" selected="selected">- Select a car -</option>
  <option value="20226">Toyota</option>
  <option value="20227">Chevy</option>
  <option value="20228">Mazda</option>
</select>


问:
How to know our application is active or idle?
I want to set auto timeout scenario in my application after "x" mins. I tried with timer call using schedule timer (after "x" mins). User is reading a T&C page with scrollable/tap state also timer is triggered. But I'm expecting timer call when user doesn't do any action(touch, scroll). simply if user doesn't touch the screen for specified period of time, I need to call timeout popup. I want to handle this timeout scenario for my entire application. </p>

答:
You can use UITapGestureRecognizer on UIWindow which receives touches on screen.
Here i have added timer for 5 second after that timeOut function will call.

Add UIGestureRecognizerDelegate in Appdelegate

```<code>   var window: UIWindow?
    var timer: Timer?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        let tapGesture = UITapGestureRecognizer(target: self, action: nil)
        tapGesture.delegate = self
        window?.addGestureRecognizer(tapGesture)
       //Start timer for first time
        timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.timeOut), userInfo: nil, repeats: false)
        return true
    }

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
        print(" tapped on screen,")
        timer?.invalidate()
        //set Timer Ex: 5 Second
        //Run timer on touch
        timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.update), userInfo: nil, repeats: false)
        return false
    }
    @objc func timeOut() {
        print("TimeOut")
    }
</code>```

Body:
You can use UITapGestureRecognizer on UIWindow which receives touches on screen.
Here i have added timer for 5 second after that timeOut function will call.

Add UIGestureRecognizerDelegate in Appdelegate

   var window: UIWindow?
    var timer: Timer?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        let tapGesture = UITapGestureRecognizer(target: self, action: nil)
        tapGesture.delegate = self
        window?.addGestureRecognizer(tapGesture)
       //Start timer for first time
        timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.timeOut), userInfo: nil, repeats: false)
        return true
    }

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
        print(" tapped on screen,")
        timer?.invalidate()
        //set Timer Ex: 5 Second
        //Run timer on touch
        timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.update), userInfo: nil, repeats: false)
        return false
    }
    @objc func timeOut() {
        print("TimeOut")
    }


问:
UIPageViewController with previous and next buttons
How to add previous and next buttons to UIPageViewController and only on button click the page should change with horizontal scroll effect. Can anyone suggest me any tutorial to refer?
As I am new to Swift, I don't know how to implement this. Please help..</p>

答:
here you can do it as using Buttons:

```<code>func addUIButton(){
        //next button
        let myButton = UIButton()
        myButton.setTitle("Next", for: UIControlState.normal)
        myButton.setTitleColor(UIColor.red, for: .normal)
        myButton.frame = CGRect(x: self.view.frame.size.width - 50, y: self.view.frame.size.height/2 - 50, width: 50, height: 50)
        myButton.addTarget(self, action: #selector(pagesViewController.pressed(sender:)), for: .touchUpInside)
        self.view.addSubview(myButton)
        self.view.bringSubview(toFront: myButton)
    }
    func addSecondUIButton(){
        //previous button
        let myButton = UIButton()
        myButton.setTitle("Previous", for: UIControlState.normal)
        myButton.setTitleColor(UIColor.red, for: .normal)
        myButton.frame = CGRect(x: 20, y: self.view.frame.size.height/2 - 50, width: 100, height: 50)
        myButton.addTarget(self, action: #selector(pagesViewController.Secondpressed(sender:)), for: .touchUpInside)
        self.view.addSubview(myButton)
        self.view.bringSubview(toFront: myButton)
    }
</code>```

Button handlers:

```<code>func pressed(sender: UIButton!) { //next button
        switch VC.CurrentVC {
        case page1:
            VC.CurrentVC = page2
            getNextVC(newIndex: page2)

            break
        case page2:
            VC.CurrentVC = page3
            getNextVC(newIndex: page3)

            break
        case page3:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

            break
        default:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

        }
    }
    func Secondpressed(sender: UIButton!) { //previous button
        switch VC.CurrentVC {
        case page1:
            VC.CurrentVC = page3
            getNextVC(newIndex: page3)

            break
        case page3:
            VC.CurrentVC = page2
            getNextVC(newIndex: page2)

            break
        case page2:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

            break
        default:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

        }
    }
</code>```

Method that handles to move to nextVC

```<code>func getNextVC(newIndex: UIViewController){

        setViewControllers([newIndex], direction: UIPageViewControllerNavigationDirection.forward, animated: false, completion: nil)
    }
</code>```

Struct Class:
    //to store current vc

```<code>import Foundation

import UIKit

struct VC {
    static var CurrentVC = UIViewController()
}
</code>```

Demo Project link - https://drive.google.com/open?id=1pWLMcU2eny65zqdjxOMbnry2FwhkRjye

For reference check this link

Output screenshot

Body:
here you can do it as using Buttons:

func addUIButton(){
        //next button
        let myButton = UIButton()
        myButton.setTitle("Next", for: UIControlState.normal)
        myButton.setTitleColor(UIColor.red, for: .normal)
        myButton.frame = CGRect(x: self.view.frame.size.width - 50, y: self.view.frame.size.height/2 - 50, width: 50, height: 50)
        myButton.addTarget(self, action: #selector(pagesViewController.pressed(sender:)), for: .touchUpInside)
        self.view.addSubview(myButton)
        self.view.bringSubview(toFront: myButton)
    }
    func addSecondUIButton(){
        //previous button
        let myButton = UIButton()
        myButton.setTitle("Previous", for: UIControlState.normal)
        myButton.setTitleColor(UIColor.red, for: .normal)
        myButton.frame = CGRect(x: 20, y: self.view.frame.size.height/2 - 50, width: 100, height: 50)
        myButton.addTarget(self, action: #selector(pagesViewController.Secondpressed(sender:)), for: .touchUpInside)
        self.view.addSubview(myButton)
        self.view.bringSubview(toFront: myButton)
    }

Button handlers:

func pressed(sender: UIButton!) { //next button
        switch VC.CurrentVC {
        case page1:
            VC.CurrentVC = page2
            getNextVC(newIndex: page2)

            break
        case page2:
            VC.CurrentVC = page3
            getNextVC(newIndex: page3)

            break
        case page3:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

            break
        default:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

        }
    }
    func Secondpressed(sender: UIButton!) { //previous button
        switch VC.CurrentVC {
        case page1:
            VC.CurrentVC = page3
            getNextVC(newIndex: page3)

            break
        case page3:
            VC.CurrentVC = page2
            getNextVC(newIndex: page2)

            break
        case page2:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

            break
        default:
            VC.CurrentVC = page1
            getNextVC(newIndex: page1)

        }
    }

Method that handles to move to nextVC

func getNextVC(newIndex: UIViewController){

        setViewControllers([newIndex], direction: UIPageViewControllerNavigationDirection.forward, animated: false, completion: nil)
    }

Struct Class:
    //to store current vc

import Foundation

import UIKit

struct VC {
    static var CurrentVC = UIViewController()
}

Demo Project link - https://drive.google.com/open?id=1pWLMcU2eny65zqdjxOMbnry2FwhkRjye

For reference check this link

Output screenshot


问:
How to specify $HOME folder in sublime-build file?
I am using a custom build system in Sublime Text 3 for a C++ project. One of the lines looks like

```<code>"-I${HOME}/my_file/include"
</code>```

The problem is that ${HOME} does not expand to the actual /home/user_x, but expands to an empty string ''. I cannot find any way of specifying the HOME folder elegantly, without the need to write the actual path. Is there a way of doing this? I.e., to expand the UNIX $HOME variable to the actual location of the home folder?

答:
What you're running afoul of here is that the cmd, shell_cmd and working_dir arguments are all subject to variable expansion in build systems.

What's not outlined there is that anything of this format is treated as a variable when the expansion happens, and unknown variables are expanded to an empty string (i.e. no value).

As such, Sublime sees your ${HOME} and tries to expand it, which unhelpfully removes it's value from the string.

The easiest and least invasive way around this is to quote the $ character in the variable expansion so that Sublime will ignore it and pass it through, where the shell can expand it as appropriate:

{
    "shell_cmd": "echo Home is \\${HOME}"
}
```

<p>or</p>

<pre class="lang-json prettyprint-override"><code>{
    "cmd": "echo Home is \\${HOME}",
    "shell": true
}
</code>```

Note that as seen in these examples you need to use either shell_cmd with a complete command string or cmd with a command string in combination with shell being set to true in order for this to work.

Note also that the quoting appears to be doubled because the build file is JSON. So when the build is loaded, \\${HOME} is internally seen by Sublime as \${HOME} (i.e. it "eats" the first level of quoting), and the final quoting causes Sublime to treat the $ as a literal and not special so that it will be passed to the shell, which expands it itself.

Body:
I am using a custom build system in Sublime Text 3 for a C++ project. One of the lines looks like

"-I${HOME}/my_file/include"

The problem is that ${HOME} does not expand to the actual /home/user_x, but expands to an empty string ''. I cannot find any way of specifying the HOME folder elegantly, without the need to write the actual path. Is there a way of doing this? I.e., to expand the UNIX $HOME variable to the actual location of the home folder?

Body:
What you're running afoul of here is that the cmd, shell_cmd and working_dir arguments are all subject to variable expansion in build systems.

What's not outlined there is that anything of this format is treated as a variable when the expansion happens, and unknown variables are expanded to an empty string (i.e. no value).

As such, Sublime sees your ${HOME} and tries to expand it, which unhelpfully removes it's value from the string.

The easiest and least invasive way around this is to quote the $ character in the variable expansion so that Sublime will ignore it and pass it through, where the shell can expand it as appropriate:

{
    "shell_cmd": "echo Home is \\${HOME}"
}

or

{
    "cmd": "echo Home is \\${HOME}",
    "shell": true
}

Note that as seen in these examples you need to use either shell_cmd with a complete command string or cmd with a command string in combination with shell being set to true in order for this to work.

Note also that the quoting appears to be doubled because the build file is JSON. So when the build is loaded, \\${HOME} is internally seen by Sublime as \${HOME} (i.e. it "eats" the first level of quoting), and the final quoting causes Sublime to treat the $ as a literal and not special so that it will be passed to the shell, which expands it itself.


问:
Jenkins Plugins are missing in Available tab
While setting up the Jenkins, I skipped the plugins installation in the wizard. Now I am trying to install it manually. I searched a lot and came to know that I can install it through the web in Manage Jenkins -> Plugin Manager -> Available tab. No plugins are available here. I even typed plugin names in filter but still could not succeed.

Here I am trying to install Git Plugin.

When I click on Check now button, It throws some below Java exception.

Full Stack Trace

```<code>sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
Caused: javax.net.ssl.SSLHandshakeException
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
    at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:190)
    at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1624)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
    at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52)
    at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$2.doDispatch(MetaClass.java:186)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:85)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:616)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
</code>```

Can somebody assist me with the plugin installation?

答:
When you are installing & configuring Jenkins, by default it points updates.jenkins.io plugins site.

If your Jenkins master can access the Internet, installing plugins is easy.

Looks like either you have skipped or don't have access to internet on your machine from where you are doing installation.

Probably you can give it a try by Navigating to the Manage Jenkins > Manage Plugins page in the web UI & Click on the Advanced tab.

Hit 'Çheck Now' button to retrieve plugins again - which then becomes available in 'Available' tab. Optionally you can also point to any nexus artifact repo & have that certificate authorized to get list of plugins as well.

Another alternative is to manually load required '.hpi' plugins along with dependent plugins if you have locally on your system by locating under file system & doing a upload.

Reference: https://jenkins.io/doc/book/managing/plugins/

Body:
While setting up the Jenkins, I skipped the plugins installation in the wizard. Now I am trying to install it manually. I searched a lot and came to know that I can install it through the web in Manage Jenkins -> Plugin Manager -> Available tab. No plugins are available here. I even typed plugin names in filter but still could not succeed.

Here I am trying to install Git Plugin.

When I click on Check now button, It throws some below Java exception.

Full Stack Trace

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
Caused: javax.net.ssl.SSLHandshakeException
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
    at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:190)
    at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1624)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
    at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52)
    at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$2.doDispatch(MetaClass.java:186)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:85)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:616)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

Can somebody assist me with the plugin installation?


问:
When I navigate to the view controller containing ARSCNView a blank screen appears
When I navigate to the view controller containing ARSCNView a blank screen appears instead of camera view, with all other UI Elements visible partially (transparent)

This is my code for navigating to the next ViewController

let

```<code>secondViewController = storyboard?.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
self.present(secondViewController, animated: true, completion: nil)
</code>```

答: Since ARSCNView uses camera you have to add permission request in plist file. Add "Privacy - Camera Usage Description" in order to be able to use camera. </p>

Body:
When I navigate to the view controller containing ARSCNView a blank screen appears instead of camera view, with all other UI Elements visible partially (transparent)

This is my code for navigating to the next ViewController

let

secondViewController = storyboard?.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
self.present(secondViewController, animated: true, completion: nil)