At the McMullen Ford Dealership in Council Bluffs, I happened to see this machine. No one near it, no one drooling over it, just the car, right there.
The Ford GT
At the McMullen Ford Dealership in Council Bluffs, I happened to see this machine. No one near it, no one drooling over it, just the car, right there.
Compare tobacco packaging warnings across the globe.
The ceiling at the Orpheum.
Lego people, made of lego blocks. Would have been a recursive trip if they were made of lego people though..
Leela the lap dog.
I'm halfway done and I've made two observations:
I'm in Frankfurt, or more specifically the Frankfurt airport. It doesn't have free wireless internet access. Neither did Chicago. But both had T-Mobile deals. But then my Chicago T-Mobile account didn't seem to take in Frankfurt. Anyway, whatever. Here's the fun part:
Our friends here (in the context of the site you are reading) seem to have a mechanism to convert my IP address into a geographical location. In turn, they've defaulted my language/locale over automatically. Nifty. But after a few minutes of thinking, perhaps a little irritating too. Really- the last time I was at the site, I did everything in English, so why the switcheroo? It wasn't like I was an anonymous user either.. Anyway, +1 on pulling the IP based i18n.
Bullet point number two (the Windows CE being given excrement status), is evidenced by this, in mid-flight (and more irritatingly, mid-movie):
Needless to say, the powers that be at MS were looking down upon me since my particular console (embedded into the back of the seat in front of me) took about a thousand times longer to start than any of the other ones of the plane.
public class FinalExample {
public static final String CONSTANT =
"I can never change!";
}
public class FinalExample {
public static final String CONSTANT =
"I can never change!";
public static void main (String[] args) {
CONSTANT = "I can always change";
}
}
$ javac *.java
FinalExample.java:7: cannot assign a value to final variable CONSTANT
CONSTANT = "I can always change";
^
1 error
public class FinalExample {
public static final String[] CONSTANT_ARRAY =
{"I", "can", "never", "change"};
public static void main (String[] args) {
for (int x=0; x<CONSTANT_ARRAY.length; x++)
System.out.print(CONSTANT_ARRAY[x] + " ");
System.out.println();
}
}
$ java FinalExample
I can never change
public class FinalExample {
public static final String[] CONSTANT_ARRAY =
{"I", "can", "never", "change"};
public static void main (String[] args) {
CONSTANT_ARRAY[2] = "always";
for (int x=0; x<CONSTANT_ARRAY.length; x++)
System.out.print(CONSTANT_ARRAY[x] + " ");
System.out.println();
}
}
$ java FinalExample
I can always change
public class FinalExample {
public static final String[] CONSTANT_ARRAY =
{"I", "can", "never", "change"};
public static void main (String[] args) {
CONSTANT_ARRAY =
{"I", "can", "always", "change"};
}
}
$ javac *.java
FinalExample.java:6: illegal start of expression
CONSTANT_ARRAY = {"I", "can", "always", "change"};
^
1 error
<arnold>Gentoo iss fo getting you pumped uuuup!<arnold>
Well, that an for agonizing over which CFLAGS to use to make programs that already complete in milliseconds do so 3% faster.
apt-get install happiness
How can it be so difficult to legally buy a song online?
Here's the challenge- find a service to download a song. It has to be adhere to the following standards:
After a day or two of fruitless searching, I found a couple of candidates: mp3tunes, and maybe emusic. But, both seem to be indie-label oriented.
Maybe I'm missing something obvious here, and there really is an easy way to do what I want to do: get music legally without being encumbered by some third party software. At the moment, the only viable avenues I seem to have are:
I'm not going to hit the P2P could (I have a wife and dog to think about), but perhaps it answers why so many people do lean that way. I know I'd gladly pay a buck a song if I could get it on my terms- but alas, that seems impossible at the moment.
Perhaps the RIAA won't issue a license to someone that wants to provide music in a fairly open way. Perhaps no one has thought of that yet? Is it illegal? I don't know. Have you had better luck finding music online?
|
ar Arabic 17 أبريل, 2007
iw_IL Israel Hebrew יום שלישי 17 אפריל 2007
ja_JP Japan Japanese 2007年4月17日
ko Korean 2007년 4월 17일 화요일
de_LU Luxembourg German Dienstag, 17. April 2007
el Greek Τρίτη, 17 Απρίλιος 2007
en_IE Ireland English 17 April 2007
en_IN India English Tuesday, 17 April, 2007
mk Macedonian вторник, 17, април 2007
tr_TR Turkey Turkish 17 Nisan 2007 Salı
uk Ukrainian вівторок, 17, квітня 2007
en English Tuesday, April 17, 2007
I'd been meaning to get a little example that scrapes the surface of the java.util.concurrent package online. Here's what I came up with:
import java.util.concurrent.*;
import java.util.*;
public class Example implements Runnable {
private static Random random = new Random();
private String payload;
public Example (String someString) {
this.payload = someString;
}
public String getPayload() {
return this.payload;
}
public void run () {
int seconds = random.nextInt(10);
long totalSleep = 1000l*seconds;
try {
Thread.sleep(totalSleep);
} catch (InterruptedException tie) {
throw new RuntimeException("I got interrupted");
}
System.out.println(this.payload);
}
public static void main (String[] args) {
ExecutorService es = Executors.newFixedThreadPool(3);
List<Future<Example>> tasks = new ArrayList<Future<Example>>();
for (int x=0; x<10; x++) {
String name = "I am thread number: " + x;
Example e = new Example(name);
Future<Example> future = es.submit(e, e);
tasks.add(future);
}
// -- all threads should be launching, let's get the Example objects
try {
for (Future<Example> future : tasks) {
Example e = future.get();
System.out.println(" [future complete]: " + e.getPayload());
}
es.shutdown();
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
}
It's a very simple thread. It gets constructed with a String (payload). When run, it sleeps for an arbitrary amount of time (less than 10 seconds), and then prints out the payload it was constructed with.
There's really nothing new with the Runnable interface and the run method here. The fun part is what we get to play with from the java.util.concurrent package.
The first major point to note is that we aren't going to launch Threads the old-fashioned way [Thread t = new Thread(someRunnable); t.start();]. Instead, we're going to create an ExecutorService and submit our Runnable objects to it. There are a variety of ExecutorService implementations that can be created from the Executors factory, but the simplest of the lot might be the one created by the newFixedThreadPool(int size) method. The method name in this case is fairly self-documenting.
public static void main (String[] args) {
ExecutorService es = Executors.newFixedThreadPool(3);
The next fancy object that we encounter is Future. The ExecutorService's submit method can accept a Runnable as well as an arbitrary object, in this case, an Example. In return, it will provide a Future<Example>. (Note that in our case, even though we are submitting the same instance variable (e), it is treated as a Runnable, and then an Example in the context of the submit method). We've also got a List of Future of Examples that we augment with our freshly returned Future<Example> object.
List<Future<Example>> tasks = new ArrayList<Future<Example>>();
for (int x=0; x<10; x++) {
String name = "I am thread number: " + x;
Example e = new Example(name);
Future<Example> future = es.submit(e, e);
tasks.add(future);
}
At this point, the ExecutorService has already begun to start all the Runnables it can (3 concurrently in this case). As soon as one completes, it will replace it with another. However, all of that action is happening in a separate thread, and our main method proceeds execution. And our main method is still chugging along, which gets us here:
try {
for (Future<Example> future : tasks) {
Example e = future.get();
System.out.println(" [future complete]: " + e.getPayload());
}
es.shutdown();
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
We loop over the list, and recover the Future<Example> objects that we threw in there as a result of the Runnable submissions. Note that we're doing this in the same order as we created and submitted our threads to the pool. We then get() the Example object that we asked the ExecutorService to return to us upon thread completion. As you can see, the Future is the conduit for this activity. Finally, we shutdown the pool.
Here's the output from the execution:
~/Code/concurrency keerat$ java Example
I am thread number: 1
I am thread number: 2
I am thread number: 4
I am thread number: 0
[future complete]: I am thread number: 0
[future complete]: I am thread number: 1
[future complete]: I am thread number: 2
I am thread number: 5
I am thread number: 6
I am thread number: 8
I am thread number: 9
I am thread number: 3
[future complete]: I am thread number: 3
[future complete]: I am thread number: 4
[future complete]: I am thread number: 5
[future complete]: I am thread number: 6
I am thread number: 7
[future complete]: I am thread number: 7
[future complete]: I am thread number: 8
[future complete]: I am thread number: 9
As evident, our threads finish execution in an arbitrary order. However, using the List of Future objects, we are able to join them in the same order we put them in the queue.
There's nothing here that we couldn't have done with a little bit of good, old-school threading. But, we got a reliable, clean and easy pool in one line. We got a simple mechanism to join on a thread and get something in return- something that the thread could have mutated or worked on.
We visited India for a lightning fast trip that lasted about 8 days earlier this month. It was fun, and a little frantic. At Delhi, I really wanted to visit Humanyun's tomb.
This is the gateway to the actual tomb. As we were walking toward it, Steph noticed something that I'd always taken for granted: the six pointed stars. While we might be most familiar with the incarnation used in Jewish symbolism, it is interesting to note that many faiths including Islam have long histories with the same symbol.
The tomb remained as large as my memory had remembered. The grounds have improved dramatically though, and the signs around the place are a lot better. In addition, there's far better handicap access. I learned that all of this was a result of the Aga Khan's interest and philanthropy in the site.
While it is easy to see that the buildings are all very symmetric, the same theme has been carried over to the layout of the grounds and waterways. Symmetry is an underlying theme in a lot of Islamic architecture, atleast from what I saw in Delhi.
Many of the precious stones have been stolen, and much of the color faded in the dome over where Humayun's grave lies. Yet, you can still see the original architecture clearly. Quite amazing even by today's standards, and more so when you consider that it was constructed in the 1500s.
The disparity between the have and the have-not's is always visible in India. Small impromptu dwellings like this slum are common in many Indian cities.
Back in Bangalore, we took life a little easier, and just spent the days eating, drinking and driving around town.
Yes, if only we could all be Java Masters. Baldwin's where we (from MAIS) got whipped at soccer every now and then.
Near Koramangala, we drove past the multitude of marble shops. There must be around 50 of these where enormous sheets of marble lie stacked in the open for people to look and make purchases.
As you might expect, there's a variety in how well these stores do, especially if they are all packed close together. Some manage by specializing in specific types of marble. Others like the Marble Palace evidently have good sales people.
I'd never seen much advertising for CITU. They are evidently, the Center for Indian Trade Unions. More evident, they seem to be a bunch of commies. While communism might not be a common theme across India, public urination is a prevalent across. This gent clearly didn't think much of the "Against the American Imperialism" slogan, and seemed quite content to pee all over CITU's proud notice of a conference. Nifty.
Walls in many cities in India that protect a private space typically have a topping of smashed glass embedded in concrete to thwart would-be wall climbing and scaling folks.
Towards the end of the trip, we got to spend some time with old friends. Alok and Jennifer shared some Hennessey with us at their place, and now I'm afraid that we will be spending some coin on the stuff.