Monday, February 25, 2008

Creating a directory path in Eclipse

The following snippet of code creates a folder structure in eclipse.
String directory = "ibn.soa.workingfolder";
String[] result = directory.split("\\.");
int k = result.length;
String e = "";
int i = 0;
while (i != k) {
e = e + result[i++] + "\\";
b = project.getFolder(".\\src\\" + e);
b.create(IResource.FORCE, true, null);

For example if you had the user enter something like "ibn.soa.workingfolder" and wanted to create that structure in eclipse you could use the above snippet. There are certain assumptions made, like you want it created in the src folder, but if you were looking for this kind of solution you probably know what those assumptions are by this point.
There is another way to do this using the eclipse Java Development Tooling ,JDT, framework but I didn't want to do it that way.

Labels: ,

Sunday, February 17, 2008

Quotes from Einstein

"Measured objectively, what a man can wrest from Truth by passionate striving is utterly infinitesimal. But the striving frees us from the bonds of the self and makes us comrades of those who are the best and the greatest."

Those words were said by Einstein, amongst the greatest scientist/thinkers of our time, he spent his life working on some of the most intriguing problems of his/our time. His quotes are a source of inspiration for me; another quote of his is
"What does a fish know about the water it swims in?"
I am reading a book on chaos called "CHAOS The amazing science of the unpredictable" by James Gleick. I picked up last year in Dubai. It's been a pretty good read so far, with some really though provoking arguments and some really interesting questions. Two of the ones that really seem trivial to start with are
Q1. Does wind have a velocity?
Q2. Can you measure the length of a coast line?
I will let you figure out those on your own but I will provide an answer to another question to help you start thinking about the answers.
Q3. How many buckets of water are in the Pacific Ocean?
A3. It depends on the size of the bucket.

Unfortunately very few bookstores in Saudi Arabia carry good books on science/math. I have been trying to get my hand on a book on Fourier transforms for a while but have had no luck. I applied for a credit card so I could buy it but it online but I was turned down. I applied for a card at the bank I work at, and they turned me down! *Insert explicative here* what the !@#$ do I need to do to get a credit card? There is more than one way to skin a cat... So I will be applying for a card at a competing bank and get approved because I have to enough money in my account to qualify for one. Plus, I don’t have bad credit history, heck I don’t have a credit history, not that it matters in Saudi Arabia. I have always been amazed at how much importance a credit history plays in the lives of people in the USA and how it matters little to none in Saudi Arabia.
Well enough of that, time to go back to writing plugins for eclipse. I can't get my plugin to connect to mysql on my target runtime; I have got to keep working on it.

Labels: , ,

Sunday, February 03, 2008

H1 approval

So after I give up completely on going back to the UnitedSstates, my H1 visa gets approved. Very weird, it's almost as if they were waiting for me to give up all hope and then they approve it. I found a decent job in Riyadh , got a car, got a house, got a big screen tv, got a wii and now they tell me I can go back. I'm not sure I want to go back now... I mean is there a special place in hell for people who are never satisfied? Because if there is than I will sure as hell, pun intended, end up there. I don't want to spend the rest of my life thinking "what if?" but I also don't want to give up what I have here, Riyadh, either. Bah, decisions decisions, I might go back to get an MBA. I would love to get a masters degree in mathematics, not sure if it's on the cards though. My less than stellar undergrad GPA would bar me from all but the most lowly of colleges, unless of course work experience and those GMAT, GRE exams help. I'm thinking of taking the GRE, but what would be the point? I already have a good enough GMAT score. I mean education is a business, right? I should be able to get in if I'm willing to pay, right? I asked someone at Columbia if I could do their part time distance thingy and they said I should apply. Same degree as a normal Columbia student and everything. I guess international experience counts. Oh well, I'm going to try to stop thinking about it for a while and enjoy the super bowl tonight. Companies were paying 2.3 Million $ for 30 seconds for ad airtime in last years super bowl, I wonder what insane amount it will be this year?
On a totally different note, I think with the way Bush is handling the economy/budget will make sure that no one will want to move to the United States in the future. All that money spent on border security & fancy fences will be rendered useless if no one wanted to get in because the economic conditions were bad. I read this article on this kid from California who spoke fluent mandarin, I think I will make my kid, if I ever have one, learn Mandarin, Hindi, English and Afrikaans. Why Afrikaans? well... why not?