Sleep

March 9th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

Sleep.

It’s something that I have done a lot of over the past week.

I find breaks very amusing. I don’t really travel too much, so I look at a break as an excellent time to get work done. I know, I know, I am weird.

So this break I had a list of things to do…

  1. Get healthy
  2. Work on independent study
  3. Finish up capstone proposal
  4. Rest

Well, the first one is sorta completed. I still have a little bit of a cough, but I am no longer sick. A warning to all: Do not get the flu on finals week. It sucks.

I was able to complete a little bit of work on the independent study that I have been working on… of course, I only got the work done today, and there is still a lot to do.

Yeah. Capstone proposal didn’t even get looked at.

Rest… now… I got lots of rest. I slept at least 12 hours a day, every day. Holy crap. I don’t know if I can go back to a normal sleep pattern now. However, the down side to doing this is that I really got very little done…. but I got rest… and that was the goal, right?
I wish I could have blogged more. Perhaps I will soon. I have a few comic ideas too. Here’s to week 1!

Glassfish, Flash, and Web Services

March 5th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

This past quarter, I was taking a class in which I got to play with web services. I developed a web service in Java and used the latest application server, Glassfish, to deploy it. To consume the service, I was going to write a C# desktop application, and a Flash Lite mobile app. I thought it would be very exciting, and a lot of fun.

I was wrong.

The C# app was nothing remarkable. In fact, I was very impressed at how easy Microsoft has made web services. Just point Visual Studio at the auto generated (more on this later) WSDL file, and you can make the calls easily.

The flash application was…. more of a problem. So, in an attempt to explain why it was a problem, let me make a nice broad claim…

Flash will not work with Glassfish.

Random Yokel: But Dave! Isn’t the point of web services interoperability?
Dave: Why yes! Which is why I don’t know who to be more mad at…. Adobe or Sun!

So, Lets discuss what is wrong!

Using Glassfish, you automatically generate a WSDL based off of your Java code. The WSDL itself is valid XML, and a valid WSDL. However, when I pointed my little flash mobile test application at the WSDL, it failed. The error that Flash Lite 3.0 gave me was:

There are no valid services/ports in the WSDL file!

Weird. Especially because there definitely is a single, valid service and port in the WSDL… but that’s ok. I tried to turn it into a standard Flash application (rather than a Flash Lite 3.0). I removed the little bit of ‘mobile only’ code, and ran it again as a Flash 9 app (but the code was still ActionScript 2.0). It loads… so I try to execute my helloWorld() method (just returns the String “Hello World!”), and it fails:

Element tns:helloWorldResponse not resolvable

Strange. However, at least it appeared to get farther this time. Now, this error message gave me a little bit of a headache for a while… and then I found out the Flash does not support xsd:import. So, because the WSDL file that Glassfish will automatically generate (I suppose I should have guessed it would cause me problems), includes an import to an external schema defining your data types, Flash will choke. Ok. Let’s get around that. So, I took the WSDL that was generated by Glassfish and merged in the schema file. Simple enough, no problems. Run the code, pointing to the new WSDL which I hosted on my server (so: http://localhost/newWSDL.xml, rather then Glassfish app server: http://localhost:8080/Path/File?wsdl)… New error:

Unable to connect to endpoint: <PortURL>

Damn it. Nothing appears to be wrong with my code, C# and PHP can easily connect to my service. I was able to find this document, which basically says that Axis (another Sun app server) is sending poorly formed SOAP packets, and the solution is purchasing Flash Remoting. Right. I believe that. If the packets were poorly formed, I should be getting errors in other languages. Besides, my helloWorld() method is only returning a String! Personally, I want to think that it is some Flash sand-boxing issue, but I truly can not figure it out. Why this is so difficult? My final conclusion on this project was that Flash can not connect to a Glassfish app server (at least, out of the box). If someone has figured out how to make the two play nice, I would love to hear it.

This is bad news for Sun and Adobe. The point of web services is interoperability between systems. If you can’t deploy a simple application using Glassfish (which is the new Sun App Server…) that can be consumed by a simple Flash app… what is the point? Sure. I could go the Microsoft route, but what if I don’t want to? What if I can’t?

Change the World

March 2nd, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

Sometimes I wish I could change the world as easily as I can change a computer program.

I don’t think the time will ever come that we can do this to change the world… However, I will always hope there will be new releases every few weeks that make more progress and make it better.

Thanks Elvis for the concept.

Finals Week

February 26th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

I have the flu. I don’t have time to sleep. I have major projects to finish.

This sucks.

I hope to post again when I am through this hell.

Perhaps the insert script failed..

February 15th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

So, some people get all hyped up about Valentines day… other people don’t.

This comic is for the database geek that got all excited and swept up, and then realized the truth. Yes, I used most of the art for the last one, but give me a break! Finals are coming up!

Sometimes it just isn’t there. If it’s only there around February 14th… maybe it isn’t real :-P

Love.Sonnet();

February 13th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

In anticipation of Valentines Day. I figured I would draw a comic, where a geek professes his love.

In summation:

for (int i=0; i<ways.length; i++) {
   print("I love thee, " + ways[i]);
}

Have a great Valentines day!

Crunch Time

February 4th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

I have been going to RIT for a while. Grad school is still fairly new to me, and it really has been the first time I have been challenged. The work isn’t particularly hard, but the most difficult part is the intense amount of work expected. Throw in the 20 hours of tutoring and teaching I do, and I start running out of time fast.

What does this mean? It means that I spent last night’s exciting superbowl in my living room with my laptop coding (although, to be fair, I was pretty much only paying attention to football by the 4th quarter). I was hoping to draw a comic last night after the game, but since I was experiencing a delightful bug with glassfish, I was unable to get to it. This is a direct side effect of “crunch time”.

Weekends are assumed to be spent in the labs now, be it for tutoring or to try to get my projects done. I knew this coming in, but it starts to get worse and worse as the quarter ends. Since RIT has 10 week quarters, when the crunch starts to come, the best students are the ones that are adept at the art of triage. Which assignment is worth most? Which assignment has the closest due date? How much will not doing this assignment hurt me? These are not good questions to have to ask, but in a student-academic setting it happens a lot.

(several paragraph rant on homework assignments deleted, perhaps I will write an post on it another day)

So, it is crunch time here at RIT. You can see it in the eyes of the students, you can start to hear the sense of urgency in their voices. General grumpiness levels are up due to lack of sleep, and labs are starting to get more and more crowded as the final weeks tick away. Not much can be done to prevent the inevitable, but some thing can be done to keep yourself sane.

  1. Set aside 30-60 minutes a day to have fun
  2. Have one fun thing to do a week that takes up a little bit of time (usually Friday or Saturday night)
  3. Smile, at least a little.

Making sure that you get to at least spend a little bit of time a day to do something fun (be it playing pool, playing a video game, watching TV, or hanging out with a friend for a meal) is vital to keep yourself from burning out, and burn out is the worst thing that can happen here. Shutting down at the worst possible moment, the last week of the quarter, is what needs to be avoided at all costs. So, grab that cup of coffee with a friend, let your brain reset before getting back to work.

Do at least one big thing that is fun a week. If it is going to a party on Friday night, or maybe going out bowling with friends, it is what you have to use to drive yourself to make it through the week. Think of it as the reward for accomplishing the work you have been doing all week. Make sure you don’t get too crazy, because I know programming with a hangover sucks, but make sure you relax.

Smile. Please Smile. This is the toughest one for me. Despite the scientific proof that smiling is actually good for you, this is just as much about keeping everyone around you from getting more and more down. Seeing someone smile is… rare… here at RIT. Try to make the last few weeks of the quarter as painless as possible for yourself and everyone around you - if you smile, it adds that little bit of happiness to the environment you are in… and if enough people do it, maybe the end of the quarter will just be busy and stressful, but not depressing and painful.

Shotgun Debugging

January 27th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

One of the most painful things I experience with the students I tutor is the practice of Shotgun Debugging. The practice will generally give the student horrible, unreadable code. After today’s tutoring, I determined it was time to write about some common debugging practices. So, here are the things I tell my students every week - and they quickly forget.

Only change one thing at a time.

This one is hard for beginning programmers. They get a logic error (or sometimes even a compile error) and then change 5-6 things in their code before they try again. If the changes work, they have no idea why, and will change 5-6 things next time they get a similar error. Which leads me to the next point:

Learn what the common errors mean.

….and how to fix them. When you get the error in Java for “cannot find symbol”, what does that really mean? Look at the text associated with it! It will tell you if it doesn’t understand the class you are looking for, or the variable, or even the method. Got a “null pointer”? That really does mean that something you are referencing is null! The JVM does not lie! Sure, some errors are a little more complicated, for those:

Actually read the error.

The biggest problem I see with students is they simply do not understand the code that they are working with. Reading the errors and understanding what is actually happening when you manipulate a line or two of code is the first step in becoming a better programmer. Every good programmer has spent a significant amount of their time learning how to debug, not just how to code. Lastly, I find myself telling my students:

Make sure you catch every instance of the error.

Let’s face it. We try to teach reusable, generic code, but it just doesn’t happen. I have learned to accept that some students are just going to copy and paste branches of code, over, and over, and over again. So, if you must do this, when you realize there is a logic error in the branch you copied, it will exist in every branch… no matter how much you think you “just fixed it”.

Sometimes tutoring can be very frustrating, but I really do enjoy the moment when a student finally has it click. I suppose there is nothing I can do sometimes, because some students just really hate code, but I hope that they can at least take a little bit back from what I help them with.

Social Bandwagon

January 26th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

It seems that everyone is getting on the social networking and social computing bandwagon. Not sure this will work out for them though, you have to read it within range of a wireless hot spot.

The toughest part of this comic was coming up with the actual fortune. I even had a demotivator one, but I didn’t think I wanted to be that negative. Both fortunes were inspired by Bowling for Soup songs.

Chinese Fortune

January 24th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

I ordered Chinese food today for when I was working in the labs. I finished it off then broke open the fortune cookie.

Be direct, usually one can accomplish more that way.

Now, lately I have been getting some pretty lame fortunes, but for some reason this one didn’t seem too bad. Sure, you can usually get better advice from a good friend then from a cookie (although, that can be iffy!), but sometimes hearing a ‘wise’ saying kinda gets your mind ticking.

Beating around the bush never helped anything. Of course, sometimes it is tactful to be subtle, but usually being direct is an appreciated change to todays really passive, polite culture. I personally can’t think of time where it is truly better to be indirect with someone… short term yes, but nothing really in the long term. Anyone have any ideas?

….and I just got an idea for a comic.. hmmm. Stay tuned!