tag:blogger.com,1999:blog-2238825005908992332024-02-07T16:23:06.648-08:00Full of leavesThoughts on software, programming, music, and education. And other stuff.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.comBlogger116125tag:blogger.com,1999:blog-223882500590899233.post-19635689968927491502012-10-11T06:58:00.002-07:002012-10-11T06:58:34.736-07:00Blog has movedI have moved by blog to github: <a href="http://daveho.github.com/">http://daveho.github.com</a>. See you there!David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-66133721595632929192012-06-05T06:42:00.000-07:002012-06-05T06:42:37.189-07:00CodeLite - a very nice free C/C++ IDEFrom time to time I do a bit of C/C++ development, and I appreciate the benefits of using an IDE to automate tedious aspects of development such as build automation.<br />
<br />
In the past I've used <a href="http://www.eclipse.org/cdt/">Eclipse CDT</a>, which is fairly nice, but quite heavyweight. I poked around with <a href="http://www.codeblocks.org/">Code::Blocks</a> a few years ago, but it had some rough edges.<br />
<br />
Imagine my surprise to discover <a href="http://codelite.org/">CodeLite</a>, a surprisingly functional and full-featured IDE. It's implemented using <a href="http://wxwidgets.org/">wxWidgets</a>, so it runs on Linux (as well as Windows and MacOS X). With very little effort I was able to create a skeleton wxWidgets project and hack on it. The code completion is based on <a href="http://ctags.sourceforge.net/">ctags</a>, and works surprisingly well. There is also support for using <a href="http://clang.llvm.org/">Clang</a> for code completion, although I haven't tried that. CodeLite even includes some support for refactoring: I was able to use it to rename some C++ member variables without much difficulty. CodeLite generates a makefile which does proper dependency tracking and can take advantage of multicore and hyperthreaded CPUs.<br />
<br />
In addition to using CodeLite on my main laptop (Core i3, 8 GB RAM), I have been using CodeLite on our kitchen laptop, which is an old Dell Inspiron 600M with a 1.8 GHz Pentium 4M and 1.5 GB of RAM. It works just fine on this old hardware. Very useful for occasional 5-minute hacking sessions between drawing, watching Electric Company, dancing, and other things my 2- and 4-year olds like doing.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-47364756545630994252012-02-02T13:19:00.000-08:002012-02-02T13:19:59.425-08:00CloudCoder, a web-based programming exercise systemWell, I haven't updated my blog in a really long time, so here goes...<br />
<br />
<a href="http://www.knox.edu/academics/faculty/spacco-jaime.html">Jaime Spacco</a> and I have been working on a web-based programming exercise system called CloudCoder. We've finally reached the point where it's ready for students to use. I wrote up a web page that explains the basic idea (for students in the CS 101 course at York College):<br />
<blockquote><a href="http://faculty.ycp.edu/%7Edhovemey/spring2012/cs101/cloudCoder.html">http://faculty.ycp.edu/~dhovemey/spring2012/cs101/cloudCoder.html</a></blockquote>I'm planning to use CloudCoder to assign exercises to accompany each reading assignment. The idea is to give students a concrete way to test their own understanding of the material. I'm also hoping that if students try a problem, and have trouble with it, they will use the opportunity to attend office hours or a tutoring session. We'll see how it works out.<br />
<br />
We made CloudCoder available under an open source license (AGPL v3), and the code is on Github:<br />
<blockquote><a href="https://github.com/daveho/CloudCoder">https://github.com/daveho/CloudCoder</a></blockquote>There are definitely some rough edges, but it is usable. If you want to know more, you can <a href="mailto:dhovemey@ycp.edu">drop me a line</a>.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-20074310983345021672011-04-07T05:35:00.000-07:002011-04-07T05:35:57.145-07:00Reflections on using PandoraLately I've decided to force myself to be honest when I rate music (like/dislike) on Pandora. The rubric is "do I enjoy listening to this song enough to want to hear it again?"<br />
<br />
There are a couple interesting phenomena I've noticed.<br />
<br />
First, initial impressions are not always accurate in the long term. I find myself hitting "dislike" for songs that I did initially like several months ago. There are probably some songs I disliked initially that I might like now, but of course I'll never know about those.<br />
<br />
Second, and this is where the honesty comes in, is that I have had to admit to myself that I don't necessarily like music I "should" like. For example, I don't like any Velvet Underground song. There, I said it. They sucked. I also dislike most songs by the Jam, although I do think "Eton Rifles" is a good song. I don't like the Cure or Depeche Mode at all, which is somewhat surprising considering I'm a huge Smiths fan. What is harder is hitting dislike for artists I admire. There are Morrissey songs I don't particularly care for (anything off of Kill Uncle, for example.) I've considered hitting dislike for remixes of New Order songs (although usually I just use the "bored" feature for those.) It pains me to have to hit dislike for any song by the Mekons, but their most recent album (Natural) is, well, I hate to say it, <i>terrible</i>.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-5626627531466885422011-03-31T11:11:00.000-07:002011-03-31T11:27:29.133-07:00Anti-parallel computing with JavaI did a lecture today on fork/join parallelism using the <a href="http://www.jcp.org/en/jsr/detail?id=166">JSR 166</a> fork/join framework. As an example, I parallelized merge sort in the obvious way and got some decent performance improvements:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoE_IKvm-niS4SR43nFwQHUmQxEm7hovIhHyT469EqCTW7FHDNnrjrpA7-p1tG34X79xMgylEkWHwt3tfSXkWL6PgA9hAlOIV5RYF9_sANsg-00GsGlguGrvZ4q32BCTjSkHPpPkfx5CnA/s1600/parMergeSort.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoE_IKvm-niS4SR43nFwQHUmQxEm7hovIhHyT469EqCTW7FHDNnrjrpA7-p1tG34X79xMgylEkWHwt3tfSXkWL6PgA9hAlOIV5RYF9_sANsg-00GsGlguGrvZ4q32BCTjSkHPpPkfx5CnA/s400/parMergeSort.png" width="400" /></a></div><br />
Here's the speedups for increasing numbers of elements for the 2-way and 4-way cases:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf4LGAo5bEwPwzo2P4DTpY01jeoYMNAzNL7mnXg8ZGC0EUfsfLCnhdmg3QJjf823A2hxbzuTakzBk60jDc6w25B2N779cPJTsUmqOqmRl2O4uk4-agldHeZpIyHZSkTvWbJPUb8xa3yfbf/s1600/parMergeSortSpeedup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf4LGAo5bEwPwzo2P4DTpY01jeoYMNAzNL7mnXg8ZGC0EUfsfLCnhdmg3QJjf823A2hxbzuTakzBk60jDc6w25B2N779cPJTsUmqOqmRl2O4uk4-agldHeZpIyHZSkTvWbJPUb8xa3yfbf/s400/parMergeSortSpeedup.png" width="400" /></a></div><br />
This was on an Intel Core 2 Quad Q6600. The sequential data is measuring the time to call the built-in <b>Collections.sort()</b>, which is an optimized quick sort implementation.<br />
<br />
Overall, the implementation took about 25 minutes, much of which was consumed with figuring out that the <b>ForkJoinPool</b> class's <b>execute()</b> method doesn't wait for the top-level task to complete. (I should probably go back and read <a href="http://www.awprofessional.com/bookstore/product.asp?isbn=0201310090">Doug Lea's book</a>.)<br />
<br />
Not bad for a language whose programming paradigm is <a href="http://existentialtype.wordpress.com/2011/03/15/teaching-fp-to-freshmen/">anti-parallel by its very nature</a>!David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-4476513744387493122011-03-26T06:03:00.000-07:002011-03-26T06:03:25.189-07:00GNOME 3 - lots of gratuitous changes in store!Jon Corbet (the guy behind lwn.net) has written an interesting (and disturbing!) <a href="http://lwn.net/Articles/433409/">preview of Gnome 3</a>.<br />
<br />
Suffice it to say that the Gnome UI folks are radically changing the way pretty much everything works, regardless of how current users feel about the changes, in the name of making the UI more "intuitive" for "novice users". Yes...just like KDE did with KDE 4.<br />
<br />
I have only two comments:<br />
<ul><li>My 3 year old likes GNOME just the way it is, thank you. I guess he's not a typical novice user.</li>
<li>Thank $DIETY for <a href="http://www.xfce.org/">XFCE</a> and <a href="http://www.lxde.org/">LXDE</a>.</li>
</ul>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-43302885204795099212011-02-09T13:46:00.000-08:002011-02-09T13:46:54.505-08:00Violet UMLIn <a href="http://faculty.ycp.edu/%7Edhovemey/spring2011/cs320/index.html">my Software Engineering course</a>, I have the students do OOA&D projects where some form of software for working with UML diagrams is useful.<br />
<br />
In previous years, I've used <a href="http://argouml.tigris.org/">ArgoUML</a>. It's open source, and quite full-featured. It also <a href="http://argouml.tigris.org/issues/show_bug.cgi?id=1834">does not support undo</a>. Every year I investigate to see if any progress has been made on this issue, and every year it's "in progress". Students find this limitation extremely frustrating, and I don't blame them. Feh.<br />
<br />
This year I stumbled across <a href="http://www.horstmann.com/violet/">Violet UML</a>, which I had somehow missed in my previous searches for open source UML tools. It does not aim to be a full-blown CASE tool --- e.g., no code generation, reverse engineering, etc. This is actually a virtue in my case: it's very simple to use, so the learning curve for students should be minimal. The UI is intuitive. And it has undo. It's a Java app packaged as an executable jar file, so no installation required. Win win win.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com3tag:blogger.com,1999:blog-223882500590899233.post-81054212276776709602011-02-08T06:13:00.000-08:002011-02-08T06:13:54.199-08:00Text editors, GeanyI'm teaching a <a href="http://faculty.ycp.edu/%7Edhovemey/spring2011/cs365/index.html">course on parallel and distributed programming</a> where the programming environment is the head node of a Linux cluster, which we're connecting to using VNC. We're using the classic "text editor and makefile" development environment rather than an IDE, so the choice of text editor has been on my mind lately.<br />
<br />
Years ago, I was an <a href="http://www.gnu.org/software/emacs/">Emacs</a> guy, but I abandoned that particular ship when I started to develop wrist problems.<br />
<br />
In grad school <a href="http://www.vim.org/">Vim</a> was my editor of choice. I gave it a try again, and there are definitely things I like about it. Running an arbitrary filter process on a region of text bounded by a regular expression search is really cool. However, its model for switching between buffers is appallingly primitive. If Vim had a sidebar displaying a list of open files, it would probably be my favorite editor. But it doesn't.<br />
<br />
Oddly enough, my preferred editor in recent years has been <a href="http://projects.gnome.org/gedit/">Gedit</a>. It's very basic, but it's clear that its developers actually thought about usability. The gedit-plugins package in Debian/Ubuntu provides some few useful extensions. Plus, its default syntax coloring scheme is the same as Vim's, which to my eyes is simply the correct one. (Comments are blue. That's just the color they are.) Unfortunately, there is no support for word completion. There seem to be a few plugins that have provided support, but there's doesn't seem to be a Debian package for any of them, and I wasn't encouraged by the complicated list of instructions for installing any of them locally.<br />
<br />
After a number of web searches, I stumbled upon <a href="http://www.geany.org/">Geany</a>. It's a lightweight programmer's editor with a few IDE-like features. I've been using it for a few days, and it's more or less exactly what I was looking for. It has a side pane and word completion, but the UI is fairly minimal. I haven't really used the IDE features (such as compiling from within the editor), but happily those features aren't imposed on you in any way. Most importantly, there was a Debian package available through APT.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com1tag:blogger.com,1999:blog-223882500590899233.post-20868506358079296842011-02-02T07:15:00.000-08:002011-02-02T07:15:38.842-08:00I am a criminalRecently, one of the DVDs that Eli and Gus like to watch became corrupted. I'm not sure exactly what the problem is; there aren't any obvious scratches, and we've cleaned it. The symptom is that during one of the scenes, the video freezes.<br />
<br />
So, I ripped the data off of the disc using <a href="http://www.gnu.org/software/ddrescue/ddrescue.html">ddrescue</a>, managing to get all but about 800K of the data. I can play the resulting ISO image using the awesome <a href="http://www.videolan.org/vlc/">VLC</a>. There's a brief pause in the video where the missing data occurs, but otherwise it plays perfectly.<br />
<br />
So why am I a criminal? The DVD data is scrambled with <a href="http://en.wikipedia.org/wiki/Content_Scramble_System">CSS</a>, which of course requires libdvdcss to unscramble. And since CSS is legally a mechanism to guard against unauthorized copying, unscrambling the content is illegal under the <a href="http://en.wikipedia.org/wiki/Digital_Millennium_Copyright_Act">DMCA</a>.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-43590422094878305642010-09-23T05:44:00.000-07:002010-09-23T05:44:12.320-07:00If Eclipse views could talk...If the various <a href="http://www.eclipse.org/">Eclipse</a> views in the default Java perspective could talk, what would they say?<br />
<br />
<b>Package explorer</b>: Here are the projects in your workspace! Look, I can actually present them in a sensible way! Not like some IDEs I could mention. Yeah, you can have multiple projects open at the same time.<br />
<br />
<b>Java editor</b>: I know what your code means! I will automate boring tasks like adding getters and setters for you. I will let you know when you've made a mistake. You'll probably want to override my ugly default syntax-coloring choices.<br />
<br />
<b>JUnit</b>: What am I doing over here in the left-hand pane? Sure, you'll be able to see whether or not the bar is green, but the stack trace is much too narrow to show you the text of a failed assertion. Hey, why don't you move me down to the bottom pane? Ahhh...that's much better. By the way, if <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">assertTrue</span> or <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">assertFalse</span> fails, I'll let you know with the message "Assertion failed: null".<br />
<br />
<b>Type hierarchy</b>: Let me tell you why I'm here. Uh...hold on...I'm pretty sure there's something I can do that's useful...uh...crap, I can't think of why you would actually need to use me. That sucks. Oh well, at least I'm not taking up any of your valuable screen real estate over here as a hidden tab in the left-hand pane.<br />
<br />
<b>Mylyn</b>: Hi! I'm Mylyn! Every other view is named in a way that clearly indicates its purpose, but not me! I'm Mylyn! If you were an elite developer, you'd know what I'm for. Apparently you're not an elite developer. I'm Mylyn! I need one-sixth of your screen! I'm Mylyn! Wait, don't close me! I'm My [<i>click</i>]<br />
<br />
<b>Outline</b>: Hey, here's a concise list of your fields and methods! If your class gets really complicated, this will help you navigate around it. Sure, this right-hand pane that I'm in is taking up about a third of the screen on that netbook you're using, but I'm totally worth it. Wait...if you use proper object-oriented design, the class won't get complicated? I don't believe it. Wait...don't close me! I [<i>click</i>]<br />
<br />
<b>Console</b>: Here's your standard output. You can type stuff here as standard input, too. However, I adamantly refuse to position the cursor in any way that would indicate where the next character of output (or echoed input) will be generated. Nor will I accept ANSI escape codes. This big red button to kill the process is pretty useful, though.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-54543821900986344462010-08-19T19:04:00.000-07:002010-08-19T19:24:46.293-07:00ASUS 1005HA netbook - first impressionsMy new netbook (Asus 1005HA, Linux version) arrived today. I bought it to replace my Lenovo X61 tablet, not for any technical reason, but because the X61 won't fit in the trunk bag on my bicycle.<div><br /></div><div>Software: The preinstalled Linux (Xandros?) is crap, so I immediately installed the Ubuntu 10.04 netbook remix. I have to say that I am <i>extremely</i> impressed with Ubuntu. There is a nice application launcher (in place of a traditional desktop.) The window manager uses the "one maximized application at a time" model, which I initially thought would be annoying, but is actually really nice. Each running app gets a small icon on the panel, and Alt-Tab switches between apps. Very good use is made of the limited (1024x600) screen real estate. I found it easy to add a new application launcher (for Eclipse!), and to add launchers to the "Favorites" category. Connecting to wireless networks (WPA and WEP) worked flawlessly. Installing software from the package repositories (openjdk, subversion) worked great.</div><div><br /></div><div>Hardware: Awesome! The screen is bright and sharp. The keyboard is much better than I expected - I can type at close to full speed. The track pad works very well, and dragging on the right edge scrolls up and down. I haven't run any benchmarks, but it seems quite responsive. I installed Eclipse and did a bit of Java programming, and performance was fine. (It's some kind of Atom which supports hyperthreading.) Battery life is predicted (by the Ubuntu battery meter) at about 5.5 hours, which seems reasonable. I am waiting for a 2GB memory module to arrive, but with the pre-installed 1GB it works just fine. And the size - it really is significantly smaller and lighter than any traditional notebook, even ultraportables.</div><div><br /></div><div>Overall: I really like it a lot so far. I'm looking forward to seeing how well it can handle serious work during the school year.</div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-51563709356311888512010-08-19T18:34:00.000-07:002010-08-19T18:57:11.619-07:00What I Did This SummerIt's been a busy summer. Things that I did (in absolutely no order):<div><ol><li>Full-time parenting. This was by far the most interesting and rewarding activity. Eli is now talking up a storm, and Gus is almost walking. I can now sing the themes to <a href="http://pbskids.org/superwhy/">Super Why</a> and <a href="http://pbskids.org/dinosaurtrain/">Dinosaur Train</a> from memory.</li><li>Went to Charlotte to visit the Bridges clan. Lots of fun, but US Airways now on enemies list.</li><li>Vacationed in Dewey Beach, DE with Bridges, Hovemeyer, and Swope families. Good times! However, fantasized about formally suggesting "Drunken Frat Boy, DE" as new name for town.</li><li>Continued work done by YCP undergrads (hi Ray and Brandon!) to create an RTOS for AVR microcontrollers. The kernel is 100% C (no assembly)! Planning to somehow get a SIGCSE or CCSCE paper out of this.</li><li>Successfully programmed a 22V10 GAL, for both combinational and stateful logic. (I need to break down and actually learn about FPGAs sometime.)</li><li>Attended Heisler/Williams wedding reception and Hoyt/Spacco wedding. Latter involved travel to Chicago. Reconnected with <a href="http://www.cs.umd.edu/">UMD</a> peeps.</li><li>Advised one student doing an internship for credit, and another taking a course by tutorial.</li><li>Retooling of Programming Language Design course.</li><li>ABET stuff (don't ask.)</li><li>Read all 3 books by <a href="http://www.stieglarsson.com/">Stieg Larsson</a>. Highly recommended.</li><li>Got netbook. How did I live without one of these? Lenovo X61 notebook now seems hopelessly large and cumbersome.</li><li>Rode bike many times. Planning to use as main commuting vehicle during school year when weather cooperates.</li><li>Reviewed a book.</li><li>Attended CCSCE 2010 organizational meeting.</li><li>Lunch at <a href="http://victorybeer.com/">Victory Brewing Company</a> twice with Kate to celebrate aniversaries.</li></ol>There's probably some other stuff I forgot.</div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-19493339364678988092010-05-27T13:20:00.000-07:002010-05-27T13:27:23.810-07:00using git to track marmoset svn repositoryI'm doing some work on <a href="http://sourceforge.net/projects/marmoset/">marmoset</a> this summer. As an experiment, I'm doing my development in a git repository, using git-svn to track changes in the main svn repository. My changes are somewhat experimental, so I didn't want to commit to svn HEAD, and svn branches are so 1990s. We'll see how it goes. I'm also pushing my changes to a publically-visible git repos:<div><br /></div><div><a href="http://faculty.ycp.edu/~dhovemey/marmoset.git">http://faculty.ycp.edu/~dhovemey/marmoset.git</a></div><div><br /></div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-84791982536228880182010-04-29T06:15:00.001-07:002010-04-29T06:18:37.039-07:00Greatest Song EverHere's a screenshot of Pandora playing the greatest song ever:<div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOK_rvRKg6pzTHudHOj7VeHfu0ugZ1LmboCiONHZ2sun_Rjp2_5VPwstLkRpZ2UnsCAh_WY5kgQyYfwv1boXJ8xI73hmnt3rztMQu2EHTohiswCnaSiNE62LU7503ie8V7JPHWdwcPGwKx/s1600/acceptYourself.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 221px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOK_rvRKg6pzTHudHOj7VeHfu0ugZ1LmboCiONHZ2sun_Rjp2_5VPwstLkRpZ2UnsCAh_WY5kgQyYfwv1boXJ8xI73hmnt3rztMQu2EHTohiswCnaSiNE62LU7503ie8V7JPHWdwcPGwKx/s320/acceptYourself.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5465547594909039986" /></a><br /></div><div>Some of the things I was obsessed with in high school haven't stood the test of time, but The Smiths most definitely have.</div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-80723533528296688922010-04-12T11:57:00.000-07:002010-04-12T12:03:05.226-07:00gdb debugging using simavrI just got debugging using gdb working with <a href="http://gitorious.org/simavr">simavr</a>. It's as simple as putting<br /><blockquote><pre>avr->gdb_port = 1234;<br />avr->state = cpu_Stopped;<br />avr_gdb_init(avr);</pre></blockquote>in the code that preceeds the simulation loop. Then, start avr-gdb (using the name of your firmware ELF file as the executable), and issue the command "target remote localhost:1234". Presto, you're debugging your firmware. Sweet.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-48404451103639693372010-04-10T07:51:00.001-07:002010-04-10T07:56:59.870-07:00simavrOne of the headaches of developing code for an embedded system is the difficulty of debugging target code. I suppose you can use an ICE if you have money and expertise, but a nice simple alternative is a software simulator.<div><br /></div><div>I just discovered <a href="http://gitorious.org/simavr">simavr</a>, which is an open-source software simulator for AVR microcontrollers. It is a library which simulates a variety of AVR cores, and has hooks through which you can emulate hardware (such as devices attached to I/O pins). The idea is you write a C program which defines your hook functions, and then call into the library to run the actual simulation.</div><div><br /></div><div>I was able to get a "blinking LED" program working in a couple hours by adapting the example code. I used ANSI control sequences to visualize the pins of an output port, but you can use any kind of UI you want. It looks as though simavr supports debugging of the target firmware using gdb, which is totally awesome. I will try that next.</div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-87285150404688819932010-04-10T04:20:00.001-07:002010-04-10T04:28:44.949-07:00Fare thee well, Firefox?Is it just me, or has firefox gotten to be intolerably slow to start up? I've timed it, and 10-15 seconds is not unusual on the computers I use.<div><br /></div><div>I'm trying out Google Chrome, and I have to say, it seems a lot more responsive.</div><div><br /></div><div>It doesn't seem all that long ago that I was trying out Phoenix (remember when it was called that?) and it was the best browser out there. I think Firefox was more or less perfect fairly early in its development. I can distinctly remember thinking, in the 2.0 days, "Why is development continuing? It already does everything it needs to do."</div><div><br /></div><div>I suppose in 10 years I'll be posting about how bloated Chrome has become.</div>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-84875529717388703992010-03-24T05:55:00.001-07:002010-03-24T05:57:39.492-07:00Makefiles 101Just finished up some lecture notes on building C/C++ programs using a makefile:<br /><blockquote><a href="http://faculty.ycp.edu/%7Edhovemey/spring2010/cs320/lecture/lecture23.html">http://faculty.ycp.edu/~dhovemey/spring2010/cs320/lecture/lecture23.html</a></blockquote>I think I've covered the essential concepts and techniques, although I should probably include a complete example (program and makefile). We'll see how it goes in class...David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-82414274230036612922010-02-22T13:42:00.001-08:002010-02-22T14:00:48.296-08:00More progress on OO language interpreterGarbage collection is now (I think?) working in <a href="http://code.google.com/p/thud-lang/">Thud</a>, my object-oriented scripting language:<br /><blockquote><pre><span style="color:blue;">[dhovemey@nobby]$</span> cat LongLoop.thud<br /># With the heap set to 8192 objects,<br /># this program causes the garbage collector to run.<br /><br />import System::IO;<br /><br />var n = 0;<br />while (n < 9000) {<br /> n = n + 1;<br />}<br /><br />IO.out.println(n);<br /><span style="color:blue;">[dhovemey@nobby]$</span> thud LongLoop.thud<br />9000<br /></pre></blockquote>At this point, the compiler and bytecode interpreter are more or less working. What remains is to add all of the standard library classes needed to make it a useful language: I/O, containers, regular expressions, etc.<br /><br />I began this project with the idea that implementing a language like <a href="http://python.org/">Python</a> or <a href="http://www.ruby-lang.org/en/">Ruby</a> would be a fairly easy task. Well, it was harder than I thought it would be, but really not that hard overall. Right now, there are about 15,000 lines of source, including comments and whitespace. This is bloated somewhat by the 2,500 or so lines generated by <a href="http://www.gnu.org/software/bison/">bison</a> for the parser, and also the fact that I essentially recreated the Java I/O classes (streams, readers/writers, etc.) rather than use <a href="http://en.wikipedia.org/wiki/Iostream">iostreams</a>.<br /><br />[Aside: is it just me, or is iostreams ridiculously complicated?]<br /><br />Eventually, I'm hoping to use Thud as my main day-to-day scripting language. In the longer term, it would be an interesting project to replace the bytecode-interpreter-based virtual machine with one based on <a href="http://llvm.org/">LLVM</a>.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-26327079608295148852010-02-03T10:27:00.000-08:002010-02-03T10:28:32.892-08:00Last oneI could post more of these, but I'll stop with this one.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwXDCeopixHpyVaaW_p9I8-QeT-h9slaeDjUJKl9tvTEAvWiMw1-xNcf3k2wTQDz6Y8tY62UT3DELXpWic89Tu0siz4idexPtZNkSEWzU0l5Tnr4mWDNIuMhQS5r5XyoWzeLwn5R0zs5vW/s1600-h/evenMoreRandomArt.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwXDCeopixHpyVaaW_p9I8-QeT-h9slaeDjUJKl9tvTEAvWiMw1-xNcf3k2wTQDz6Y8tY62UT3DELXpWic89Tu0siz4idexPtZNkSEWzU0l5Tnr4mWDNIuMhQS5r5XyoWzeLwn5R0zs5vW/s320/evenMoreRandomArt.png" alt="" id="BLOGGER_PHOTO_ID_5434085814995351666" border="0" /></a>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-13964644699837601102010-02-03T10:22:00.001-08:002010-02-03T10:23:22.497-08:00More random artThis random art stuff is really just too cool for words:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPMKg203ESTYZ1EaO2J0vOV5k_MmxxFCuA4NvCZOuxuiu7knb2go34xGZiK3E47mAiZkbDgm8TJ-Ldb0DsIeV2BQR3EkvjYMkpnccCMyyRbA1iNhzfeHOUcAX_IzlstJ27nIxxjokApW8O/s1600-h/moreRandomArt.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPMKg203ESTYZ1EaO2J0vOV5k_MmxxFCuA4NvCZOuxuiu7knb2go34xGZiK3E47mAiZkbDgm8TJ-Ldb0DsIeV2BQR3EkvjYMkpnccCMyyRbA1iNhzfeHOUcAX_IzlstJ27nIxxjokApW8O/s320/moreRandomArt.png" alt="" id="BLOGGER_PHOTO_ID_5434084437742749570" border="0" /></a>David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com0tag:blogger.com,1999:blog-223882500590899233.post-80610400215671637552010-02-03T07:27:00.000-08:002010-02-03T07:34:01.673-08:00Random ArtI'm implementing <a href="http://www.cs.hmc.edu/%7Estone/">Christopher Stone</a>'s <a href="nifty.stanford.edu/2009/stone-random-art/">Random Art Nifty Assignment</a> in preparation for assigning it in a data structures course I'm teaching. Since the assignment involves the creation of "random" functions of two variables, it's a good opportunity to discuss the idea of using trees to represent expressions.<br /><br />Obligatory screenshot of first successful run of the program:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXOeqPB1sCsxSyotMThdRNZ8FNY3v1XOnSSCnYfhvUlJZhNW9giQ_XlpOQZhu-eKvYEeuDKcwjF6D0SH00Hyz57Inh7vLFBxeUkitFxPWmiOMgOBaz55ooSEDqMrumqmSLbVA19mhbdES/s1600-h/randomArt.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 306px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXOeqPB1sCsxSyotMThdRNZ8FNY3v1XOnSSCnYfhvUlJZhNW9giQ_XlpOQZhu-eKvYEeuDKcwjF6D0SH00Hyz57Inh7vLFBxeUkitFxPWmiOMgOBaz55ooSEDqMrumqmSLbVA19mhbdES/s320/randomArt.png" alt="" id="BLOGGER_PHOTO_ID_5434039917687367618" border="0" /></a><br />This is an extremely cool assignment.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com1tag:blogger.com,1999:blog-223882500590899233.post-10169202716656611332010-01-22T13:19:00.001-08:002010-01-22T13:46:22.420-08:00Hello, worldI have been working on an interpreter for a simple dynamic OO programming language (vaguely like Java, but dynamically typed like Ruby.)<br /><br />Today I got a hello world program to run:<br /><blockquote><pre><span style="color:blue;">[dhovemey@nobby]$</span> ThudC Hello.thud<br /><span style="color:blue;">[dhovemey@nobby]$</span> ThudDisAsm Main\$.thudc<br />class Main$ {<br />method main$() {<br /> 0: push_module_ref 2(System::IO)<br /> 3: load_field 4(out)<br /> 6: push_const 5(Hello, world!)<br /> 9: call 7(println) 2<br /> 13: pop<br /> 14: push_nil<br /> 15: return<br />}<br />}<br /><span style="color:blue;">[dhovemey@nobby]$</span> thud Hello.thud<br />Hello, world!<br /><span style="color:blue;">[dhovemey@nobby]$</span> echo $?<br />0<br /><span style="color:blue;">[dhovemey@nobby]$</span> cat Hello.thud<br />import System::IO;<br /><br />IO.out.println("Hello, world!");<br /></pre></blockquote>Oh yeah.<br /><br />Note that in the example above, the source file "Hello.thud" produces a compiled class called "Main$" because that is a special class generated for "top-level" statements in a source file. The idea is to make the language useful as a scripting language, where many programs will be a sequence of statements that use the built-in classes.<br /><br />The language (and its implementation) is currently called "Thud", which is one of the standard <a href="http://catb.org/jargon/html/M/metasyntactic-variable.html">metasyntactic variable</a>s. It's also the title of one of the recent <a href="http://en.wikipedia.org/wiki/Discworld">Discworld</a> novels by Terry Pratchett.<br /><br />There is still a lot of work to do before the interpreter is actually useful:<br /><ul><li>Currently, there is no garbage collection.</li><li>The built-in types support very few methods. For example, the built-in Int32 type does not support any arithmetic methods.</li><li>The IO facility is limited to printing to stdout.</li></ul>I started this project quite a while ago because I was frustrated with both Perl and Ruby. I know Perl quite well, but find it to be exceedingly ugly to write programs in. I tend to like Ruby in theory, especially because it is a pure OO language (where all values are objects). However, I find that Ruby suffers from cryptic syntax. I gave up trying to learn Ruby on rails because I find that significant chunks of rails code---especially the ones that look like anonymous hashes hanging in space---to be deeply impenetrable.<br /><br />I freely admit that the world does not need another OO scripting language, but it has been a lot of fun designing and implementing one.<br /><br />The Thud virtual is based on a bytecode interpreter. There are exactly 17 opcodes. There are no static fields or static methods---instead, the same effect is achieved by having "modules", which are singleton classes. (For example, System::IO is a module.)<br /><br />I will be posting the source code (<a href="http://www.gnu.org/philosophy/free-sw.html">free software</a>, of course) in the near future.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com1tag:blogger.com,1999:blog-223882500590899233.post-73945792429025381052009-11-30T12:57:00.000-08:002009-11-30T13:00:02.245-08:00C++ typename keywordI used the "typename" keyword in a C++ program for the first time today. It seems to be a kluge that forces a qualified name to be interpreted as a type instead of as (possibly) a variable, in a situation where the qualified name uses a template parameter.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com1tag:blogger.com,1999:blog-223882500590899233.post-46624402525158782592009-11-20T12:32:00.000-08:002009-11-20T12:33:22.048-08:00MeaglesMeagles. 'To be coming in Society which that I do; and going; albeit,<br />too!' As he last perfectly there Mr F. to all over head, Dutch chance<br />them sense after superiod yielding his hand, I won't speak of both the<br />corner, Mr Dorrit? Yes, yes.' The quest you will ever be the river be<br />they reminister's honour order the explanation of approach, indeed?' 'To<br />think, to preparing to have take him,' said to that the sensation of a<br />dreamed to contemplate, pleasant of an idle have stoppage ceased another<br />mouths in saying it seem so,' returned across this ruin and Jeremiah.<br />This, that's all the offenced at their Father's confidence and bad<br />wearing been a minutes, for they spoke as if he walking about into the<br />inhaled; the which he is slipped it.David Hovemeyerhttp://www.blogger.com/profile/01220018216001152600noreply@blogger.com1