An archive of posts from coolnamehere.com, a site I maintained from 2000 to 2011. It wasn’t originally set up in blog style, so there are rough corners from smushing it into a chronological order.
categories → coolnamehere
Sep 5, 2011 (Updated Sep 6, 2011)Introduction You probably already have Perl if you are running Linux or OS X. However, it is usually not the latest version of the language. I prefer to install my own copy. That way I can take advantage of new language features. Also, the system Perl is often used in administrative scripts. There is always the chance that my experiments will mess something up. It is not easy, but I have done it before.
Aug 23, 2011
I have been dabbling a lot with Moose, a solid framework for object oriented programming in Perl. It is remarkably powerful and has transformed the way I look at Perl OO. It is also different enough from object oriented programming in other languages that I needed to create a section for it on coolnamehere.
Jun 10, 2011$ sudo apt-get install ipython $ sudo port install py27-ipython $ alias ipython='ipython-2.7' $ ipython Python 2.7.1 (r271:86832, May 18 2011, 11:05:32) Type "copyright", "credits" or "license" for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In : exit() Do you really want to exit ([y]/n)?
Jun 7, 2011 (Updated Jun 16, 2011)Introduction If you have never programmed before in your life, then do I have the perfect programming language for you. It’s called Python. It is easy to learn, flexible, and loaded with capabilities that you never thought would be so easy to use. Imagine your thrill when you write a complete program in just a few lines! If you have spent years programming Perl, and are just about sick of all of the weird little context dependencies (“My function does this when you hand it a single object, and that when you hand it a list, unless you are assigning the result to a list, in which case it does this other thing”), then do I have the perfect language for you.
Oct 5, 2010
One of my big projects over the last year has been a Parrot Babysteps tutorial. One of the more interesting tasks in that tutorial was reading a CSV file in Parrot. I used the HYG Star Catalog as a sample CSV file that was large enough to present some interesting data. This was fun in Parrot, but obviously I thought quite a bit about how I would tackle the problem in a higher level language such as Ruby. Today seems like a good day to find out.
Sep 9, 2010 (Updated Sep 9, 2010)I want to learn Rakudo. You might want to learn Rakudo. Let’s spend a little time looking at how to get started. While I follow the same very simple pattern of other Babysteps on this site, I don’t expect Rakudo to be your first language. I won’t spend as much time explaining what’s going on, at least not on my first pass through these steps.
Sep 9, 2010Installation You will obviously need to install Rakudo if you want to use it. There are a couple of options, but I will focus on Rakudo Star. Rakudo Star is a distribution which includes some important libraries and an excellent book. Rakudo is released every month, so some of my details about version numbers may be a little off. I will do my best to stay caught up. Fortunately, my Babysteps are so basic that new releases have little effect on their value.
Sep 8, 2010
The Perl world has evolved over the years. Once upon a time, it was a simple glue language that made life easier for system administrators. It’s grown up a lot since then, and now powers much of the Internet. The language has added new features, and the CPAN has made a dizzying number of libraries available.
Dec 9, 2009
Parrot is more than just PIR and PASM. I’m not talking about the ability to use languages like Rakudo written for the Parrot virtual machine. I am also not talking about the ability to write your own language. Both of those are quite nifty, of course. It is fair to say that those two items are probably why you are experimenting with Parrot in the first place. However, the Parrot distribution also ships with an extra language: NQP.
Oct 2, 2009 (Updated Apr 12, 2011)
This is part 6 of Parrot Babysteps, my ongoing Parrot PIR tutorial.
This one’s a bit more bloggy than the earlier steps, but that’s just the mood I was in when writing it. You can ignore the commentary and focus on the code if that’s your preference.
Sep 17, 2009 (Updated Jul 21, 2010)
This is part 4 of Parrot Babysteps, my ongoing Parrot PIR tutorial.
Jul 11, 2009Parrot is a virtual machine that provides the base for Rakudo and a large number of other languages. I honestly can’t tell you what its virtues are compared to other virtual machines, because I’m just not that well informed. I have been exploring PIR, the Parrot Intermediate Representation language. It’s a lot more low level than what I’m used to, but it is still a lot of fun to play with.
Jul 11, 2009 (Updated Jul 11, 2009)
Nice work! You have begun to learn Perl by writing a complete program which gets input from a user and prints output including a modified version of their input. Yes, there is much more to learn, but you have dipped your toes into the pool. Now you can go out there and start learning about the huge and wild world of Perl programming!
Jul 11, 2009 (Updated Sep 8, 2010)
This page once contained many links to Perl 6 information as the design notes were being assembled for the newest revision of this language. Those links are painfully out of date now. I’ll streamline instead with a few core ideas:
May 5, 2009 (Updated Jul 11, 2009)
Having a program that displays the exact same message every time you run is nice when it comes to being consistent, but not so entertaining as a program. “What does it do?” “It prints out my name.” “Oh.” Let’s make things a little more interesting. We could change the value of
$namein the code, but it might be a little tiresome to do this before showing it to each new person. How about making the program ask for a name? User interaction - a neat idea.
Oct 29, 2007 (Updated Jul 11, 2009)
There is more than one way to experiment with Ruby. JRuby is a mature version of Ruby written for the Java Virtual Machine. This gives you a great deal of platform independence, since JRuby will comfortably run anywhere that Java runs. It also provides you with access to Java’s huge standard library. I thought I would take a little time to examine the Jruby implementation, which is nearing a 1.0 release.
Jun 14, 2007 (Updated Jul 11, 2009)
This is Part 3 of an ongoing series about writing interactive fiction games in Python. By the end of Part 2 we had created a text-based user interface and explored one way of storing multiple scenes. This part will finally bring the needed glue for the player to move between all of the scenes in the story. In other words, we’ll have a game!
Apr 20, 2007 (Updated Jul 11, 2009)
This is the second part of an ongoing series about using Python to create interactive fiction. I hope to show you one fun use of Python while teaching you more about the basics of this language. We started by defining how our game was going to work and creating a set of scenes for play. Next we wrote the code to handle a single round of the game. Today we are going to tie all of our scenes together to make a complete, playable game of interactive fiction. We are going to approach it from an experimental view, playing with different approaches until we find one that makes us happy. Well, one that makes me happy.
Apr 19, 2007 (Updated Jul 11, 2009)
I think the next step is to write the code for a single round of the game. We’ll limit ourselves to Scene 1 to stay focussed.
Jan 25, 2007 (Updated Jul 11, 2009)
Sometimes it’s helpful to have multiple consoles open. The best example I can think of is when you are logged in to a machine via
ssh. There are other ways, of course. You could try to log in to the server with ‘-X’ so that X11 applications can run on the remote host but display on your computer. That’s not always easy, though. The administrator of the server may not allow X11 forwarding. Your machine may not allow or even understand X11 requests. You could log in to multiple
sshsessions. This is what I did for several years. It works, but it’s not the most convenient approach, since it clutters up your desktop.
screenis a better option.
Apr 30, 2006 (Updated Jul 11, 2009)
I had to share a “Eureka!” moment that I recently experienced about REBOL. I never did get around to refining it, but it stands here as a rambling testament of - well, as a testament of my ability to ramble. I might end up refining it later, or I might not. I just didn’t want the thoughts to disappear in air as thoughts are sometimes known to do.
Mar 17, 2006 (Updated Jul 11, 2009)
A mountain of standards and specifications have piled on top of XML over the years, but the core language is still pretty easy to get started in. Because it is a markup language rather than a programming language, there aren’t as many new concepts to learn. If you’ve learned HTML in the past, then XML will be familiar.
Mar 17, 2006 (Updated Jul 11, 2009)
XML is the core language of the Web. It forms the foundation for nearly everything you read with your browser. You might not know this, though, because of the great number of languages and acronyms you find. Web pages are written in XHTML, news feeds are written in RSS, and many applications communicate to each other with XML-RPC. If you use Google Talk, then you are relying on the Jabber protocol. What do each of these languages have in common? They are all XML languages.
Mar 7, 2005 (Updated Jul 11, 2009)
Now we know how to do things, and we know how to choose whether or not we will do something. We’re getting close to having some real skills. We just need to get the understanding of one more concept before we reach the first little plateau of programming knowledge. We need to learn how to do a task more than once. Well, besides just running the script again, but that doesn’t really count.
Feb 28, 2005 (Updated Jul 11, 2009)
One thing you like to keep track of on your laptop is how much juice is left in your battery. There’s nothing quite like being in the middle of some insane hacking session and watching as the computer suddenly gets tired and blacks out on you. Of course, I’ve already got a handy battery monitor in my KDE panel, but what if I’m not in KDE? Okay, okay, there are handy battery monitors for nearly every desktop environment out there. That’s not my point, though. My point is that I’d like to explore some basic system stuff using REBOL on an Ubuntu 8.10 system. Got it? Okay, good. Now that we’ve settled this little detail, let’s move on.
Feb 28, 2005 (Updated Jul 11, 2009)This section contains articles on various random ideas that I had as I was learning REBOL. They didn’t really fit in the context of the tutorial or any of the general pages in the top REBOL section suppose they are counterparts to the Moderately Interesting Ruby Exercises more than anything else. I hope they provide some general ideas and inspiration for other potential REBOLlers.
Feb 27, 2005 (Updated Jul 11, 2009)
In part 1 I gave you a first cautious glance at the REBOL programming language. In part 2 I extended that glance to a peek at the excellent REBOL/View GUI library. Let’s continue learning how to program with Rebol. Today I want to get you started with some structured programming by introducing you to selection structures. Selection structures make it possible to decide whether or not to do something based on a test. Here are a few uses for a simple selection structure.
Jan 4, 2005 (Updated Aug 25, 2011)
Let’s admit it. Perl is everywhere. It powers most of the Internet, in one form or another. What? Your site doesn’t use Perl and CGI? Well, what about the administrative scripts that keep it running smoothly when everyone is snug in their beds? Even a fair chunk of Microsoft IIS servers rely on Perl for administrative tasks. I’m not saying that Perl is being used on every site on the Internet, including yours. I’m saying that Perl is probably being used on any random site you happen to look at on the Internet, including yours.
Dec 26, 2004 (Updated Apr 9, 2017)
REBOL is the “Relative Expression-Based Object Language”, and it was developed by Carl Sassenrath. Who is Carl Sassenrath? Why, he’s one of the people responsible for the amazing operating system which powered the Amiga computer. What’s the Amiga? Why, the Amiga was only the incredibly robust and cool computer released by the same company that brought the world’s first personal computer, Commodore. What’s Commodore? Stop bothering me, kid. Just take it from a relative old-timer: the Amiga put a whole heck of a lot of power into a consumer-affordable personal computer, and it wasn’t really matched by other computers for a good five or ten years. Nowadays, I look at REBOL and it feels like the first language I’ve come across to take lessons from past languages and apply them in a new context, rather than just reimplement them with different syntax.
Dec 26, 2004 (Updated Jul 11, 2009)
I’m sure you thought that getting started was fun, but it really didn’t do anything to show off REBOL. I’d like to go through almost exactly the same process, but this time focussing my attention on REBOL/View. So let’s give it a try!
Dec 26, 2004 (Updated Jul 11, 2009)
One of REBOL’s strengths is the rich selection of native datatypes. This selection is part of what makes it so easy to express solutions to your problems, because there is less “mental mapping” to make as you use or create an abstract type to represent an important concept. Learning this selection is also one of the challenges for those who are trying to master the language. I am facing that challenge right now, so I decided to make this table of native REBOL datatypes and how they are expressed.
Dec 25, 2004 (Updated Jul 11, 2009)Pages 01 Getting Started 02 Getting Started With View 03 Making Decisions 04 Repeating Yourself Introduction Right. Here is this language that you’ve never heard of: REBOL. I think we should learn how to use it together, sort of a “Babysteps” approach. You and I can add REBOL to our steadily expanding toolkit of programming languages. And remember to just ignore people when they ask you “Why should I learn REBOL (or Perl, or Python, or Ruby) instead of Perl (or Python, or Ruby, or Java)?
Dec 22, 2004 (Updated Apr 9, 2017)
This is unusual. I’ve come across the first language that I don’t want to tell you about. I don’t know why I want to keep REBOL a secret. It has been very useful even in the limited roles that I have given it so far. The language is consistent and pleasant to work with. It has a richness of datatypes that just can’t be matched by other languages. The GUI library, View, is surprisingly straightforward for simple tasks, and there are excellent libraries like RebGUI to make it just as easy for more elaborate interfaces.
Oct 28, 2004Okay, I’ll be honest. LISP scares the dickens out of me. It’s ancient by the standards of computer languages. The language is completely different from any of the stuff I use in my day-to-day programming. Yet it has all the features of those languages and more. Garbage collection? Got it. The ability to pass functions around as easily as an integer? Done (and not in a cranky C function pointer manner, either).
Oct 1, 2004 (Updated Jul 11, 2009)
Thanks to everybody for the positive feedback on the first MIRE. I still have your attention, so I’ll move on to my next exercise. This one is a little more involved than the first, but bear with me - the results should be worth it.
Sep 17, 2004 (Updated Jul 11, 2009)The Problem I want to look at the Fark headlines without opening a browser. Why? I dunno, maybe I just want to see what’s new since the last time I looked, without being distracted by the site clutter. Now, I could just turn off images and go to the site, and that would work fine. Actually, it would work quite well. No need for this article, then. I’m off for some coffee …
Sep 15, 2004 (Updated Jul 11, 2009)
People who come to UNIX (or Linux) from the world of Windows are often disappointed by the apparent clunkiness and lack of unified tools. “Where’s Visual Studio? Where’s C++ Builder? Heck, Notepad would be nice.” These folks are looking all around for an IDE, or Integrated Development Environment. What they don’t realize is that UNIX is an Integrated Development Environment. You can’t get around the fact that this environment was made for geeks, by geeks. That means a lot of the programs that seem so clunky and awkward to the Windows person are, in fact, intended to work together to make development easier. Okay, so they aren’t all pointy-clicky and pretty, but that’s because pointy-clicky and pretty aren’t as important to these particular folks.
Jul 11, 2004 (Updated Jul 11, 2004)
There are several different approaches to programming, but the one that is easiest for me to grasp is imperative programming. The imperative approach allows you to tell the computer exactly what you want it to do and how you want it done. The best analogy I can think of is a cooking recipe. You have a list of ingredients and a specific set of instructions to follow. Veer from the recipe and you may not be happy with the results. Veer too far from the recipe and your house could burn down.
Jul 11, 2004
Jul 8, 2004 (Updated Apr 9, 2017)Unix for the Windows World Okay, so you’re a geek. Or you’d like to be. All of your cool friends are running Linux - or maybe even FreeBSD. You’d like to install something with a distinctly geeky UNIX flavor. There’s a problem, though. You’ve got a PC, it runs Microsoft Windows, and your parents / spouse / girlfriend / boyfriend / children will cause you great pain - or at least a great headache - if you do anything to endanger their comfortable environment.
Jun 5, 2004 (Updated Jul 11, 2009)
Mar 12, 2004 (Updated Jul 11, 2009)
PHP is great. It is easy to learn and easy to use. Of course, it is also easy to make a project that is so amazingly baroque that mere humans have no chance of ever editing it. This is a trait that PHP shares with one of its biggest rivals, Perl. It can be funny to listen to an argument between PHP and Perl folks about why their favorite is the best and the other guy is the worst. The other guy is always “unstructured and unsuitable for real projects”, while the favorite is “fast and expressive”.
Mar 10, 2004 (Updated Jul 11, 2009)As much as I admire the clever braintwistings of FreeRide and the many other excellent projects that are out there, I must admit that Web programming is what I know best. And Web programming is what this section is about, from the Ruby side of things. I will take a peek at CGI programming, Embedded Ruby, setting up servers, and anything else I can think of that will make it easier for you to use Ruby as a major component of developing your Web applications.
Mar 10, 2004 (Updated Jul 11, 2009)
This article is intended to provide a casual introduction the CGI programming with the Ruby language. You won’t be an expert when you are done, but you will certainly be ready to explore more on your own, and maybe delve into becoming a Ruby/CGI expert.
Jul 11, 2003 (Updated Jul 11, 2004)
Seattle is a city. It may not be as big as Los Angeles or New York, but it is still a city. You do not have an excuse to be bored, even if you are flat broke. My wife and I have lived in Seattle since 1999, and it still feels like we are scraping the surface of what this area has to offer after ten years.
Jun 23, 2003 (Updated Apr 9, 2017)
Ruby is an exciting language with a huge number of features that appeal to advanced programmers. You should not let that intimidate you, though. The language is very easy to get started with, and you can work your way into the more arcane corners.
Jul 11, 2002 (Updated Jul 11, 2002)Yep. Emacs, one of the shining stars of the GNU project and its philosophy of Free software. It’s sort of an editor, but if all you do is edit files with it, maybe you could be using something else. I am rather fond of NEdit and JEdit. I am also a longtime user of Vim - despite my occasional membership in the Church of Emacs. There are a lot of fine editors out there, and you will be quite productive working with any of them.
Jun 28, 2002 (Updated Jul 11, 2009)
Vim is one of the two major editors of the UNIX world. The other one is Emacs, which I am also quite fond of. Still, it’s hard to beat Vim. It may be awkward, ugly, and hard to use, but there’s just something inescapable about it. Regular expressions are a major part of the editing interface, which gives you a great deal of (admittedly cryptic) power.
Jun 2, 2002 (Updated Mar 22, 2015)Vital Information and Links Version 2.2.3 Project Page PageTemplate on RubyForge Instructions Start with installation PageTemplate 2.x is stable, but not well-tested or documented. Loads of new features were added by Greg Millam in short order, and testing / streamlining was completely derailed by daily life. I've been promising to work on PageTemplate 3.0 for years. Introduction PageTemplate is a Ruby package which allows you to utilize text templates for your Web projects.
Jun 2, 2002 (Updated Jul 11, 2009)If The if directive tells PageTemplate to only display a chunk of content when some condition is true. PageTemplate will skip the block and move on if the condition is false. Syntax [%if condition%] chunk [%end if %] Here is an example of if in use. #!html [%if pageowner %] <a href="admin.cgi">Admin View</a> [%end if %] In this example, if the application tells PageTemplate that pageowner is true, PageTemplate inserts a link to an administrative page.
Jun 2, 2002 (Updated Jul 11, 2009)Loop Basics The loop directive is the most complex, and requires more explanation of its details. Let’s start by just looking at the basic syntax of a loop in PageTemplate. Loop Use the loop directive when you want PageTempate to insert the same chunk repeatedly for a list of items. It can grab values from the item to be inserted in value directives within the chunk. If there is no list of items, the in chunk is skipped.
Jun 2, 2002 (Updated Jul 11, 2009)PageTemplate has a number of other features for the designer, and I couldn’t figure out where to put them. Let’s just dump them here until the day I do figure out where a good spot for them would be. Filter Filtering seemed so handy with variables that we thought it would be fun to have filtering as an independent action. All the contents of a filter block are passed through the named filter during output.
Jun 2, 2002 (Updated Jul 11, 2009)Who Are You? You are the esteemed Web Designer, aesthetically talented and perhaps artistically inclined. You know what makes a good Web page. You are not a programmer, though. It’s horrible when you have to go down to the caves where they keep the developers to explain where a simple login form belongs. You also don’t want to remember where their odd-looking programming code is supposed to go in your beautiful page.
Jun 2, 2002 (Updated Jul 11, 2009)Getting Started Before you dig into the code, you might want to take a look at the designer’s perspective of PageTemplate. Using PageTemplate In Your Ruby Code This is a very quick overview, because I just spent hours going over the designer documents and I’m a little tired. First, of course, you’ll want to install the PageTemplate package. Once that’s done, require the package. require 'PageTemplate' You’ll need a PageTemplate object to hold values and parse template files.
Jun 2, 2002 (Updated Nov 11, 2009)The major directives require variables, which are just names for the value your want inserted, checked, or otherwise accessed. It’s a good idea to use variable names that make sense(name for a person’s name, title for the title of the page, etc.). Value Substitution Substitution is the easiest concept to master. When PageTemplate comes across a value directive, it replaces that directive with some text. Syntax [%var variable%] Example <h1>Hello, [%var name%]</h1> Every time that PageTemplate sees [%var name%] in your template, it will replace that directive with the text associated with name.
Jun 1, 2002 (Updated Jul 11, 2009)
I say that I do not have a favorite programming language. If I did have a favorite language, it might be Ruby. I’ve been messing around with it randomly for a few years, and I am continually amazed by how easy it is to build programs with it. Ruby is a delight to work with. I’m not sure how to describe it, because it uses elements from so many great languages. Freak that I am, I’ve gone out and started fiddling with some of the languages that Ruby borrows from so I can use Ruby better.
Jun 1, 2002 (Updated Jul 18, 2011)I already talk a little bit on this site about the language tools I use, such as Perl, Ruby, and Python. There’s a section where I touch on the most important tool of a geek like me: the text editor. But coolnamehere needs a section for the smaller tools that I use everyday. They may have been born on UNIX-like operating systems, but they do not live exclusively in that environment.
May 29, 2002 (Updated Jul 11, 2009)
What can I say about Perl? I’ve had very little to talk about it on this site over the years, despite the fact that I use Perl on an almost daily basis. It’s not as cute as Ruby, or as clean as Python, but it’s always there. There have been numerous projects that are just plain easier in Perl. I can’t explain it.
Dec 29, 2001 (Updated Jul 11, 2009)
I have decided to link to my LinkedIn profile instead of messing about with a resume page. That way I can show all the needed details, you can get some context, and I can keep from triggering any silly word filters with my site.
Nov 11, 2001 (Updated Nov 11, 2001)I occasionally have thoughts or comments that have no bearing on geekery or art. No direct bearing, anyhow. Actually, they could be about nearly anything. Or nothing. Insane rantings, if you will. Anyways, they get dumped in the Babblings (or Insane Rantings) section.
Jul 11, 2001Choose your weapon As a geek, your text editor is your most important tool. Pick one or two, and really get to know it. I don’t care if you choose Emacs, vi, SciTE, or whatever else. Pick it and learn how to use it. I want you to really get the hang of your editing environment. Being more skilled with your tools will make it easier for you to get work done.
Jul 11, 2001 (Updated Jul 11, 2009)
Computers are all about programs. If you take the time to learn how to program, then you’re “on the inside” - more than just an ordinary user. The computer will obey your every whim, and you will be able to sneer at “lusers” (loser-users) who have no idea how their computer works. You will make millions of dollars working in your shorts. Beautiful people will throw themselves off of cliffs to be near you. The planet will be yours for the taking!
Jan 17, 2001 (Updated Jul 11, 2009)You may have already heard me say that I do not have a favorite programming language. That’s true. However, if you want to learn how to program - if you have never programmed before in your life (except maybe some QBASIC several years ago) - than Python sticks out way way ahead of the others. It is easy to get started, it is consistent across most operating systems, and you can make your programs as big, elaborate, and “real-world” as you want.