Search Results

Search found 7 results on 1 pages for 'vilius normantas'.

Page 1/1 | 1 

  • HTML 5 Canvas performance

    - by Vilius
    Hello there! I'm just started on playing around with the canvas HTML5-object. For the sake of performance tests, I have made a little ping pong game (http://bit.ly/arTPut). Apart from my quick'n'dirty programming skills, I believe, that there are also some performance boosts, I haven't used. Especially, the ball seams to be blue with a little red-touch, but by my decleration it should be yellow. Would be very nice, if someone could help me! Greetings, Vilius

    Read the article

  • Java: random long number in 0 <= x < n range.

    - by Vilius Normantas
    Random class has a method to generate random int in a given range. For example: Random r = new Random(); int x = r.nextInt(100); This would generate an int number more or equal to 0 and less than 100. I'd like to do exactly the same with long number. long y = magicRandomLongGenerator(100); Random class has only nextLong(), but it doesn't allow to set range.

    Read the article

  • Scala: custom control structures with several code blocks

    - by Vilius Normantas
    Is it possible to create a custom control structure with several code blocks, in the fashion of before { block1 } then { block2 } finally { block3 }? The question is about the sugar part only - I know the functionality can be easily achieved by passing the three blocks to a method, like doInSequence(block1, block2, block3). A real life example. For my testing utilities I'd like to create a structure like this: getTime(1000) { // Stuff I want to repeat 1000 times. } after { (n, t) => println("Average time: " + t / n) }

    Read the article

  • Java: is Exception class thread-safe?

    - by Vilius Normantas
    As I understand, Java's Exception class is certainly not immutable (methods like initCause and setStackTrace give some clues about that). So is it at least thread-safe? Suppose one of my classes has a field like this: private final Exception myException; Can I safely expose this field to multiple threads? I'm not willing to discuss concrete cases where and why this situation could occur. My question is more about the principle: can I tell that a class which exposes field of Exception type is thread-safe? Another example: class CustomException extends Exception { ... } Is this class thread-safe?

    Read the article

  • Scala: Mixing traits with private fields

    - by Vilius Normantas
    It's not much of a question, it's rather my excitement that it's possible at all! I wrote this little example just to prove the opposite - I expected either a compiler error or one of the values (111 or 222, I wasn't sure). scala> trait T1 { private val v = 111; def getValueT1 = v } scala> trait T2 { private val v = 222; def getValueT2 = v } scala> class T12 extends T1 with T2 scala> val t = new T12 scala> t.getValueT1 res9: Int = 111 scala> t.getValueT2 res10: Int = 222 Why doesn't the v get overridden? Off course this works only as long as vs are private, but still.

    Read the article

  • Shallow Copy in Java

    - by Vilius
    Hello there! I already know, what a shallow copy is, but I'm not able to impliment it. Here's a short example. public class Shallow { String name; int number; public Shallow (String name, int number) { this.name = name; this.number = number; } } Test the implementation ... public class ShallowTest { public static void main (String[] args) { Shallow shallow = new Shallow("Shallow", 123); Shallow shallowClone = new Shallow(shallow); shallowClone.name = 'Peter'; shallowClone.number = 321; System.out.println(shallow.name + " - " + shallow.number); } } As I purpose, just the reference of the non primitive datatype String would be copied, so that by calling "shallowClone.name = 'Peter';" I would also change the name of "shallow". Am I right? But somehow, it just does not want to work ....

    Read the article

  • Transfer ADOBE licence after inheritance

    - by Vilius
    Hello there! After my aunts death, I have inherited an iMac with several Adobe software on it (= Photoshop, Illustrator, InDesign, etc.). Is ist possible to sell (or better to overwrite the licence) the software to other persons in the name of my aunt? Or whom does the software belong now? Thanks in advice! :)

    Read the article

1