问:
Set Label text to non-transparent
I have a grid with labels, each "Tile" has a transparent background color, however the text also appears to be transparent. Is there a way to remove the transparency from the label text?

My code:

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="LoyaltyWorx.GridMenu"
             BackgroundImage="grid.jpg"
             Title="Main Menu"
             >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="2*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="0" BackgroundColor="#1481BA"  Opacity="0.5" x:Name="CardTile"/>
        <Label Text="Transactions" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="1" BackgroundColor="#ede890" Opacity="0.5" x:Name="TransactionTile"/>
        <Label Text="Promotions" TextColor="White" FontSize="30" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="1" Grid.Column="0" BackgroundColor="#1481BA"  Grid.ColumnSpan="2" Opacity="0.7" x:Name="PromoTile"/>
        <Label Text="Settings" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="0" BackgroundColor="#ede890" Opacity="0.5" x:Name="SettingsTile" />
        <Label Text="My Profile" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="1" BackgroundColor="#1481BA" Opacity="0.5" x:Name="ProfileTile"/>
    </Grid>
</ContentPage>
</code>```

ScreenShot:

答:
You need to add your label in StackLayout look like this :

```<code><StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#1481BA" Opacity="0.5" >
    <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BackgroundColor="Transparent" x:Name="CardTile"/>
</StackLayout>
</code>```

You can also use Frame in place of StackLayout

Title: Set Label text to non-transparent

Body:
I have a grid with labels, each "Tile" has a transparent background color, however the text also appears to be transparent. Is there a way to remove the transparency from the label text?

My code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="LoyaltyWorx.GridMenu"
             BackgroundImage="grid.jpg"
             Title="Main Menu"
             >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="2*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>

    </Grid>
</ContentPage>

ScreenShot:

Body:
You need to add your label in StackLayout look like this :

<StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#1481BA" Opacity="0.5" >
    <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BackgroundColor="Transparent" x:Name="CardTile"/>
</StackLayout>

You can also use Frame in place of StackLayout


来源: stackexchange

问:
MSBuild builds projects with project references correctly but not from solution
When i build a A.sln which includes 2 projects B.csproj and C.csproj which has internal project references it throws reference errors in MSBuild. But when i build B.csproj and C.csproj seperately in MSBuild it don't throw errors. And also building A.sln in VS IDE also don't throw errors.I'm using .NET 2.0 framework. Please find below the scripts used to build the sln and projs.

```<code>MSBuild "<path>/A.sln" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\A.sln.log /verbosity:normal

MSBuild "<path>/B.csproj" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\B.csproj.log /verbosity:normal

MSBuild "<path>/C.csproj" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\C.csproj.log /verbosity:normal
</code>```

Edit:

All the errors thrown are from code for missing refernces(all are project references). I get only three type of errors like given below.

error CS0012: The type 'X' is defined
  in an assembly that is not referenced.
  You must add a reference to assembly
  'Y, Version=2.0.0.0, Culture=neutral,
  PublicKeyToken=aad4cbe5d7c27078'.

error CS0234: The type or namespace
  name 'X' does not exist in the
  namespace 'Y' (are you missing an
  assembly reference?)

error CS0246: The type or namespace
  name 'X' could not be found (are you
  missing a using directive or an
  assembly reference?)

I cleared all previously built dlls from build paths before building from both IDE and MSBuild. But IDE just works fine and don't show a reference missing indicator in "Refrences" section for the project.

No reference paths added manually in IDE.

Another Update:

I just noticed that when i open both the projects from the solution, references are correctly pointing in IDE. But when i open the projects seperately in IDE, the missing references i mentioned occuring in MSBuild creeps up. Very wierd.

So to summarize,

Buiilding .proj in MSBuild - Good

Buiilding .proj in IDE - Error

Buiilding .sln in MSBuild - Error

Buiilding .sln in IDE - Good

Looks very wierd for me. Help much much appreciated.

答:
Remove the assembly from GAC(C:\WINDOWS\assembly folder - select your assebly and right click and uninstall).

Because solution keeps reference using guid and if that guid is in GAC, it will keep taking GAC version for compilation.

ContentLicense: CC BY-SA 2.5

Body:
When i build a A.sln which includes 2 projects B.csproj and C.csproj which has internal project references it throws reference errors in MSBuild. But when i build B.csproj and C.csproj seperately in MSBuild it don't throw errors. And also building A.sln in VS IDE also don't throw errors.I'm using .NET 2.0 framework. Please find below the scripts used to build the sln and projs.

MSBuild "<path>/A.sln" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\A.sln.log /verbosity:normal

MSBuild "<path>/B.csproj" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\B.csproj.log /verbosity:normal

MSBuild "<path>/C.csproj" /p:Configuration=Release /p:StartupObject="" /p:WarningLevel=4 /p:Optimize=true /t:rebuild /l:Filelogger,Microsoft.Build.Engine;logfile=F:\C.csproj.log /verbosity:normal

Edit:

All the errors thrown are from code for missing refernces(all are project references). I get only three type of errors like given below.

error CS0012: The type 'X' is defined
  in an assembly that is not referenced.
  You must add a reference to assembly
  'Y, Version=2.0.0.0, Culture=neutral,
  PublicKeyToken=aad4cbe5d7c27078'.

error CS0234: The type or namespace
  name 'X' does not exist in the
  namespace 'Y' (are you missing an
  assembly reference?)

error CS0246: The type or namespace
  name 'X' could not be found (are you
  missing a using directive or an
  assembly reference?)

I cleared all previously built dlls from build paths before building from both IDE and MSBuild. But IDE just works fine and don't show a reference missing indicator in "Refrences" section for the project.

No reference paths added manually in IDE.

Another Update:

I just noticed that when i open both the projects from the solution, references are correctly pointing in IDE. But when i open the projects seperately in IDE, the missing references i mentioned occuring in MSBuild creeps up. Very wierd.

So to summarize,

Buiilding .proj in MSBuild - Good

Buiilding .proj in IDE - Error

Buiilding .sln in MSBuild - Error

Buiilding .sln in IDE - Good

Looks very wierd for me. Help much much appreciated.

ContentLicense: CC BY-SA 3.0


问:
Add-PSSnapin Microsoft.Crm.PowerShell not installed error
Trying to script an upgrade for my Dynamics organization following this TechNet blog.

But running into the below error which I understand, but not sure the process to get the PSSnapin onto my system.

```<code>PS C:\Program Files\Dynamics SDK\SDK\Bin> Add-PSSnapin Microsoft.Crm.PowerShell

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.Crm.PowerShell' is not installed on this computer.
At line:1 char:1
+ Add-PSSnapin Microsoft.Crm.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Crm.PowerShell:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
</code>```

答:
First of all, sign in with the Administrator account on your Microsoft Dynamics 365 server.

Then in elevated mode Run

```<code>Add-PSSnapin Microsoft.Crm.PowerShell
</code>```

If you have no registered then use the Use PowerShell cmdlets for XRM tooling to connect to Dynamics 365

You can externally also download the same from GITHUB:
Link provided by theMadTechnician

Hope it helps

Body:
Trying to script an upgrade for my Dynamics organization following this TechNet blog.

But running into the below error which I understand, but not sure the process to get the PSSnapin onto my system.

PS C:\Program Files\Dynamics SDK\SDK\Bin> Add-PSSnapin Microsoft.Crm.PowerShell

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.Crm.PowerShell' is not installed on this computer.
At line:1 char:1
+ Add-PSSnapin Microsoft.Crm.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Crm.PowerShell:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Body:
First of all, sign in with the Administrator account on your Microsoft Dynamics 365 server.

Then in elevated mode Run

Add-PSSnapin Microsoft.Crm.PowerShell

If you have no registered then use the Use PowerShell cmdlets for XRM tooling to connect to Dynamics 365

You can externally also download the same from GITHUB:
Link provided by theMadTechnician

Hope it helps


问:
Hazelcast cluster over AWS using Docker
Hi am trying to configure hazelcast cluster over AWS.

I am running hazelcast in docker container and using --net=host to use host network config.

when i look at hazelcast logs, I see

```<code>[172.17.0.1]:5701 [herald] [3.8] Established socket connection between /[node2]:5701 and /[node1]:47357
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-out-0] DEBUG c.h.n.t.SocketWriterInitializerImpl - [172.17.0.1]:5701 [herald] [3.8] Initializing SocketWriter WriteHandler with Cluster Protocol
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-in-0] WARN  c.h.nio.tcp.TcpIpConnectionManager - [172.17.0.1]:5701 [herald] [3.8] Wrong bind request from [172.17.0.1]:5701! This node is not requested endpoint: [node2]:5701
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-in-0] INFO  c.hazelcast.nio.tcp.TcpIpConnection - [172.17.0.1]:5701 [herald] [3.8] Connection[id=40, /[node2]:5701->/[node1]:47357, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [172.17.0.1]:5701! This node is not requested endpoint: [node2]:5701
</code>```

I can see error saying bind request is coming from 172.17.0.1 to node1, and node1 is not accepting this request.

```<code>        final Config config = new Config();
        config.setGroupConfig(clientConfig().getGroupConfig());
        final NetworkConfig networkConfig = new NetworkConfig();
        final JoinConfig joinConfig = new JoinConfig();
        final TcpIpConfig tcpIpConfig = new TcpIpConfig();
        final MulticastConfig multicastConfig = new MulticastConfig();
        multicastConfig.setEnabled(false);
        final AwsConfig awsConfig = new AwsConfig();
        awsConfig.setEnabled(true);
        // awsConfig.setSecurityGroupName("xxxx");
        awsConfig.setRegion("xxxx");
        awsConfig.setIamRole("xxxx");
        awsConfig.setTagKey("type");
        awsConfig.setTagValue("xxxx");
        awsConfig.setConnectionTimeoutSeconds(120);
        joinConfig.setAwsConfig(awsConfig);
        joinConfig.setMulticastConfig(multicastConfig);
        joinConfig.setTcpIpConfig(tcpIpConfig);
        networkConfig.setJoin(joinConfig);
        final InterfacesConfig interfaceConfig = networkConfig.getInterfaces();
        interfaceConfig.setEnabled(true).addInterface("172.29.238.71");
        config.setNetworkConfig(networkConfig);
</code>```

above is the code to configure AWSConfig
Please help me resolve this issue.

Thanks

答:
You are experiencing an issue (#11795) in default Hazelcast bind address selection mechanism.

There are several workarounds available:

Workaround 1: System property

You can set the bind address by providing correct IP address as a hazelcast.local.localAddress system property:

java -Dhazelcast.local.localAddress=[yourCorrectIpGoesHere]
```

<p>or</p>

<pre class="lang-java prettyprint-override"><code>System.setProperty("hazelcast.local.localAddress", "[yourCorrectIpGoesHere]")
</code>```

Read details in System properties chapter of Hazelcast Reference Manual.

Workaround 2: Hazelcast Network configuration

Hazelcast Network configuration allows you to specify which IP addresses can be used to bind the server.

Declarative in hazelcast.xml:

<hazelcast>
  ...
  <network>
    ...
    <interfaces enabled="true">
      <interface>10.3.16.*</interface>
      <interface>10.3.10.4-18</interface>
      <interface>192.168.1.3</interface>
    </interfaces>
  </network>
  ...
</hazelcast>
```

<p><strong>Programmatic:</strong></p>

<pre class="lang-java prettyprint-override"><code>Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
InterfacesConfig interfaceConfig = network.getInterfaces();
interfaceConfig.setEnabled(true).addInterface("192.168.1.3");
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
</code>```

Read details in Interfaces section of Hazelcast Reference Manual.

Update:
With the earlier steps you are able to set a proper bind address - the local one returned by ip addr show for instance. Nevertheless, it could be insufficient if you run Hazelcast in an environment where local IP and public IP differs (clouds, docker).

Next Step: Configure public address

This step is necessary in environments, where cluster nodes doesn't see each other under the reported local address of the other node. You have to set the public address - it's the one which nodes are able to reach (optionally with port specified).

networkConfig.setPublicAddress("172.29.238.71");

// or if a non-default Hazelcast port is used - e.g.9991
networkConfig.setPublicAddress("172.29.238.71:9991");
```

Title: Hazelcast cluster over AWS using Docker

Body:
Hi am trying to configure hazelcast cluster over AWS.

I am running hazelcast in docker container and using --net=host to use host network config.

when i look at hazelcast logs, I see

[172.17.0.1]:5701 [herald] [3.8] Established socket connection between /[node2]:5701 and /[node1]:47357
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-out-0] DEBUG c.h.n.t.SocketWriterInitializerImpl - [172.17.0.1]:5701 [herald] [3.8] Initializing SocketWriter WriteHandler with Cluster Protocol
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-in-0] WARN  c.h.nio.tcp.TcpIpConnectionManager - [172.17.0.1]:5701 [herald] [3.8] Wrong bind request from [172.17.0.1]:5701! This node is not requested endpoint: [node2]:5701
04:24:22.595 [hz._hzInstance_1_herald.IO.thread-in-0] INFO  c.hazelcast.nio.tcp.TcpIpConnection - [172.17.0.1]:5701 [herald] [3.8] Connection[id=40, /[node2]:5701->/[node1]:47357, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [172.17.0.1]:5701! This node is not requested endpoint: [node2]:5701

I can see error saying bind request is coming from 172.17.0.1 to node1, and node1 is not accepting this request.

        final Config config = new Config();
        config.setGroupConfig(clientConfig().getGroupConfig());
        final NetworkConfig networkConfig = new NetworkConfig();
        final JoinConfig joinConfig = new JoinConfig();
        final TcpIpConfig tcpIpConfig = new TcpIpConfig();
        final MulticastConfig multicastConfig = new MulticastConfig();
        multicastConfig.setEnabled(false);
        final AwsConfig awsConfig = new AwsConfig();
        awsConfig.setEnabled(true);
        // awsConfig.setSecurityGroupName("xxxx");
        awsConfig.setRegion("xxxx");
        awsConfig.setIamRole("xxxx");
        awsConfig.setTagKey("type");
        awsConfig.setTagValue("xxxx");
        awsConfig.setConnectionTimeoutSeconds(120);
        joinConfig.setAwsConfig(awsConfig);
        joinConfig.setMulticastConfig(multicastConfig);
        joinConfig.setTcpIpConfig(tcpIpConfig);
        networkConfig.setJoin(joinConfig);
        final InterfacesConfig interfaceConfig = networkConfig.getInterfaces();
        interfaceConfig.setEnabled(true).addInterface("172.29.238.71");
        config.setNetworkConfig(networkConfig);

above is the code to configure AWSConfig
Please help me resolve this issue.

Thanks

Body:
You are experiencing an issue (#11795) in default Hazelcast bind address selection mechanism.

There are several workarounds available:

Workaround 1: System property

You can set the bind address by providing correct IP address as a hazelcast.local.localAddress system property:

java -Dhazelcast.local.localAddress=[yourCorrectIpGoesHere]

or

System.setProperty("hazelcast.local.localAddress", "[yourCorrectIpGoesHere]")

Read details in System properties chapter of Hazelcast Reference Manual.

Workaround 2: Hazelcast Network configuration

Hazelcast Network configuration allows you to specify which IP addresses can be used to bind the server.

Declarative in hazelcast.xml:

<hazelcast>
  ...
  <network>
    ...
    <interfaces enabled="true">
      <interface>10.3.16.*</interface>
      <interface>10.3.10.4-18</interface>
      <interface>192.168.1.3</interface>
    </interfaces>
  </network>
  ...
</hazelcast>

Programmatic:

Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
InterfacesConfig interfaceConfig = network.getInterfaces();
interfaceConfig.setEnabled(true).addInterface("192.168.1.3");
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);

Read details in Interfaces section of Hazelcast Reference Manual.

Update:
With the earlier steps you are able to set a proper bind address - the local one returned by ip addr show for instance. Nevertheless, it could be insufficient if you run Hazelcast in an environment where local IP and public IP differs (clouds, docker).

Next Step: Configure public address

This step is necessary in environments, where cluster nodes doesn't see each other under the reported local address of the other node. You have to set the public address - it's the one which nodes are able to reach (optionally with port specified).

networkConfig.setPublicAddress("172.29.238.71");

// or if a non-default Hazelcast port is used - e.g.9991
networkConfig.setPublicAddress("172.29.238.71:9991");


问:
Angular does not work in Chrome
I have created an Angular-cli project in WebStorm and when I run the project by click on Run icon I can see my project in http://127.0.0.1:4200/ or http://localhost:4200/ but when I copy these links into Chrome I can not see my project and it seems that the Chrome browser does not work. I see all related pages but I could not find a solution.

答: Use your local IP address instead of local host. It worked for me ex: http://10.0.1.30:4200</p>

Title: Angular does not work in Chrome


问:
IntelliJ IDEA and Google Chrome fail to connect for JavaScript debugging
JetBrains IntelliJ IDEA sometimes loses its own JetBrains IDE Support plugin in Chrome. Upon debugging in IDEA, Chrome complains that:

hmhgeddbohgjknpmjagkdomcpobmllji is blocked

Requests to the server have been blocked by an extension

and stays on this page:

```<code>chrome-extension://hmhgeddbohgjknpmjagkdomcpobmllji/loading.html?__QUERY__
</code>```

Where hmhgeddbohgjknpmjagkdomcpobmllji is JetBrains' plugin ID.

Instead of redirecting to the target page of the form:

```<code>http://localhost:63342/__PROJECT__/__PATH__/index.html
</code>```

答:
Restarting Google Chrome or disabling-and-enabling IDE Support plugin helps. IDEA "finds" Chrome again and Debug workflow works as intended.

Another possible problem is a failed authorization.

To debug a URL like this:

```<code>http://localhost:63342/__PROJECT__/__PATH__/index.html
</code>```

Open it in the browser before starting to debug. It'll give 404 Not Found. Then switch back to IDEA and it will offer you to Copy authorization URL to clipboard:

```<code>http://localhost:63342/__PROJECT__/__PATH__/index.html?_ijt=__KEY__
</code>```

Open this URL.

After this manual authentication is complete, IntelliJ IDEA should be able to debug index.html in Chrome.

IDEA always opens index.html for debugging in the browser window where the latest authentication happened. E.g., in a Chrome Incognito window, instead of a Chrome "normal" window, if you've just authorized IDEA in Incognito.

Going incognito may require an additional setup:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206201319-launching-chrome-incognito-in-intellij-12

Body:
JetBrains IntelliJ IDEA sometimes loses its own JetBrains IDE Support plugin in Chrome. Upon debugging in IDEA, Chrome complains that:

hmhgeddbohgjknpmjagkdomcpobmllji is blocked

Requests to the server have been blocked by an extension

and stays on this page:

chrome-extension://hmhgeddbohgjknpmjagkdomcpobmllji/loading.html?__QUERY__

Where hmhgeddbohgjknpmjagkdomcpobmllji is JetBrains' plugin ID.

Instead of redirecting to the target page of the form:

http://localhost:63342/__PROJECT__/__PATH__/index.html

Body:
Restarting Google Chrome or disabling-and-enabling IDE Support plugin helps. IDEA "finds" Chrome again and Debug workflow works as intended.

Another possible problem is a failed authorization.

To debug a URL like this:

http://localhost:63342/__PROJECT__/__PATH__/index.html

Open it in the browser before starting to debug. It'll give 404 Not Found. Then switch back to IDEA and it will offer you to Copy authorization URL to clipboard:

http://localhost:63342/__PROJECT__/__PATH__/index.html?_ijt=__KEY__

Open this URL.

After this manual authentication is complete, IntelliJ IDEA should be able to debug index.html in Chrome.

IDEA always opens index.html for debugging in the browser window where the latest authentication happened. E.g., in a Chrome Incognito window, instead of a Chrome "normal" window, if you've just authorized IDEA in Incognito.

Going incognito may require an additional setup:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206201319-launching-chrome-incognito-in-intellij-12


问:
Python - Log Transformation on variables using numpy
I am working on feature engineering process as part of a machine learning project. And currently I have to determine whether to do log transformation for certain columns or not.

I came to know that log transformation should be done on those columns which are having skew distribution of values.

Now here are my questions / doubts for which I need clarifications.

How do I determine in Python whether a particular column values belong to skew distributions(either right skew or left skew) ?

And assume that I have determined the columns over which I need to apply log transformation, there are many bases to the log function such as loge, log10, log2, etc... So do I use natural log (i.e) loge or log10 or anything else in this machine learning approach ?

And if I am not wrong, log transformation can be applied only on numeric variables. Is this right ?

答:
Yes, you can apply log transformation to numerical data only. There are other alternative ways to convert text data into numerical ex. one-hot-encoding.

Plot the histogram of columns to check if there is any skewness in the data. Box plot also helps in this regards.

If you are using pandas then hist() function will be helpful. Try to plot with different bin sizes.
For log transformation select any base, that won't impact much. Generally loge and log10 are used.


问:
Comparing the row with other row within same query
I have a question about the SQL Query.

Basically, I would like to get a sample value from the testCategory = compareTestCat and testType = compTestType.

I am not really sure if we can compare the first row with the fourth row within the same query.
Is there any way that I can do this?

答:
Try SELF JOIN to compare values within the same table.

Try the Following:

```<code>SELECT A.*
FROM YourTable A
JOIN YourTable B ON A.testCategory = B.compareTestCat and A.testType = B.compTestType
</code>```

A and B are the different alias names for the same table.

Body:
Try SELF JOIN to compare values within the same table.

Try the Following:

SELECT A.*
FROM YourTable A
JOIN YourTable B ON A.testCategory = B.compareTestCat and A.testType = B.compTestType

A and B are the different alias names for the same table.


问:
junit spring boot profile properties not being read
I am trring to read a value from the properties file in my junit setup using spring boot.
I can not read the value. Below is my content:-

application-test.properties

```<code>my.user.name=Amar
</code>```

COnfig file to create beans:

```<code>@Configuration
@ActiveProfiles("test")
@Profile("test")
public class RdbmsTestConfig {

    @Value("${my.user.name}")
    private String name;

    @Bean
    public String myString(){
        return "Amar";
    }

    @Bean
    public PropsHolder propsHolder() {
        PropsHolder propsHolder = new PropsHolder();
        propsHolder.setUserName(name);
        return propsHolder;
    }
 }
</code>```

My test class:

```<code>@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = RdbmsTestConfig.class)
@ActiveProfiles("test")
public class TestRoomService {

    @Autowired
    @Qualifier("myString")
    private String myString;

    @Autowired
    private PropsHolder propsHolder;

    @Autowired
    private Environment env;

    @Test
    public void userTest() {
        Arrays.stream(env.getActiveProfiles()).forEach(System.out::println);
        System.out.println(propsHolder.getUserName());
        Assert.assertNotNull(myString);
        Assert.assertEquals("Amar",myString);
    }
}
</code>```

The value for propsHolder.getUserName comes out to be ${my.user.name}

答:
I've never used @Profile(), so i'm not sure if that is supposed to do what you want it to do. But I'm always using @PropertySources(), because otherwise, how is the code supposed to know where to look for the properties?</p>

```<code>@Configuration
@PropertySources(value = { @PropertySource("classpath:core-
test.properties") })
</code>```

Body:
I am trring to read a value from the properties file in my junit setup using spring boot.
I can not read the value. Below is my content:-

application-test.properties

my.user.name=Amar

COnfig file to create beans:

@Configuration
@ActiveProfiles("test")
@Profile("test")
public class RdbmsTestConfig {

    @Value("${my.user.name}")
    private String name;

    @Bean
    public String myString(){
        return "Amar";
    }

    @Bean
    public PropsHolder propsHolder() {
        PropsHolder propsHolder = new PropsHolder();
        propsHolder.setUserName(name);
        return propsHolder;
    }
 }

My test class:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = RdbmsTestConfig.class)
@ActiveProfiles("test")
public class TestRoomService {

    @Autowired
    @Qualifier("myString")
    private String myString;

    @Autowired
    private PropsHolder propsHolder;

    @Autowired
    private Environment env;

    @Test
    public void userTest() {
        Arrays.stream(env.getActiveProfiles()).forEach(System.out::println);
        System.out.println(propsHolder.getUserName());
        Assert.assertNotNull(myString);
        Assert.assertEquals("Amar",myString);
    }
}

The value for propsHolder.getUserName comes out to be ${my.user.name}

Body:
I've never used @Profile(), so i'm not sure if that is supposed to do what you want it to do. But I'm always using @PropertySources(), because otherwise, how is the code supposed to know where to look for the properties?

@Configuration
@PropertySources(value = { @PropertySource("classpath:core-
test.properties") })


问:
Standard app engine maven plugin appengine:run restarts spring boot application multiple times
I am facing weird issue with standard app engine and spring boot application generated using jhipster. When I am trying to run appengine:run on my local system, application is initiated by maven plugin multiple times and then it fails as datasource instance is already initiated.
Due to which it's difficult to debug the issues with application. Recently I added google search API. And to debug the same I need to run it locally.
The same application runs without any issues on cloud.

Anyone has any idea what could be wrong with it?

答: I resolved this issue by reducing scaling instances to 1. It's not actually issue. It was initializing due to scaling specified in appengine-web.xml</p>


问:
Hiding elements and categories for custom controls
I have a question please. Is it possible to hide some of the elements and categories of the base control (for a custom control). I want only the properties I defined to be shown. Thanks for your time.</p>

答:
You can use the [Browsable(false)] custom attribute to prevent the property from appearing in the WinForms property editor:

```<code>[Browsable(false)]
public new PropertyType PropertyName
{
    get { return base.PropertyName; }
    set { base.PropertyName = value; }
}
</code>```

However, this will make the property still work, it just won’t appear in the form designer. The compiler will happily accept it. If you want the property to actually stop working, throw exceptions:

```<code>[Browsable(false)]
public new PropertyType PropertyName
{
    get { throw new InvalidOperationException("This property cannot be used with this control."); }
    set { throw new InvalidOperationException("This property cannot be used with this control."); }
}
</code>```

Of course, the compiler will still happily accept it, but it will throw at runtime. However, even so, the client programmer could still access the “original” property by casting to the base type, i.e. instead of

```<code>myControl.PropertyName
</code>```

they can write

```<code>((BaseControlType) myControl).PropertyName
</code>```

and it would still work. There is nothing you can do about this (short of deriving from a different base class).

Body:
You can use the [Browsable(false)] custom attribute to prevent the property from appearing in the WinForms property editor:

[Browsable(false)]
public new PropertyType PropertyName
{
    get { return base.PropertyName; }
    set { base.PropertyName = value; }
}

However, this will make the property still work, it just won’t appear in the form designer. The compiler will happily accept it. If you want the property to actually stop working, throw exceptions:

[Browsable(false)]
public new PropertyType PropertyName
{
    get { throw new InvalidOperationException("This property cannot be used with this control."); }
    set { throw new InvalidOperationException("This property cannot be used with this control."); }
}

Of course, the compiler will still happily accept it, but it will throw at runtime. However, even so, the client programmer could still access the “original” property by casting to the base type, i.e. instead of

myControl.PropertyName

they can write

((BaseControlType) myControl).PropertyName

and it would still work. There is nothing you can do about this (short of deriving from a different base class).


问:
Problems with React Router Redux ("React.createElement: type is invalid" error)
I've got some problems setting up React-Router-Redux.
I'm just following the basic example on https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux#usage.

My App.jsx looks like this:

```<code>import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import createHistory from 'history/createBrowserHistory';

import Home from './containers/Home';
import About from './containers/About';
import store from './store';

const history = createHistory();

class App extends Component {
  render() {
    return (
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <div>
            <Route exact path="/" component={Home}/>
            <Route path="/about" component={About}/>
          </div>
        </ConnectedRouter>
      </Provider>
    );
  }
}

export default App;
</code>```

When I save this, I get the following error:

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.

Check your code at App.js:25.

And line 25 is:
<ConnectedRouter history={history}>

Can someone help me out?

These are my dependencies:

```<code>"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"history": "^4.7.2",
"redux": "^3.7.2",
</code>```

答:
ConnectedRouter component available for react-router-redux version 5. Look at this issue. As we can see from your dependencies, you are using react-router-redux version 4 currently.

So you should upgrade your react-router-redux package this way:

if you use npm:

```<code>npm install react-router-redux@next
</code>```

or if you use yarn:

```<code>yarn add react-router-redux@next
</code>```

Body:
I've got some problems setting up React-Router-Redux.
I'm just following the basic example on https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux#usage.

My App.jsx looks like this:

import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import createHistory from 'history/createBrowserHistory';

import Home from './containers/Home';
import About from './containers/About';
import store from './store';

const history = createHistory();

class App extends Component {
  render() {
    return (
      <Provider store={store}>
        <ConnectedRouter history={history}>

            <Route exact path="/" component={Home}/>
            <Route path="/about" component={About}/>

        </ConnectedRouter>
      </Provider>
    );
  }
}

export default App;

When I save this, I get the following error:

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.

Check your code at App.js:25.

And line 25 is:
<ConnectedRouter history={history}>

Can someone help me out?

These are my dependencies:

"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"history": "^4.7.2",
"redux": "^3.7.2",

Body:
ConnectedRouter component available for react-router-redux version 5. Look at this issue. As we can see from your dependencies, you are using react-router-redux version 4 currently.

So you should upgrade your react-router-redux package this way:

if you use npm:

npm install react-router-redux@next

or if you use yarn:

yarn add react-router-redux@next

ContentLicense: CC BY-SA 4.0


问:
Second spinner does not update values
If i change or add first spinner's (spinnerBreeds) values - works ok. But Second spinner does not update values. I tried  call the notifyDataSetChanged() on the adapter, but still does not work.

My code is:

```<code>    public class MainActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            // Create DataHelper object and insert some sample data
            DataHelper datahelper = new DataHelper(this);
            datahelper.insertBreed ("Beagle");
            datahelper.insertBreed ("Bulldog");
            datahelper.insertBreed ("Chow Chow");

            // Get sample data from the database and display them in the spinner
            Spinner spinnerBreeds = (Spinner) findViewById(R.id.spinnerBreeds);
            ArrayList<String> list = datahelper.getAllBreeds();
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list);
            spinnerBreeds.setAdapter(adapter);

            //Init second spinner
            DataHelper2 datahelper2 = new DataHelper2(this);
            datahelper2.insertAge("1 year");
            datahelper2.insertAge ("2-3 years");
            datahelper2.insertAge("4-5 years");
            datahelper2.insertAge("6-9 years");
            datahelper2.insertAge("10+ years");

            // Get sample data from the database and display them in the spinner
            Spinner spinnerAge = (Spinner) findViewById(R.id.spinnerAge);
            ArrayList<String> list2 = datahelper2.getAllAge();
            ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list2);
            spinnerAge.setAdapter(adapter2);

    }
</code>```

答:
Replace these:

```<code>new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list);
new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list2)
</code>```

with:

```<code>new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, list);
new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, list2)
</code>```

And instead of this:

```<code>ArrayList<String> list = datahelper.getAllBreeds();
</code>```

Use:

```<code>ArrayList<String> list = new ArrayList<String>();
for(DataHelper d: dataHelper)
        {
            if (d.getBreed() != null)
            {
                list1.add(d.getBreed();
            }
        }
</code>```

And instead of:

```<code>ArrayList<String> list2 = datahelper2.getAllAge();
</code>```

Use:

```<code>ArrayList<String> list2 = new ArrayList<String>();
for(DataHelper2 a : dataHelper2)
        {
            if (a.getAge() != null)
            {
                list2.add(a.getAge();
            }
        }
</code>```

Title: Second spinner does not update values

Body:
If i change or add first spinner's (spinnerBreeds) values - works ok. But Second spinner does not update values. I tried  call the notifyDataSetChanged() on the adapter, but still does not work.

My code is:

    public class MainActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            // Create DataHelper object and insert some sample data
            DataHelper datahelper = new DataHelper(this);
            datahelper.insertBreed ("Beagle");
            datahelper.insertBreed ("Bulldog");
            datahelper.insertBreed ("Chow Chow");

            // Get sample data from the database and display them in the spinner
            Spinner spinnerBreeds = (Spinner) findViewById(R.id.spinnerBreeds);
            ArrayList<String> list = datahelper.getAllBreeds();
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list);
            spinnerBreeds.setAdapter(adapter);

            //Init second spinner
            DataHelper2 datahelper2 = new DataHelper2(this);
            datahelper2.insertAge("1 year");
            datahelper2.insertAge ("2-3 years");
            datahelper2.insertAge("4-5 years");
            datahelper2.insertAge("6-9 years");
            datahelper2.insertAge("10+ years");

            // Get sample data from the database and display them in the spinner
            Spinner spinnerAge = (Spinner) findViewById(R.id.spinnerAge);
            ArrayList<String> list2 = datahelper2.getAllAge();
            ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list2);
            spinnerAge.setAdapter(adapter2);

    }

Body:
Replace these:

new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list);
new ArrayAdapter<String>(this, R.layout.spinner_layout, R.id.text, list2)

with:

new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, list);
new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, list2)

And instead of this:

ArrayList<String> list = datahelper.getAllBreeds();

Use:

ArrayList<String> list = new ArrayList<String>();
for(DataHelper d: dataHelper)
        {
            if (d.getBreed() != null)
            {
                list1.add(d.getBreed();
            }
        }

And instead of:

ArrayList<String> list2 = datahelper2.getAllAge();

Use:

ArrayList<String> list2 = new ArrayList<String>();
for(DataHelper2 a : dataHelper2)
        {
            if (a.getAge() != null)
            {
                list2.add(a.getAge();
            }
        }


问:
How to create error vector without NULLs/NAs?
I have a function that starts with input validation.
It checks if the first argument is dataframe, the second is string etc...

I have defined an error vector:

```<code>err_msg <- c()
</code>```

If any of the validation conditions fails (if's) I am appending the err_msg vector:

```<code>err_msg[1] <- "Please provide non empty data set!"
err_msg[3] <- "'Product' should be a string" etc...
</code>```

Final error vector looks like this:

```<code>err_msg
"Please provide non empty data set!", NA, "'Product' should be a string"
</code>```

I want it to omit NA/NULL and shrink it to contain only error messages.

Please advise how can I do it (one line code) maybe there is a function or best practice to do this.

答:
According to the comments I have changed the error mechanism of my functions and I will not "collect" error messages (I wanted to show all the issues with the inputs in one list/vector for the user to fix all at once).

If there is an error, I have a flag that will become true, the main function code will check the flag and enter the function main code only if it passed validation.

Else print error message.

If next run won't pass validation it will print the appropriate error.
If you think there is another best practice please post here.

Body:
I have a function that starts with input validation.
It checks if the first argument is dataframe, the second is string etc...

I have defined an error vector:

err_msg <- c()

If any of the validation conditions fails (if's) I am appending the err_msg vector:

err_msg[1] <- "Please provide non empty data set!"
err_msg[3] <- "'Product' should be a string" etc...

Final error vector looks like this:

err_msg
"Please provide non empty data set!", NA, "'Product' should be a string"

I want it to omit NA/NULL and shrink it to contain only error messages.

Please advise how can I do it (one line code) maybe there is a function or best practice to do this.


问:
The content of element type "id" must match - hbm xml
I know this question is asked quite often.

I get the below mapping error.

I have tried some permutations and combinations.

I've tried some solutions and cannot seem to get this fixed.

Can someone look at my below configuration?

The xmls are valid.

I use hibernate 3 and mysql as the database

Error Log:

```<code>log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/sample/Employee.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:17)
    at com.sample.TestEmployee.main(TestEmployee.java:13)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/sample/Employee.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:523)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1511)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1352)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1338)
    at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:12)
    ... 1 more
Caused by: org.hibernate.MappingException: invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:463)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:520)
    ... 8 more
Caused by: org.xml.sax.SAXParseException: The content of element type "id" must match "(meta*,column*,type?,generator?)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:460)
    ... 9 more
</code>```

Employee.hbm.xml

```<code><?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "//Hibernate/Hibernate Mapping DTD 3.0//EN/" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.sample.Employee" table="employee">
   <id name="idEmployee" column="ID">
        <column name="uid" not-null="true"/>
        <generator class="native" />
   </id>
   <property name="empName">
       <column name="empName" length="16" not-null="true" />
   </property>
   <property name="sex">
        <column name="sex" length="16" not-null="true" />
   </property>
</class>
</hibernate-mapping>

Employee class:
package com.sample;
public class Employee {

    private Long idEmployee;
    private String empName;
    private String sex;
    public Long getIdEmployee() {
        return idEmployee;
    }
    public void setIdEmployee(Long idEmployee) {
        this.idEmployee = idEmployee;
    }
    public String getEmpName() {
        return empName;
    }
    private String address;
    private int age;

    public void setEmpName(String empName) {
        this.empName = empName;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
CREATE TABLE `employee` (
`idEmployee` int(11) NOT NULL AUTO_INCREMENT,
`empName` varchar(45) NOT NULL,
`sex` varchar(45) NOT NULL,
`age` int(11) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
 PRIMARY KEY (`idEmployee`)
 );
</code>```

答:
Exception says:

```<code>Caused by: org.xml.sax.SAXParseException: The content of element type "id" must match "(meta*,column*,type?,generator?)".
</code>```

Your ID type is mismatched. On Employee class your idEmployee variable type is Long and on .hbm.xml file your ID property mapping has native generator that means the ID is Integer type by default. So you should use type="long" annotation on your ID property. Or just try to use different type of ID generator. And on your ID annotation in .hbm.xml file you using two names for ID column. You are using column="ID" and column="uid". Example how .hbm.xml file should look like:

```<code><hibernate-mapping>
     <class name="com.sample.Employee" table="employee">
        <id name="idEmployee" type="long">
            <column name="uid" not-null="true"/>
            <generator class="native" />
        </id>
        <property name="empName">
            <column name="empName" length="16" not-null="true" />
        </property>
        <property name="sex">
            <column name="sex" length="16" not-null="true" />
        </property>
    </class>
</hibernate-mapping>
</code>```

Or try to use SequenceStyleGenerator. Generator which creates separate ID sequence for every table by given sequence name. The default type of generated id is Long. .hbm.xml file example:

```<code> <hibernate-mapping>
    <class name="com.sample.Employee" table="employee">
        <id name="idEmployee" column="ID">
            <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
                <param name="optimizer">none</param>
                <param name="increment_size">1</param>
                <param name="sequence_name">seq_employee_id</param>
            </generator>
        </id>
        <property name="empName">
            <column name="empName" length="16" not-null="true" />
        </property>
        <property name="sex">
            <column name="sex" length="16" not-null="true" />
        </property>
    </class>
 </hibernate-mapping>
</code>```

I hope it helps you... ☺

Body:
I know this question is asked quite often.

I get the below mapping error.

I have tried some permutations and combinations.

I've tried some solutions and cannot seem to get this fixed.

Can someone look at my below configuration?

The xmls are valid.

I use hibernate 3 and mysql as the database

Error Log:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/sample/Employee.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:17)
    at com.sample.TestEmployee.main(TestEmployee.java:13)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/sample/Employee.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:523)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1511)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1352)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1338)
    at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:12)
    ... 1 more
Caused by: org.hibernate.MappingException: invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:463)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:520)
    ... 8 more
Caused by: org.xml.sax.SAXParseException: The content of element type "id" must match "(meta*,column*,type?,generator?)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:460)
    ... 9 more

Employee.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "//Hibernate/Hibernate Mapping DTD 3.0//EN/" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.sample.Employee" table="employee">
   <id name="idEmployee" column="ID">
        <column name="uid" not-null="true"/>
        <generator class="native" />
   </id>
   <property name="empName">
       <column name="empName" length="16" not-null="true" />
   </property>
   <property name="sex">
        <column name="sex" length="16" not-null="true" />
   </property>
</class>
</hibernate-mapping>

Employee class:
package com.sample;
public class Employee {

    private Long idEmployee;
    private String empName;
    private String sex;
    public Long getIdEmployee() {
        return idEmployee;
    }
    public void setIdEmployee(Long idEmployee) {
        this.idEmployee = idEmployee;
    }
    public String getEmpName() {
        return empName;
    }
    private String address;
    private int age;

    public void setEmpName(String empName) {
        this.empName = empName;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
CREATE TABLE `employee` (
`idEmployee` int(11) NOT NULL AUTO_INCREMENT,
`empName` varchar(45) NOT NULL,
`sex` varchar(45) NOT NULL,
`age` int(11) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
 PRIMARY KEY (`idEmployee`)
 );

Body:
Exception says:

Caused by: org.xml.sax.SAXParseException: The content of element type "id" must match "(meta*,column*,type?,generator?)".

Your ID type is mismatched. On Employee class your idEmployee variable type is Long and on .hbm.xml file your ID property mapping has native generator that means the ID is Integer type by default. So you should use type="long" annotation on your ID property. Or just try to use different type of ID generator. And on your ID annotation in .hbm.xml file you using two names for ID column. You are using column="ID" and column="uid". Example how .hbm.xml file should look like:

<hibernate-mapping>
     <class name="com.sample.Employee" table="employee">
        <id name="idEmployee" type="long">
            <column name="uid" not-null="true"/>
            <generator class="native" />
        </id>
        <property name="empName">
            <column name="empName" length="16" not-null="true" />
        </property>
        <property name="sex">
            <column name="sex" length="16" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

Or try to use SequenceStyleGenerator. Generator which creates separate ID sequence for every table by given sequence name. The default type of generated id is Long. .hbm.xml file example:

 <hibernate-mapping>
    <class name="com.sample.Employee" table="employee">
        <id name="idEmployee" column="ID">
            <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
                <param name="optimizer">none</param>
                <param name="increment_size">1</param>
                <param name="sequence_name">seq_employee_id</param>
            </generator>
        </id>
        <property name="empName">
            <column name="empName" length="16" not-null="true" />
        </property>
        <property name="sex">
            <column name="sex" length="16" not-null="true" />
        </property>
    </class>
 </hibernate-mapping>

I hope it helps you... ☺


答:
Based on the very sparse information you provided, this looks like what you need:

```<code>SELECT *
    FROM
        TestTable
    WHERE
            testCategory = compareTestCat
        AND testType = compTestType;
</code>```

UPDATE

If you are interested in comparing different rows in the same table with each other, then you will need to go with a self join on the table. Examples of solutions for this have already been provided by others.

Title: Comparing the row with other row within same query

Body:
I have a question about the SQL Query.

Basically, I would like to get a sample value from the testCategory = compareTestCat and testType = compTestType.

I am not really sure if we can compare the first row with the fourth row within the same query.
Is there any way that I can do this?

Body:
Based on the very sparse information you provided, this looks like what you need:

SELECT *
    FROM
        TestTable
    WHERE
            testCategory = compareTestCat
        AND testType = compTestType;

UPDATE

If you are interested in comparing different rows in the same table with each other, then you will need to go with a self join on the table. Examples of solutions for this have already been provided by others.


问:
How to prevent collation affecting table names in SQL syntax?
Can someone explain how to protect table names from being subject to the collation settings?
I'm currently getting the error message:

```<code>(0 row(s) affected)

(0 row(s) affected)

(0 row(s) affected)
Msg 208, Level 16, State 1, Line 1
Invalid object name 'Dataarchive'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'MyDatabase.dbo.Dataarchive'.
</code>```

From this SQL:

```<code>USE master;
CREATE DATABASE MyDatabase COLLATE Danish_Norwegian_CI_AS;
GO

USE MyDatabase
CREATE TABLE DataArchive (id INT);
GO

SELECT * FROM DataArchive; -- succeeds
SELECT * FROM dataArcHIVE; -- succeeds
SELECT * FROM [MyDatabase].[dbo].[DataArchive]; -- succeeds
GO
SELECT * FROM Dataarchive; -- fails - interprets aa as special A character.
GO
SELECT * FROM [MyDatabase].[dbo].[Dataarchive]; -- fails
GO

USE MASTER;
DROP DATABASE MyDatabase;
GO
</code>```

I expected collation to apply to sorting my data, not to table names themselves.

Background

This situation has arisen because the customer was responsible for installing the SQL Server, and set the server collation to Danish_Norwegian_CI_AS, thus any database, by default has this collation (and we do not specifically set the collation of the Database when creating a new database through code/script). In this situation, I still did not expect that our table names would be interpreted differently at all. Meaning our only option is to force latin collation on the database and users can specify per-column collation if they want something different?

答:
I think SQL Server before execute a query, check or compile it, for example it checks for table validation like this:

```<code>select *
from sys.objects
where name = N'Dataarchive'
</code>```

That will have no result. instead for other modes that will return a result.

Because of this it will raise:

Invalid object name 'Dataarchive'.

But you can check over sys.object with another COLLATION like this:

```<code>select *
from sys.objects
where name COLLATE latin1_General_CI_AI = N'Dataarchive'
</code>```

That will have a result, AFAIK, You can't force SQL Server DBMS to do its check or compile like this.

BTW, You can get data of a table in that case - with using Dynamic SQL - like this:

```<code>declare @tablename nvarchar(255) = 'Dataarchive';
declare @sql nvarchar(255) =
    N'SELECT * FROM '+ (
        select name
        from sys.tables
        where name = @tablename COLLATE Latin1_General_CI_AI);
exec sp_sqlexec @sql;
</code>```

Body:
Can someone explain how to protect table names from being subject to the collation settings?
I'm currently getting the error message:

(0 row(s) affected)

(0 row(s) affected)

(0 row(s) affected)
Msg 208, Level 16, State 1, Line 1
Invalid object name 'Dataarchive'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'MyDatabase.dbo.Dataarchive'.

From this SQL:

USE master;
CREATE DATABASE MyDatabase COLLATE Danish_Norwegian_CI_AS;
GO

USE MyDatabase
CREATE TABLE DataArchive (id INT);
GO

SELECT * FROM DataArchive; -- succeeds
SELECT * FROM dataArcHIVE; -- succeeds
SELECT * FROM [MyDatabase].[dbo].[DataArchive]; -- succeeds
GO
SELECT * FROM Dataarchive; -- fails - interprets aa as special A character.
GO
SELECT * FROM [MyDatabase].[dbo].[Dataarchive]; -- fails
GO

USE MASTER;
DROP DATABASE MyDatabase;
GO

I expected collation to apply to sorting my data, not to table names themselves.

Background

This situation has arisen because the customer was responsible for installing the SQL Server, and set the server collation to Danish_Norwegian_CI_AS, thus any database, by default has this collation (and we do not specifically set the collation of the Database when creating a new database through code/script). In this situation, I still did not expect that our table names would be interpreted differently at all. Meaning our only option is to force latin collation on the database and users can specify per-column collation if they want something different?

Body:
I think SQL Server before execute a query, check or compile it, for example it checks for table validation like this:

select *
from sys.objects
where name = N'Dataarchive'

That will have no result. instead for other modes that will return a result.

Because of this it will raise:

Invalid object name 'Dataarchive'.

But you can check over sys.object with another COLLATION like this:

select *
from sys.objects
where name COLLATE latin1_General_CI_AI = N'Dataarchive'

That will have a result, AFAIK, You can't force SQL Server DBMS to do its check or compile like this.

BTW, You can get data of a table in that case - with using Dynamic SQL - like this:

declare @tablename nvarchar(255) = 'Dataarchive';
declare @sql nvarchar(255) =
    N'SELECT * FROM '+ (
        select name
        from sys.tables
        where name = @tablename COLLATE Latin1_General_CI_AI);
exec sp_sqlexec @sql;


问:
scheduling order (timeline) for FCFS, SJN, SRT, Round Robin
I got this question from my friend, new to the operating system area.

We got:

Job number 1

Arrival Time = 0, CPU cycles = 80,

Job number 2

Arrival Time = 22, CPU cycles = 60,

Job number 3

Arrival Time = 44, CPU cycles = 24,

Job Number 4
Arrival Time = 55, CPU cycles = 40.

How can I do the scheduling order for FCFS, SJN, SRT, Round Robin (using a time quantum of 20).

Thank you. If you can give me any ideas...

答:
FCFS: stands for first come first serve Means the job that comes first must be executed at first so it will do it it's work in this way.

Job number 1 then Job number 2  then Job number 3  then Job Number 4.

It will not stop executing when the new process comes in. It has disadvantage that a short process has to wait for a longer process to finish because suppose a shorter process comes at end then it has to wait for all long processes on queue to end.

Shortest job first
This can't be implemented for short-term-scheduler.I will explain why at the end

You next algorithm is SRT is based on this algorithm. Here we get jobs in an order and we don't swith the cpu if the new job is short. However they arrival time of the processes is different so it will first execute job1 then job2 then job3 then job4. May be you think that job3is shorter and it should switch cpu but that only happends if you are allowed to preempt the process and if that's the case then it's not SJB but SRT.

However if you have two process at time 0 with length/burst = 80 and 40 then it will pick the process whose burst is 40.

Only for long term scheduler This algorithm is not for short-term scheduler because you need to know the length/burst of next process which takes time or you can also try to approximate time , there is a complex formula but that does not work always.

SRT: stands for shortest remaining time first: A premptive algorithm/version of shortest job first.

First job : arrival time 0 and CPU cycle 80

second job: arrival time 22 and CPU cycle 60

3rd job : arrival time 44 and CPU cycle 24

4rth job: arrival time 55 and CPU cycle 40

At time 0 the only process you have is F1(means first job) after 22 m-seconds a new process is placed in queue so the scheduler computes it's length and first job was executed for  22 m-seconds now it's remaining time is 80-22 = 58 and the length of new process is 60 which is greater than 58 so scheduler does not switch to the new process. After 44 m-seconds a third job comes in so you have 80-44 = 36 and time required by 3rd job is only 24 so the scheduler places all results of that process on stack and allocatess CPU to the third job/process.

After 55 second another process is placed on the queue with length 40 but the third process is still shorted so the first job is process 3 which will be finished for the first.

Job 1 runs for 44 seconds :     remaining time = 36 at this point Job 3 gets processor.

job 3 runs for 24 seconds: finished.

At this point we have job 1 with 36 m-seconds , job 2 with 60 m-seconds and job 4 with 40 seconds. So scheduler allocates again CPU to job 1 because it's the shortest and once it's finished then it allocates to job 4 and then job 2.

Disadvantage: Too much preemption require also time.

Round-Robin: Similar to First-come-first-serve the only difference is that it allocates equal time to each process(means allows preemption where fcfs does not allow). Here you use time quantum of few m-seconds.

There are two possibilities: Either the process completes it's burst then the process releases the CPU voluntarily if not the after the time quantum is over the scheduler take the CPU away from this process and allocates it to the next.

If you have N process in queue then every process will get 1/n cpu time in chunks of at most q time units.

Job1 gets CPU for 20 m-seconds and because there is no other process in queue then this job1 gets again cpu for next 20 sm-seconds.

As the first job has executed 2*20 this time there has been a new process(job2) in the queue so this process will get CPU for 20 seconds. When the job2 was executing there are two other process placed in the queue.(job3 and job4).
Now job3 gets the CPU for 20 seconds and then job4 gets CPU for 20 m-seconds.
After first cycle:

Job1 has executed 2*20 ; remaining time = 40

job2 has executed 20 ; remaining time =  40

job3 has executed 20; remaining time = 4

job4 has executed 20; remaining time = 20.

After second cycle:
 - Job1 has executed 40-20 ; remaining time = 20

job2 has executed 40-20 ; remaining time =  20

job3 has executed 4-4; remaining time = finished/only executed for 4 seconds.

job4 has executed 20-20; remaining time = 0/finished.

After third cycle:
 - Job1 has executed 20 - 20 ; remaining time = 0

job2 has executed 20 -20 ; remaining time =  0

The performance of this algorithm depends on the size of time-quantum. If you have small time quantum then too many preemptions/context-switches (moving processes to stack and allocating cpu to new process) is also not good and if time quantum is too large then it's also not good and try to think why? :D


问:
Moving from one tab to other using fragments
I have a tab layout having 4 tabs, the view pager is replaced with fragments, i have one button in tab 3 (i mean in fragment 3). On clicking of that button i should go to fragment 1 (inside tab 1), how to achieve this ?
 I am just able to replacing the fragment 3 with fragment 1. but the tabs also should change .</p>

答:
Prem's answer is right!
If you want to access view pager inside fragment from Activity just do it like that in fragment view click listener

```<code>((YOUR_VIEWPAGER_ACTIVITY)getActivity()).mViewPager.setCurrentItem(int position)
</code>```

Note: Make sure mViewPager is public in Activity

Body:
Prem's answer is right!
If you want to access view pager inside fragment from Activity just do it like that in fragment view click listener

((YOUR_VIEWPAGER_ACTIVITY)getActivity()).mViewPager.setCurrentItem(int position)

Note: Make sure mViewPager is public in Activity


问:
Moment js. How to convert the current time to a different time zone
For example current time (Timezone +2) time 11:00 how to get this time for (Time zone +9). Need to use moment js.

答:
Is explained in momentjs documentation

https://momentjs.com/timezone/docs/#/using-timezones/converting-to-zone/

Their example:

```<code>var m = moment.tz("2013-11-18 11:55", "America/Toronto");
m.format();                     // 2013-11-18T11:55:00-05:00
m.startOf("day").format();      // 2013-11-18T00:00:00-05:00
m.tz("Europe/Berlin").format(); // 2013-11-18T06:00:00+01:00
m.startOf("day").format();      // 2013-11-18T00:00:00+01:00
</code>```

Body:
Is explained in momentjs documentation

https://momentjs.com/timezone/docs/#/using-timezones/converting-to-zone/

Their example:

var m = moment.tz("2013-11-18 11:55", "America/Toronto");
m.format();                     // 2013-11-18T11:55:00-05:00
m.startOf("day").format();      // 2013-11-18T00:00:00-05:00
m.tz("Europe/Berlin").format(); // 2013-11-18T06:00:00+01:00
m.startOf("day").format();      // 2013-11-18T00:00:00+01:00


问:
Eclipse Unhandled event loop exception no more handles - Windows 7 64 bit
I have tried searching but cannot find my answer. I would appreciate any help.

I get this error when editing 2+ windows in Eclipse.Version: Luna Service Release 1 (4.4.1). eg., Open 2 class windows.

When clicking one panel to make class A active. If I click Class B to make Class A the active panel I get the same error.

Workaround is to close so I only have one panel showing for editing my class.

Unhandled event loop exception

```<code>org.eclipse.swt.SWTError: No more handles
    at org.eclipse.swt.SWT.error(SWT.java:4467)
    at org.eclipse.swt.SWT.error(SWT.java:4356)
    at org.eclipse.swt.SWT.error(SWT.java:4327)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
    at org.eclipse.swt.widgets.Control.createHandle(Control.java:703)
    at org.eclipse.swt.widgets.Label.createHandle(Label.java:199)
    at org.eclipse.swt.widgets.Control.createWidget(Control.java:743)
    at org.eclipse.swt.widgets.Control.<init>(Control.java:111)
    at org.eclipse.swt.widgets.Label.<init>(Label.java:101)
    at org.eclipse.ui.texteditor.StatusLineContributionItem.fill(StatusLineContributionItem.java:182)
    at org.eclipse.jface.action.SubContributionItem.fill(SubContributionItem.java:61)
    at org.eclipse.jface.action.StatusLineManager.update(StatusLineManager.java:345)
    at org.eclipse.ui.internal.WorkbenchPage.updateActivations(WorkbenchPage.java:302)
    at org.eclipse.ui.internal.WorkbenchPage.access$17(WorkbenchPage.java:280)
    at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:202)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$3.run(PartServiceImpl.java:234)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:231)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:682)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:613)
    at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:106)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.handleEvent(ContributedPartRenderer.java:61)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
    at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1453)
    at org.eclipse.swt.widgets.Shell.WM_MOUSEACTIVATE(Shell.java:2334)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4654)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1626)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.PeekMessage(OS.java:3141)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
</code>```

I also get:

```<code>Warning: The environment variable HOME is not set. The following directory will be used     to store the Git
user global configuration and to define the default location to store repositories:     'C:\Users\Chris'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
</code>```

But I have tried to install Git within Eclipse to no avail.

Thank you in advance,
Chris

答:
In most cases, the reason is having some resources (controls, images, fonts...) not disposed.

But e.g. for creating controls, exception is being thrown, when OS.CreateWindowEx() returns 0 (you can refer to https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms632680(v=vs.85).aspx for more details)

(This relates to Windows impl of SWT only of course)

You can use free Sysinternal Process Explorer to check whether you've actually taken too much handles (In Process Explorer wnd, choose View>Select Columns... > Process Memory tab > check "USER Objects")

Possible reason can be e.g. passing invalid parent into control's constructor

Hope this helps

Body:
I have tried searching but cannot find my answer. I would appreciate any help.

I get this error when editing 2+ windows in Eclipse.Version: Luna Service Release 1 (4.4.1). eg., Open 2 class windows.

When clicking one panel to make class A active. If I click Class B to make Class A the active panel I get the same error.

Workaround is to close so I only have one panel showing for editing my class.

Unhandled event loop exception

org.eclipse.swt.SWTError: No more handles
    at org.eclipse.swt.SWT.error(SWT.java:4467)
    at org.eclipse.swt.SWT.error(SWT.java:4356)
    at org.eclipse.swt.SWT.error(SWT.java:4327)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
    at org.eclipse.swt.widgets.Control.createHandle(Control.java:703)
    at org.eclipse.swt.widgets.Label.createHandle(Label.java:199)
    at org.eclipse.swt.widgets.Control.createWidget(Control.java:743)
    at org.eclipse.swt.widgets.Control.<init>(Control.java:111)
    at org.eclipse.swt.widgets.Label.<init>(Label.java:101)
    at org.eclipse.ui.texteditor.StatusLineContributionItem.fill(StatusLineContributionItem.java:182)
    at org.eclipse.jface.action.SubContributionItem.fill(SubContributionItem.java:61)
    at org.eclipse.jface.action.StatusLineManager.update(StatusLineManager.java:345)
    at org.eclipse.ui.internal.WorkbenchPage.updateActivations(WorkbenchPage.java:302)
    at org.eclipse.ui.internal.WorkbenchPage.access$17(WorkbenchPage.java:280)
    at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:202)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$3.run(PartServiceImpl.java:234)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:231)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:682)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:613)
    at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:106)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.handleEvent(ContributedPartRenderer.java:61)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
    at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1453)
    at org.eclipse.swt.widgets.Shell.WM_MOUSEACTIVATE(Shell.java:2334)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4654)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1626)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
    at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4705)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
    at org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.PeekMessage(OS.java:3141)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

I also get:

Warning: The environment variable HOME is not set. The following directory will be used     to store the Git
user global configuration and to define the default location to store repositories:     'C:\Users\Chris'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

But I have tried to install Git within Eclipse to no avail.

Thank you in advance,
Chris