Archive for January, 2008

Arc has been released

Tuesday, January 29th, 2008

This has been a long time in coming. Paul Graham and Robert Morris have released an initial version of the Arc programming language.

Announcement
Language Web Site
Software
Tutorial
Forum

They recommend using version 352 of MzScheme because the latest version apparently breaks Arc. I already had 360 installed and was in a hurry, so I tried it, and most of the tutorial seemed to work fine except for the web server which failed. I’ll try later with 352 and see how it goes.

The language is still quite volatile, so I’m not sure if anyone is too interested in investing a lot of time creating libraries yet, but when the language settles down, I’m very curious about the acceptance level of Arc.

It seems to have quite a bit of Lispy goodness, and I’ve agreed with Paul’s language philosophy from what I’ve read about what he wants Arc to become. Hopefully it will live up to those ideas. On the one hand, I can see benefits in having a standard such as the one for Common Lisp, but on the other hand, Ruby & Python have done extremely well with the BDFL model with Matz & Guido, and I think Paul Graham could pull off that role if he wants to.

A problem with a “standards” approach is the proliferation of implementations dividing the community; whereas, the single implementation languages seem to have a more unified community.

If Arc can retain the best of Lisp, add some niceties from other languages and attract an active developer community, I think it may become very interesting.

rlwrap

Probably one of the best things I’ve gotten out of the Arc release so far was a tip from a guy on the forum on how to add readline support to the Arc REPL using rlwrap. I’d never heard of rlwrap before, and it’s awesome! I can now get readline support for logo and arc without needing to rebuild them with native support.

sudo apt-get install rlwrap
rlwrap logo

What a great idea :)

Surfing a Huge Wave

Monday, January 28th, 2008

I’ve spent some time (kayaking or boogie boarding, not surfing) in waves big enough to really get the adrenaline pumping out of fear, and they were a tiny fraction of this size. I can’t imagine what this guy’s heart was doing!

Automatically Delete Unwanted Cookies in Firefox

Saturday, January 26th, 2008

I prefer to not have cookies stored in my browser, but it’s impractical to not store any cookies since this would require repeatedly logging in to authenticated sites that I frequently use. A simple solution in Firefox is the following:

From the Edit menu, choose Preferences and then click the Privacy tab. You should see a dialog similar to the following one:

firefox1.png

Check the “Accept cookies from sites” checkbox. For the “Keep until” setting, select “I close Firefox”. The latter is the key - it will erase all cookies from Firefox whenever you close the program. Of course, we don’t want to erase all the cookies, so click the “Exceptions…” button on the right and you’ll see a dialog similar to the following:

firefox2.png

Just type the name of the web site you want to allow in the text box and click the “Allow” button, and Firefox will add it to the exception list so it won’t be deleted when you close Firefox. You can add a full URL such as www.MySite.com, or just the domain name MySite.com to allow cookies for any host in that domain. You an also add sites you want to disallow any cookies from by clicking the “Block” button.

I have about 30 sites that I allow Firefox to store cookies for, but this technique has helped me avoid accumulating tons of unwanted cookies in Firefox. I hope it’s helpful for you.

Dolphin Bubble Rings

Tuesday, January 22nd, 2008

My uncle passed on a link he received from my cousin to an amazing video showing dolphins cleverly making sophisticated bubble rings and manipulating them in interesting ways:

2008 Programming Language Plan

Thursday, January 17th, 2008

I’ve learned a number of programming languages since I began programming 25 years ago. Earlier in my career, my choice of which programming language to learn was largely driven by external factors such as a class or job requirement, or the expectation of job demand in the future.

More recently I’ve enjoyed learning new programming languages both for the joy of learning something new, and for an increase in productivity.

While it’s true that no programming language is a silver bullet, I’ve found that the choice of programming language can provide a dramatic increase in productivity - much more so than many have asserted. The benefit can be direct, by allowing the creation of a solution to a particular problem with less time and effort than it would take using another language, or it can be an indirect by providing new ways to think about a solution.

Do you think language affects how we think?

The Past

In 1982, I spotted a Radio Shack Color Computer in a store window and immediately applied for a Radio Shack credit card which had a credit limit ($500) sufficient to purchase the computer which had 4K of RAM (I later upgraded to 16K) and no external storage (unless you count the ability to hook up a cassette recorder). Contrast the 16K RAM of that early machine with my current 2,097,152K RAM :)

That was the beginning of a life long interest in programming.

In the language list below, bold indicates a more significant professional involvement, and the year indicates when I first learned the language. I’ve also likely forgotten a few:

  1. 1982 - Radio Shack Extended Color BASIC
  2. 1983 - 6809e Assembler
  3. 1983 - Pascal
  4. 1984 - HP 48SX RPL
  5. 1984 - S/360 Assembler
  6. 1985 - COBOL
  7. 1985 - dBase III / Metafile
  8. 1985 - C
  9. 1985 - 8088/8086 Assembler
  10. 1986 - C++
  11. 1996 - Java
  12. 1997 - Perl
  13. 2002 - C#
  14. 2004 - Python
  15. 2005 - JavaScript
  16. 2006 - Ruby
  17. 2007 - PHP

The Present

Currently, I program primarily in Ruby, followed by JavaScript and the occasional PHP script. Ruby is the most productive programming language I’ve used thus far. The combination of power, pragmatism & pleasure in programming is hard to beat. If it also had performance, it would be a truly great language.

I’ve also begun learning Logo as I teach my daughter how to program. Logo is a great introduction to the Lisp family, so I hope to leverage it as I learn Scheme and Common Lisp later this year.

The Future

After completing the Logo course with my daughter, I plan on moving on to Scheme as I go through Structure and Interpretation of Computer Programs which some have called the greatest computer science text ever written.

After Scheme I plan on learning Common Lisp which has the potential to replace Ruby as my primary programming language.

Beyond Logo/Scheme/Common Lisp, the following languages are of interest:

  • Haskell
  • Erlang
  • Lua
  • ML
  • OCaml

If you know of candidates for a future programming language, feel free to add it in a comment.

You may notice that Smalltalk is lacking from the lists above. Despite its prominence in programming language history, I currently don’t feel that Smalltalk is sufficiently better/different than Ruby to warrant an investment in learning it.

After focusing on object oriented for twenty years, I have more of an interest in the functional world of programming languages (and multiple dispatch is cool :) ).

Update: I was just over at Hacker News and saw something I’ve seen many times before. In a nutshell, some guy was stating that Paul Graham’s success with ViaWeb had little to do with his choice of programming language (Lisp) and more to do with him just being a good hacker. In other words, he could’ve written it in any language. I’m so glad Paul responded because his response confirms my thoughts on the matter:

What a weird situation. I keep trying to tell people Lisp is great, and they say, no, no, you guys were just really good programmers. But if I’m such a good programmer, why don’t they believe me?

Paul Graham has written a lot on Lisp and is one of the main factors in me becoming interested in Lisp (along with the fact that Ruby pulled a lot of good ideas from it), but the simple quote above communicates volumes IMO.

Beware of LEGO Mindstorms NXT on Mac OSX

Tuesday, January 8th, 2008

I recently installed the software that came with a LEGO Mindstorms NXT kit onto a Mac Mini running OSX 10.4. I was somewhat concerned when the install program prompted me for an admin password, so I attempted to install the software into a directory in my home directory instead of the main Applications directory, but it still prompted for an admin password. Since LEGO is a large reputable company, I gave them the benefit of the doubt and figured the admin password may have been necessary to install Bluetooth drivers or some other feature. I should’ve learned a lesson from the Sony root kit debacle with respect to blindly trusting large corporations. In the Sony case, maliciousness was involved, in the LEGO Mindstorms case, I think only incompetence is to blame.

After installing the LEGO Mindstorms NXT software, I noticed that the OSX Activity Monitor failed to start which was puzzling. I also noticed that my Missing Sync program (used to synchronize data on my Treo 650 with the Mac) was failing as well - probably related to Bluetooth misconfiguration. I discovered later that, independently of the software issue, the LEGO Mindstorms NXT kit was malfunctioning (some attachments worked, but the motors couldn’t be activated), so we sent it back for an exchange.

I thought that uninstalling the LEGO Mindstorms NXT software might return my Mac OSX system to normal, so I found the uninstall shell script in the Applications directory. With many OSX applications, it’s sufficient to simply delete the directory associated with the particular application from the Applications directory, but since Bluetooth drivers (and possibly other stuff) was installed, I figured the uninstall script would remove anything that was installed. I viewed the contents of the script briefly, but I was in a particular hurry at the time, so I double-clicked the icon for the uninstall script before I thoroughly reviewed it. It took longer to execute than I expected, and to my great dismay I shortly discovered why.

The LEGO Mindstorms NXT uninstall script removed the entire Applications directory from my Mac OSX system!

I’ve contacted technical support at LEGO Mindstorms mainly to try and determine how this happened. One of the reps did admit that this has happened before. I’m not sure what they could do to resolve this to my satisfaction other than pay me for the time I’ve lost in trying to get the Mac back to normal. I’ve been able to get the bundled applications reinstalled with some effort, but I still have a fair amount of work to do to reinstall many open source apps.

If LEGO Mindstorms comes up with a creative solution to resolve this to my satisfaction, I’ll be elated to post an update, but I expect that to be unlikely to say the least. Hopefully this blog post can save at least one person from losing an entire day to a similar problem.

When the replacement LEGO Mindstorms NXT kit arrives I’m either going to install the software on an old Windows PC, or create a new virtual machine for that purpose, but I don’t think I can trust LEGO Mindstorms enough to install it on an important computer at this point. Regardless, I’m going to be much more careful (paranoid?) when installing software that requires root access in the future.

Update 1/18/2008: It’s been ten days since I originally called LEGO Mindstorms NXT technical support, and I haven’t received a call from a supervisor or level 2 person as was promised. I just called them again and talked to the same person who opened the ticket originally. He still refuses to allow me to talk with his supervisor (actually, he states he doesn’t have a supervisor, and that level 2 is his “supervisor”) and simply repeats the same mantra about how my issue has “been escalated several levels”. I can’t recall a tech support experience that has been quite this bad.

Update 1/18/2008 13:00: I just received the following email response a few minutes ago (probably because I communicated the situation to LEGO corporate headquarters).

Hello,

Your issue has been escalated to the developers in Denmark.
They will get back to you, but we have no control over when that will happen.

In the meantime the only solutions we can offer to you are to repair user permissions and to do an archive reinstall of your Operating System.

Update 1/24/2008 14:10: Just spoke with David C. from LEGO Mindstorms NXT QA (he was referred to me by a LEGO consumer specialist I had spoken to a couple days ago), and he explained the situation to me. This was a known issue (deleting all your apps on Mac OSX) that has apparently been fixed in the current release of the software. He apologized and will send me a free LEGO Mindstorms NXT kit. It doesn’t match the monetary loss in time, but it’s a nice gesture and I appreciate it. I expect it’s more than many companies would do to remedy the situation.

As to the communication issues with the first line technical support, out of respect for David I won’t go into detail, but suffice it to say that they are aware of issues with their front line support and are endeavoring to correct them.

Learning Logo - Part One

Saturday, January 5th, 2008

I decided last spring that it was a good time to begin teaching my eldest daughter how to program. She was eleven at the time and had demonstrated both interest and aptitude. So after researching various programming languages, I chose to use the Logo programming language - specifically, Berkeley Logo.

There are many good programming languages to choose from to teach children how to program depending on their abilities and interests, but I felt the benefits of Logo gave it the edge. It has much of the power of the Lisp family of languages but with a simpler syntax. The syntax is very uniform which saves children from having to learn too many inconsistent oddities of other languages (including my current favorite, Ruby). I had a preconceived idea that Logo was primarily about turtle graphics, so I was quite surprised when I dug a little deeper and found a very expressive language built on a solid foundation. Having said that, I think the availability of turtle graphics in Berkeley Logo is a big plus for allowing visual feedback for children.

In August, I wrote a blog post comparing a short function (from Brian Harvey’s home page) in Logo and several other languages. Several people added other versions in the comments. It may give you a glimpse of the conciseness and expressiveness of Logo.

In deciding on a programming language, I purposely ignored IDEs. In fact, I’ve discovered that more powerful languages are much less dependent on the availability of good IDEs. For example, when I switched from Java to Ruby, I didn’t miss Eclipse at all, and I’m much more productive with Ruby and a good text editor than I was with Eclipse and Java. On the other hand, I’ve heard some glowing testimonial from Smalltalk and Lisp IDE users, so I expect I’ll be experimenting with Lisp IDEs in the future.

Getting Started

Many thanks to Brian Harvey of UC Berkeley both for UCBLogo (along with other contributors) and for making excellent teaching materials freely available.

On Ubuntu Linux, simply install the ucblogo package. This will also install a PDF reference manual for Berkeley Logo which I recommend becoming familiar with.

You can also find links for other platforms on Brian Harvey’s home page.

Here are links to the free text books:
Computer Science Logo Style Volume 1: Symbolic Computing
Computer Science Logo Style Volume 2: Advanced Techniques
Computer Science Logo Style Volume 3: Beyond Programming

There is also a comp.lang.logo usenet group. You can access that via an nntp reader, or via Google below:
http://groups.google.com/group/comp.lang.logo/topics?hl=en

Methodology

My teaching methodology thus far has simply been to have my daughter read a chapter, and then complete a short assignment of questions and programming exercises that I’ve designed to ensure she’s mastered the important concepts in the chapter. I’ll spend some time with her explaining the solutions to problems she may have missed.

If there’s interest, I can provide the complete set of chapter assignments including questions & answers and programming problems & solutions once we’ve completed volume 1. Feel free to leave a comment, if you’d like a copy.

Some Quotes

Here are some quotes from the preface of “Computer Science Logo Style vol 1″ to whet your appetite :)

The truth is that Logo is one of the most powerful programming languages available for home computers.

In Logo there is only one syntax, the one that invokes a procedure.

More powerful languages are based on some particular mathematical model of computing and use that model in a consistent way. For example, APL is based on the idea of matrix manipulation; Proglog is based on predicate calculus, a form of mathematical logic. Logo, like Lisp, is based on the idea of composition of functions.

Conclusion

I highly recommend learning Logo whether you’re teaching your children to program or you simply want to learn another programming language. I’ve found both to be beneficial to my professional programming career. The Berkeley version of Logo is very powerful and has the following special features (from the intro to the UCBLogo reference manual):

  • Source file compatible among Unix, Windows & Mac
  • Random-access arrays
  • Variable number of inputs to user-defined procedures
  • Mutators for list structure
  • First-class instruction and expression templates
  • Macros

I’ve entitled this Part One because I intend to follow up with some more posts as we become more familiar with the language.

We’ve also been dabbling in some simple robotics projects. I would love to find a robotics controller, or kit, that allows programming in Logo - if anyone knows of such a thing, please let me know.

Happy programming :)