Jun 2 2009

Hollywood is Programming to Interfaces

I’ve had a private theory about Hollywood and how it works behind the scenes for quite some time now, and recently I thought about it using a design pattern approach, and noticed it fits nicely.
Lets start with the theory itself:
I noticed that sometimes I’ll meet people and think “this guy/girl look a bit like Hollywood actor X or Y”. This happened quite a bit. Sometimes its very subtle, and sometimes its very obvious. Some actors have many ‘lookalikes’ and some very few. And as the exception to the rule, a small number of people seem to be absolutely unique look wise.

I always thought that human look can be classified. I don’t mean it in a ‘cattle herding’ way. I mean that we all know someone who looks like this or that person etc. When we think about why they look like that other person, its usually “because they have a similar shape of mouth, or similar shape of cheekbone structure” etc. Some people are unclassifiable, which to me is another type of classification.

It appeared to me that consciously or not, Hollywood raise actors to glory based on their look-class. Since we attract to things that feel somewhat ’similar’ or ‘familiar’, by covering as many look-classes they generate larger following in bulk, thus larger revenues etc.

Let me give two examples I find more obvious than others: Take Cameron Diaz. I’ve seen and met quite a few girls that look like Ms Diaz. I don’t mean they are spitting images of her, but they do bear a resemblance. Now take whatshername from Spiderman… hmm… Whatever, you know who I mean - I’ve seen and met quite a few girls that look like her. Maybe “like her” is not accurate, but at least they looked like her “look class”. They had similar shape mouth, or similar shape of head etc. A movie that stars those two actors will potentially attract people who are in it for the movie, but also those who get that worm familiar fuzzy feeling when they see Ms Diaz or Ms Whatshername-from-Spiderman. They would feel they can ‘relate’ to those actresses or actors.
What Hollywood is doing here is coding to interfaces. They have created an Actor interface over the years. Polished it till it sparkled like a super nova. They even used Real Actors (TM) to do the R&D for this interface. That was before the millennium. Some say before the 90s. Some say before the 80s. Then they started implementing the interface using different Look & Feel implementations, being the currently ‘hot’ actor. Each implementation covered a different look class. So we got our Cameroon Diazes and our Whatshernames-from-Spiderman, and our Sandra’s Bollocks, and of course, our many many uncategorized look-like-him/her-self. Of course occasionally a new interface is being created to serve as the template for future generations. And we take those concrete classes of look&feels actors and consume them till we’re blue in the face. Then we cast them away once a new concrete implementation is released and so on, ad nauseum.
Gotta love show bussiness…


May 31 2009

Convert Video for Viewing on the HTC G1/Magic Android phone.

The Google Android OS is the best mobile Operating System I’ve used, and the HTC G1/Magic phones are really excellent machines. They become even more excellent when you can take films and TV shows with you on your morning/evening commute. The train ride will never be the same again.
I’ve had to look up quite a bit to find the right and easy way to convert videos for the phone, and ended up collecting all the information I found into a neat and handy Bash script.  I assume this could work for any other phone using the 3GPP / H263 video decoder/codec/type, but I haven’t tested it (you’re welcome to try it out and let me know).

Please remember that I’ve done this for myself mainly, so it assumes you’re using a Debian based distro for the setup portion of the script. If you don’t have apt, you’ll have to do the leg work and get all the pre-equisites sorted out yourself.

The script has two main parts: Setup and Conversion. The conversion is pretty straight forward. To convert 3 files you simple do:

./androvideo videofile1 videofile2 videofile3

However, converting to the phone requires the h263 decode/encode libs and ffmpeg to be compiled against them. When you perform the Setup portion (via ./androvideo -s) the script will attempt to do all for you. Attempt is the key word here. NO promises it will work for you (it does for me, but I’m special :o).

During setup, what is supposed to happen is:

  • Get all build dependencies for ffmpeg via apt.
  • Get a few libs ffmpeg will need, subversion, checkinstall and build-essentials
  • Downloads the amr shared libs from and attempt to compile/install
  • Get latest ffmpeg from svn and attempts to compile/install with the amr libs included
  • Get rid of temp dir, all downloaded files and compiled pre-install stuff

Download the script (right click and Save Link As)
You’ll have to “chmod +x androvideo” after you download it to make it executable

I could not have done this without the very good help from these resources:
http://www.linuxquestions.org/questions/linux-mobile-81/androidg1-and-video-converted-via-ffmpeg-h263-687163/
http://po-ru.com/diary/up-to-date-ffmpeg-on-ubuntu-hardy/
http://tldp.org/LDP/abs/html/
http://www.penguin.cz/~utx/amr


May 27 2009

Happy Go Lucky, and Dead…

Not far from Covent Garden is this little place, showing death is no excuse for lack of optimism. With that attitude they’re sure to get me as a future customer…

Death is no excuse - so Cheer up!

Death is no excuse - so Cheer up!


Apr 21 2009

mySql’s Missing Time Zones (from Java icu4j)

mySql’s time zone tables have a few zones named ’slightly’ differently than what you might expect. This is mostly a discrepancy between Java’s icu4j time zones and the ones in the tzdata package which is used by mysql to populate its own time zone tables. When you pass a standard Java icu4j time zone which does not correspond to a tzdata one, it causes NULL to be returned from the CONVERT_TZ mySql function.

I’ve made a short list of some of the time zone’s in Java and their corresponding tzdata zones. If I find more (or if you know of any) let me know and I’ll add them to the list.

Java icu4j => mySql (tzdata)

IST => Asia/Calcutta
PST => PST8PDT
US/Pacific-New => US/Pacific
CST => CST6CDT


Apr 20 2009

The Law of Start-ups

I’ve dabbled with internet start-ups during my career, and I know its a tough adventure to kick off a company. 95% of such adventures end in sudden death without killing the bad guy or saving the girl. There are many experts with rules and advice out there. But I have 3 pence to contribute in the form of 3 simple rules:

  1. Never EVER hire your friend/buddy/chum/pal/mate of yours to run your company or for that matter - to work for or with you. Its OK to befriend your colleagues, but don’t start business on the basis of friendship. It rarely works, and you’re more likely to loose your friend. No venture is worth a good friendship.
  2. Never EVER take VC money unless its absolutely the last resort. And even then, reconsider and wait a little bit more. By taking investor money you essentially give up your venture. Usually you’ll be offered a seeminlgy very large amount of money for a huge chunk of the company, and then likely to treat you as a liability, not an asset. Keep that in mind.
  3. Be Organic, Grow Organic. Don’t try to grow into Microsoft over night. Stay calm and if you have a good business model, growth will come on its own accord. It sure does taste better without the chemicals… That also applies to fruit, veg and meat!

I raise a glass of mead in memory of all the start-ups that are no longer with us.


Apr 15 2009

Boat for Sale. Possible Leak…

This is not really new, as this boat has been moored not far from my home for a good while now, but its an excellent demonstration of honest selling. Its still on the market accepting offers. Go on, buy Gordon’s boat and save the world…

Kingston Boat for Sale

Kingston Boat for Sale - Close up


Mar 10 2009

Internet Explorer’s Javscript - what they don’t teach you at the W3C…

There seems to be a few IE7 JavaScript caveats which are outside the usual non-standards rubbish. I’ll use this post to list them as I find them (so I will be updating it occasionally). If that’s the dominant browser gods help us all. One would have thought that if a company goes and releases a dominant browser which is flawed in so many ways, that they would also release a decent set of debugging tools to go with it… But no… no such luck. So:

  • Don’t use JavaScript keywords like ‘return’ as an associative array’s (or object’s) keys. If you do, don’t refer to them in dot notation. Use the associative array way of obj['key']. IE will not like it. Not one bit.
  • When you return JSON formatted data, remember to use strings as keys. While Firefox will accept JSON with non stringed keys (i.e., {key:’value’}, IE requires them to be properly stringed, i.e., {’key’:'value’}
  • Don’t add an extra comma after the last object property:
    object = { prop:val, prop2:val, prop3:val , };
    That last comma after prop3:val will make IE sad.
  • Install that dreadful Microsoft Script Debugger… It’s not very good. Strike that - its pretty bad and will make general web surfing a nightmare but its the best you’re going to get.

Oct 22 2008

Available for hire

I am currently looking for my next project. If you have an interesting suggestion or offer please contact me at harel at harelmalka dot com.


Oct 22 2008

The Door Book Project - A simple photo blog using cfNotate.

A while back I’ve created cfNotate: an ORM framework for ColdFusion (eyes rolling now I’m sure). What sets it aside from other such frameworks is that it uses inline code annotations in the source code itself to determine how the properties map to database fields. This was done as a proof of concept, and worked very well and very fast. Stop rolling your eyes, they’ll get stuck.
I’ve used this framework to create www.thedoorbookproject.com, which is a simple photo blog type site for Mike Dobson’s door photography (well worth a visit, and his calendars are fantastic so get one). I’m now posting the source code for this site.
Please bear in mind that I’ve done this to demonstrate the framework, and NOT to show proper coding style, following standards, security, testing etc. The main goal of this photo blog app was getting it up in the least amount of time possible while using cfNotate.

The actual site uses cfmbb for a forum. This is not included. As well, the site includes all the UI and graphics from the actual site. See system/config.cfm for some configurables.

The Door Book Project photo blog using cfNotate


Oct 6 2008

HomeBox - iGoogle style home page component.

Like most things, this component was created out of necessity.
I was looking for a component to handle home page display for freecrm.com,  with movable configurable boxes in the style of iGoogle. Javascript frameworks are nice, but I was after something stand alone, with as little dependency on external frameworks as possible, and withot too many frills. It had to perform a single task and nothing else. There was nothing like that ‘out there’.

At this stage its best to just view the demo to get a picture of what I’m talking about. Alternatively, this script has been running for months now in http://www.freecrm.com so you can view it in a real world scenario there (you’ll need to register for the free account though).

You start by initializing the HomeBox object, after the page has finished loading but using the onLoad event for the window. At this stage we can set up some custom Javascript functions to be called when a window is dropped, moved or removed. The drop and move functions provide you with the name (id) of the box, the column its at now (1, 2 or 3) and its new order. Order is a number incremented by 5 for each vertical position. For example, if you drag a box to the top of a column its order would be 5.The second box would be 10 and so on. The purpose of this order property is to simply allow you to sort the boxes in a column via a numeric value.

Each box can be dragged, but can also add custom right-left-up-down buttons which act like 1-click box movers, instead of drag. Sort of a backup for people who have a “drag problem”.
What happens when these event handles fire is up to you. In freecrm.com I save their position
in the database for each user using some RPC calls. If you don’t define an event handler, the default behaviour is to do nothing, but if HomeBox.debugMode is true, to alert you the parameters passed. I also load the box positions and generate my equivalent of index.html
dynamically. You can do the same, or perhaps save their positions in cookies, or not at all.
Its up to you and your application requirements.

Please note that You’ll need to include the domdrag.js script provided. It handles all the drag&drop functionality. Also note that index.html contains some CSS class definitions which you’ll need to customize the look and feel of the boxes.

See a demo of HomeBox

Download HomeBox

window.onload = function ()
{
HomeBox.init();
// setup a custom onBoxDrop event handler to be fired when a box is dropped after drag.
HomeBox.onBoxDrop = function(name,column,position) {
alert('Box dropped: ' + name + ", " + column + ", "+ position);
};
HomeBox.onBoxMove = function(name,column,position) {
alert('Box moved: ' + name + ", " + column + ", "+ position);
};
HomeBox.onBoxRemove = function(x) {
alert('Box removed: ' + x )
};
}