This feed contains pages in the "programming" category.
I decided it was about time to upgrade my monitor situation. For the past few years I've used a 15-inch and a 14-inch at 1024x768 to give me two windows of usable text and been very happy, but when my father and I temporarily swapped monitors for troubleshooting I realized that I had been missing a lot. You can fit an awful lot of code on a large monitor.
I thought that having a widescreen monitor in portrait/pivot/tall mode would be the most useful option. Instead of having the monitor be extra wide, rotate it around and have it be extra tall. While this isn't terribly useful for web pages or video games, it seems like a fantastic idea for programming: you can still fit 80 characters across, but instead of 35 lines down, you suddenly get 70 or 80 - that's double the code!
Monitors with rotating stands are uncommon, but I found a 22-inch HP w2207 in town and set it up. It's a very nice monitor: glossy screen, heavy base, easy rotation, DVI and VGA inputs, plus two USB ports and speakers. It's native resolution is 1680x1050, which in portrait/pivot/tall mode is twice as many pixels high as a 15/14-inch monitor in 1024x768, and slightly wider. Great.
Problem 1: rotating the display to present correctly is hit-or-miss and
annoying at best. Make sure you video card driver supports the "Resize, Rotate
and Reflection" (RANDR) extension; an easy way to check is to look at the
output of xdpyinfo:
$ xdpyinfo | grep RANDR
RANDR
xorg's nv drivers do, its radeon drivers do not, and in any case, you may
not currently use RANDR with XINERAMA, the extension that allows you to
treat multiple monitors as one. If you don't use XINERAMA, you need to run
multiple window managers and can't share windows or the clipboard between them
- that's annoying.
Rotating with the command-line utility xrandr is easy, but I found when
rotating back that my xterm's fonts were screwy - sometimes way too big,
sometimes way too small. I bound a script to flip screen orientation to the
Windows key (most useful it's ever been), but I found that depending on what I
wanted to do, the widescreen might have been more convenient, and flipping the
display and the physical screen was just more effort than it was worth.
Problem 2: a 22-inch portrait/pivot/tall is just too big. My neck hurt from moving my head up and down to read, and the difference in color and picture quality on different parts of the monitor becomes very apparent when you switch back and forth between the top of the screen and the bottom.
However, when the screen was in pivot/portrait/tall mode, and I was hacking away in vim with the taglist and vimproject plugins providing sidebars, it worked great until my neck started hurting. Maybe if I had gone with a 19-inch widescreen it would have been better, but I ended up taking the HP w2207 back and getting the less expensive and less featureful 22-inch Acer AL2216W.
Besides not having a pivoting stand, the big difference between the two is that the AL2216W does not have a glossy screen. I've decided that I prefer the traditional matte screen instead of the glossy one; while movies certainly look better on a glossy screen, I found it harder to read text and it was very distracting to see my face in the mirror the entire time I used the monitor. The effect was annoying with background lighting, but when I opened the window it was just unbearable.
As for fitting 80 characters of text per line, I found that with a 12 point DejaVu Sans Mono I could fit two windows side-by-side perfectly. Even better, I could have vim open on one half of the screen and split the other half between two windows - maybe a window for compiling, an interactive REPL, quick documentation, revision control, whatever. It's great.
Without the need for RANDR, I can go back to using XINERAMA and use two
monitors conveniently. The second monitor is still invaluable for tasks like
web browsing, email, and especially for API documentation.
As Ferd said, "Alec, welcome to the 90s."
Posted Thursday night, July 5th, 2007One of the courses I'm taking this semester in the Computer Science department is "Artificial Intelligence and Computer Games," which deals with, naturally, applications of AI in computer games. We're using Unreal Tournament 2004 because it provides a rich, 3D environment with many possibilities and there exists a good set of supporting materials.
Gamebots is a modification that provides a generic socket-based, client-side API for controlling Unreal Tournament characters. JavaBot goes one step further and provides a Java framework for the Gamebots API and a nice front-end for managing multiple bots simultaneously.
Unfortunately, the JavaBot is very minimal; it takes care of parsing the messages from the server, but you're on your own to do things like keep track of health, nearby items, and other players. I wrote a superclass for the course that makes it easy to pick and choose which parts of the Gamebots API to implement and hides the grunt work of generic state updating. It's available for download and in darcs should you be interested. I'll be updating it throughout the semester.
Posted late Friday afternoon, February 2nd, 2007I just came across foldl.com and foldr.com and it very much brightened my day.
Posted late Sunday evening, December 3rd, 2006From the Python documentation on comparison operators:
There are no implied relationships among the comparison operators. The truth of
x==ydoes not imply thatx!=yis false. Accordingly, when defining__eq__(), one should also define__ne__()so that the operators will behave as expected.
Umm... wait... what? Equality and inequality overlap?
I know about __cmp__(), but if Python looked for __eq__(), and if
not found, tried to return not __ne__(), that would be pretty spiffy.
Bowdoin's Computer Science department is heavily vested in Java; if there's a class that requires programming, more than likely you're expected to do it in Java. This has always gotten on my nerves, not just because I dislike the language, but because it's a proprietary language and the only workable implementations have been proprietary.
I started my first assignment for the Robotics class I'm taking, and sure enough, all the supporting files are in Java. I decided to give GNU's gij/gcj combination a try, and installed them both (I'm using Debian testing, so they're both just an 'apt-get install' away). I typed 'javac *java', and lo and behold, both the source files compiled up without any problems! Not only that, but the compile was really fast - significantly faster than Sun's has ever been! This is fantastic.
Posted at noon on Saturday, September 9th, 2006American Scientist has an interesting article entitled "Semicolon Wars" which introduces for a general audience the different types of programming languages.
I learned some good trivia. "Endian," a term used to describe byte ordering, comes from Jonathan Swift story, and there's such a thing as "sulkingCamelCase." There was also an amusing paragraph of Dijkstra exerpts and a good John McCarthy comment.
Posted Thursday afternoon, June 15th, 2006I wrote a script to convert my WordPress entries and comments to PyBlosxom's format and sent it to the pyblosxom-devel mailing list a few weeks ago.
Posted late Sunday evening, April 16th, 2006The first talk I attended was about darcs, the distributed change-based revision control system. It was the most academic talk I saw at the conference, and it was mostly over my head - he spoke on mathematical correctness for patch commutation Yeah. I think the audience was for those who have followed darcs development in detail or at least had substantial Haskell experience, and I part of neither crowd.
The next talk was about Subversion It was targeted at those still using CVS - honestly, who comes to a conference like FOSDEM in 2006 using CVS and hasn't taken the time to check out Subversion?. He was a good presenter and I enjoyed the talk, especially the end about the roadmap and desired features.
One he mentioned was buffered commits for offline operation - instead of contacting the server on checkin, package the commit aside for later communication with the server. If Subversion had this I would stop wandering from revision control system to revision control system. I don't want to carry around an entire archive with me, especially ones for big projects like a gcc or KDE or whatever, and I do like the star-topology model SVN promotes, but I would like to be able to work offline without needing to talk to the server whenever I want to notate a change. SVK doesn't cut it; I spent quite a bit of time trying to get it working before I left, but ended up abandoning it and just using darcs. The presenter suggested - and I agree - that this feature would solve most of the problems distributed version control systems are trying to tackle (and for the most part still haven't gotten quite right).
During the Q&A session his laptop went to screensaver and he had a Windows laptop - no one had noticed before, but there was a lot of booing from the audience. To his credit he ignored it at first and continued unfazed, but eventually had to acknowledge it - "hey, I like to use PowerPoint." This answer didn't particularly satisfy anyone.
The third talk I attended was about Valgrind a debugging framework most often confused as a memory-leak checker. It was a very good talk, and even though it was a talking head slideshow the presenter had good content and examples and kept the audience's attention. I just started using Valgrind for the C project I'm doing for my Operating Systems class and it's nifty, and I'm very excited about its future possibilities. His description of how Valgrind actually works was most enlightening, and so many people had good questions for him that the session ran well over time.
I hung around for a tutorial on OpenBSD wireless networking. It was stuff I mostly knew, but the presenter made the same mistake the Plan9 one did. If you can't pull off a funny joke, don't say bad things about other Free Software / Open Source projects. It alienates the audience and you lose credibility. Also, I think wireless was a sore subject for many attendees; FOSDEM's wireless network didn't work at all during the conference, which is most unfortunate since a good number of people could have set it up for them.
The afternoon was a bust for the most part. Neither of the two sets of talks interested me - the Security track had talks on AppArmor, ClamAV, and OpenCA, while the Desktop track had talks on Beagle (the GNOME program like Apple's Spotlight or Google Desktop), OpenOffice, and XUL. I wandered around the booths for a bit before sitting in on the last part of the AppArmor talk. It appears to be some sort of systrace-alike. The ClamAV talk was disappointing; he just described what it is and the different parts in no great detail. I could have gotten the same information from the "About ClamAV" page. There was so much potential - tell us about how it's being used in inventive ways or in large deployments, what the project roadmap is, or lessons learned from running a project that must be updated several times a day, but don't just read us the about page.
The closing talk by Jeff Waugh of GNOME and of Canonical/Ubuntu was absolutely fantastic. Best talk of the show, no contest.
He spoke about the importance of usability to evangelism. Most people, he said, don't consider the computer as the center of their lives, and if free software is to gain real marketshare it needs to appeal to the average human (mistakenly referred to as the "dumb user"). One really easy way to do that is make software very usable. He went through how GNOME has become more usable - intuitive dialog boxes, less preferences, and more doing the right thing by default. I was one of those who has been disappointed by GNOME providing less opportunity to customize, but I see now why they did what they did, agree with what they did, and respect it.
I took pictures of one of his dialog box examples. Exhibit A
<http://gallery.thened.net/v/college/bowdoin05-06/study_abroad/fosdem_2006/img_2937.jpg.html>_
is an awful dialog box. One must read two paragraphs before knowing which
button to click, and even then one has to sit there and think about it for a
while before determining that there's no correct way to proceed. Exhibit B
<http://gallery.thened.net/v/college/bowdoin05-06/study_abroad/fosdem_2006/img_2941.jpg.html>_
is what a normal user will actually perceive Exhibit A to be. Exhibit C
<http://gallery.thened.net/v/college/bowdoin05-06/study_abroad/fosdem_2006/img_2939.jpg.html>_
is one of the new GNOME dialog boxes; it's short on text, tells the user
precisely and succinctly what his options are in one or two sentences, and then
presents three options, two corresponding to actions and one that lets the
user say "wait a minute, I hit the wrong button." Notice that the buttons are
labeled with the action they represent; when the user, perceiving Exhibit C as
Exhibit D
<http://gallery.thened.net/v/college/bowdoin05-06/study_abroad/fosdem_2006/img_2943.jpg.html>_,
doesn't read the dialog text (and most of us don't), he can tell the computer to
do what he wants without thinking very hard.
Ubuntu is a very exciting project. I loaded it up on a laptop for my sister last year so she could watch DVDs; she liked it. I hear they're in negotiations with HP to get it sold preinstalled; that would be fantastic. When Dapper Drake comes out in June I plan on harassing friends and family to ditch Windows for it; it'll be supported for more years than they're likely to have a computer and will "just work" for most things.
FOSDEM - especially RMS and Jeff Waugh's talk - gave me a lot to think about. I'm very glad I went.
To end on a funny note, the best joke from Jeff Waugh's talk was when he explained how LAMP wasn't a killer app but was a network affect - he expanded the acronym to be Linux, Apache, Most of our scripting languages start with P, and PostgreSQL - and drew large applause.
All of my pictures are available in the photo gallery
<http://gallery.thened.net/v/college/bowdoin05-06/study_abroad/fosdem_2006/>_.
Update: Jeff Waugh emailed and let me know he is still very much with the GNOME project; mistake corrected.
Posted at lunch time on Wednesday, March 22nd, 2006I braved the cold shower to wash my hair and towel off; quite a way to get going in the morning.
On the tram over there I ran into some other FOSDEM types. One was a KDE/Kubuntu guy from Scotland who was wearing his kilt - pretty funny. There was a sudden stop and one of his cardboard boxes went flying to reveal a big KDE gear inside. Someone was quick to exclaim "Look, he's got KDE in that box!", and then speculation began about the contents of the other, larger box - we settled on GNOME.
The opening talk was by Richard Stallman (RMS), demi-god, founder of the Free Software Foundation, architect of the GNU project, and original author of a host of incredibly useful software like GNU Emacs and gcc. I was very excited to hear him speak, and he definitely lived up to my expectations. He talked about (against) software patents, and I was struck by the eloquence which he delivered his speech. Very convincing. A transcript of a similar speech is available; recommended reading.
I decided to skip the GPLv3 panel (since I figured it was just going to be a real-life flamewar, only less fun because only one person had a microphone) and headed out to the booths. It was an odd assortment:
O'Reilly had an enormous stack of books for sale in both English and French. Unfortunately, none of their books were particularly interesting this time around.
The FSF had several tables with T-Shirts and was soliciting new members.
VideoLAN had an impressive display. They had a webcam and were doing live transforms on the streams; the neatest was the stencil one. They also had set up two laptops and had a movie full-screen between them.
The Free Knowledge Foundation (never heard of it)
Gentoo had quite a crowd around their table, but I think it was mostly existing users who knew each other. They had a demo machine of Gentoo running on an older Mac clone and Portage for Solaris on an Ultra 5. I resisted the temptation to run "emerge openoffice" and walk away.
Debian had a sizable presence with a bunch of T-Shirts. One was "Good things come to those who... wait." They also had a nifty demo of the debian-installer that picked a random language each time.
Eikga, the former GnomeMeeting, and OpenWengo, some sort of VoIP, each had a table.
Fedora had a booth but whenever I walked by if anyone was talking to the guy behind the table they were asking to what degree it was independent from Red Hat (and never seemed to be satisfied with the answer).
openSuse had a large booth and a large tutorial room, but neither ever seemed crowded.
GNUStep had some fliers out, but it was mostly guys talking behind the table to each other. They had their own tutorial room, though, but I never looked inside.
OpenBSD had a size-able presence and lots of merchandise. In addition to the T-shirts and posters, Wim was there with some cool Soekris embedded machines. I talked with one of the OpenBSD guys about his Soekris and have decided not to get one - I was hoping to use it as an email/www server since I don't need a lot of power, but it's apparently difficult to find a hard drive with a low enough power usage to come in under the 15-watt maximum the board can handle. Firewall/router/access point yes, server replacement no.
There was a somewhat combined FreeBSD/NetBSD/MirOS table. I talked with the guy running the FreeBSD table and he said that they had hoped to get their own tutorial room, but there just wasn't enough space; they were going to have a full program next year. They did have a giant stuffed beastie which made everything OK.
After wandering around I went to part of the DTrace tutorial. It was absolutely
fantastic. DTrace is a facility to give a user, developer, or administrator an
end-to-end view of what an application is really doing, and the implementation
is extremely clever. The presenter had energy and his talk was properly
targeted - he demoed it and everyone was impressed. He had one quick script
that watched for calls to poll() and printed out each unique stack trace
along with a count of how many times it occurred; from start to finish, it took
him less than 30 seconds to write the script, run it, wiggle his mouse around,
and be told that Xorg was the primary source of poll() calls. I can't wait
to get my hands on OpenSolaris and try DTrace, and I think most people there
felt the same way.
I left the DTrace tutorial early to hear the Plan9 talk. Plan9 is Bell Labs' reworking of Unix around a network paradigm, and was open-sourced a few years ago. The concept is cool, and the stuff he showed off was cool, but he was not an effective presenter and tried to make jokes at other projects' expense that didn't come off as funny. I have wanted to try Plan9 out, but the presentation didn't make me excited about it and the lure of network transparency isn't enough for today.
Unfortunately the DTrace presentation (not tutorial) was at the same time as the keysigning, and I decided to do the keysigning. It was a mess - it took the full hour for us to get around, mostly because people didn't know proper protocol. It was cool putting faces to names, though.
I then went off to the Xen talk. Xen is the para-virtualizer; think VMWare or QEMU, but implemented in such a way that it doesn't need to create an entire virtual machine. He didn't show anything off, but he explained how the thing works and what improvements were being made, and I enjoyed the presentation. Debian is working on their Xen support, so hopefully by the time I have access to a somewhat powerful computer when I get back to Bowdoin this summer I'll be able to try it out.
Xen was the last official talk of the day, but the Debian tutorial room had a
presentation on the automated package verification tool piuparts entitled
"Nobody expects the Finnish Inquisition" (The author/presenter is Finnish). It
was a good talk, but he was preaching to the converted - those there were
probably not making the mistakes that his tool was commonly finding.
This was my third night in Brussels and I was hungry for some real food: hamburgers or pizza. Many of the restaurants didn't have a flashy exterior announcing what kind of food was served, but rather had menus in the window; this made for slow going. Finally, I rounded a corner and there, like flaming writing in the sky, was a large neon sign: "HAMBURGERS". Sweet. I went in, and using my impeccable French ordered two hamburgers, fries, and a drink. Unfortunately, I don't know how to ask for plain hamburgers in French; so close.
Posted at teatime on Monday, March 20th, 2006Replace a bunch of these:
#ifdef DEBUG
fprintf(stderr, "message");
#endif
With one of these:
#ifdef DEBUG
#define DPF(...) fprintf(stderr, __VA_ARGS__)
#else
#define DFP(...)
#endif</pre>
And some of these:
DPF("foo");
Macros are so cool. Idea from The Sherrill Group at the Georgia Institute of Technology's C Tutorial.
Posted at lunch time on Saturday, February 18th, 2006