Browsing 7239 questions and answers with Jon Skeet

Jenkins Execute shell commands with wildcards

I am trying to get Jenkins to execute a shell command but still allow wildcards to be used. Here's what I'm trying to do for reference: mvn deploy:deploy-file -Dpackaging=jar...
Jon Skeet
people
quotationmark

If you mean you just want the * to be passed on directly, just use single quotes to avoid the shell from applying globbing: mvn deploy:deploy-file [...] '-Dfile=Spigot/Spigot-Server/target/spigot-*.jar' more 4/16/2016 8:39:50 AM

people

Set and get properties and constants differences

Is there any difference between the following declarations (other than the difference between the const and static readonly)? public static int foo1 { get; } = 8; private static...
Jon Skeet
people
quotationmark

It's the same as foo2. The difference with foo3 is that the property access won't even consult foo3 - Foo3 is compiled to code equivalent to public static int Foo3 { { get { return 9; } } } Now admittedly from the perspective of... more 4/15/2016 7:32:31 PM

people

why? error? 'Car'member names cannot be the same as their enclosing type

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace half_test { class Car { private int...
Jon Skeet
people
quotationmark

Why? That's just the rules of the language. If you're creating a class called Car, it can't contain any members (properties, methods, fields, nested types, events) called Car. It would be really confusing if this were allowed,... more 4/15/2016 11:02:28 AM

people

Datest, offsets and timezones in java

I'm trying to understand the underlying mechanic of temporal utilities. So, I made the next example: public class Test { public static void main(String[] args) { ...
Jon Skeet
people
quotationmark

I have the LocalDateTime with established timezone systemDefault No, you don't. You started with a LocalDateTime, but then you converted it into a ZonedDateTime. A ZonedDateTime is effectively a LocalDateTime with a ZoneId and an... more 4/14/2016 6:00:11 PM

people

Check subclass of an object in Java

Consider the classes MinorClassA and MinorClassB, both extending MajorClass. I have an object of MajorClass that I know for sure is actually an instance of one of its...
Jon Skeet
people
quotationmark

Sounds like you want the instanceof operator: At run time, the result of the instanceof operator is true if the value of the RelationalExpression is not null and the reference could be cast to the ReferenceType without raising a... more 4/14/2016 10:24:46 AM

people

Fixing an line in c# wpf

the line i got the error : IEnumerator enumerator = this.ListBox1.Items.GetEnumerator(); while (enumerator.MoveNext()) { object objectValue =...
Jon Skeet
people
quotationmark

The simplest fix would be to use the language support for iterators: foreach (object value in ListBox1.Items) { list2.Add(Conversions.ToString(value)); } If you expect the values to already be strings, you could make the foreach... more 4/14/2016 9:54:06 AM

people

Create xml attribute with namespace programatically

How can I create the following as XElement? <data name="MyKey" xml:space="preserve"> <value>Date of birth</value> <comment>Some...
Jon Skeet
people
quotationmark

Separate the namespace from the local name, using the XName +(XNamespace, string) operator for convenience: data.Add(new XAttribute(XNamespace.Xml + "space", "preserve")); Note that you can write the whole of your element creation in a... more 4/14/2016 8:53:45 AM

people

Tricky : Array of controls dynamically created causing problems

I put "Tricky" in the title because I'm aware that it will be hard to understand precisely what I want but I'll try to be clear. I have a textBox with an event for TextChange...
Jon Skeet
people
quotationmark

You need to do three things when the number changes: Remove any existing textboxes Create a new array with the new size, and save a reference to that new array into your field (textBoxesQ) Initialize the array So something like: if... more 4/14/2016 6:14:21 AM

people

How to Parse the first Property even if the Json is not valid?

I am parsing tons of different jsons which only have the first Property in common. Depending on the value of this first property I parse the json into different object and also...
Jon Skeet
people
quotationmark

You can use a JsonReader (probably JsonTextReader as the concrete type) to parse the JSON as a stream, a bit like XmlReader. So for example: using System; using System.IO; using Newtonsoft.Json; public class Test { static void... more 4/13/2016 3:02:56 PM

people

Property file same key with different value in java

I have a property file like this. host=192.168.1.1 port=8060 host=192.168.1.2 port=8070 host=192.168.1.3 port=8080 host=192.168.1.4 port=8090 Now I want the unique url so I can...
Jon Skeet
people
quotationmark

Basically that property file is broken. A property file is a sequence of key/value pairs which is build into a map, so it requires the keys be unique. I suspect that if you load this into a Properties object at the moment, you'll get just... more 4/13/2016 12:36:58 PM

people