Browsing 7239 questions and answers with Jon Skeet
Java doesn't make this terribly easy, as far as I can see. I believe you do have to actually encode everything, but you don't need to create a big byte array... you can use a CharsetEncoder to keep encoding into a ByteBuffer in order to... more 7/10/2015 9:42:49 AM
Firstly, your code is bound to fail if a.length + b.length > 100. You should be using a.length + b.length as the length of c. Yes, because when you've gone past a.length, you're still trying to use b[i]. Imagine a.length is 50 and... more 7/10/2015 8:48:04 AM
Why the two methods gives so much of difference ? The Javascript code is giving you the number of milliseconds since the Unix epoch. The .NET code (if you'd got it right - more on that in a second) is giving you the number of ticks... more 7/10/2015 5:28:59 AM
You could write an extension method on the enum: public static Color ToColor(this ColorCode colorCode) { ... } Then you could have: Color tmp = ColorCode.Aqua.ToColor(); It's not quite an implicit conversion, but it's as readable... more 7/9/2015 5:35:16 PM
An ArrayList is fine - but the element type should be something that combines the 4 values. For example: List<Person> people = new ArrayList<>(); ... class Person { private final String firstName; private final String... more 7/9/2015 4:13:49 PM
This method: public void charAttack(int enemyHealth) { enemyHealth -= equippedWep[0].dmg; } ... is basically pointless. The statement enemyHealth -= ... only affects the parameter called enemyHealth. It won't change currEnemy.Health... more 7/9/2015 1:00:54 PM
"Signed" and "big-endian" are very different things, and I believe you're confusing yourself. Yes, bytes are signed in Java and unsigned in C# - but I strongly suspect you're getting the same actual bits in both cases... it's just that a... more 7/9/2015 12:35:01 PM
Currently if the dealer ID can't be found, you're calling RedirectToAction, but ignoring the result and then trying to return your view with the dealer ID. I suspect you want: [HttpGet] public ActionResult Edit(int dealerId = 0) { ... more 7/9/2015 11:05:37 AM
I suspect the problem is that the filename you're specifying is relative to your working directory, and you're expecting Process.Start to look there when starting the process - I don't believe it works that way when UseShellExecute is... more 7/9/2015 7:08:27 AM
Unfortunately I don't think the TimeSpan custom formatting makes this feasible :( You could either perform the string formatting yourself... string text = (int) span.TotalHours + span.ToString(@"\:mm\:ss"); Or string text =... more 7/9/2015 6:23:02 AM