Search Results

Search found 30 results on 2 pages for 'kelvin'.

Page 2/2 | < Previous Page | 1 2 

  • Binding a value to one of two possibilities in Guice

    - by Kelvin Chung
    Suppose I have a value for which I have a default, which can be overridden if System.getProperty("foo") is set. I have one module for which I have bindConstant().annotatedWith(Names.named("Default foo")).to(defaultValue); I'm wondering what the best way of implementing a module for which I want to bind something annotated with "foo" to System.getProperty("foo"), or, if it does not exist, the "Default foo" binding. I've thought of a simple module like so: public class SimpleIfBlockModule extends AbstractModule { @Override public void configure() { requireBinding(Key.get(String.class, Names.named("Default foo"))); if (System.getProperties().containsKey("foo")) { bindConstant().annotatedWith(Names.named("foo")).to(System.getProperty("foo")); } else { bind(String.class).annotatedWith(Names.named("foo")).to(Key.get(String.class, Names.named("Default foo"))); } } } I've also considered creating a "system property module" like so: public class SystemPropertyModule extends PrivateModule { @Override public void configure() { Names.bindProperties(binder(), System.getProperties()); if (System.getProperties().contains("foo")) { expose(String.class).annotatedWith(Names.named("foo")); } } } And using SystemPropertyModule to create an injector that a third module, which does the binding of "foo". Both of these seem to have their downsides, so I'm wondering if there is anything I should be doing differently. I was hoping for something that's both injector-free and reasonably generalizable to multiple "foo" attributes. Any ideas?

    Read the article

  • Covariant return types in Java enums

    - by Kelvin Chung
    As mentioned in another question on this site, something like this is not legal: public enum MyEnum { FOO { public Integer doSomething() { return (Integer) super.doSomething(); } }, BAR { public String doSomething() { return (String) super.doSomething(); } }; public Object doSomething(); } This is due to covariant return types apparently not working on enum constants (again breaking the illusion that enum constants are singleton subclasses of the enum type...) So, how about we add a bit of generics: is this legal? public enum MyEnum2 { FOO { public Class<Integer> doSomething() { return Integer.class; } }, BAR { public Class<String> doSomething() { return String.class; } }; public Class<?> doSomething(); } Here, all three return Class objects, yet the individual constants are "more specific" than the enum type as a whole...

    Read the article

  • How Hot Can It Get? [Video]

    - by Asian Angel
    The coldest temperature possible is zero degrees Kelvin, but how hot do you think it can actually get? Watch as Vsauce discusses the varying levels of temperatures, what happens at those levels, and ends with the hottest possible temperature known to humanity. How Hot Can It Get? [via Geeks are Sexy] Why Enabling “Do Not Track” Doesn’t Stop You From Being Tracked HTG Explains: What is the Windows Page File and Should You Disable It? How To Get a Better Wireless Signal and Reduce Wireless Network Interference

    Read the article

  • How to use JQuery UI datepicker with bgIframe on IE 6

    - by Steve Davies
    I am trying to use the JQuery UI datepicker (latest stable version 1.5.2) on an IE6 website. But I am having the usual problems with combo boxes (selects) on IE6 where they float above other controls. I have tried adding the bgIframe plugin after declaring the datepicker with no luck. My guess is that the .ui-datepicker-div to which I am attaching the bgIframe doesn't exist until the calendar is shown. I am wondering if I can put the .bgIframe() command directly into the datepicker .js file and if so, where? (the similar control by kelvin Luck uses this approach) Current code $(".DateItem").datepicker({ showOn:"button", ... etc ... }); $(".ui-datepicker-div").bgIframe();

    Read the article

  • Compression algorithm for IEEE-754 data

    - by David Taylor
    Anyone have a recommendation on a good compression algorithm that works well with double precision floating point values? We have found that the binary representation of floating point values results in very poor compression rates with common compression programs (e.g. Zip, RAR, 7-Zip etc). The data we need to compress is a one dimensional array of 8-byte values sorted in monotonically increasing order. The values represent temperatures in Kelvin with a span typically under of 100 degrees. The number of values ranges from a few hundred to at most 64K. Clarifications All values in the array are distinct, though repetition does exist at the byte level due to the way floating point values are represented. A lossless algorithm is desired since this is scientific data. Conversion to a fixed point representation with sufficient precision (~5 decimals) might be acceptable provided there is a significant improvement in storage efficiency. Update Found an interesting article on this subject. Not sure how applicable the approach is to my requirements. http://users.ices.utexas.edu/~burtscher/papers/dcc06.pdf

    Read the article

< Previous Page | 1 2