Monday, June 23, 2008
Do Not Buy A Time Capsule
Labels: Development
Wednesday, May 14, 2008
No Joy of Xi
The idea, you see, was to start a GNU Screen session on your workstation. Screen is a terminal based program which lets you "attach" to a running command line prompt, so you can start Screen at work, go home and pick up right where you left off. I used to run the editor XEmacs inside Screen, so I could go to a talk and resume my editing session on my laptop. However, this means running XEmacs in no-window mode, where it loses many features.
The first brainflash was to use XEmacs' gnuclient utility, which also lets you "attach" to another program from the command line, this time to a running (x)Emacs. Normally this pops up a new window, but I found a version of gnuclient for XEmacs which lets me run in no-window mode. So I now start XEmacs, start Screen, run gnuclient, and now I can connect to the same editor anywhere.
The next step was to set up scripts that run these with the configurations I want - myscreen, myxemacs, mygnuclient; not strictly necessary but I can wrap the programs with a little sugar so they always run the right way, do the right thing, and fail with graceful error messages. I'd done this first with myx11vnc, which has odd and weird options I can never remember.
But I digress ... and I'm still short of my real goal. You see, other than losing features in XEmacs in command mode, one thing that was really bugging me was that I continually switch back and forth between vi and Emacs at the command line. I prefer Emacs, but vi is faster to load and type, so I use it for quick jobs ... but it has an almost entirely different set of control keys, which can get confusing. The problem has gotten worse since I've temporarily retired the use of Eclipse at work until some bugs are worked out in a new loader system ... so now I just use XEmacs and vi, without the palate cleaner of a CUA-compatible editor ... and thus end up really confusing myself.
What I really want is an Emacs as easy and convenient as vi, so I can run it anywhere. Gnuclient is about that fast since you don't need to open an Emacs, but typing mygnuclient is painful and can't even be done with tab completion with half a dozen my* programs sitting around in my bin directory.
But wait ... why not call mygnuclient ... 'xi'?
Well, I can, and do. And the result is now I have a fullfeatured Emacs-compatible editor at the command line, fast to type and fast to load as vi, with the added bonus of all my Emacs macros, all my open files, and the history of whatever I was working on. Calloo, callay, he chortled in his joy.
But a lot of the particular details of this depend on my work setup. And I don't blog about the details of my work. (Note no code samples.) So I started to replicate this behavior on my new Mac OS X laptop with Aquamacs so I could show you how this is done without giving away any proprietary trade-secrety things.
But Mac OS X is not Ubuntu, and Aquamacs is not XEmacs. Aquamacs is a version of Emacs, as it turns out; and Steve Yegge's delusions aside, Emacs is perennially just a bit behind of Emacs in all the features that matter to me. No, Steve, I don't care what your experience is; all I know is that in my experience Emacs keeps on leaving me twisting in the wind so I've learned NOT to rely on it, not when I've got XEmacs - but Aquamacs' slick Mac OS X changed that equation.
I really like Aquamacs; it uses the Mac-only command key for all the typical Mac keyboard shortcuts, and the remaining option keys for Emacs. It really is the best of both worlds, and I wouldn't want to give that up ... but Aquamacs isn't compatible with gnuserv. It's version, emacsclient, does not have a no-window mode because Emacs's multiple TTY support is less well developed than XEmacs. There's a patch, but it isn't here yet, and I'm pretty sure it's only compatible with vanilla Emacs, not the Aquamacsy goodness I want. So no 'xi,' not on my laptop yet.
None of this is unsolvable. I'm convinced I could make it work. But not the easy hour or so of hacking it took to make this work on the Ubuntu version, and not in the time available to me to make my "every day in May" blog posts. So you'll have to wait a while to hear the Joy of Xi told properly, in all its grody, replicable detail.
-the Centaur
Labels: Development
the consequence...
... of making things easier on Qumana was to make things harder on Blogger. Apparently the setting I turned off on Blogger to prevent the extra carriage returns in Qumana means that Blogger posts will come out all mooshed together. Sigh.
Labels: Development, Webworks
Sunday, May 11, 2008
The great bit bucket in the sky...
AAARGH!
These browser based apps still leave something to be desired. Anyway, it was really witty and acknowledged all of Jim's good points while carefully highlighting my areas of difference in a subtle yet engaging way. You should have been there ... *sigh*. Will rewrite it (in Qumana so I don't lose it) and will post it as a new article shortly.
-the Centaur
Labels: Development, Webworks
Saturday, May 10, 2008
A Blogging Bookmarklet
What is BlogThis! ?: "BlogThis! is an easy way to make a blog post without visiting blogger.com ... Clicking BlogThis! creates a mini-interface to Blogger prepopulated with a link to the web page you are visiting, as well as any text you have highlighted on that page. Add additional text if you wish and then publish or post from within BlogThis! ... just drag the link below to your browser's Link bar. Then, whenever the mood strikes, click BlogThis! to post to your blog:This isn't the only bookmarklet out there. There's also one for Google Bookmarks, Steve Rubel at MicroPersuasion has his own list of key bookmarklets, and Irregular Shed shows us how to make your own. I know these work in Firefox but I suspect you can get this to work in other browsers as well.
So check out these links, and if you find yourself doing any of these common tasks in less than a click and the associated commenting/typing time, add yourself a bookmarklet and save a few minutes of your life.
-the Centaur
Labels: Development, Webworks
Friday, May 09, 2008
Interestingly...
... if you have a blog draft hanging around for a long time in Blogger and finally publish it, it gets published at the date that you initially started it and not the date it was actually published. Interesting...
-Anthony
Labels: Development
Wednesday, May 07, 2008
Extra Spaces
Qumana is a great blog post editor, but it has an interesting property that makes its posts appear weird on my web site.
If you hit return, it wraps the whole paragraph in a HTML "p" tag <p>like so</p>.
Which is nice, in theory it's how you're supposed to use the "p" tag, but ...
It puts huge spaces between paragraphs in my blog.
I'm not sure why this is happening. Some CSS error in my stylesheet? Some translation ... WHOA!
I just did "view source" on the published blog, and found extra <br> tags after each paragraph in the published blog! So THAT's what is happening... now, of course, the question is WHY, since they don't show up on Qumana's Source View.
Here's seeing if switching from "Enter Starts A New Paragraph" to "Enter Starts A New Line" does the trick.
9:56pm hit return.
-the Centaur
Labels: Development, Webworks
Friday, May 02, 2008
Insignificance
Created via Automotivator, which I found after seeing a Livejournal post (itself found via Planet Lisp) in which its creator, Zach Beane, created a motivational poster for all the smug lisp weenies:
I may not program in Lisp much anymore - probably less than once a month or so, compared to my Top Five (currently Javascript, Java, C++, Bash and Python) - but I do now have this poster hanging in my office at the Search Engine That Starts With a G. Already it's gotten quite a few questions ... :-)
So, on the note of doing things wrong and personal insignificance ... here's some random bits about some changes in the works. This is one of the first blog posts I've done on my new Macintosh, which replaces my beloved but fried Blue Slab of Coolness and my beloved but stolen old Powerbook. Having used it for a month or two now, I do so wuv my my Mac and it's crappy user interface, which does just enough right to almost make me ignore its massive gaffes (like switching between two windows and the screen suddenly reshuffling the z-buffer heights of all open applications).
But it's really flipping over into usability thanks to a trick I learned combining Spaces and VMWare, letting me switch back and forth between Windows Vista and Mac OS X Leopard with ease. (Apparently the new MacBook Pros are some of the best laptops to run Windows Vista. Who knew?) VMWare is slick because it lets you run Windows Vista on your Macintosh in a virtual machine - it's even smart enough to use the partition set up by Apple's Boot Camp dual-boot solution - but it really didn't get hyper useful until I learned the Spaces trick. Spaces (a warmed over version of the virtual desktops feature popularized by the X Window System) lets you create several "virtual desktops" you can switch between via control arrows - and once you do that, you can give one of them to Vista in full screen mode.
I can't remember the blogger who recommended this trick to me (Mossberg? Some Lifehacker article?), but using Space's control-arrows to switch desktops actually has proven easier in practice than using VMWare's (admittedly hyper-slick) Unity mode. Unity, like Parallels' Coherence mode, sounds great because it puts your Windows windows on your Macintosh desktop like any other Mac app. However, using Spaces to put Vista on its own desktop means the Mac apps and the Windows apps get their own OS desktop features like the taskbar, destktop icons, etc. Looking at the Lifehacker article on Parallels I linked to above, I suspect that I could make Unity work much better; but this is working well enough for me to get stuff done now.
Also this is a first post using Qumana, new blogging software which narcissistically inserts some adware which you can see here to the lower right. --->
Powered by Qumana
Qumana has been so nice to me so far (WYSIWIG mode, automatically snarfing URLs out of the keyboard when you insert links, etc., etc.) I'll leave the ad in just this one time.
SO click on some links above and give our "sponsors" some love. :-)
-Anthony
Labels: Development
Wednesday, April 16, 2008
Google News Quotes
Consider this election season. All along the campaign trail we have heard candidates' thoughts on the future of health care, the war in Iraq, and even each other. These debates have generated untold pages of commentary, and it's only too easy to lose track of original quotations. Unlike much of the surrounding rhetoric, these quotations cited in news articles are not conjectures but facts - transcriptions of actual words and thoughts - be they campaign promises, arguments or opinions. Wouldn't it be great if they were easily searchable?
You can search for quotes right at the top of the Google News box; it apparently just shows news if it can't find quotes. At the time of this writing, searches on John McCain, Hillary Clinton and Barack Obama all turn up with news quotes:
Hillary Clinton: "I believe the potential for life begins at conception"
Barack Obama: "You go into those small towns in Pennsylvania and, like a lot of small towns in the Midwest, the jobs have been gone for 25 years and nothing's replaced them"
John McCain: "We need to make a clean break from the worst excesses of both political parties"
I have a policy of not directly talking about my employer on my blog, so I deny all knowledge of the hard work of my cubemates in making this happen. Check it out...
-Anthony
Labels: Development, Webworks
Wednesday, September 12, 2007
F-sharp
For those not in the know, OCaml is a frighteningly efficient functional programming language that is the intellectual child of my former college nemesis, ML. (Since then ML and I have become friends, teamed up, and fought supervillains together, but that's another story for another time).
Even though I don't use functional programming all that often, it's an important way to think about programming and you can do a lot in it - so the more we do to put powerful functional programming tools in the hands of the masses, the better.
Hence the significance of Microsoft porting this to .NET. "Dot NET" a library of software for Windows platforms that includes the Common Language Runtime, Microsoft's answer to the Java Virtual Machine. The great thing about the CLR is that it's very, very easy to port new languages to, and those new languages immediately have access to lots and lots of Microsofty goodness. Note to the fruits-and-birds crowd: that was not a joke. Microsoft makes a lot of good shit, and thanks to Mono more and more of that is becoming available in the Linux world.
In short, the vast library of Microsoft tools is now at the tender mercies of functional programming devotees. Bwah hah hah haaaaa! Language geeks will rule the world!
Labels: Development
Synergy
The claimed magic was this: you set your laptop computer next to your desktop computer and plug into your network, take your mouse from your desktop and MOVE THE POINTER OVER ONTO YOUR LAPTOP SCREEN (!) and then just start typing. When you want the keyboard to move back to the desktop, you just move the mouse pointer back and when it leaves one computer screen and reappears on the other, magic, whoosh, you're back in control of your desktop.
Well, that was the claimed magic; it didn't work so well with the versions of Linux and Windows we were using at the time, or perhaps the release of Synergy that existed then is not as good as what exists now. Regardless, I never got it to work then, but a year later, with a new Linux distro and a brand spanking new Mac laptop, I got it running like a charm in just a few minutes.
The kindly folks who run the computers at the search engine that starts with a G preinstall synergy on our Linux desktops, so all that remains to do at work is download a Synergy client like
SynergyOSX or, even better, its recommended replacement SynergyKM, install it, and set up the configuration.
I liked this so much I wanted to try this at home - but there was only one snag. At home I work in primarily PC environment. Yes, yes, I know, I should make better use of my two Macs and my Linux desktop and my Palm Pilot and my Newton and my Apple IIc, but let's stay focused here people on what I do use every day, which is the nice Windows laptop and its big brother desktop with the 24-inch LCD screen.
However, I found on the PC, in some ways Synergy is even simpler except for a typical Windows snag. All you need to do is download one Synergy binary for Windows and install it on both machines. On the server, you get a nice desktop icon for Synergy, and clicking on it gives you the option to listen to another machine's mouse and keyboard or else to share this one's. Clicking on that enables a dialog box where you can list the names of your two machines and set up "links" between screens that the mouse pointer can travel on. (Note: these links did not appear to be symmetrical, so if you specify that your laptop is to the left of your desktop, you actually need to specify the vice versa link as well or your mouse may become trapped after it crosses the border.) On the client you do a similar procedure, specifying what machine name it should listen to as it server.
However, the snag is that these are machine names, not IP addresses. At work the kindly techfolks have set up the whole infrastructure for you to resolve names to IP addresses, which Synergy depends on; at home, on a simple router, you may need to set this up yourself. Trying to specify the IP addresses causes Synergy to throw errors and not work, and ignoring the problem just means your Synergy client won't be able to find your Synergy server.
A simple way around this problem is with a hosts file, which tells Windows how to map names to IP addresses on your local network. This enables you to specify a few lines that say (for example) that the IP address 192.168.1.2 maps to "desktop" and that 192.168.1.3 maps to "laptop". I added a pair of lines to the hosts file on both my desktop and my laptop to make sure both programs could talk to each other (note: all names confabulated to protect my innocent little computers):
192.168.1.3 desktop
192.168.1.4 laptop
This gives Windows enough information to map these names to their IPs. (Note that this assumes your router or cable modem IP assignments are stable; consult your documentation on how to set this up more reliably if you have problems.) With that information, Synergy can decode these names and the client can find the server and vice versa.
And with that, it works. I move my mouse over, stuff changes on my laptop, I move my mouse back, I finish typing this essay. Not even sexay-looking enough to take a screenshot, but radically useful and easy as pie. I wish I'd done it earlier.
-the Centaur
Labels: Development
Tuesday, June 05, 2007
Cool Technical Talks
- Tech talks from the search engine that starts with a G.
- Donald Knuth's Musings taped at Stanford.
- "Ted" Talks: Ideas Worth Spreading.
I've had a chance to see or attend a fair number of the first talks, but the others are new to me as of today. Anyone else have any suggestions? Add to the comments (or mail me and I'll post them here).
-the Centaur
Labels: Development
Thursday, April 26, 2007
The Wiki Is Dead Again...
Labels: Development
Sunday, November 26, 2006
When To Wiki Rather Than Blog
SO, what I've found? As cheap and disposable as blog entries are, they're still aimed towards recording complete thoughts. If you can't finish a thought, or it needs to be refined, blogging (for me) gets in the way, because my thoughts drift backward into the distance and I never finish them.
THAT is why I've reinitialized the wiki over at dresan.net. A wiki's pages are automagically editable and suitable for recording incomplete, incoherent, half-completed thoughts that can be edited, updated, or reorganized as need be. My blog was becoming my pristine notebook; so time to whip out something sloppy that I can just write on, regardless of how well formed my thoughts are.
So, for example, when I'm trying to get SLIME working for XEmacs on Windows with CLISP running on Cygwin, and I haven't quite figured it out yet, I can just create a wiki entry on dresan.net about Slime which captures my current thoughts, crossreferenced with XEmacs and CLISP and Cygwin which I can edit and refine to my heart's content.
If there's an easy way to do that on a traditional blog, I don't know it yet. But I can make a wiki proxy a blog: see the updates page of dresan.net for a good example.
Not that I want to give up blogging in favor of futzing around on a wiki; there's something deeply satisfying about this blog and its interface. But I do miss my wiki features on the blog, and I hope that one day either Blogger adapts those features or else that I find a wiki/blog/bliki that does the job that I can port all my old data from.
Blog/Wiki developers, take note.
-the Centaur
Labels: Development
Monday, October 23, 2006
dresan.net
The short story is that the Library of Dresan will remain my primary blog, but I've created dresan.net as a playground to experiment with new technologies. It's still a little rough, but I hope to beat it into shape over the next few weeks.
So enjoy!
-the Centaur
Labels: Development
Scrolling through RSS
Except of course I still can't get internet at home, dag nab it, since I live on the surface of Mars, which does put a kink in the whole thing (hence my nickname "Internet Cafe Boy"). Oh well. I pray that state of affairs won't last forever.
-Anthony
Labels: Development
Wednesday, November 30, 2005
Congratulations! This is a valid Atom 1.0 feed.
http://www.fanufiku.com/atom.xml. Some interesting programming lessons were learned during this. More in a bit.
-the Centaur
Labels: Development
Saturday, November 19, 2005
A little better...
-the Centaur
Labels: Development
Thursday, November 17, 2005
I know Atom Fu
Seriously, Fanu Fiku now has a nascent Atom feed. The atom.xml feed produced by fiku.py has some validation errors but the feed seems to read fine in my first newsreader tets.
Hopefully before the next issue goes up I'll be able to correct the blog title issue and make the validation problems go away with the help of the Feed Validator and the Atom Standard.
Once I get it running, I'll post a bit more about what's going on under the hood in fiku.py to make this happen.
Till then, fellow fanu, remember to believe...
-the Centaur
Labels: Development
Wednesday, July 27, 2005
Football vs Videogames: A good question
Clearly high school sports violence isn't something new, and few people would consider banning it. How do we educate our public and politicians about how to think properly about things that are new and different?
And by "properly" I don't mean "agreeing with me" --- reasonable people can disagree about the possible dangers of things like videogames and still remain reasonable --- instead I mean testing ideas against evidence, putting things in their proper context, and applying values formulated as universals, which means that in general you do NOT toss a call for ban or investigation onto the publicity trail of every pseudosensation that swims down the stream, but take a measured ... dare I say "conservative" ... attiude towards any call for government regulation.
-the Centaur
Labels: Development
Tuesday, July 26, 2005
Wiki Hacked Again
-Anthony
Labels: Development
Sunday, July 24, 2005
Memories...
But, while I relish the memories, I'd never go back (though I may end up going forward to Mac OS X :-):

Here's an early 10th birthday to you, Windows.
-Anthony
Labels: Development
Tuesday, July 19, 2005
The Bleeding Retro Edge
-Anthony
Labels: Development
Tuesday, June 28, 2005
Words of Wisdom ... Not Just for Software
Eclipse's Culture of Shipping: "In software, having cool ideas is nice, but shipping them is what counts. For us it only counts if you have shipped the thing. That's really the mindset we have. And given that you focus on shipping, we never want to be in a mode of always being two years away from shipping. You need to have a short-term deliverable. You also plan, decide and act with this mindset."
You know, all artists should probably learn this lesson. It's easy to plan the Great American Novel or the Next Great SF/Fantasy Trilogy, but in the meantime write some damn stories, paint some paintings, write a webcomic, and get your stuff out there.
-the Centaur
Labels: Development
Wednesday, May 25, 2005
Bolot Kerimbaev, Technology Commando

SO many of you (where many is defined as N greater than or equal to one) may remember that the Wiki was down for "security reasons". Well, this wasn't that someone had hacked the site, trashed the data or even just spammed the comments pages: it was, more literally, a security issue with my web hosting provider, which tightened its security provisions on script hosting and killed OddMuse, the wiki engine I was using. Fortunately Bolot Kerimbaev, a friend from Taido class, uses the same wiki engine and the same service provider, and he told me that the use of semicolons rather than ampersands in the URLs was causing the problem. A simple fix, really.
Well, not so simple.
I worked at it for a while, but found that other features were broken on my site as well ... because semicolons were EVERYWHERE in URLs in the OddMuse code. At first I tried changing them individually, then, as the problem got more complex, decided to try to abstract out the separator character into a $SEP variable that I could change and control. That worked well ... for a while ... but eventually the OddMuse instance I was working on became unstable, then stopped working entirely. Because I'd been futzing around with vi on a local directory and uploading the Perl script to my web site rather than using proper source control (for shame!), I couldn't even roll things back successfully without losing all of my changes.
SO I called Bolot for help, and we got together at Atlanta Bread Company at Perimieter Point to take care of the problem. This Atlanta Bread Company (one of their best stores) is right next to a Starbucks Coffee, which kindly provides T-Mobile Wi-Fi. So we logged in and tackled the problem, and after a few minutes showing Bolot what was going wrong, he took over the keyboard to fix it.
And a whole lot more.
First, rather than laboriously editing the files locally and uploading them with FTP, Bolot suggested we use SSH and edit the files in place so we could see the changes immediately. This point is so important I'm going to follow it up with a separate post, but that's another blog for another day. Now, apparently I got through thirteen and a half years of Georgia Tech without using SSH extensively (I almost always relied upon remote X Windows logins prior to my Windows/Cygwin days) so this option never occurred to me. Bolot, however, was able to do it almost instantly:
ssh -l username hostname
Moreover, we found that using the Cygwin instance on my laptop, we could not just SSH in to the site ... but could actually use VIM, the enhanced VI editor. And with a few quick commands, he had syntax highlighting and color schemes working - remotely, via SSH, in the bash window already set up in Cygwin on my machine. Other than the window title and the lack of a toolbar, it looked identical to the gVIM I frequently use on my machine.
vim
:colors darkblue
:set nu
(Note tab completion actually works on setting the colors!
After finding and fixing the first and most important of the problems, we then went to test. Bolot immediately became frustrated with my Internet Explorer installation and turned to my copy of Firefox instead, which was hopelessly out of date. Within moments, he showed me why people use Firefox: within moments he was able to painlessly install gesture support, web developer tools, a variety of search tools, flash blocking, ad blocking, and a host of other applications which made the Firefox experience almost palatable, despite the fact that its interface is still slower, clunkier and uglier than IE. Shortly thereafter, Bolot was able to find and eliminate the rest of the problems in OddMuse, realizing that the problem was not semicolons in URLs in general, but the presence of the string ";id" in the URL. By the time he was done, he had not just corrected the problems in OddMuse itself, but also other problems with my installation which were interfering with stylesheets.
SO: an improved browser, web site, method of connecting to the web site, and a whole host of other tools. All delivered straight to my brain in less than an hour.
Lessons learned: Be dogged with your tools. Find out all they have to offer you. Use them as they were best intended. And be dogged about eliminating problems in your way. Make it possible to get feedback on changes instantly, so you make many small changes safely and feel free to experiment. Then, you will be able to work far faster than you ever thought possible.
More thoughts on this later .... but, until then, hats off to you, Bolot Kerimbaev, Technology Commando.
-the Centaur
Labels: Development
Monday, May 02, 2005
I am not alone
But the point is, it ain't just me.
Clean up your act, folks. This will come back to bite ya.
-the Centaur
Labels: Development
Thursday, February 10, 2005
Trying to decipher line noise?
I particularly like the tool's ability to translate what a regular expression means into human-readable language:
Check it out!
-the Centaur
Labels: Development
Wednesday, October 13, 2004
Oh, and I just discovered RSS...
RSS Feed.
Actually technically it's an Atom feed, but, hey, they're all the same to SharpReader.
Ok, so now I have to upgrade my Python webcomic script to produce an XML site feed, which I suppose means I have to add XML support to Sangreal for when I switch the script over to Sangreal. Rassen frassen ... yes, I *do* plan to join the 21st century, give me a break...
Labels: Development
Monday, September 20, 2004
Iron Laws of Software Development
Friday, September 17, 2004
My First APL Program
Most recently, someone mentioned that array languages are the least
widely known family --- perhaps because the founding language in the group,
APL, was written with a nonstandard character set. Perhaps the most terse
of all programming languages, APL spawned a series of children, like J and K,
which, even though they can be written in a normal alphabet, retain APL's
essential terseness --- or, dare we say, obscurity?
I plan to learn J. However, before I did so, I committed myself to learning
at least a smidgen of the original APL, so I could see how the language was
originally intended to work and look.
Here's my first APL program, designed to produce a Vigenere tableau:
Note the code isn't in the standard ASCII character set, so I had
to represent it as an image file.
The heart of the code is the central box of the next image. This should read as:
disclose (( -1 rotate (indexList (shapeOf Y)))
(outerProduct rotate) (enclose Y))
and executes right to left:
To translate into pseudocode:
// Assign the alphabet to the variable Y
Y = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// Now perform the following:
(unbox
((outerproduct rotate)
(rotate -1 (enumerate (length y)))
(box y)
)
)
// This is the moral equivalent of:
// (1). Treat array Y like a "scalar" variable
boxedY = box(y)
// (2) Find the length of Y - in this case,26
lengthOfY = length(y)
// (3) Get an array from 1 to the length of Y
// We will use this (1 2 ... 26) later to
// rotate the alphabet to the side
list1toY = enumerate(lengthOfY)
// (4) Rotate list by one so that the first
// row is a "no-op" rotation: (26 1 2 ... 25)
// (I should have just have subtracted one
// from each list to get (0 1 .. 25), but
// it's just my first APL program!)
rotateAmounts = rotate(-1, list1toY)
// (5) Create a "mapping rotate" function that takes
// a list of integers as its first argument and
// rotates each element of its second argument
// by the supplied integer.
// We had to "box" Y earlier because APL by
// default treat each of its elements as a one-element
// array.
mapRotate = outerproduct(rotate)
// Now create 26 copies of Y, each rotated by the amount
// specified in the rotateAmounts variable, and collect
// them all into a list. This is morally equivalent to:
// list(
// rotate(26, boxedY),
// rotate( 1, boxedY),
// ...
// rotate(25, boxedY)
// )
rotatedY = mapRotate(rotateAmounts, boxedY)
// Now "unbox" the rotated list, which takes the
// list of lists of rotated Ys and turns them into
// a matrix or grid rotation
return unbox(rotatedY)
The idea in my mind was to take an input array and print
a diagonalized rectangle with it. With the alphabet, this
becomes a Vigenere table --- once the "indecipherable cipher",
now a trivial matter for any modern computer.
With a different string, like "01" or "_[]" (reading the two
brackets as the APL Quad character), and a suitable change
in length of the output, it becomes instead a checkerboard:
Deciphering that is left as an exercise to you, dear fanu.
Labels: Development
Saturday, September 11, 2004
Pretty inspiring to a language designer, and a great example of information design for everyone else.
Labels: Development
Sunday, July 11, 2004
Visual Basic: Visual Basic 2005: Defining and Using Generics in Visual Basic 2005
Will wonders never cease? What's next, lambdas, continuations,
and currying? I'm almost scared to look. List comprehensions
I could handle, but if they go for APL-style array operations
I'm going to go have to have a little lie down for a while.
Labels: Development
Thursday, June 03, 2004
Grain Of The Language
Cool merging of the word zealot and lout!
Labels: Development
I was working on an API and had trouble picking a name for
a particular operation (which we'll call, say, "getCurrentText"
for sake of argument). TheFullyExplicitName was a little long
and unwieldy and I hve vry strng f3l'ns agst Un*x stle abbrs,
so I wanted to derive a simple text name that fits with the
rest of the API (read, readLine, isMoreNeeded).
So I ferret around on the web and find a few interesting
resources:
Java Collections API Design FAQ
API Design with Java
but no good resource for overall API names.
It seems to me there should be a standard lexicon of API
names. Just as there are standards for names in given languages
(e.g., getX/setX in Java, get/set properties in C#, -p predicates
in Lisp, isX for predicates in Java-like languages, etc.) there should
be standard names we can use for APIs with standard definitions
read/write or read/print
open/close
clear
iterator/hasNext/next
and so on. I guess there need to be two parts to this library:
the semantic list of terms that are common to many APIs, and
standard names that have maximum usage across the API's
semantic contents.
Anyway, just rambling.
Labels: Development
Tuesday, March 16, 2004
Most of my concerns last time were about syntax, which might strike you
as superficial. So before I get any further into syntax, let me recognize
the importance of a clean underlying language model.
There's a lot of value to a pure language model. A clear low-level imperative
model enables languages like C and FORTRAN to be translated into efficient
machine code, making them good system and scientific computation languages,
respectively. A clear object model enables packaging vast quantities of code
into rich libraries for reuse, making Smalltalk and Java good languages for
experimentation and rapid development, respectively. Pure functional
orientation makes correctness proofs and parallel transforms easy,making
Haskell and Objective Caml darlings of the language design movement.
And pure logical design makes it easy to specify what you want to do,
rather than how, and that makes languages like Prolog and Mercury
popular in certain artificial intelligence circles.
But, in my mind, pragmatics ultimately trumps all. There's a reason
C++ was built on top of C, a reason Java has bare-metal types,
a reason Lisp has (progn) and (loop), a reason Prolog has cut.
Programmers have to be able to use the language to solve useful
problems, or the language is a toy.
Now, this isn't intended to denigrate language designers who have
taken one element of the paradigm to the max while at the same
time focusing on pragmatic concerns like execution efficiency,
expressiveness, and ease of use. But, to be frank, most language
designers who do leap onto the fundamentalist imperative / functional
/ logic / object-oriented bandwagon don't even bother to address
such concerns --- because they are fundamentally incompatible
with the programmatic consequences of the delusions and lies that
their religious views force them to adopt.
Which brings us back to syntax. Time and time again, I've heard
language designers say "I don't like such-and-so features, so I'm not
going to put them into my language." Balderdash. That's not a valid
reason to do something in a programming language that
other programmers are supposed to use; it's just childish
foolishness. Oh, you don't wan't multi-line comments, nested comments,
or function types in your language? Too bad. Grow the fuck up.
What's a good reason to do something in a language? It's about the
consequences. Multiple inheritance was omitted from Java because
it caused problems in the semantics and construction of C++ which
made it difficult for programmers to construct correct programs. Similarly,
at the syntactic level Java uses a separate assignment and equality
symbol and removes the equivalence of integers and booleans
to prevent a class of common programmer errors.
On the flip side, having expressive syntactic notations like the slice syntax,
list comprehensions and hash table constructors makes it possible for
programmers to write programs that accomplish a great deal concisely.
Lisp, my favorite language, makes it hard to write concise programs
because of its over-reliance on parentheses as its single list / grouping
/ code block / function definition / macro / what have you construct.
I understand completely why ultimately a real Lisp dialect has to be
reducible to something like an s-expression comprising functions and
data. But programmers should not have to write
all of those s-expressions if there's a more concise way to represent
it, nor should they have to rely on squinting at flashing parens and
reformatting indentation in their syntax-aware graphical editor just
to know whether or not they've written the right number of enclosing
parens on whatever godawful cond-lambda-reduce-map construct
they had to construct to get their job done.
So my plan moving forward: collect examples of syntax I like, and
show how they might reduce to s-expressions in a variant of Lisp.
Ultimately I want to push this back to collecting examples of semantic
features I like, and derive a clean model that would be both expressive,
interpretable, compilable and efficient.
Labels: Development
Sunday, March 14, 2004
I've been doing a lot of thought about language design recently. I just switched from a couple of years of Visual Basic hackery back to the more familiar territory of Java, and while most of my time has been spent reacquainting myself with the landmarks of my college town and checking out the features of the new mall, I've also had a chance to check out some of the neighboring countryside. The up-and-coming development called C# is growing nicely, and while I was wandering the old town suburbs of Bash scripting and Perl I ran into the charming subdivisions of Python and Ruby, also with many features.
But while I was born programming FORTRAN and shortly thereafter moved to BASIC, my hometown language will always be LISP. And while I like many of the features I find in modern languages, I find myself still hankering after LISP's elegant s-expressions and the ability to compose arbitrary data structures with them.
I suppose that's the same nostalgia a C programmer gets for the ability to create arcane constructs like a dereferenced an array of pointers to functions. And I wouldn't want to give up my cherished Java packages, objects and methods (or C#'s namespaces, objects and methods, or VB's references, objects, and methods) in favor of (load "myfile") just to get s-expressions. But I suspect that C programmers are far happeir with the tradeoffs they have moving to C++ than I am with moving from Java to Lisp.
The C programmer loses some speed and freedom in C++, but keeps all of his old operators while gaining classes, inheritance, and the Standard Template Library. I, on the other hand, gain classes, inheritance, platform independence, and a vast library --- but Java's collection classes are a poor substitute for s-expressions and Lisp's list operators.
This isn't the only thing that you lose. Java and Visual Basic both have good regular expression libraries, but they're a pain in the butt to work with compared to the elegant integration you find in Perl, Python or Ruby. And there are many other language technologies that have arisen in recent years --- the slice notation for sequences from Icon which is now found in Python and Ruby, the interned immutable strings of Java and Python, list comprehensions in Python, hashes from Perl and Python, packages and namespaces from Java and C# --- that haven't yet migrated to as many other languages as they should.
I know different languages have different purposes. A shell script is not a scripting language, and a RAD tool is not for programming provably correct programs. But, damn it, programmers should be able to USE these language technologies, no matter what language they come from! Why can't I say something like "foreach i in [0..9] do println myArray[1:i].toString();" in just about any language to print a triangle of array values, rather than the torturous process I have to go through to do this in most normal languages?
So, I've decided to do something about it. I'm going to design my dream language on paper, and then all you language zealots can tell me why your particular language trumps it. I'm going to start to collect my favorite language features in my blog, and start to collect comments about what features work with each other. I don't want to create a kitchen sink of a language like PL/I that no-one would use; I want to collect a list of safe language features, syntactic constructs, and useful operators that anyone ought to be able to include in their language, and then start discussing how we can begin to use these more effectively in future language design.
To start with, here are a few language features I've come across that I think are cool --- or, more pointedly, that I think should be a natural part of any language other than low-level system workhorses and toy language-theory workbenches:
Regular Expressions.
Awk, Perl and Python programmers take these for granted. Programmers in other languages should be able to as well. Visual Basic and Java expose regular expression frameworks which you can access in a clunky way using object-oriented notation, but there's something to be said for syntactic support at the level of the =~ operator. Other languages, like C and Lisp, simply leave you twisting in the wind trying to roll your own. No more, I say to you future language designers: go thee emulate "$scalar =~ /bladeblah/", or improve upon it. Enough said.
Slice Notation.
For the longest time, I never thought of using arrays any other way than the usual: "declare myArray[size]; pass myArray = arrayOund; get myArray[element];". Then I saw Python's slice notation myArray[3:5] and saw the light. Why shouldn't I be able to refer to the subelements of an array by something as simple as [3:5]? Or everything to the end of the array as [5:]? And do the same for strings as in "This that the other"[3:5] when the language supports viewing strings this way? I guess my point is that you as a language designer may not want that special syntax because it wrecks the purity of your object oriented syntax model, tweaks your function calling notation, doesn't fit with your ideas of programs as data, or simply because you, Larry, want the colon. In the end, people have to use the damn language to do things. While a simple, clean syntax makes rare things possible, it can make easy things hard. Get over it and add slices to your language.
Coexistence of Object-Oriented and "Bare Metal" Types
I know from experience you can use Java in both a pure object-oriented, LISP-like high-level way and a low-level, C-emulation mode, with a consequent tradeoff of programming flexibility for speed and power. I think part of Java's success is its vast library of objects, which in turn can use bare ints, booleans and floats to do the meat of the programming. I think C# will become even more successful for a similar reason, because it provides even more opportunity to manipulate the metal while letting you fly off into high-level object land if you need to.
How Does It All Fit Together?
It doesn't yet. If I was to throw all the items in my list into some bastardized example I'd get something like:
println "The first ten characters of the method name are: "
foreach character in ( strMethodCall =~ /[A-Z](.*)\./ ).[1:10] do
println " " + character
Hm.
I'm not sure I'd want to program in yet. How are blocks indicated - by indentation? Ick. Where do statements end? Can we omit the semicolons? Should we add braces? Can we come up with better syntax regular expressions than the gawdawful "/[A-Z](.*)\./", or do we just stick with it because it's standard? Do we call the loop method "for" as in Python, or "foreach" because we want to reserve "for" for a C-style loop?
I have another 30 or so things on my list, and I'm not going to go into all of them in this essay, saving them for future entries instead. I'm going to keep at this sounding board for a while, proposing useful constructs I've mined from reading language definitions, in the hope of finding a basic set of syntactic constructs that are clear, useful, productive, and most of all, satisfy the principle of least astonishment: a C or Pascal or Lisp programmer should be able to move to this new language and see its programming language constructs are somehow ... familiar, even if they've never used them before.
Labels: Development



