Response to Steve Jobs’ Open Letter to

http://www.engadget.com/2010/04/29/steve-jobs-publishes-some-thoughts-on-flash-many-many-thou/

I mostly agree with most of the technical issues he raises and I think the lesson here is that it does, in fact, pay to use open standards. However, there are some things he says that I take issue with as a developer:

Replacing flash with H.264 is not an option right now for several reasons. Firstly, flash isn’t simply a way to view video. At present there is no way to have interactive elements in a web page that work on desktop and iP* other than javascript, which has its interoperability problems (though the jQuery and prototype folks usually do a good job at sorting that out for you). Second is the notion that H.264 already is the default format for HTML5. No, it is not. That has not been decided yet. Hopefully H.264 doesn’t win since it, too is proprietary, the very thing Jobs takes issue with for Flash! I even notice that at Apple stores, the employees are basically told to tell this tale to customers who are web developers that they should just replace everything with HTML5 and H.264. I hope that Google does open-source VP8 and that it becomes the format that wins, or VP8 and Ogg and that Apple doesn’t kick and scream in protest when they win the HTML5 video format wars. We don’t want .gif part 2!

Jobs also has a disdain for 3rd party development tools. Here I see the motivation as business, not technical. We developers have only so much time-money and Jobs knows that making it difficult to support multiple platforms with the same source tree more or less will make a lot of developers chose to develop only for Apple’s products. Jobs knows this very well and I believe it was behind the decision not only to not allow Flash but also to not allow Java. Jobs even boldly chided Java as something no one uses anymore. No one? Well, except for their mobile devices’ biggest upcoming competitor, the Android platform. That’s all.

When developing C++ desktop applications, I don’t want to waste my investment. I use Qt. It doesn’t block me from using the latest innovations in Windows, Mac OS X or Linux’ desktops (KDE and Gnome), but it gets me most of the way easily. 90% of the time for 90% of the people making business apps (not games), OS specific GUI code shouldn’t be necessary. I believe the same is true for mobile devices. Without writing with the iphone in mind, I believe you can have your tool translate your menus, form items, etc. into the appropriate code for different platforms. Apple won’t allow this. My understanding is they won’t even allow this if such a tool (including the tool Adobe made earlier to translate Flash into Obj-C) even if you hand-edit the code after generation or make your own regexp to modify after generation (so at least minor edits won’t require a rewrite to remove wasteful routines, etc.) This is a shame. It’s bad for developers and consumers, but good for Apple. It also directly affects me as I was planning on making an XUL to iphone gui converter.

So again, I absolutely agree with Jobs’ assessment of Flash’s shortcomings. If he is serious about them, though, I trust that he will allow Flash once they are addressed? If Adobe fails to correct these issues and it may be impossible without breaking backwards compatibility, their prize platform may go the way of the Dodo, with or without Apple’s sabotage. At the very least, I believe something that creates obj-c from an AS3/Flex project should technically address the issues.

Newscientist: Horizontal and vertical: The evolution of evolution

http://www.newscientist.com/article/mg20527441.500-horizontal-and-vertical-the-evolution-of-evolution.html?full=true&print=true

Lately, I’m increasingly thinking, especially after reading this article, that evolutionary computing would benefit greatly from using a more bacterial type of evolution, where genes are shared between often unrelated organisms, rather than brute inheritance. Another way of looking at it, is it might be good to deal with the complexities of subroutine sharing (which functional programming would make easier) than the complexities of sexual reproduction which make my eyes glaze over to read the solutions offered for. Maybe I’m just not clever enough (my earlier post on genetic programming had a little ruby script and it only uses asexual reproduction).

I am skeptical of the article’s claim that the shared genetic code of all organisms must mean that genes were shared between organisms like bacterium do today. Firstly, bacterium don’t all share some common genes due to the passing of genes between species as it is. Secondly, clade evolution – where clades that are just better at evolving edge out others over time could be sufficient explanation. Surely DNA-based life had immense advantages over life with less fault-tolerant code. Just the same, the article makes a good point that biologists are, being human macro-centric – they focus on multi-cellular organisms even though most of the biomass, even more of the variety, along with the vast, vast majority of the history of life on this planet, is prokaryotic.

Exercise 3-6: Sorting Lists & 3-7 Using Library Modules

It looks like there’s one other guy on the internet who’s posting his answers for the exercises in this book. So, I’ll be linking to his so you (and I) can compare our answers. He knows what he’s doing. In his posts, he talks about, e.g., what he’d do in Haskell. I’m not a functional programming guy (lisp gives me the heebie-geebies, my earlier post on evolutionary programming where I used it notwithstanding). So, below are my answers (click to see more if you’re looking at the blog and not this post by itself) and here is the Japanese guy’s answers.

Continue reading

Erlang Exercises – Chapter 3

I learn by doing much more than by reading or listening, so as I go through O’Reilly’s Erlang Programming, I take the exercises at the end seriously. Generally, when I learn a new programming language, while I read, I’ll make a program of my own choosing, perhaps something that will be useful to me or that I could sell. However, with Erlang, I don’t even know where to begin using it yet. I want to get really, really good at it before I even attempt to make anything with it (I think remembering the mistakes I made with my first Ruby on Rails project caused this shift in attitude.. and let’s not forget the triumphs of reading Mastering Regular Expressions in its entirety).

I will be posting my attempts at the exercises, in case others might find it useful or seasoned Erlang programmers might tell me what I may be doing wrong. I’ll be spacing out my answers to chapter 3 over the week to keep things interesting. Here are the first three exercises from Chapter 3:
Continue reading

Ah, now Mac OS X is finally behaving…

I mentioned in a post earlier about my frustrations w/ the mac keyboard. I finally got around to being frustrated enough to google and (pretty simply) solve the issues I had. Basically, as a programmer the craaaazy way home and end work on mac is unacceptable. The Windows & UNIX way is better (home and end of the line, not the document). Here are the relevant, helpful posts:

http://blog.dubh.org/2007/11/configuring-mac-os-x-terminal.html
http://www.starryhope.com/tech/apple/2006/keyfixer/

Old posts, but very, very helpful. There really should just be a system-wide option, something like “home and end keys operate on line, not document”. Indeed, the primary reason I’m making such a banal post is I hope Apple’s marketing research finds this and maybe does something about making the growing UNIX nerd & programmer user base a lot happier..

I Created Life!

Here is a ruby script I quickly whipped up to teach myself genetic programming/evolutionary programming, and also to demonstrate basic principles of biology (please see below to see how it works.. if you’re on my front page, click to read more first). I think I’m going to write something more sophisticated in erlang (I don’t know erlang, but I’m intrigued) after I get further down the road in gp, but here’s what I quickly whipped up. Since writing it, I have started reading A Field Guide to Genetic Programming and already notice some things I should have done a little different. But in some respects, having a simple string of characters change their role in different modes is elegant and I think I prefer that way of doing things, despite shortfalls in statistical bias. Here are some observations I have at this point:

I know the people researching gp are really smart, so there’s probably something I’m missing, but I don’t see how genetic programming is supposed to quickly find solutions. Evolution is as slow as molasses. You need to dig through millions of years of dirt to see actual changes. I can only see gp quickly finding solutions if the process is being run continually, with multiple challenges or “resources”. I was glad to see, after having this thought, mention of multi-objective (5.1.3) and coevolution (5.4) in the book. It makes me think I’m on the right track. I also remember a while back reading in the article Discover had about Avida that when there was only one resource, one species would quickly capitalize on that and then the evolution would stagnate, but having multiple resources would create diversity and even better solutions at attacking that one resource. The ability of organisms to repurpose adaptations is important in evolution and without it, most complexity would not have been possible.

This leads me to another point. It seems gp works best when it works the most like evolution in the real world works. The rate of mutation is low and, despite my initial intuitions that a high mutation rate would lead to a good solution more quickly, I found that it was actually harmful to do so. Even though, in this script, there is a bias towards shorter programs (the longer the chromosomes, the more calories it takes to create just one offspring), when I had a higher mutation rate, like, say, 1 out of 5 copies, the length of the genes would get really, really long as a defense against mutations. This could happen because if the last parenthesis of the mini-lisp program is closed prematurely, the rest of the genes are ignored. Junk dna. In my program, at least, junk dna was a defense against mutation since I would get really short programs that have long tails of junk after them, but decreasing the mutation rate shrunk those tails down to almost insignificant. Weird. Please try downloading this and edit it to see for yourself.

While mutations should be rare, it helps to have variety. I did just substitutions at first and it worked, but it took a while. I also added stutters, insertions and deletions. Once I added stutters, it helped a lot! Even before adding stutters, I found that, when the “challenge” was 6 * x, I would get x + x + x + x + x and something like 7 * x competing with each other for a long time (5x or 7x often becomes the leading candidate after a few generations and it takes forever for any 6x to show up). Adding the stutters seemed to get multiplication through addition happening faster, though.

Download yeasties or copy/paste from below (requires ruby and clisp):

Continue reading

Set up Verizon USB720 BroadbandAccess card on OpenSuse 11

Just wanted to share the settings I used to get it working (because discussion boards are full of things that don’t work, and most people are jerks who never share that they got something working).

Using KNetworkManager (haven’t gotten it working using if-up)

Click on KNetworkManager icon (it’s the one that looks like a globe) in the taskbar. Go to “New connection…” and select ttyUSBX from the submenu (X may be 0, or something higher if you have a USB-RS232 converter like I do). Then, enter these settings:

Number: #777
Username: YOURVERIZONNUMBER@vzw3g.com
Password: vzw

Baud Rate: 230400
Data bits: 8
Parity: None
Stop bits: 1
Send delay: 0

Make sure “no authorization” is checked. Also, in the last screen, you might want to check “auto connect”.

Similar settings should work with Sprint’s usb card, which is pretty much identical.

Install Flash Plugin in Linux x86_64

Download the .tar.gz plugin (even if you’re using an .rpm-based distribution), untar and:

nspluginwrapper -i libflashplayer.so

You don’t have to copy the file first or anything. If that command doesn’t work, install nspluginwrapper, but any self-respecting x86_64 distro will install that plugin by default for your browser.

T-Mobile Web (formerly T-Zones) settings for Samsung/Softbank 707scii

I got me a Softbank 707scii. Some sellers on eBay actually offer gprs unlock. This means, I can surf the internet on my Japanese cell phone! So, anyone who’s trying to figure out the right settings, here they are:

Access name: wap.voicestream.com
Authorization type: Normal
User ID: [blank]
Password: [blank]
Protocol: WAP
Home URL: http://wap.myvoicestream.com (I reckon this optional.. Yahoo is also good)
Gateway address: 216.155.165.050
Secure connection: Off
Log-in timeout (sec.): 90

I might add that the trick seems to be power cycling the device.

How to respond to events in a custom WindowSWF panel (Actionscript 3)

One power you have in making custom panels for Flash (or whatever recent Adobe programs that support flash-based panels) that is almost never realized is the ability to respond to events. Does anything like this sound familiar to you: you want to update the panel every time the user changes a document or creates a new one? You want to do something when the document closes? The user moves their mouse (and not directly above the panel)? Fools all over the internet dogmatically claim that it’s impossible. It’s not. Here’s how you do it:

Writing purely in Javascript for Flash (JSFL), you might notice that you can attach events much like you can in actionscript thusly:

someCallback = function () {
    alert('all your bases are belong to us');
    }

fl.addEventListener("documentChanged", someCallback);

To do that in your flash panel, simply enclose that stuff in an MMExecute(); Thusly:

MMExecute("someCallback = function () { alert('all your bases are belong to us'); }");
MMExecute("fl.addEventListener("documentChanged", someCallback);");

And.. it works. Sure enough. But that’s not very interactive. I want FLASH to do something (since javascript just doesn’t do much in the authoring environment), like, say, update the display with new info. Wouldn’t it be cool if I could do this?

MMExecute("fl.addEventListener("documentChanged", SomeAS3Function);");

Alas, not possible. Holy Hell. ExternalInterface can’t even help us out here (right? I’d love to be wrong here…) But here’s what you can do. It’s not terribly pretty, but it does the job and when Adobe comes to their senses and builds AS3 JSFL communication into newer products, it would be very easy to modify the code for a more elegant solution. You can have global variables in the javascript and access them anywhere in the flash document. So, try this:

MMExecute("var updt = false");
MMExecute("updateDoc = function() { updt = true; }");
MMExecute("fl.addEventListener('documentChanged', updateDoc);");

Then, somewhere that is always looping (i.e., where stop() wasn’t called), you’ll want to add an event listener for entering the frame:

this.addEventListener(Event.ENTER_FRAME, updatey);
function updatey(event:Event) {
if(MMExecute("updt") == "true") {
   // whatever you wanna do! Resurrect dinosaurs, make robots feel...
   MMExecute("updt = false;");
   }
}

Note, that MMExecute returns a string so, though it be boolean in javascript, it’s converted to “true” and “false” in actionscript. When dealing with arrays and such, this becomes particularly frustrating, though you must question the design of your program any time you are passing complicated objects around… think about it.

Oh, one final note. It seems the capabilities I wish existed in Flash do exist in Fireworks (?) as detailed here. I looked and looked but could not find any equivalent to IsFwCallbackInstalled for Flash. Given how many things I’ve had to discover that were not anywhere to be found on Adobe’s site and how many undocumented features there are, I can’t help but wondering if a more elegant solution is lurking below.. Do tell me if you find it, mmkay?