Archive for October, 2009

Email me when you’re done

I run a lot of long processes on servers, so it is nice to know when my program has finished running. Luckily a shell script from my quantum chemistry class does that.

echo "Your job" $1 "on" ${HOST} "is done" | mail -s "Your job is done" ${USER}@host.com

Replace host.com with your host. It pipes the text to mail, which sends an email to the user@host.com with the specified subject.

No Comments

Learning to Program or Just Learning

So I had a young family member ask me to debug his program, because he was learning to program in C++. I asked him why he wanted to learn how to program. He replied it seemed like a good thing to know. It is a good thing to know, but it shouldn’t be your motivation for learning something. There are a lot of things in the world to learn. One should learn things that will help them accomplish their goals.

When I was a young, I learned REXX scripting to make it easier to play BBS door games using ZOC. I learned C++, MFC and DirectX, because I wanted to program video games. Later I learned OpenGL and OpenAL too since I wanted to make games for any platform. I learned HTML and Java, because I wanted to make websites with applets. I learned Flash, because I wanted to make a cool intro to my website and maybe a video game. I learned Objective-C to program iPhone games. I learned MATLAB, because I can throw down stuff and analyze things quickly. I learned PHP, because I wanted to make a database driven website. All of these computer related learnings revolve around accomplishing a task.

You learn something to be able to do something, not just to do it. When you want to do something with the knowledge you gain it makes you eager to gain that knowledge. I taught two weekend courses to high school. Those kids signed up for my course because they had specific things they wanted to learn. This made them more attentive and better learners. In high school I wasn’t too fond of biology, but in graduate school I was eager to learn all I could, because it was the right time for me to learn. I was interested in the subject. Some basic knowledge in broad subject areas is needed, but I think K-12 education should be focused on fostering learning skills and feeding the appetite to learn. Schools are pretty rigid due to limited resources, ingrained doctrine and maybe some other things that I am unable to name.

I’ve had discussions about education and school along similar veins. People want to go straight to the cool stuff. Other things are just boring and make students lose interest before you get to the cool part. As a child, one may feel forced to learn how to play the piano or learn a foreign language, but when you get older it’s harder to learn to play the piano or a foreign language when you actually want to travel and use the foreign language or have a jam session. I also think a part of feeling forced to learn is that the parents don’t play an instrument or speak said foreign language at home. If it was a part of your life, then it would feel more natural. One needs to cultivate an environment that makes learning a necessity.

No Comments

Java and unsigned types in little-endian

I encountered this annoying thing about Java. Java is natively big-endian and signed types only. One has to go through loops to read in unsigned types in little-endian. I have some binary files with values stored as unsigned byte and shorts in little-endian. I did some googling and found that I could do some bitwise operators and some shifting to get at it. The first site was this one. I was going to make a wrapper class for the buffered data stream, but after some more reading I found that I could change the endianness with some functions in the new io, java.nio. I found some more documentation, but that was being rewritten for the the current Java beta.

ByteBuffer bb;
//some code to setup the ByteBuffer
bb.order(ByteOrder.LITTLE_ENDIAN);
short s = 0xFF & bb.get();
int i = 0xFFFF & bb.getShort();

No Comments

Living with No Regrets

The answer to “Why do I spend so much time working”. I’m blessed to have access to incredible resources and opportunities. I feel pretty bad if I don’t take advantage of them. Other people can only dream to be in the position that I’m in, although most people wouldn’t want to be in the position I’m in. I was told by my old adviser that this would be in the only time in my life where I could devote to solely doing research. As you get older, you get burdened with more administrative duties. Professors don’t actually do research, they direct research programs. Do I feel like I’m missing out? I used to feel like I was missing out, but after the years I’ve grown accustomed to the lifestyle. I enjoy and utilize the flexibility that comes with being a graduate student. Everyday you try to find answers and ask more questions. Doing research that you’re passionate about is like reading a book that you don’t want to put down. That’s why I don’t mind all the long hours. It would be impossible to work as much as I do without some level of enjoyment.

The saddest thing would be to live life with regrets. I try to live my life doing everything I want to do. What I want to do right now is to make contributions to science. Fame and Glory!

No Comments

Money isn’t that important

As you get older, you begin to realize that all that effort you spent in your youth seeking money might have been time wasted. I’ve gotten use to the lifestyle of the “poor” student. I don’t eat ramen everyday, but I budget my allowances wisely. At a recent family gathering my friend’s father told me that health is the most important thing in this world. When you’re healthy, you can do anything. I take that to heart. That sentiment was reiterated by other family members. The thing is that they are all wealthier than I, but also wiser and older. I spend a lot of time training and exercising for my health and also to accomplish some goals in life. After staring up my training program, I’ve felt like I’ve been in the best shape of my life. I still have much more to gain, but this feeling is awesome. I make sure to make time to run everyday. That hour where I go running is my Zen moment to myself. Nothing really matters then. All my worries seem to go away. In fact, I think I really don’t have anything to worry about. The stress just seems to melt away.

If you’re in bad health, it puts a strain on your finances. No matter how rich you are, hospital bills can easily wipe you out. Some people would give all their wealth up if they could just get better from their ailment. I think that’s a reason why universal healthcare is important. Preventive medicine should save money in the long run.

You need money to buy things, a car, a house, nice dinners at the French Laundry, kid’s college education, etc. But how much of that do you really need. You could spend all your time working and never see your kid. You leave for work before your kid wakes up and you come back after your kid has gone to bed. You work to afford tutors for your kids while you could just have easily taught them. Or childcare for that matter. This goes back to that Ellen Degeneres joke about going to work to pay for your work clothes and the car you need to get to work, to pay the mortgage for that house, which you leave empty for half the day. The punchline is that is what is called “normal”. When I was a graduate student, I asked a professor about pursuing a Phd. He said I should do it straight out of school. I might get too used to the lifestyle of working and having money to be a “poor” student again. Happiness is relative. He said to get the same utility from watching a movie with his girlfriend in graduate school he has to buy a Porsche now.

I do admit I’m a bit envious when I see my friends post facebook pictures of their travels and their gastronomic adventures. But for me, it’s more having limited time rather than financial resources since flights and hotels are so cheap now in this economy.

No Comments

Limit Resources to Spur Creativity

Sometimes having too many resources can make you lazy and having too many choices can be overwhelming. One example that I’m going to butcher in its retelling is a supercollider where they wanted to smash two electrons. Due to limited budgets, they built only one ring and got better results, because they can put an electron and a positron in the same ring yielding a bigger smash. Being limited also forces you to be more resourceful and seek creative solutions. Instead of picking the easy solution you’re forced to scrap by here and there. I started to remember this after reading about The Boy Who Harnessed The Wind. When you’re limited in resources you are also forced to prioritize after careful thought.

No Comments

Go-Kart Racing

Just learned that I’m horrible at kart racing. Now it’s time to figure out why.

No Comments

Aperture v. Lightroom

I’ve decided to fully embrace digital photography as my hobby of choice. I see many benefits like forcing me to see the world and forcing myself to get out there. To cement my commitment I am sinking some capital into it. Nice lens are expensive, so if I don’t make use of them I’ll be wasting money. To accompany the hardware, I’ll probably need better software, so I downloaded both Aperture and Lightroom trials. So far, I’ve decided I don’t need them. The Camera RAW importing in photoshop works well enough for me. It’s not like I’m a professional photography who has many projects and need something to manage my workflow. I process each RAW individually, so having the ability to batch process doesn’t help me at all. This also is an indication of my decision to post-process pictures in photoshop more. The conclusion is as of this moment, all I need is photoshop. I’ve been watching PixelPerfect on Revision3 and Adobe.TV to get my education on.

No Comments

Safari

Safari was freezing on me a lot, momentary freezes. I did some googling and found out that there is a reset Safari command, which has so far fixed the problem.

No Comments

Movies

It’s been a while since I’ve seen a movie on the big screen, so I was going to go check out a movie, but as I was leaving, I realized I should be working instead. I hadn’t one anything to deserve it. When you have goals to accomplish, you must hard to achieve them. Everything else is just superfluous. Besides the movie I was going to see wasn’t a good movie in the artistic sense, but the special effects would have been nice to see on a big screen. I tend to watch movies as I’m doing something else to save time. I’ll add that to the list of movies I haven’t watched, but want to watch eventually. Right now I’m more into being active than passively enjoying entertainment. I can be passive when I’m old.

No Comments