问:
HTML Buttons Clicks sequential or parallel?
Is the click handling/detection for html buttons sequential or parallel? I already googled this topic but didn't find any usefull articles.</p>

答:
"asynchronous" means "Does something later, in response to something".

A click event listener causes something to happen later, in response to a click.

It is therefore asynchronous.


来源: stackexchange

问:
R and gganimate: How to change the title
Good morning SO community,
I have the following snippet of code:

```<code>library( animation )
library( dplyr )
library( gganimate )
library( ggplot2 )

someData = data.frame( years = seq( -5000, 1000, by = 100 ) ) %>%
mutate( values = sample( 1:20, length( years ), replace = TRUE ),
      label = ifelse( years < 0, paste0( abs( years ), ' B.C.E.' ), years ) )

chart = ggplot( someData ) +
geom_line( aes( x = years, y = values, frame = years, cumulative = TRUE ) ) +
ggtitle( 'Year:  ' )

gganimate( chart, interval = .2 )
</code>```

This way, the years appear in the title of the plot (numerically ordered).
Is there a way to put the label values - in the same order they appear in the data frame - instead?

My first try was to use frame = label in the aesthetics of geom_line but the labels appeared in alphabetical order. So, I tried to change the levels order through:

```<code>someData$label = factor( someData$label, levels = someData$label, order = TRUE )
</code>```

but this gave me the following error:

```<code>Error in frame_vec == f : comparison of these types is not implemented
In addition: Warning message:
In FUN(X[[i]], ...) :
Incompatible methods ("Ops.ordered", "Ops.factor") for "=="
</code>```

Any help would be much appreciated, thanks.

答:
There is actually a pending pull request concerning this functionality, but it hasn't been merged into the original repo yet. In the meantime, you could install the modified package using devtools::install_github("nteetor/gganimate"), and then you can do:

```<code>gg_animate(chart, title_frame = ~ with(someData, label[years == .]))
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Good morning SO community,
I have the following snippet of code:

library( animation )
library( dplyr )
library( gganimate )
library( ggplot2 )

someData = data.frame( years = seq( -5000, 1000, by = 100 ) ) %>%
mutate( values = sample( 1:20, length( years ), replace = TRUE ),
      label = ifelse( years < 0, paste0( abs( years ), ' B.C.E.' ), years ) )

chart = ggplot( someData ) +
geom_line( aes( x = years, y = values, frame = years, cumulative = TRUE ) ) +
ggtitle( 'Year:  ' )

gganimate( chart, interval = .2 )

This way, the years appear in the title of the plot (numerically ordered).
Is there a way to put the label values - in the same order they appear in the data frame - instead?

My first try was to use frame = label in the aesthetics of geom_line but the labels appeared in alphabetical order. So, I tried to change the levels order through:

someData$label = factor( someData$label, levels = someData$label, order = TRUE )

but this gave me the following error:

Error in frame_vec == f : comparison of these types is not implemented
In addition: Warning message:
In FUN(X[[i]], ...) :
Incompatible methods ("Ops.ordered", "Ops.factor") for "=="

Any help would be much appreciated, thanks.

Body:
There is actually a pending pull request concerning this functionality, but it hasn't been merged into the original repo yet. In the meantime, you could install the modified package using devtools::install_github("nteetor/gganimate"), and then you can do:

gg_animate(chart, title_frame = ~ with(someData, label[years == .]))


问:
Why are project layout resources kept separate from Java sources?
Why does maven keep resources in a separate "source folder" from the Java sources?

From my experience, in Java the resource files are mostly treated like Java source files which, when "compiled", just need to be copied as-is with the classes, and eventually packaged in the jar, and accessed by the classloader's methods getResource/getResourceAsStream, via the classpath.

Personally I find it a useless complexity to keep resource files separate from Java sources.

What do you think?

Is there a good reason why maven keeps resources separate from sources?

Is there any counter indication in not using src/main/resources and src/test/resources and keeping
resources in src/main/java and src/test/java using maven?

答:
I think that code/resources separation is often useful:

Packages must follow Java specification rules, for example reserved word, like 'int', is not allowed. Having illegal packages in source code folder would be confusing.

Resources has instance nature, classes has, well, classes nature. For example you may have classes Continent and Country in the same package but resources better organize as tree:

africa/

morocco.txt

kenya.txt

europe/

poland.txt

Resources structure, in my opinion, is more stable than code structure. Code refactoring happens often, classes move from package to package for better readability. Obligation to move resources on refactoring discourages developer from refactor.

If separated resource folder is required even only for 1% of resource files, is reasonable to move remaining 99% to that folder and keep resources in single place only.

However, there are cases when keeping resources and java code together is useful. For example unit tests compares input and output - nice to have file with input and output in the same folder as unit test code.

ContentLicense: CC BY-SA 4.0


问:
MSBuild Your project.json doesn't have a runtimes section
I have an issue with MSBuild which give this message:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win10-x86-aot": { } }' to your project.json and then re-run NuGet restore.

I found several issues as the mine on StackOverflow and the solution seems to be to delete the obj folder but it was not the same context.

I installed only MSBuild for Visual Studio 2017 (so, without Visual Studio) for using it with Jenkins. My Jenkins master is installed on a Mac OS, and MSBuild is installed on a Windows 10 PC which is used only to do this job.
If I use my development machine (Windows 10 laptop with Visual Studio 2017) as Jenkins remote agent and I launch the build from Jenkins portal, it works well, but if I use the other PC with MSBuild, I have this issue.

答: Okay, so I solved my issue adding a  section in my CSPROJ, according to the MSDN documentation here</p>


问:
Module Pattern still necessary now that javascript has native 'classes"
The Module pattern is used to mimic the concept of classes (since JavaScript doesn’t natively support classes) so that we can store both public and private methods and variables inside a single object.

Is this still pattern still necessary now that javascript has it's own native classes?

答:
The module pattern isn't only (or even primarily) used to mimic classes. It's proper modules, not classes, that make the old module pattern likely to become...if not obsolete, then a lot less-used, in the next few years. Those and private methods (which are currently a Stage 3 proposal) and perhaps to an extent private fields (also Stage 3).

But prior to proper modules, or sometimes even concurrent with them, you'd still use it if you want to have private functions or data or similar related to something which isn't private. Example:

```<code>const Foo = (function() {
    function privateFunction(x) {
        return /*...do something with `x`...*/;
    }

    class Foo {
        dosomething(x) {
            return privateFunction(x) ? "a" : "b";
        }
    }
    return Foo;
})();
</code>```

I'll also note that sometimes, you might use an anonymous block rather than an IIFE, since class, const, and let have block scope. I wouldn't above because I'd have to make the outer Foo non-constant (so I could assign to it in the block), but there are other times when it might apply...

Body:
The module pattern isn't only (or even primarily) used to mimic classes. It's proper modules, not classes, that make the old module pattern likely to become...if not obsolete, then a lot less-used, in the next few years. Those and private methods (which are currently a Stage 3 proposal) and perhaps to an extent private fields (also Stage 3).

But prior to proper modules, or sometimes even concurrent with them, you'd still use it if you want to have private functions or data or similar related to something which isn't private. Example:

const Foo = (function() {
    function privateFunction(x) {
        return /*...do something with `x`...*/;
    }

    class Foo {
        dosomething(x) {
            return privateFunction(x) ? "a" : "b";
        }
    }
    return Foo;
})();

I'll also note that sometimes, you might use an anonymous block rather than an IIFE, since class, const, and let have block scope. I wouldn't above because I'd have to make the outer Foo non-constant (so I could assign to it in the block), but there are other times when it might apply...


问:
How to check if a data item is empty in Blueprism
I want to check if a data item is empty or not. I am storing some values from clipboard into a data item and want to check if data item is empty or contains some text.</p>

答:
What I've done is determine the length:</p>

```<code>(Len([Cost Centre])>0) AND
(Len([Quantity])>0) AND
(Len([Product Code])>0) AND
(Len([Unit Price])>0)
</code>```

Body:
What I've done is determine the length:

(Len([Cost Centre])>0) AND
(Len([Quantity])>0) AND
(Len([Product Code])>0) AND
(Len([Unit Price])>0)


问:
C#/WPF INotifyPropertyChanged never Open
Huhu,

I read many posts but none was really helpful. So I ask for myself.
Hope someone can help me and I didn't think it a duplicate.

I have a list and this data gets from a Database. The data shows in a Textbox and I want the possibility to change the data. So I write a INotifyPropertyChanged. But it didn't work how I want it. I see always the old value and not the new one.

WPF code:

```<code>    <dxn:NavBarGroup Name="_navBarOverlay" Header="Benutzerübersicht">
            <Grid Style="{StaticResource GridStyleAccordion}">
                <DataGrid x:Name="userDataGrid" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True" AlternatingRowBackground="{DynamicResource WihaGrauB}" ColumnWidth="auto" ColumnHeaderHeight="30"   AutoGenerateColumns="False" Grid.Row="0"   Width="auto" Height="auto">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="OperatorID" Binding="{Binding OperatorID}" MinWidth="200" Width="3*"/>
                        <DataGridTextColumn Header="Benutzer"  Binding="{Binding Name}" MinWidth="150" Width="2*" />
                        <DataGridCheckBoxColumn Header="Aktiv" Binding="{Binding Aktiv}" MinWidth="50" Width="*"/>
                    </DataGrid.Columns>
                    <DataGrid.RowDetailsTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <Button x:Name="deleteButton" DockPanel.Dock="Left" Height="40" Width="30" Click="deleteButton_Click" Margin="10,0,0,0">
                                    <StackPanel>
                                        <Image Source="{Binding ImageUrl}" />
                                    </StackPanel>
                                </Button>
                                <Grid Margin="10">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="OperatorID: " FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="1" FontWeight="Bold" Margin="2,2,2,2"/>
                                    <TextBox x:Name="operatorText" IsReadOnly="True" Text="{Binding OperatorID}" Width="150" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="2" TextAlignment="Center"  Margin="2,2,2,2" />
                                    <TextBlock Text="Name: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="2" Margin="2,2,2,2"/>
                                    <TextBox  x:Name="nameText" Text="{Binding  Path=Name, Mode=TwoWay}" Grid.Column="2" Width="150" MaxLength="128" TextAlignment="Center" HorizontalAlignment="Left" Grid.Row="2"  Margin="2,2,2,2"  />
                                    <TextBlock Text="DeviceID: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="3" Margin="2,2,2,2"/>
                                    <TextBox Text="{Binding DeviceID}" Grid.Column="3" Width="150" HorizontalAlignment="Left" MaxLength="255" TextCompositionManager.PreviewTextInput="passwordBoxNeu_PreviewTextInput" Grid.Row="3" TextAlignment="Center"  Margin="2,2,2,2"/>
                                    <TextBlock Text="Passwort: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="4" Margin="2,2,2,2" />
                                    <TextBox Text="{Binding Passwort}" Grid.Column="4" Width="150" HorizontalAlignment="Left" Grid.Row="4" TextAlignment="Center" MaxLength="4" TextCompositionManager.PreviewTextInput="passwordBoxNeu_PreviewTextInput"  Margin="2,2,2,2"/>
                                    <TextBlock Text="Aktiv:" FontWeight="Bold" FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="5" Margin="2,2,2,2"/>
                                    <CheckBox Grid.Column="5" Grid.Row="5" IsChecked="{Binding Aktiv}" Margin="2,2,2,2" />
                                    <Button Style="{StaticResource ButtonStyleWIHA}" Click="saveUserPanel_Click" Name="saveUserPanel" Content="Save" Grid.Row="6" />
                                </Grid>
                            </DockPanel>
                        </DataTemplate>
                    </DataGrid.RowDetailsTemplate>
                </DataGrid>
            </Grid>
        </dxn:NavBarGroup>
</code>```

User list class:

```<code>    public class User : INotifyPropertyChanged
    {
        private string _name = string.Empty;
        public event PropertyChangedEventHandler PropertyChanged;
        public string Name
        {
            get { return this._name; }
            set
            {
                if (value != this._name)
                {
                    this._name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }
        public string OperatorID { get; set; }
        public bool Aktiv { get; set; }
        public string ImageUrl { get; set; }
        public string DeviceID { get; set; }
        public string Passwort { get; set; }

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
</code>```

My EventHandler:

```<code>     private void saveUserPanel_Click(object sender, RoutedEventArgs e)
    {

        var user = (sender as Button).DataContext as User;

        if (user != null)
        {

            SqlConnection conn = new SqlConnection("Server=127.0.0.1;Database=Wiha;Trusted_Connection=true");
            conn.Open();
            SqlCommand cmd = new SqlCommand("dbo.wiha_operator_Update", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@OperatorID", user.OperatorID));
            cmd.Parameters.Add(new SqlParameter("@DeviceID", user.DeviceID));
            cmd.Parameters.Add(new SqlParameter("@Name", user.Name));
            cmd.Parameters.Add(new SqlParameter("@Password", user.Passwort));
            cmd.Parameters.Add(new SqlParameter("@Active", user.Aktiv));
            using (SqlDataReader rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    if (rdr[0].Equals("S"))
                    {

                        popup = new ToolBox(string.Format("Operator '{0}' wurde bearbeitet.", user.OperatorID));
                        popup.Show();
                        //ShowAllOperator();
                    }
                    else
                    {
                        popup = new ToolBox(string.Format("Fehler beim bearbeiten des Operator '{0}'", user.OperatorID));
                        popup.Show();
                    }

                }
            }

        }
    }

    public void ShowAllOperator()
    {
        try
        {
            List<User> users = new List<User>();
            // string sql = "SELECT * FROM wiha_Operators";
            SqlConnection conn = new SqlConnection("Server=127.0.0.1;Database=Wiha;Trusted_Connection=true");
            conn.Open();
            // SqlCommand cmd = new SqlCommand(sql, conn);
            SqlCommand cmd = new SqlCommand("dbo.wiha_operators_SelectAll", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            using (SqlDataReader rdr = cmd.ExecuteReader())
            {

                while (rdr.Read())
                {
                    users.Add(new User() { Name = rdr.GetValue(2).ToString(), OperatorID = rdr.GetValue(0).ToString(), Aktiv = rdr.GetValue(4).Equals(true), ImageUrl = "C:/Users/Jason/Desktop/DeleteIcon.png", DeviceID = rdr.GetValue(1).ToString(), Passwort = rdr.GetValue(3).ToString() });
                }

            }
            userDataGrid.ItemsSource = users;
        }
        catch (Exception)
        {

            throw;
        }
    }
</code>```

Hope someone can help me :D

答:
You just need to inform how WPF will bind to your data, adding one more information in your binding:

```<code><TextBox Text="{Binding XXXX, UpdateSourceTrigger=PropertyChanged}" />
</code>```

The reason is simple: you are instructing the view to update the source every time you change the Text property. And for the TextBox, that usually only happens when you leave the control.

The NotifyPropertyChanged works on the other way: from your C# code you want to instruct your view to be updated with a new value. Looking at your class, that is only happening at the Name property.

Body:
Huhu,

I read many posts but none was really helpful. So I ask for myself.
Hope someone can help me and I didn't think it a duplicate.

I have a list and this data gets from a Database. The data shows in a Textbox and I want the possibility to change the data. So I write a INotifyPropertyChanged. But it didn't work how I want it. I see always the old value and not the new one.

WPF code:

    <dxn:NavBarGroup Name="_navBarOverlay" Header="Benutzerübersicht">
            <Grid Style="{StaticResource GridStyleAccordion}">
                <DataGrid x:Name="userDataGrid" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True" AlternatingRowBackground="{DynamicResource WihaGrauB}" ColumnWidth="auto" ColumnHeaderHeight="30"   AutoGenerateColumns="False" Grid.Row="0"   Width="auto" Height="auto">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="OperatorID" Binding="{Binding OperatorID}" MinWidth="200" Width="3*"/>
                        <DataGridTextColumn Header="Benutzer"  Binding="{Binding Name}" MinWidth="150" Width="2*" />
                        <DataGridCheckBoxColumn Header="Aktiv" Binding="{Binding Aktiv}" MinWidth="50" Width="*"/>
                    </DataGrid.Columns>
                    <DataGrid.RowDetailsTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <Button x:Name="deleteButton" DockPanel.Dock="Left" Height="40" Width="30" Click="deleteButton_Click" Margin="10,0,0,0">
                                    <StackPanel>
                                        <Image Source="{Binding ImageUrl}" />
                                    </StackPanel>
                                </Button>
                                <Grid Margin="10">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="OperatorID: " FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="1" FontWeight="Bold" Margin="2,2,2,2"/>
                                    <TextBox x:Name="operatorText" IsReadOnly="True" Text="{Binding OperatorID}" Width="150" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="2" TextAlignment="Center"  Margin="2,2,2,2" />
                                    <TextBlock Text="Name: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="2" Margin="2,2,2,2"/>
                                    <TextBox  x:Name="nameText" Text="{Binding  Path=Name, Mode=TwoWay}" Grid.Column="2" Width="150" MaxLength="128" TextAlignment="Center" HorizontalAlignment="Left" Grid.Row="2"  Margin="2,2,2,2"  />
                                    <TextBlock Text="DeviceID: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="3" Margin="2,2,2,2"/>
                                    <TextBox Text="{Binding DeviceID}" Grid.Column="3" Width="150" HorizontalAlignment="Left" MaxLength="255" TextCompositionManager.PreviewTextInput="passwordBoxNeu_PreviewTextInput" Grid.Row="3" TextAlignment="Center"  Margin="2,2,2,2"/>
                                    <TextBlock Text="Passwort: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="4" Margin="2,2,2,2" />
                                    <TextBox Text="{Binding Passwort}" Grid.Column="4" Width="150" HorizontalAlignment="Left" Grid.Row="4" TextAlignment="Center" MaxLength="4" TextCompositionManager.PreviewTextInput="passwordBoxNeu_PreviewTextInput"  Margin="2,2,2,2"/>
                                    <TextBlock Text="Aktiv:" FontWeight="Bold" FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="5" Margin="2,2,2,2"/>
                                    <CheckBox Grid.Column="5" Grid.Row="5" IsChecked="{Binding Aktiv}" Margin="2,2,2,2" />
                                    <Button Style="{StaticResource ButtonStyleWIHA}" Click="saveUserPanel_Click" Name="saveUserPanel" Content="Save" Grid.Row="6" />
                                </Grid>
                            </DockPanel>
                        </DataTemplate>
                    </DataGrid.RowDetailsTemplate>
                </DataGrid>
            </Grid>
        </dxn:NavBarGroup>

User list class:

    public class User : INotifyPropertyChanged
    {
        private string _name = string.Empty;
        public event PropertyChangedEventHandler PropertyChanged;
        public string Name
        {
            get { return this._name; }
            set
            {
                if (value != this._name)
                {
                    this._name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }
        public string OperatorID { get; set; }
        public bool Aktiv { get; set; }
        public string ImageUrl { get; set; }
        public string DeviceID { get; set; }
        public string Passwort { get; set; }

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

My EventHandler:

     private void saveUserPanel_Click(object sender, RoutedEventArgs e)
    {

        var user = (sender as Button).DataContext as User;

        if (user != null)
        {

            SqlConnection conn = new SqlConnection("Server=127.0.0.1;Database=Wiha;Trusted_Connection=true");
            conn.Open();
            SqlCommand cmd = new SqlCommand("dbo.wiha_operator_Update", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@OperatorID", user.OperatorID));
            cmd.Parameters.Add(new SqlParameter("@DeviceID", user.DeviceID));
            cmd.Parameters.Add(new SqlParameter("@Name", user.Name));
            cmd.Parameters.Add(new SqlParameter("@Password", user.Passwort));
            cmd.Parameters.Add(new SqlParameter("@Active", user.Aktiv));
            using (SqlDataReader rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    if (rdr[0].Equals("S"))
                    {

                        popup = new ToolBox(string.Format("Operator '{0}' wurde bearbeitet.", user.OperatorID));
                        popup.Show();
                        //ShowAllOperator();
                    }
                    else
                    {
                        popup = new ToolBox(string.Format("Fehler beim bearbeiten des Operator '{0}'", user.OperatorID));
                        popup.Show();
                    }

                }
            }

        }
    }

    public void ShowAllOperator()
    {
        try
        {
            List<User> users = new List<User>();
            // string sql = "SELECT * FROM wiha_Operators";
            SqlConnection conn = new SqlConnection("Server=127.0.0.1;Database=Wiha;Trusted_Connection=true");
            conn.Open();
            // SqlCommand cmd = new SqlCommand(sql, conn);
            SqlCommand cmd = new SqlCommand("dbo.wiha_operators_SelectAll", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            using (SqlDataReader rdr = cmd.ExecuteReader())
            {

                while (rdr.Read())
                {
                    users.Add(new User() { Name = rdr.GetValue(2).ToString(), OperatorID = rdr.GetValue(0).ToString(), Aktiv = rdr.GetValue(4).Equals(true), ImageUrl = "C:/Users/Jason/Desktop/DeleteIcon.png", DeviceID = rdr.GetValue(1).ToString(), Passwort = rdr.GetValue(3).ToString() });
                }

            }
            userDataGrid.ItemsSource = users;
        }
        catch (Exception)
        {

            throw;
        }
    }

Hope someone can help me :D

Body:
You just need to inform how WPF will bind to your data, adding one more information in your binding:

<TextBox Text="{Binding XXXX, UpdateSourceTrigger=PropertyChanged}" />

The reason is simple: you are instructing the view to update the source every time you change the Text property. And for the TextBox, that usually only happens when you leave the control.

The NotifyPropertyChanged works on the other way: from your C# code you want to instruct your view to be updated with a new value. Looking at your class, that is only happening at the Name property.


问:
I don't have Razor Editor(even though I installed mvc 3.0)
I installed mvc 3.0 in my VS 2010 and I can make and run 3.0 application but I don't get intellisense or highlighting.

It seems that I am missing the razor editor

http://blogs.jetbrains.com/dotnet/wp-content/uploads/2010/11/snaghtml1f47de61.png

http://blogs.jetbrains.com/dotnet/2010/11/razor-intellisense-and-resharper/

Where can I download this so I can get it to work?

答: I uninstalled all my plugins and VS 2010. Then reinstalled VS 2010 and right after mvc 3.0. Now it works.</p>

ContentLicense: CC BY-SA 2.5


问:
Improve reCaptcha 2.0 solving automation script (Selenium)
I've written a python with selenium code to solve new behaviour captcha. But something is lacking as to fully imitate user behaviour: the code works to locate and click on a captcha, yet after that google sets up additional pictures check

which is not easy to automate. How to improve the code to solve captcha immediately without pictures check (letting google no hint of robot presence)?

Python code

```<code>from time import sleep
from random import uniform
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC

# to imitate hovering
def hover(element):
    hov = ActionChains(driver).move_to_element(element)
    hov.perform()
# optional: adding www.hola.org proxy profile to FF (extention is installed on FF, Win 8)
ffprofile = webdriver.FirefoxProfile()
hola_file = '/Users/Igor/AppData/Roaming/Mozilla/Firefox/Profiles/7kcqxxyd.default-1429005850374/extensions/hola/hola_firefox_ext_1.9.354_www.xpi'
ffprofile.add_extension(hola_file)
# end of the optional part

driver = webdriver.Firefox(ffprofile)
url='http://tarex.ru/testdir/recaptcha/recaptcha.php'

# open new tab, also optional
driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
driver.get(url)

recaptchaFrame = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.TAG_NAME ,'iframe'))
        )
frameName = recaptchaFrame.get_attribute('name')

# move the driver to the iFrame...
driver.switch_to_frame(frameName)

# *************  locate CheckBox  **************
CheckBox = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID ,"recaptcha-anchor"))
        )

# *************  hover CheckBox  ***************
rand=uniform(1.0, 1.5)
print('\n\r explicit wait for ', rand , ' seconds...')
sleep(rand)
hover(CheckBox)

# *************  click CheckBox  ***************
rand=uniform(0.5, 0.7)
print('\n\r explicit wait for ', rand , 'seconds...')
sleep(rand)
# making click on CheckBox...
clickReturn= CheckBox.click()
print('\n\r after click on CheckBox... \n\r CheckBox click result: ' , clickReturn)
</code>```

答:
Here is my solution:</p>

```<code># -*- coding: utf-8 -*-

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Chrome()

driver.get(url='https://www.google.com/recaptcha/api2/demo')

# find iframe
captcha_iframe = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.TAG_NAME, 'iframe'
        )
    )
)

ActionChains(driver).move_to_element(captcha_iframe).click().perform()

# click im not robot
captcha_box = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.ID, 'g-recaptcha-response'
        )
    )
)

driver.execute_script("arguments[0].click()", captcha_box)
</code>```

Body:
I've written a python with selenium code to solve new behaviour captcha. But something is lacking as to fully imitate user behaviour: the code works to locate and click on a captcha, yet after that google sets up additional pictures check

which is not easy to automate. How to improve the code to solve captcha immediately without pictures check (letting google no hint of robot presence)?

Python code

from time import sleep
from random import uniform
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC

# to imitate hovering
def hover(element):
    hov = ActionChains(driver).move_to_element(element)
    hov.perform()
# optional: adding www.hola.org proxy profile to FF (extention is installed on FF, Win 8)
ffprofile = webdriver.FirefoxProfile()
hola_file = '/Users/Igor/AppData/Roaming/Mozilla/Firefox/Profiles/7kcqxxyd.default-1429005850374/extensions/hola/hola_firefox_ext_1.9.354_www.xpi'
ffprofile.add_extension(hola_file)
# end of the optional part

driver = webdriver.Firefox(ffprofile)
url='http://tarex.ru/testdir/recaptcha/recaptcha.php'

# open new tab, also optional
driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
driver.get(url)

recaptchaFrame = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.TAG_NAME ,'iframe'))
        )
frameName = recaptchaFrame.get_attribute('name')

# move the driver to the iFrame...
driver.switch_to_frame(frameName)

# *************  locate CheckBox  **************
CheckBox = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID ,"recaptcha-anchor"))
        )

# *************  hover CheckBox  ***************
rand=uniform(1.0, 1.5)
print('\n\r explicit wait for ', rand , ' seconds...')
sleep(rand)
hover(CheckBox)

# *************  click CheckBox  ***************
rand=uniform(0.5, 0.7)
print('\n\r explicit wait for ', rand , 'seconds...')
sleep(rand)
# making click on CheckBox...
clickReturn= CheckBox.click()
print('\n\r after click on CheckBox... \n\r CheckBox click result: ' , clickReturn)

Body:
Here is my solution:

# -*- coding: utf-8 -*-

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Chrome()

driver.get(url='https://www.google.com/recaptcha/api2/demo')

# find iframe
captcha_iframe = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.TAG_NAME, 'iframe'
        )
    )
)

ActionChains(driver).move_to_element(captcha_iframe).click().perform()

# click im not robot
captcha_box = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.ID, 'g-recaptcha-response'
        )
    )
)

driver.execute_script("arguments[0].click()", captcha_box)


问:
Query to find result based on group by
I have a query as follows the problem is in the result I want it to be grouped by TESTTool and Release version for that particular week. So If I enter a range of dates then I should get the testtool,Releaseversion,Week No,TotalNoscripts,Pass and fail percentages for that week based on the release version and Testtool.But if I provide a range of dates it groups by dates which I do not want.

```<code>select TestTool,ReleaseVersion,WeekNo=DATEPART(wk,StartDate),YearNo=DATEPART(year,StartDate),
totalnoofscripts=count(ScriptName),PassPercentage=round(avg(case when Status='Pass' then 100.0 else 0.0 end), 2),
 FailPercentage=round(avg(case when Status='Fail' then 100.0 else 0.0 end), 2)
 from CitraTestLogging.dbo.TestScript as s1,CitraTestLogging.dbo.TestRun as s2
 where  s1.TestRun_ID=s2.ID and StartDate between '2017-12-01' and '2017-12-08'
 group by TestTool,ReleaseVersion,StartDate order by TestTool,ReleaseVersion,StartDate;
</code>```

QueryResult
TableStructure

答:
You just have to remove startdate from the group by.

I added the year and week to the order by so that you get the results ordered.
Any formatted your SQL!

```<code>SELECT TestTool
    ,ReleaseVersion
    ,WeekNo = DATEPART(wk, StartDate)
    ,YearNo = DATEPART(year, StartDate)
    ,totalnoofscripts = count(ScriptName)
    ,PassPercentage = round(avg(CASE
                WHEN STATUS = 'Pass'
                    THEN 100.0
                ELSE 0.0
                END), 2)
    ,FailPercentage = round(avg(CASE
                WHEN STATUS = 'Fail'
                    THEN 100.0
                ELSE 0.0
                END), 2)
FROM CitraTestLogging.dbo.TestScript AS s1
    ,CitraTestLogging.dbo.TestRun AS s2
WHERE s1.TestRun_ID = s2.ID
    AND StartDate BETWEEN '2017-12-01'
        AND '2017-12-08'
GROUP BY TestTool
    ,ReleaseVersion
    ,DATEPART(year, StartDate)
    ,DATEPART(wk, StartDate)
ORDER BY TestTool
    ,ReleaseVersion
    ,DATEPART(year, StartDate)
    ,DATEPART(wk, StartDate);
</code>```

Title: Query to find result based on group by

Body:
I have a query as follows the problem is in the result I want it to be grouped by TESTTool and Release version for that particular week. So If I enter a range of dates then I should get the testtool,Releaseversion,Week No,TotalNoscripts,Pass and fail percentages for that week based on the release version and Testtool.But if I provide a range of dates it groups by dates which I do not want.

select TestTool,ReleaseVersion,WeekNo=DATEPART(wk,StartDate),YearNo=DATEPART(year,StartDate),
totalnoofscripts=count(ScriptName),PassPercentage=round(avg(case when Status='Pass' then 100.0 else 0.0 end), 2),
 FailPercentage=round(avg(case when Status='Fail' then 100.0 else 0.0 end), 2)
 from CitraTestLogging.dbo.TestScript as s1,CitraTestLogging.dbo.TestRun as s2
 where  s1.TestRun_ID=s2.ID and StartDate between '2017-12-01' and '2017-12-08'
 group by TestTool,ReleaseVersion,StartDate order by TestTool,ReleaseVersion,StartDate;

QueryResult
TableStructure

Body:
You just have to remove startdate from the group by.

I added the year and week to the order by so that you get the results ordered.
Any formatted your SQL!

SELECT TestTool
    ,ReleaseVersion
    ,WeekNo = DATEPART(wk, StartDate)
    ,YearNo = DATEPART(year, StartDate)
    ,totalnoofscripts = count(ScriptName)
    ,PassPercentage = round(avg(CASE
                WHEN STATUS = 'Pass'
                    THEN 100.0
                ELSE 0.0
                END), 2)
    ,FailPercentage = round(avg(CASE
                WHEN STATUS = 'Fail'
                    THEN 100.0
                ELSE 0.0
                END), 2)
FROM CitraTestLogging.dbo.TestScript AS s1
    ,CitraTestLogging.dbo.TestRun AS s2
WHERE s1.TestRun_ID = s2.ID
    AND StartDate BETWEEN '2017-12-01'
        AND '2017-12-08'
GROUP BY TestTool
    ,ReleaseVersion
    ,DATEPART(year, StartDate)
    ,DATEPART(wk, StartDate)
ORDER BY TestTool
    ,ReleaseVersion
    ,DATEPART(year, StartDate)
    ,DATEPART(wk, StartDate);


问:
Issue with excel sheet while trying to fetch the values from groovy script
If i place getCell(0,0) in String reqTagName = sheet1.getCell(0,0).getContents() for the below code then, it is only executing the first value from the sheet. But, if I place getCell(0,Row) for the same String reqTagName = sheet1.getCell(0,0).getContents() and change the values in the excel sheet from number to string then it works as expected. But it is not working when I pass number as request value in the sheet. I have tried changing the data type from String to any other still its not working....

I have pasted the code below:

```<code>import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
log.info("Testing Started")
def reqOperationName = "getInsuranceDetails_1_FTC_005"
def inputDataFileName = "D:/SOAP UI Pro/MPI.xls"
def inputDataSheetName = "MPI"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet  sheet1 = workbook.getSheet(inputDataSheetName)
def responsesCount = 0

String[] Responses = null
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
String xmlResponse = reqOperationName+"#Request"
def reqholder = groovyUtils.getXmlHolder(xmlResponse)
try{
    rowcount = sheet1.getRows()
    colcount = sheet1.getColumns()
     Responses = new String[rowcount-1]
    responsesCount = rowcount-1
    for(Row in 1..rowcount-1){

    String reqTagName = sheet1.getCell(0,Row).getContents()
        log.info reqTagName
        def TagCount = reqholder["count(//*:"+reqTagName+")"]
        if(TagCount!=0){
            String reqTagValue = sheet1.getCell(0,Row).getContents()
            reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
            reqholder.updateProperty()
        }

    //test the request
    testRunner.runTestStepByName(reqOperationName)
    reqholder = groovyUtils.getXmlHolder(reqOperationName+"#Response")
    Responses[Row-1] = reqholder.getPrettyXml().toString()
    log.info Responses[Row-1]

    }
}
catch (Exception e) {log.info(e)}
finally{
    workbook.close()
}
Workbook existingWorkbook = Workbook.getWorkbook(new File(inputDataFileName));
WritableWorkbook workbookCopy = Workbook.createWorkbook(new File(inputDataFileName), existingWorkbook);

try
{
    WritableSheet sheetToEdit = workbookCopy.getSheet("MPI");
    WritableCell cell;
    for (int i =1;i<Responses.size();i++)
    {
    def resholder = groovyUtils.getXmlHolder(Responses[i])

    resTagValue1= resholder.getNodeValue("//*:productID")
    Label l = new Label(2, i, resTagValue1.toString());
    cell = (WritableCell) l;
    sheetToEdit.addCell(cell);

    resTagValue2= resholder.getNodeValue("//*:accountNumber")
    Label m = new Label(3, i, resTagValue2.toString());
    cell = (WritableCell) m;
    sheetToEdit.addCell(cell);

    resTagValue3= resholder.getNodeValue("//*:insuranceCategory")
    Label n = new Label(4, i, resTagValue3.toString());
    cell = (WritableCell) n;
    sheetToEdit.addCell(cell);

    resTagValue4= resholder.getNodeValue("//*:imei")
    Label o = new Label(5, i, resTagValue4.toString());
    cell = (WritableCell) o;
    sheetToEdit.addCell(cell);

    resTagValue5= resholder.getNodeValue("//*:handsetMake")
    Label p = new Label(6, i, resTagValue5.toString());
    cell = (WritableCell) p;
    sheetToEdit.addCell(cell);

    resTagValue6= resholder.getNodeValue("//*:handsetModel")
    Label q = new Label(7, i, resTagValue6.toString());
    cell = (WritableCell) q;
    sheetToEdit.addCell(cell);

    resTagValue7= resholder.getNodeValue("//*:insurancePolicyName")
    Label r = new Label(8, i, resTagValue7.toString());
    cell = (WritableCell) r;
    sheetToEdit.addCell(cell);

    resTagValue8= resholder.getNodeValue("//*:insuranceStartTimestamp")
    Label s = new Label(9, i, resTagValue8.toString());
    cell = (WritableCell) s;
    sheetToEdit.addCell(cell);

    resTagValue9= resholder.getNodeValue("//*:insuranceEndTimestamp")
    Label t = new Label(10, i, resTagValue9.toString());
    cell = (WritableCell) t;
    sheetToEdit.addCell(cell);
    }
}
catch (Exception e) {log.info(e)}
finally{
     workbookCopy.write();
 workbookCopy.close();
 existingWorkbook.close();
}
log.info("Testing Over")
</code>```

I got to know that the error is with the excel sheet. Should there be any change in the code or some implementation with the excel sheet??

Any help would be highly appreciated.

Thank you,

Edited code after changes implemented

```<code>import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
log.info("Testing Started")
def reqOperationName = "getInsuranceDetails_1_FTC_005"
def inputDataFileName = "D:/SOAP UI Pro/MPI.xls"
def inputDataSheetName = "MPI"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet  sheet1 = workbook.getSheet(inputDataSheetName)
def responsesCount = 0

String[] Responses = null
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
String xmlResponse = reqOperationName+"#Request"
def reqholder = groovyUtils.getXmlHolder(xmlResponse)
try{
    rowcount = sheet1.getRows()
    colcount = sheet1.getColumns()
     Responses = new String[rowcount-1]
    responsesCount = rowcount-1
    for(Row in 1..rowcount-1){

    String reqTagName = sheet1.getCell(0,0).getContents()
    log.info reqTagName
    def TagCount = reqholder["count(//*:"+reqTagName+")"]
    log.info reqholder["//*:"+reqTagName]
    if(TagCount!=0){
        String reqTagValue = sheet1.getCell(0,Row).getContents()
        reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
        reqholder.updateProperty()
    }

    //test the request
    testRunner.runTestStepByName(reqOperationName)
    reqholder = groovyUtils.getXmlHolder(reqOperationName+"#Response")
    Responses[Row-1] = reqholder.getPrettyXml().toString()
    log.info Responses[Row-1]

    }
}
catch (Exception e) {log.info(e)}
finally{
    workbook.close()
}
Workbook existingWorkbook = Workbook.getWorkbook(new File(inputDataFileName));
WritableWorkbook workbookCopy = Workbook.createWorkbook(new File(inputDataFileName), existingWorkbook);

try
{
    WritableSheet sheetToEdit = workbookCopy.getSheet("MPI");
    WritableCell cell;
    for (int i =1;i<Responses.size();i++)
    {
    def resholder = groovyUtils.getXmlHolder(Responses[i])

    resTagValue1= resholder.getNodeValue("//*:productID")
    Label l = new Label(2, i, resTagValue1.toString());
    cell = (WritableCell) l;
    sheetToEdit.addCell(cell);

    resTagValue2= resholder.getNodeValue("//*:accountNumber")
    Label m = new Label(3, i, resTagValue2.toString());
    cell = (WritableCell) m;
    sheetToEdit.addCell(cell);

    resTagValue3= resholder.getNodeValue("//*:insuranceCategory")
    Label n = new Label(4, i, resTagValue3.toString());
    cell = (WritableCell) n;
    sheetToEdit.addCell(cell);

    resTagValue4= resholder.getNodeValue("//*:imei")
    Label o = new Label(5, i, resTagValue4.toString());
    cell = (WritableCell) o;
    sheetToEdit.addCell(cell);

    resTagValue5= resholder.getNodeValue("//*:handsetMake")
    Label p = new Label(6, i, resTagValue5.toString());
    cell = (WritableCell) p;
    sheetToEdit.addCell(cell);

    resTagValue6= resholder.getNodeValue("//*:handsetModel")
    Label q = new Label(7, i, resTagValue6.toString());
    cell = (WritableCell) q;
    sheetToEdit.addCell(cell);

    resTagValue7= resholder.getNodeValue("//*:insurancePolicyName")
    Label r = new Label(8, i, resTagValue7.toString());
    cell = (WritableCell) r;
    sheetToEdit.addCell(cell);

    resTagValue8= resholder.getNodeValue("//*:insuranceStartTimestamp")
    Label s = new Label(9, i, resTagValue8.toString());
    cell = (WritableCell) s;
    sheetToEdit.addCell(cell);

    resTagValue9= resholder.getNodeValue("//*:insuranceEndTimestamp")
    Label t = new Label(10, i, resTagValue9.toString());
    cell = (WritableCell) t;
    sheetToEdit.addCell(cell);
    }
}
catch (Exception e) {log.info(e)}
finally{
     workbookCopy.write();
 workbookCopy.close();
 existingWorkbook.close();
}
log.info("Testing Over")
</code>```

In out put log I can see that it is taking the first MSISDN but after that it is taking some junk fields.

Log Output is mentioned below for every execution.

Mon Dec 11 16:44:18 IST 2017:INFO:447803000269

Mon Dec 11 16:44:18 IST 2017:INFO:[Ljava.lang.String;@8ddf43

Mon Dec 11 16:44:18 IST 2017:INFO:[Ljava.lang.String;@7bd8d3

Mon Dec 11 16:44:19 IST 2017:INFO:[Ljava.lang.String;@12dda68

答:
Try these steps and let me know if it fixed the issue :

Step 1 : Open Excel WorkBook

Step 2 : Select the column values which holds numbers as shown in the pic below and do a right click to bring out the options

Step 3 : Click on Format Cells and it will open a window

Step 4 : Click on Number as shown in the pic below

Step 5 : Go to Decimal places on the right hand side and click on the down arrow as shown in the pic below

Step 6 : Click on the down arrow until you set the decimal places to 0

Step 7 : Go to the Negative numbers as shown in the pic and select the second option

Step 8 : Click on OK and close the window.

Step 9 : Save excel sheet and run the script. You problem should be fixed

Let me know if it worked :)

Body:
If i place getCell(0,0) in String reqTagName = sheet1.getCell(0,0).getContents() for the below code then, it is only executing the first value from the sheet. But, if I place getCell(0,Row) for the same String reqTagName = sheet1.getCell(0,0).getContents() and change the values in the excel sheet from number to string then it works as expected. But it is not working when I pass number as request value in the sheet. I have tried changing the data type from String to any other still its not working....

I have pasted the code below:

import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
log.info("Testing Started")
def reqOperationName = "getInsuranceDetails_1_FTC_005"
def inputDataFileName = "D:/SOAP UI Pro/MPI.xls"
def inputDataSheetName = "MPI"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet  sheet1 = workbook.getSheet(inputDataSheetName)
def responsesCount = 0

String[] Responses = null
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
String xmlResponse = reqOperationName+"#Request"
def reqholder = groovyUtils.getXmlHolder(xmlResponse)
try{
    rowcount = sheet1.getRows()
    colcount = sheet1.getColumns()
     Responses = new String[rowcount-1]
    responsesCount = rowcount-1
    for(Row in 1..rowcount-1){

    String reqTagName = sheet1.getCell(0,Row).getContents()
        log.info reqTagName
        def TagCount = reqholder["count(//*:"+reqTagName+")"]
        if(TagCount!=0){
            String reqTagValue = sheet1.getCell(0,Row).getContents()
            reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
            reqholder.updateProperty()
        }

    //test the request
    testRunner.runTestStepByName(reqOperationName)
    reqholder = groovyUtils.getXmlHolder(reqOperationName+"#Response")
    Responses[Row-1] = reqholder.getPrettyXml().toString()
    log.info Responses[Row-1]

    }
}
catch (Exception e) {log.info(e)}
finally{
    workbook.close()
}
Workbook existingWorkbook = Workbook.getWorkbook(new File(inputDataFileName));
WritableWorkbook workbookCopy = Workbook.createWorkbook(new File(inputDataFileName), existingWorkbook);

try
{
    WritableSheet sheetToEdit = workbookCopy.getSheet("MPI");
    WritableCell cell;
    for (int i =1;i<Responses.size();i++)
    {
    def resholder = groovyUtils.getXmlHolder(Responses[i])

    resTagValue1= resholder.getNodeValue("//*:productID")
    Label l = new Label(2, i, resTagValue1.toString());
    cell = (WritableCell) l;
    sheetToEdit.addCell(cell);

    resTagValue2= resholder.getNodeValue("//*:accountNumber")
    Label m = new Label(3, i, resTagValue2.toString());
    cell = (WritableCell) m;
    sheetToEdit.addCell(cell);

    resTagValue3= resholder.getNodeValue("//*:insuranceCategory")
    Label n = new Label(4, i, resTagValue3.toString());
    cell = (WritableCell) n;
    sheetToEdit.addCell(cell);

    resTagValue4= resholder.getNodeValue("//*:imei")
    Label o = new Label(5, i, resTagValue4.toString());
    cell = (WritableCell) o;
    sheetToEdit.addCell(cell);

    resTagValue5= resholder.getNodeValue("//*:handsetMake")
    Label p = new Label(6, i, resTagValue5.toString());
    cell = (WritableCell) p;
    sheetToEdit.addCell(cell);

    resTagValue6= resholder.getNodeValue("//*:handsetModel")
    Label q = new Label(7, i, resTagValue6.toString());
    cell = (WritableCell) q;
    sheetToEdit.addCell(cell);

    resTagValue7= resholder.getNodeValue("//*:insurancePolicyName")
    Label r = new Label(8, i, resTagValue7.toString());
    cell = (WritableCell) r;
    sheetToEdit.addCell(cell);

    resTagValue8= resholder.getNodeValue("//*:insuranceStartTimestamp")
    Label s = new Label(9, i, resTagValue8.toString());
    cell = (WritableCell) s;
    sheetToEdit.addCell(cell);

    resTagValue9= resholder.getNodeValue("//*:insuranceEndTimestamp")
    Label t = new Label(10, i, resTagValue9.toString());
    cell = (WritableCell) t;
    sheetToEdit.addCell(cell);
    }
}
catch (Exception e) {log.info(e)}
finally{
     workbookCopy.write();
 workbookCopy.close();
 existingWorkbook.close();
}
log.info("Testing Over")

I got to know that the error is with the excel sheet. Should there be any change in the code or some implementation with the excel sheet??

Any help would be highly appreciated.

Thank you,

Edited code after changes implemented

import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
log.info("Testing Started")
def reqOperationName = "getInsuranceDetails_1_FTC_005"
def inputDataFileName = "D:/SOAP UI Pro/MPI.xls"
def inputDataSheetName = "MPI"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet  sheet1 = workbook.getSheet(inputDataSheetName)
def responsesCount = 0

String[] Responses = null
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
String xmlResponse = reqOperationName+"#Request"
def reqholder = groovyUtils.getXmlHolder(xmlResponse)
try{
    rowcount = sheet1.getRows()
    colcount = sheet1.getColumns()
     Responses = new String[rowcount-1]
    responsesCount = rowcount-1
    for(Row in 1..rowcount-1){

    String reqTagName = sheet1.getCell(0,0).getContents()
    log.info reqTagName
    def TagCount = reqholder["count(//*:"+reqTagName+")"]
    log.info reqholder["//*:"+reqTagName]
    if(TagCount!=0){
        String reqTagValue = sheet1.getCell(0,Row).getContents()
        reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
        reqholder.updateProperty()
    }

    //test the request
    testRunner.runTestStepByName(reqOperationName)
    reqholder = groovyUtils.getXmlHolder(reqOperationName+"#Response")
    Responses[Row-1] = reqholder.getPrettyXml().toString()
    log.info Responses[Row-1]

    }
}
catch (Exception e) {log.info(e)}
finally{
    workbook.close()
}
Workbook existingWorkbook = Workbook.getWorkbook(new File(inputDataFileName));
WritableWorkbook workbookCopy = Workbook.createWorkbook(new File(inputDataFileName), existingWorkbook);

try
{
    WritableSheet sheetToEdit = workbookCopy.getSheet("MPI");
    WritableCell cell;
    for (int i =1;i<Responses.size();i++)
    {
    def resholder = groovyUtils.getXmlHolder(Responses[i])

    resTagValue1= resholder.getNodeValue("//*:productID")
    Label l = new Label(2, i, resTagValue1.toString());
    cell = (WritableCell) l;
    sheetToEdit.addCell(cell);

    resTagValue2= resholder.getNodeValue("//*:accountNumber")
    Label m = new Label(3, i, resTagValue2.toString());
    cell = (WritableCell) m;
    sheetToEdit.addCell(cell);

    resTagValue3= resholder.getNodeValue("//*:insuranceCategory")
    Label n = new Label(4, i, resTagValue3.toString());
    cell = (WritableCell) n;
    sheetToEdit.addCell(cell);

    resTagValue4= resholder.getNodeValue("//*:imei")
    Label o = new Label(5, i, resTagValue4.toString());
    cell = (WritableCell) o;
    sheetToEdit.addCell(cell);

    resTagValue5= resholder.getNodeValue("//*:handsetMake")
    Label p = new Label(6, i, resTagValue5.toString());
    cell = (WritableCell) p;
    sheetToEdit.addCell(cell);

    resTagValue6= resholder.getNodeValue("//*:handsetModel")
    Label q = new Label(7, i, resTagValue6.toString());
    cell = (WritableCell) q;
    sheetToEdit.addCell(cell);

    resTagValue7= resholder.getNodeValue("//*:insurancePolicyName")
    Label r = new Label(8, i, resTagValue7.toString());
    cell = (WritableCell) r;
    sheetToEdit.addCell(cell);

    resTagValue8= resholder.getNodeValue("//*:insuranceStartTimestamp")
    Label s = new Label(9, i, resTagValue8.toString());
    cell = (WritableCell) s;
    sheetToEdit.addCell(cell);

    resTagValue9= resholder.getNodeValue("//*:insuranceEndTimestamp")
    Label t = new Label(10, i, resTagValue9.toString());
    cell = (WritableCell) t;
    sheetToEdit.addCell(cell);
    }
}
catch (Exception e) {log.info(e)}
finally{
     workbookCopy.write();
 workbookCopy.close();
 existingWorkbook.close();
}
log.info("Testing Over")

In out put log I can see that it is taking the first MSISDN but after that it is taking some junk fields.

Log Output is mentioned below for every execution.

Mon Dec 11 16:44:18 IST 2017:INFO:447803000269

Mon Dec 11 16:44:18 IST 2017:INFO:[Ljava.lang.String;@8ddf43

Mon Dec 11 16:44:18 IST 2017:INFO:[Ljava.lang.String;@7bd8d3

Mon Dec 11 16:44:19 IST 2017:INFO:[Ljava.lang.String;@12dda68


问:
Examining rebus handlers in progress and stopping rebus from accepting new messages
I have a web app that uses Rebus with Azure Service Bus queues as a transport.
It is configured with Simple Injector container.

During app disposal I want to stop rebus from accepting new messages and examine number of messages being handled at the moment. I may then decide to wait few seconds to allow handler to finish.

Is this achievable?

EDIT:
I know about the existence of SetWorkerShutdownTimeout and Advanced.Workers.SetNumberOfWorkers methods. Could I achieve what I aim by calling Advanced.Workers.SetNumberOfWorkers(0)?

答:
I may then decide to wait few seconds to allow handler to finish.

If you dispose the bus (or the container, which you always should do when your application shuts down, which in turn disposes the bus), any messages currently being handled will be given up to 30 seconds by default to finish processing.

No new messages will be received after the shutdown process is started.

Could I achieve what I aim by calling Advanced.Workers.SetNumberOfWorkers(0)?

Yes :) if you call

```<code>bus.Advanced.Workers.SetNumberOfWorkers(0);
</code>```

worker threads will be removed, thus leading to no more messages being received.

But you should know, that simply disposing your SimpleInjector container will give all messages currently being handled a chance to finish.

Body:
I may then decide to wait few seconds to allow handler to finish.

If you dispose the bus (or the container, which you always should do when your application shuts down, which in turn disposes the bus), any messages currently being handled will be given up to 30 seconds by default to finish processing.

No new messages will be received after the shutdown process is started.

Could I achieve what I aim by calling Advanced.Workers.SetNumberOfWorkers(0)?

Yes :) if you call

bus.Advanced.Workers.SetNumberOfWorkers(0);

worker threads will be removed, thus leading to no more messages being received.

But you should know, that simply disposing your SimpleInjector container will give all messages currently being handled a chance to finish.


问:
Screen not rotating back to portrait after leaving AVFullScreenViewController
Using this code to allow the media players to rotate in landscape (which is not supported by the app) while they are in fullscreen :

```<code>// handle orientation for the device
func application (_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    guard let vc = (window?.rootViewController?.presentedViewController) else {
        return .portrait
    }
    if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
        return .allButUpsideDown
    } else {
        return .portrait
    }
}
</code>```

working fine in ios 10 but since ios 11 the screen will not rotate back after leaving fullscreen, thus not resizing the UI (the app will after rotation occupy only half of the screen).
It seems there were some modification on avkit but I cannot find any resources on this, thoughts?

答:
I got the same problem this day. The solution is to check if iOS11 is running. If so, just return UIInterfaceOrientationMask.portrait else return the desired value. in iOS 11 the video can rotate even if only the portrait is enabled in the project settings.

Example:

```<code>if #available(iOS 11, *) {
   return UIInterfaceOrientationMask.portrait
} else {
   guard let vc = (window?.rootViewController?.presentedViewController) else {
      return .portrait
   }

   if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
      return .allButUpsideDown
   } else {
      return .portrait
   }
}
</code>```

Body:
Using this code to allow the media players to rotate in landscape (which is not supported by the app) while they are in fullscreen :

// handle orientation for the device
func application (_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    guard let vc = (window?.rootViewController?.presentedViewController) else {
        return .portrait
    }
    if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
        return .allButUpsideDown
    } else {
        return .portrait
    }
}

working fine in ios 10 but since ios 11 the screen will not rotate back after leaving fullscreen, thus not resizing the UI (the app will after rotation occupy only half of the screen).
It seems there were some modification on avkit but I cannot find any resources on this, thoughts?

Body:
I got the same problem this day. The solution is to check if iOS11 is running. If so, just return UIInterfaceOrientationMask.portrait else return the desired value. in iOS 11 the video can rotate even if only the portrait is enabled in the project settings.

Example:

if #available(iOS 11, *) {
   return UIInterfaceOrientationMask.portrait
} else {
   guard let vc = (window?.rootViewController?.presentedViewController) else {
      return .portrait
   }

   if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
      return .allButUpsideDown
   } else {
      return .portrait
   }
}


问:
Chrome Headless in Unix returns empty page source
Am using Chrome Headless to run my selenium test script in Unix machine(Cent OS).But the same script works perfectly in my local windows machine.

But in Unix machine it returns empty page source like empty html tags.

Have no clue where its error-ed out though am using latest ChromeDriver 2.33, and google chrome version 62.0..

```<code>       System.setProperty("webdriver.chrome.driver", "/../chromedriver.exe");

        --chromedriver.exe for windows local machine
        -- chromedriver for unix machine

        ChromeOptions options = new ChromeOptions();
        options.addArguments("--headless");
        options.addArguments("--no-sandbox");
        options.setAcceptInsecureCerts(true);
        options.addArguments("--ignore-ssl-errors=true");
        options.addArguments("--ssl-protocol=any");
        options.setHeadless(true);

        driver = new ChromeDriver(options);

        System.out.println("Timeout invoke ");
        driver.get("https://www.google.co.in/");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println("After invoke ");
        System.out.println("PAGE SOURCE : \n" + driver.getPageSource());
        System.out.println("RUN COMPLETE..");
</code>```

Running the above in Unix machine i get

PAGE SOURCE:

```<code><html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
</code>```

Help me in fixing this
Thanks in advance

Complete StackTrace :

```<code>Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 33523
Only local connections are allowed. org.openqa.selenium.WebDriverException: chrome not reachable   (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT
6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 60.41 seconds Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z' System info: host: 'Windows', ip: '', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'

Driver info: driver.version: ChromeDriver   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)   at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)     at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)   at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)   at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)     at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)     at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)     at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)   at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)     at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)     at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)  at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
</code>```

答:
To run Chrome Browser in Headless Mode in Unix Systems, add the arguments --disable-gpu and --remote-debugging-port=9222 :

```<code>System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.setAcceptInsecureCerts(true);
options.addArguments("--ignore-ssl-errors=true");
options.addArguments("--ssl-protocol=any");
options.setHeadless(true);
options.addArguments("--remote-debugging-port=9222");
options.addArguments("window-size=1400,600");
WebDriver driver = new ChromeDriver(options);
System.out.println("Timeout invoke ");
driver.get("https://www.google.co.in/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
System.out.println("After invoke ");
System.out.println("PAGE SOURCE : \n" + driver.getPageSource());
System.out.println("RUN COMPLETE..");
</code>```

Note A: Avoid passing both the options addArguments("--headless") and setHeadless(true) together for any single WebDriver instance.

Note B: Avoid using addArguments("--disable-gpu"); on Linux/Unix based systems as it is a configuration for Windows based OS.

Reference : Getting Started with Headless Chrome

Update

As you are seeing :

```<code>WebDriverException: chrome not reachable
</code>```

Follow the steps :

Uninstall Chrome Browser through Revo Uninstaller

Run CCleaner tool to wipe off all the OS chores.

Take a System Restart

Install current version of Chrome Browser.

Execute your Test

Body:
Am using Chrome Headless to run my selenium test script in Unix machine(Cent OS).But the same script works perfectly in my local windows machine.

But in Unix machine it returns empty page source like empty html tags.

Have no clue where its error-ed out though am using latest ChromeDriver 2.33, and google chrome version 62.0..

       System.setProperty("webdriver.chrome.driver", "/../chromedriver.exe");

        --chromedriver.exe for windows local machine
        -- chromedriver for unix machine

        ChromeOptions options = new ChromeOptions();
        options.addArguments("--headless");
        options.addArguments("--no-sandbox");
        options.setAcceptInsecureCerts(true);
        options.addArguments("--ignore-ssl-errors=true");
        options.addArguments("--ssl-protocol=any");
        options.setHeadless(true);

        driver = new ChromeDriver(options);

        System.out.println("Timeout invoke ");
        driver.get("https://www.google.co.in/");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println("After invoke ");
        System.out.println("PAGE SOURCE : \n" + driver.getPageSource());
        System.out.println("RUN COMPLETE..");

Running the above in Unix machine i get

PAGE SOURCE:

Help me in fixing this
Thanks in advance

Complete StackTrace :

Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 33523
Only local connections are allowed. org.openqa.selenium.WebDriverException: chrome not reachable   (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT
6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 60.41 seconds Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z' System info: host: 'Windows', ip: '', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'

Driver info: driver.version: ChromeDriver   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)   at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)     at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)   at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)   at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)     at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)     at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)     at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)   at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)     at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)     at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)  at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)

Body:
To run Chrome Browser in Headless Mode in Unix Systems, add the arguments --disable-gpu and --remote-debugging-port=9222 :

System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.setAcceptInsecureCerts(true);
options.addArguments("--ignore-ssl-errors=true");
options.addArguments("--ssl-protocol=any");
options.setHeadless(true);
options.addArguments("--remote-debugging-port=9222");
options.addArguments("window-size=1400,600");
WebDriver driver = new ChromeDriver(options);
System.out.println("Timeout invoke ");
driver.get("https://www.google.co.in/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
System.out.println("After invoke ");
System.out.println("PAGE SOURCE : \n" + driver.getPageSource());
System.out.println("RUN COMPLETE..");

Note A: Avoid passing both the options addArguments("--headless") and setHeadless(true) together for any single WebDriver instance.

Note B: Avoid using addArguments("--disable-gpu"); on Linux/Unix based systems as it is a configuration for Windows based OS.

Reference : Getting Started with Headless Chrome

Update

As you are seeing :

WebDriverException: chrome not reachable

Follow the steps :

Uninstall Chrome Browser through Revo Uninstaller

Run CCleaner tool to wipe off all the OS chores.

Take a System Restart

Install current version of Chrome Browser.

Execute your Test


问:
How do you configure logging in Hibernate 4 to use SLF4J
Hibernate 3.x used slf4j for logging. Hibernate 4.x uses jboss-logging. I am writing a standalone application which uses Hibernate 4, and SLF4J for logging.

How can i configure Hibernate to log to SLF4J?

If that's not possible, how can i configure Hibernate's logging at all?

The Hibernate 4.1 manual section on logging starts with the warning that it is ...

Completely out of date. Hibernate uses JBoss Logging starting in 4.0. This will get documented as we migrate this content to the Developer Guide.

... goes on to talk about SLF4J, and so is useless. Neither the getting started guide nor the developer guide talk about logging at all. Nor does the migration guide.

I have looked for documentation on jboss-logging itself, but i haven't been able to find any at all. The GitHub page is silent, and JBoss's community projects page doesn't even list jboss-logging. I wondered if th project's bug tracker might have any issues relating to providing documentation, but it doesn't.

The good news is that when using Hibernate 4 inside an application server, such as JBoss AS7, logging is largely taken care of for you. But how can i configure it in a standalone application?

答:
To anyone that could face the same problem I had. In case you have tried all the other solutions explained here and still don't see hibernate logging working with your slf4j, it could be because you are using a container that has in his folder libraries the jboss-logging.jar. This means that gets preloaded before you can even set any configuration to influence it.
To avoid this problem in weblogic you can specify in the file weblogic-application.xml in you ear/META-INF to prefer the library loaded from the application. there should be a similar mechanism for other server containers.
In my case I had to add:</p>

```<code><?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.5/weblogic-application.xsd">
   <wls:prefer-application-packages>
       <!-- logging -->
       <wls:package-name>org.slf4j.*</wls:package-name>
       <wls:package-name>org.jboss.logging.*</wls:package-name>
   </wls:prefer-application-packages>
   <wls:prefer-application-resources>
        <wls:resource-name>org/slf4j/impl/StaticLoggerBinder.class</wls:resource-name>
    </wls:prefer-application-resources>
</wls:weblogic-application>
</code>```

Body:
To anyone that could face the same problem I had. In case you have tried all the other solutions explained here and still don't see hibernate logging working with your slf4j, it could be because you are using a container that has in his folder libraries the jboss-logging.jar. This means that gets preloaded before you can even set any configuration to influence it.
To avoid this problem in weblogic you can specify in the file weblogic-application.xml in you ear/META-INF to prefer the library loaded from the application. there should be a similar mechanism for other server containers.
In my case I had to add:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.5/weblogic-application.xsd">
   <wls:prefer-application-packages>
       <!-- logging -->
       <wls:package-name>org.slf4j.*</wls:package-name>
       <wls:package-name>org.jboss.logging.*</wls:package-name>
   </wls:prefer-application-packages>
   <wls:prefer-application-resources>
        <wls:resource-name>org/slf4j/impl/StaticLoggerBinder.class</wls:resource-name>
    </wls:prefer-application-resources>
</wls:weblogic-application>


问:
How to install pyperclip to Anaconda?
I want to install pyperclip from GitHub using pip install but unfortunately it's only installed to pip and not Anaconda. I'm using PyCharm and my interpreter is Anaconda. (Linux)

I want Anaconda to install the package 'pyperclip' as well so I can use it in PyCharm. I've try Googling but can't find any result.

答:
From Anaconda's website, run the following in Terminal/cmd:

conda install -c conda-forge pyperclip

Title: How to install pyperclip to Anaconda?


问:
Skip printing the first value of array in jquery data tables
this is a response from the api

```<code>{"recordsTotal":13,"data":[[13,"wretwer","rgsdfg","sdfgsd",null],[12,"heyh","gffsf","sfgsdf",null],[11,"sdfgwt","hdgdhsf","sfgsf",null],[10,"ethgs","fgsdfgsfd","dfsgdf",null],[9,"ertyyh","dgfsfg","sdfgs",null],[8,"yuyet","ertg","hdghd",null],[7,"dfgs","wtwr","sdfg",null],[6,"tyueyt","etyetye","erty",null],[5,"qerqe","qwer","qwerqwer",null],[4,"d","d","ggsss",null],[3,"asdf","asdf","asdf",null],[2,"asdfasd","asdfasdf","asdfadsf",null],[1,"test","asdf","34asdfasdfasdfasdfasdf",null]]}
</code>```

I want to skip printing the first value of array that is 13 or 12 ....

this is what i have got so far

```<code>'use strict';
$(document).ready(function() {
    $("#appartment-table").DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": "/datatable/apartments",
        "columns": [
                    null,
                    null,
                    null,
                    null,
            {"mRender": function ( data, type, row ) {
                            return '<a href="apartments/'+row[0]+'/edit">Edit</a>';}
                    }
     ]
    });
});
</code>```

答:
You can pick which columns to show by the array indexes :

```<code>columns: [
  { data: 1 },
  { data: 2 },
  { data: 3 },
  { data: 4,
    render: function ( data, type, row ) {
       return '<a href="apartments/'+row[0]+'/edit">Edit</a>';
    }
  }
 ]
</code>```

Will skip the first element in the arrays, 13, 12 ...Remember to adjust the columns in
 accordingly (if you are using a static thead and not let DT create it by using column.title)

Body:
this is a response from the api

{"recordsTotal":13,"data":[[13,"wretwer","rgsdfg","sdfgsd",null],[12,"heyh","gffsf","sfgsdf",null],[11,"sdfgwt","hdgdhsf","sfgsf",null],[10,"ethgs","fgsdfgsfd","dfsgdf",null],[9,"ertyyh","dgfsfg","sdfgs",null],[8,"yuyet","ertg","hdghd",null],[7,"dfgs","wtwr","sdfg",null],[6,"tyueyt","etyetye","erty",null],[5,"qerqe","qwer","qwerqwer",null],[4,"d","d","ggsss",null],[3,"asdf","asdf","asdf",null],[2,"asdfasd","asdfasdf","asdfadsf",null],[1,"test","asdf","34asdfasdfasdfasdfasdf",null]]}

I want to skip printing the first value of array that is 13 or 12 ....

this is what i have got so far

'use strict';
$(document).ready(function() {
    $("#appartment-table").DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": "/datatable/apartments",
        "columns": [
                    null,
                    null,
                    null,
                    null,
            {"mRender": function ( data, type, row ) {
                            return 'Edit';}
                    }
     ]
    });
});

Body:
You can pick which columns to show by the array indexes :

columns: [
  { data: 1 },
  { data: 2 },
  { data: 3 },
  { data: 4,
    render: function ( data, type, row ) {
       return '<a href="apartments/'+row[0]+'/edit">Edit</a>';
    }
  }
 ]

Will skip the first element in the arrays, 13, 12 ...Remember to adjust the columns in <thead> accordingly (if you are using a static thead and not let DT create it by using column.title)


问:
CoordinatorLayout/AppBarLayout ExpandableListView being rendered off screen
Yet more problem in using CoordinatorLayout and AppBarLayout.

I'm trying to achieve the basic functionality of having the Toolbar scroll off screen when scrolling down and coming back on screen when scrolling up.

However, my current set up is showing a problem: Not only is the Toolbar not scrolling off, the ListView seems to be rendering off screen at the bottom. It's almost as if it's been offset by the AppBarLayout height.

Here is a gif describing the issue, note that the final item is cut off also the ScrollBar is off screen:

My layout is pretty standard:

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:background="@color/background">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:background="@color/orange"
            app:layout_scrollFlags="scroll|enterAlways"/>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeToRefresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <ExpandableListView
            android:id="@+id/listView"
            android:groupIndicator="@android:color/transparent"
            android:layout_width="match_parent"
            android:dividerHeight="0px"
            android:layout_height="match_parent"/>
    </android.support.v4.widget.SwipeRefreshLayout>

</android.support.design.widget.CoordinatorLayout>
</code>```

答:
```<code>private int mPreviousVisibleItem;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        expListView.setNestedScrollingEnabled(true);
    } else {
        expListView.setOnScrollListener(new AbsListView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
                if (firstVisibleItem > mPreviousVisibleItem) {
                    appBarLayout.setExpanded(false, true);
                } else if (firstVisibleItem < mPreviousVisibleItem) {
                    appBarLayout.setExpanded(true, true);
                }
                mPreviousVisibleItem = firstVisibleItem;
            }
        });
    }
</code>```

Body:
Yet more problem in using CoordinatorLayout and AppBarLayout.

I'm trying to achieve the basic functionality of having the Toolbar scroll off screen when scrolling down and coming back on screen when scrolling up.

However, my current set up is showing a problem: Not only is the Toolbar not scrolling off, the ListView seems to be rendering off screen at the bottom. It's almost as if it's been offset by the AppBarLayout height.

Here is a gif describing the issue, note that the final item is cut off also the ScrollBar is off screen:

My layout is pretty standard:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:background="@color/background">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:background="@color/orange"
            app:layout_scrollFlags="scroll|enterAlways"/>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeToRefresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <ExpandableListView
            android:id="@+id/listView"
            android:groupIndicator="@android:color/transparent"
            android:layout_width="match_parent"
            android:dividerHeight="0px"
            android:layout_height="match_parent"/>
    </android.support.v4.widget.SwipeRefreshLayout>

</android.support.design.widget.CoordinatorLayout>