Apr 28

Live-Action Super Mario Brothers Re-Enactment

Personal 2 Comments »

I never blog about this stuff, but it is friday, and this is the funniest thing that I have seen in a LONG time.

This must have taken SO long to plan.

Do watch the Live-Action Super Mario Brothers Re-Enactment.

And then there is the Mike Tyson Punch Out version.

Apr 27

How *not* to get you to do something

Tech 3 Comments »

Russel Beattie has closed his blog.

Now he wants people to unsubscribe from it, and hints at this via this obnoxious page.

Does that make you:

  • Want to unsubscribe
  • Want to subscribe a million bots to it

:)

Apr 25

Why I listen to the BBC at work…

Personal No Comments »

I was reminded again why I listen to BBC Radio while I work during the day (and not podcasts ;).

This morning they discussed a study that has shown women are a lot more keen to cheat on their partners while ovulating. At that time they also day dream more about non-partners.

What I get from that? Time to lock up the wife when that time of the month comes around :)

Apr 24

Safari Issue: Cascading of mouse events and why input type=”submit” wasn’t working

JavaScript, Tech 5 Comments »

For some reason the submit button on a search widget wasn’t submitting under Safari. It works totally fine in the other browsers, but Safari? nothing.

Hmm. The onsubmit event wasn’t even getting called. You click the button, and nothing.

Is it one of the annoying bugs to do with naming the submit button or something lame like that?

Nope, this one turned out to be due to an event handler placed on the body element:

document.getElementsByTagName(”body”).item(0).onclick = function() {}

Safari would take this click and call this function, and wouldn’t run the click event that the submit button has intrinsically.

Of course, the line of code above didn’t actually exist, it was created via the myriad of JavaScript libraries that this web application was using.

Apr 20

OS X Sleep: Hibernate or one eye open.

Apple, Tech 10 Comments »

Ben has been talking about OS X sleepage on the MacBook Pros.

By default, sleeping causes hibernation (save to disk). This has caused one issue for me when the machine didn’t come back happy. It is also a lot slower than my powerbook that keeps things in memory.

Ben had the problem that since the MBP does have the backup battery, when he turned off his computer it all went away.

This is why I flip on hibernate mode before I take out the battery:

alias hibernateon=’sudo pmset -a hibernatemode 1′
alias hibernateoff=’sudo pmset -a hibernatemode 0′

  • on == it will save to disk (slower but safer-ish)
  • off == keep in memory baybee (fast but don’t lose power)

Update

It turns out that option 3 can give you the best of both worlds. It will save to disk but use RAM if possible. If you lose power you are not dead in the water, but if you are powered up it is still fast.

Apr 20

Consultants, Startups, Students, and Rails

Ruby, Tech 1 Comment »

As I hang out at Rails user groups, chat with friends using Rails, and others at conferences and the like, I have seen a few groups of Rails users out there.

Consultants

Ah the consultants. If you have been to a show like No Fluff Just Stuff you would have noticed that last years season had more questions on Rails than Java (or so it felt, which was a little painful!).Many of the people up on the panel were able to answer the questions (or at least give their opinion) since they had actually used Rails. Many of them were talking about JSF and other Java web frameworks the year before, but had moved on for some of their projects.

Why have these alpha geeks moved on?

  • Positive view: Consultants often get to start new projects. They do not have the same baggage (baggage in this case == legacy code that runs and makes the business money!) that IT departments often have. If you have a million lines of code in Java, WebWork, Spring, Hibernate, would it make sense to jump over to Rails? You have the knowledge of those frameworks inside and out. You have helper libraries to make your life easier. You have nailed deployment. Does it make sense to change? The consultant moving on to client.next gets to start a new project from scratch and wants to play with the new toy. He has heard about the potential of Rails and wants to test out the hype. This has always happened, and is the reason that many have deployed Struts, WebWork, JSF, and Tapestry applications in a fairly short time period. For many of the current crop, they enjoyed the Rails experience, and they haven’t jumped to another framework….. yet!
  • Negative view: Consultants need new technology to master to sell themselves! The yet from above means that this year they gamble on Rails, but who knows what it will be next year. I personally think that Rails has legs, and the length of time that a consultant spends with a technology shows how changing that technology is. For example, I had used Spring on every Java project for the last 1.5+ years. Spring was useful enough to me that it made sense to use it on all of those projects. Therefore, major points for Spring. This can be said for JUnit (until TestNG comes in ;) and many other tools (even IntelliJ IDEA!).

Startups

Startups such as ODEO, of course 37 Signals, and the like have been strong users
of Rails. They get the benefit of…. being startups!

The green field is what they see, and their goal is to come up with technology a
s fast as possible to start to make some $ somehow (or the business model may be
to do a beta and get bought out by G/Y/MSFT).

They do not have the luxury of legacy code (again: code that runs and makes $) but they do have the luxury of making a choice from scratch.

Rails thrives on green field projects.

Students

About half of my local Rails group consists of students at the local college. The first presentation was from a student. Rails fits them nicely as it is a quick environment to whip out their projects.

I remember using this same advantage back when I was at university. The class was using C++ to build a web app, and I hacked together something using Perl, and had far more time to enjoy the fun parts of college life.

The head Java instructor is very much in the Rails camp. He talks about how hard it is to teach Java in comparison. There is so much to teach in public static void main(String args[]) and he has tried top down, bottom down, andevery other way (using BlueJ and …).

Of course…

This isn’t a definitive list and of course it doesn’t mean that any other type isn’t using Rails, but it was a little interesting.

Apr 19

Concurrency and list.getLast()

Java, Tech 7 Comments »

Brian Goetz (Mr Concurrency) has finished Java Concurrency in Practice a book in which he has sweat blood and tears for sure.

If you mention anything to him right now he will immediately be able to tell you about the concurrency issues and how we have multicores now, and hence we will soon be screwed.

Someone was complaining about list.getLast() instead of list.get(list.size()-1)

Brian pointed out that this isn’t about ease of use, but that (of course):

list.getLast() would be atomic, whereas list.get(list.size()-1) would
not, and could throw NPE even for a nonempty list if a list element were
removed by another thread at just the wrong time.

Um, I’ve got to stop doing that.

Congrats on JCiP Brian.

Apr 19

Rails Recipes: Stuff you need

Ruby, Tech 1 Comment »

If you have used Rails for non-trivial applications, you have probably run into a lot of “Hmm, what would be the best way to do this?” moments.

As soon as you tread off of the simple path, you need to think :)

Rails Recipes has been a saviour for a few of the items that I care about. The Wiki doesn’t cut it. A co-worker spent a few hours working on ideas from the Wiki. Then he cracked open Rails Recipes, found an exact solution, and it actually worked right away :)

The book is in beta form now, and will shortly be finished. I am sure there will be several versions in the future as Chad finds more and more useful ideas.

Apr 18

PHP and Ruby: Evolution before Revolution

Tech 3 Comments »

It has been a pleasure to use Rails for web applications that are suited to it, especially green field applications.

But not all projects are green fields, and what if you want to be able to use Rails in those?

I am experiencing this scenario right now. A project in production that uses PHP wants to ramp up to the next level and the new features are suited well to Rails.

That being said, we don’t have time to stop new features for a few months while we rewrite the application in Rails. It isn’t sexy to do a relaunch and say to the company “look, the app runs exactly the same but it is on cool technology!”. They don’t care :)

Migration via Web Services

A lot of the new projects are suited as Web services. Instead of having Rails be in charge of everything, the PHP front end can talk to Rails to display the functionality. Rails 1.1 is very good at this, and it is easy to write your application to deliver JSON, or XML, or HTML.

Phase One: PHP can include some HTML, or use the XML output. In the future as we get rid of the PHP code we can simply use Rails to deliver the full HTML.

Migration via ‘Portal’

The PHP front end can also proxy through to the Rails applications running behind the scenes. This makes the app feel a little like a portal, but basically it is just a proxy. The front end can build the template (header, footer, sidebars) and then call back to the Rails backend to get the main content.

This is where SiteMesh for PHP would be nice :)

Chipping away

As we add new features we can put more and more into the Ruby codebase. The front end system can be replaced, while we leave the admin application still running on the PHP side. After all, the data is all just shared at the DB level.

At a later date we can then go back and migrate the admin app. We can do this at a point when new functionality is requested at the admin level, and can role it in.

It would be much nicer to be working in pure Rails world of course, but it is an interesting experience to ease it into a production environment, and see it eat out PHP from the inside.

JRuby on Rails

What about when I need to do the same on a Java project (e.g. use Rails and use the Java code).

Luckily, JRuby on Rails is creeping along nicely.

Apr 01

Gaydar Seen for South Dakota Births

Personal 2 Comments »

A friend send me the picture below of a Gay-dar. He saw it as a hospital in South Dakota where he just met his baby a week ago.

After the baby was born, they started on the “bug baby and mom every 2 hours” routine to do some random tests that are somehow important. Just when you get the baby nice and calm they come and squeeze blood out of his heel, make him sit in his car seat for 1.5 hours, put electrodes on his brain and test his hearing, and on and on.

The strangest option for my friend was that they wanted to put electrodes on his baby’s head, and plug into this Gaydar machine. Visual impulses of men and women were sent to baby, and analysis would be done on the brain activity.

Aparantly if the baby was deemed to be “probably gay” the insurance premiums went down as statistically gays take care of their bodies a lot better.

I have a feeling Diebold is behind this somehow….

Gaydar.jpg