2013-11-03

On the bleeding edge

Fedora 20 - Alpha desktop
Fedora 20 Alpha
Got curious about the "did someone say Alpha" URL at the fedora download page.

Hmmmm. Thought I'd give it a shot. What's a few MB of bandwidth? But first ...

So I grabbed the K desktop, or KDE Live CD, the x86-64 Alpha flavour, and gave it a shot. Some folks prefer the Gnome desktop, some don't. Gnome is snazzier, but if one is accustomed doing stuff with a Windows desktop and little else, KDE will be a bit closer to the familiar.

Woah, its a 921MB .iso download so ... oh well, its not like I don't have lots of DVD blanks. But I am not anxious to waste the twenty minutes it would take to burn another coaster on my wonky DVD drive (yes, Wonky ... its an Industry Toim). Wonky, Its An Industry Toim as in Marisa Tomei's character in My Cousin Vinny "Industry Toim" perspective, but first ...

So fire up Virtual Box and set up a new virtual machine. But first, to keep things organized, move the downloaded .iso image file to a vm folder, and massage the New button in Virtual Box Manager.

In the VM create, Fedora (64 Bit) is one of the versions that shows up after setting the Type to Linux. If you grab the x86 flavour boot image file, that is fine too, just keep your architectures straight. Don't confuse me, I'm thinking here. If you try to boot an x64 .iso image but leave the guest set at "plain" or x86, it won't quite fly. One can set the guest to x64 and boot up with an x86 image, that will work. But first ...

Onward, through the fog, give it 800MB of RAM, that is plenty for a try out. Go a full 1GiB, or 1024MB if you have lots of RAM. For a Windows desktop with 4GiB, that is not quite enough to run a 1GiB guest. One must leave enough memory for the host OS. Every time I go the full 1024MB on a VM with the laptop, with 4GiB RAM, start the virtual machine, one can hear the processor fan kick in. Maybe more on that later, but first ...

Create a hard drive, a VDI (Virtual Box Disk Image) type works fine, and one can go with the "Fixed size", or the the default "Dynamically allocated" grows the disk image .vdi file as it uses up its space.

Point the file location at a new folder under vm, yes, keep things neat. Set the size to at least 10GiB, while 8GiB might be enough, it will be a tight. Might hit somewhere near the 95% used, or more, when a big batch of updates need to be applied. More on that later, of course, but first ...


The first teenager that says something like "Back In The Day" gets a smack upside the head with a floppy disk. Don't remember who said that one first, I don't make this stuff up, I just write 'em down. Anyways, pretty sure there's another screen shot around here with a similar System boot device list.


System boot list
I have seen eight inch floppy based computer systems.

Seen them in operation too, yes indeed, working operation.

Quite a bit before getting an actual and genuine professional position in the Information Technology industry. So no actual 8" floppy drive systems have ever been on my resume bullet point list, I don't go quite that old skool. Can't be too lucky, or too careful these days. But first ...

Anyways, uncheck the floppy drive from the boot list on the System settings, and move the hard disk up to the top. Its a new hard disk, and it won't be worth a boot (yet). If you really prefer the Easy button, visit the the Storage section.

Storage attributes
If you really need the Easy Button, point the CD/DVD drive to your Live .iso file. Not required, and it will have to be taken out later to get the guest addition bits to run, more on that later, GA is kind of important. But not quite yet, but first ...


So with Virtual Box we're emulating hardware in software. Neat trick. 'Nuff said on that. No dual boot setup needed to worry with and pollute your mind or your desktop, just to try out a new OS.

Might get around to a post or three on mysql, will definitely promise a hit up or two for Apache, and there is definitely some PHP stuff in the works as well. More on those bits later. But first ...

If you're happy with the disk size, boot order, and memory size, massage that virtual box Start button. If you went the Easy route and pointed the CD/DVD to the boot .iso it should be on its merry way. Otherwise, you'll have to dig around and find the download .iso file, then get prepared for take off. Next time there should not be quite as much digging, Virtual Box does have a nice habit of remembering things previously done with other VMs.

Eventually you should get a nice, clean, GUI desktop, with a Install icon in a desktop folder. Probably with networking disabled, so don't expect a browser to have much luck. Go ahead and massage that Install icon. Or dig around the desktop first if you'd like to get a feel for the lay of the land.

It took me a couple tries to get the install rolling, the Installation Options screen went stubborn on me- the radio button "I want to review/modify my disk partitions" did not want to take a click. For a little while. And for a few moments it looked as if the installer had not yet picked up the disk partition setup, but it eventually took off. One of those "wait for it ... wait for it" scenarios.

As briefly mentioned before, I really like to bump up the swap partition to a full 2GiB, or 2048MB, even if it is just for a quick try out, a POC (Proof of Concept) mode. The root, or / partition, will have to be decreased a "bit" (no pun intended) to grow swap. A calculator might come in handy, and is not considered cheating by any means. Measure twice, cut once, like the experienced carpenter always says.

Making changes to swap is a good exercise, something one might have to do on a real system, in real time. Its a bit tricky, depends on which OS flavour is in question, but might touch that topic later. But first ...

If you're really feeling adventurous, surf up the Fedora download options or formats page and try out the DVD or one of the other desktop flavours, maybe later. But first, using a Live image, with its smaller download, is the quicker path, while going the full DVD route chews up the bandwidth and download time. And does have lots more options. And lots more complications as well. Try the Live, easy route first.

Anyways, long story short, the Fedora 20 (Alpha) KDE Live .iso went fine for me, not much different. The first update count was over 500 packages, I *think* it was 520-something, maybe 525, that took a bit of time. So the Alpha has been out for a while, darn.

Getting the Guest Additions working with the VM was a breeze. That one usually trips me up, as there are a couple packages not included with the Live install "out of the box" but this one was pretty easy to get GA working. More on that later, but first ...

When the Install starts loading up stuff to the VM disk a couple icons will need a massage. First things first, set a root user password, and write it down, if you must. And create a user, going with just your initials means fewer keystrokes. Same deal with the user password, and write it down if you have to. One can check the "Administrator" check box, but that is optional too. Might make things in the GUI easier, but there's an even "more better" way to get superuser rights at the command line, will get to that soon as well.

If one struggles with coming up with decent strong passwords, there is an app for that. Really. Although it is a bit old school, you can get a random password generator web page after getting Apache and a bit of perl working on the box. Definitely more on those later. But first ...

Next up, Updates, and the Guest Additions. If you want to share a folder on your desktop to the VM guest host, or let the host machine see a folder on the guest, GA are a must have. And for pasting content into the guest, or copying content from the guest to your clipboard, that requires GA as well. But first ...

2013-11-02

but first

Virtual Box system settings
Time to back up a moment, and take it from the top.

If you've already got Virtual Box downloaded and installed, you may just want to take a pass on this one.

Or if your preference for having a virtual machine up and running is VMWare® that is perfectly fine as well.

VMWare® is a fine product, and quite popular as well. At work we have quite a few virtual servers hosted on VMWare® and it works fine, lasts a long time.

The business end of that deal falls under another team's responsibility area so professionally, my dealings with that particular program are quite limited. Last time I really gave it half an effort at a "kick the tires" check out from a system administrator perspective, it was quite a long time ago. The offerings have changed so I'd be fairly certain its quite a bit different now. Was trying out the free workstation (?) version, and it was OK but the admin console was not fond of working in Firefox so there were a few glitches.

Anyways, time to move along.

If the Virtual Box software has been downloaded, but not installed, go ahead and fire up the installer. There will be gripes about the software not being a Microsoft© certified program, but for me and my desktop that is no big thing to be concerned about. Not really up on the details of whats required to get a passing mark on that deal but I'd be fairly certain that its not a task that could be qualified as quick, nor would it be an easy one by any stretch of the imagination.

The installer will also pop your network hardware and/or drivers a few times during the install as well, it adds its own network adapter, with a DHCP setup, and a few other things, to give out IP addresses to the virtual guest machines.

For Windows 7, it will probably need a startup via the right click/run as Administrator trail as well. Can't tell for sure, have not installed virtual box on the Boss' (She Whom Must Be Obeyed) desktop just yet, and not certain that it would be a good idea, or not, to do so. And when Mama's Not Happy, No Body's Happy. 'Nuff said.

I'm still stuck with XP. As are many of the work mates, we can all be quite stubborn (or maybe just lazy) at times. Find something to use, like it, or not, but get used to it and drive it 'till the wheels fall off. A couple things with the Windows 7 changes annoy me, like for a program used often, drop it onto the task bar short cuts. Fine.

But if you want another instance of that same program up and running, now one must right click, and navigate that menu. Arrrrgh. And what happened to the show desktop shortcut? Oh, its still there, some where ... but different. Arrrrgh. Just when you get used to something, maybe even like it a bit, the powers that be decide it needs to be changed. But first ...

Get used to working the command line. A CUI can be your friend, as good keyboarding skills are usually quite a good thing to have handy. Especially for unix and linux systems, there are many ways and means around a command line interface that can be so much more efficient. A graphical user interface might be familiar, and easy to navigate (if you know where to start digging) but there are some places where command line is much more efficient with tasks, given a bit of experience and knowledge, than a GUI interface.

cmd.exe properties dialog box
cmd.exe Properties dialog
So fire up your cmd.exe box.


One way, click Start/run and just type in cmd and press enter. Or cmd.exe and press enter.

Or dig through the Programs then Accessories program group, its not too much different for Win7.

Bring up the Properties dialog box by doing a click, left or right, on the drive:backslash icon in the top left corner, hit the Properties item.

You might like cmd.exe a bit better after enabling QuickEdit mode. And there just might be one or two things in that old school ms-dos QuickEdit mode that I like even better than Linux. Really.

Be sure to visit the Layout tab, bump up the Height and Width values, and when it comes to width, just like Pontiac™, Wider Is Better. On the Font tab, Lucida Console is nice, if available, set a happy font size for your comfort, here smaller can be better. As long as its legible, try 10. Back at the Layout tab, go for at least 120 on Width. Wider, Better. Also change the Window Size Width same as the width in the Screen Buffer section, and Window Size Height at 25 or so. And the Screen Buffer, Height, more is much more better. 9000 works.

One chore in dealing with a Windows host is finding out who are the folks that have administrator rights on the box. If you know the short cut using the run box, no big deal, its just a Start / Run / lusrmgr.msc and you're there- no hunting around in control panel, nor the Administration program group, or the My Computer icon, what ever the current GUI trail is to get to that particular system item.

But if you have a command box open try this one ...


net localgroup administrators
  Members
  -------------------------
  Administrator
  eljefe
  domain\Domain Admins
  domain\Local Admins
  domain\doncorleone_adm
  The command completed successfully.
  ...


So you want to save this for later? Perhaps drop it into a spreadsheet? Or paste the results into an email? Just left click and drag to highlight the desired text bits, and ... arrrrgh, tap the Enter key to get the text into the clipboard.

The enter keystroke is somewhat annoying, but overall, the ms-dos QuickEdit does a slightly better job of selecting just the desired text bits. At a linux (or unix too) command line, text copy and paste is available too, just click and drag, or depending on the text content, just a double left click might highlight the one desired line with a <return> character added in for good measure, click the center mouse button to paste. But when it comes to grabbing multiple lines of text, e.g. just a column of text items, the linux/unix select, copy, paste routine pretty much keeps you limited to full lines. No other options with picking out the desired text. Arrrrgh. Or not, maybe there's another way, just might figure that out some day. Later. But first ...


So command line stuff can really be your friend. Really. I might be able to hit sixty or 70wpm typing, but only if the backspace gets counted. Arrrrgh.



2013-09-07

really ... don't do it!

Tempting. Very tempting. But first ...

Nice eye catching advert as seen at linkedin.

Anxious to quickly solve an issue? Go ahead, reboot that box. The phone is ringing with plenty of other attention time sinks just waiting to ... sink your time. So reboot, and move on to the next issue.

But first ...

Putting out fires can be quite fun. For a little while, at least. Nothing makes the day go by faster than staying busy.

But if one simply spends all their time and energy on fire fighting, there is no time left over for ... actual fire prevention. Prevent the fire from getting started in the first place, and amazingly, actual productive work time begins.

First things first, kudos and props are due to Steve Litt and his book Troubleshooting Techniques of the Successful Technologist. Anyone thinking of a career in programming or engineering, and no, that does not include civil engineers, that is slightly different ... maybe another topic for  later ... but first ... much benefit and wisdom can be gleaned in Mr. Litt's book.

The ...Technologist is book is some pretty heavy stuff. If one is looking at earning a EE sheepskin, you're one of the target audiences. If that isn't the case, his other troubleshooting titles, with not quite as much depth in engineering level subject matter, might be a better fit.

Or, one can wing it. And hope to get lucky. I've had the privilege and honor of  working with many different technicians, electrical engineers, programmers, developers ... and can not count myself among the elite crowd of perhaps the one person out of twenty, or more like the one out of one thousand with a natural, instinctive ability for troubleshooting. The rest of us have to work at it.

Every time I find myself in a rush, forgetting the training, experience ... I've taken a wrong turn or three more times that I would care to admit. And while a wrong turn can eventually get you to a right solution, and plenty of other learning experiences along the way, time spent is ... time spent. Its gone, it is not coming back, life does not present any do over opportunities when it comes to how one spends their time.

So now its time for some specifics. There was the mention of privilege, honor, and work mates. But unfortunately, for a few of them, the "privilege" part was ... not so much. More like a challenge. One in particular, when getting reports of "clients experiencing issues", pops into the application server host, and try this. Try that. Didn't help. Change something. Change something else. Add a thing or two. Maybe three, or even five. Delete a couple things. Tweak a configuration file, or twenty of them.

Eventually, after a couple of hours, or could be a couple of days later, Mr. Trouble Shooter (Spreader?) smugly pops into the team office and "mentions" trouble for something, and it just has to be the database, and pressing for more information, Mr. Tee does not offer any helpful details at all. Even though he's the actual source of three or four other new problems. "I'm not sure what is going on. Nothing has changed. The clients just started getting errors."

Really. Yep. Nothing at all changed. Eventually, a replacement team mate for Mr. Tee gets stuck trying to undo the all the recent damage on the application server host, and there is a reason they don't allow me to access that particular server with admin rights. The less I work on a Windows sever, generally, the healthier it stays. But there are still lots of servers where I could achieve similar damage results.

Problems don't just show up all by themselves. Maybe a server crashes, a full swap partition is one possible cause for an operating system lockup. Or perhaps a misplaced foot trips and yanks out a power cord. Or a programmer decides a change is needed, and does some kind of data update. Or a usage tipping point, we didn't buy enough CPU to handle 400 concurrent client sessions, or didn't buy enough memory, or an unknown software bug causes a program to hang onto a limited resource well after its no longer needed, and it just plain demands more. 

Cause and effect. Its not effect and cause, like saying the temperature increase in the morning causes the sun to appear above the horizon. 

So, to properly troubleshoot, what do you DO? The immediate first answer, DO NOTHING. That's right, NOTHING is the correct answer. Of all the tools available for diagnosing troubles, signal meters, packet sniffers, blinky lights, blinky lights that don't seem to be blinking right (yes ... more on that one later ...) the most important item in the troubleshooter's toolbox is ... the troubleshooter brain.

Diving right into the try this, try that, what happens when we do so and so ... will usually lead to more trouble. Take a step back, a deep breath, and think. Not do.

Might have a manager, or worse, director, or some other individual way higher up the food chain dancing around and pounding on your desk, if you still have one, demanding a fix yesterday. Better yet, last week. And you best be sure to attend the "how could we have done better" meeting set for tomorrow, and be prepared to fall upon your sword, or toss a team mate under the bus.

Learn proper troubleshooting technique. It requires clear logic, your basic Yes/No, or Go/No Go check, there is no Grey area. At least that is how it should be- trying to find a bottleneck or put a finger on which overused resource is causing "the system is slooooow" complaints is one of the more challenging scenarios.

Verify the problem. If you can't verify, you can't be sure if a "fix" is an actual fix. Find and correct the problem, fixing symptoms is not fixing the root cause of the trouble.

For a specific example, at community college a professor in a Java class, students running the lab programs, everything worked fine, for a while, and then ... not. Turns out a close handle call was absent from the code, so everyone that ran a servlet was ... surprise, holding onto a limited resource well after it was no longer needed. Reboot. Problem Solved.

Or not. The reboot frees up those connections, but the underlying problem, the cause, is still present. Maybe there's a JSP setting to increase file handles, or something similar, but that is a symptom fix, not a problem fix. Double the handles, maybe double the working life time. Something like that.

In a House episode, *maybe* it was Season 8, Dead & Buried, Hugh Laurie's character says, "Death is a consequence, not a symptom. If its not a symptom it's not relevant". Or something very close to that, and oh how true it is. Brilliant. Cause and effect.

So gather up the info. Write down the symptoms. Elaborate on the symptoms. List out where the trouble might be. As Mr. Litt often states, "Narrow it down". And don't neglect the logic part- does it make sense? If unit X really is the source of the trouble, is it used by another system? And are symptoms present in the other system(s) as well? And verify the problem. If you can't reliably and predictably reproduce the problem there is no way to ensure that a fix is indeed an actual problem fix.

Yes, a reboot is a quick solution. But it also clears the system memory, running processes, and other bits of information. Which just might hold important clues (symptoms) of the root cause of the problem.

And yes, can't forget about the Blinky Lights. I do have the privilege of counting that one of one thousand elite troubleshooters as a coworker, and a good friend. One night, a good while back, perhaps 02:00 (that is 2AM for everyone else) the phone rings. This is a true story.

  • Hello?
  • The janitor says the computer lights are blinking funny in the training room.
  • Ummm OK then. Well, since the janitor has obviously diagnosed a system problem, then he is certainly welcome to fix it.
  • zzzzzzz .....
I would have soooo wanted my two minutes back. Plus the fifteen or twenty minutes it takes to get back to dream state sleep. Also have to share the trouble ticket we got one day, "Line printer. Printing one line at a time." Hmmmm.

Sounds like its functioning as designed.

Also can't count the number of times we get an email, "I'm getting an error. Do you see anything going on in the system?" Really? You have an error. And my attention.

But would the additional ten seconds needed to paste the error text, or twenty seconds to grab a screen shot of the error dialog box (and save it in high colour bit map format what does a jpeg mean anyway, can we also test the mail server under a heavier work load) ... is that expecting too much? I can help you, but you have to help me to help you too. Something like that.

Buzzing all over the farm looking for a needle in a haystack is not a productive use of time. In fact, the farm might not even be in the right county. Or village. Or wrong haystack, that might be a challenge too.

But first ...

2013-07-06

virtual box

Virtual Box
Ah, another dependency picture. Graph.

But first,what's that mean?

Take a glance at the code, note the lines adding  nodes to the graph, placing a few attributes on the nodes.

URLs, like the  one on "Virtual Box", takes the visitor to the Downloads web page for the Virtual Box software.

Similarly, the "boot .iso" URL leads to the Fedora Project download page where one may grab a (roughly) CD sized .iso image to use for booting a desktop to install Fedora.

Well, not exactly. The image is just an image, but the php code should render, for instance, with a tool tip on the "dkms" node showing some of the packages needed to get all this working. Or, for that particular node, a mouse over should reveal some of the pieces to get the Virtual Box guest additions working in the guest system.

And the "Download" tab at fedoraproject.org presents the default Fedora install, with the Gnome desktop. Which is fine, but if one uses a Windows desktop, a lot, as I must do, the K desktop, or KDE, will be somewhat more familiar territory. Gnome is alright, but my preference is KDE for a few reasons, will go into those soon. But first ... the code ...


<?php

require_once 'Image/GraphViz.php';

$gv = new Image_GraphViz();
$gv->addEdge(array('virtual box' => 'startup, install'));
$gv->addEdge(array('boot .iso' => 'startup, install'));
$gv->addEdge(array('boot .iso' => 'burn CD'));
$gv->addEdge(array('burn CD' => 'startup, install'));
$gv->addEdge(array('startup, install' => 'update'));
$gv->addEdge(array('update' => 'dkms' ));
$gv->addEdge(array('dkms' => 'vbox GA' ));
$gv->addEdge(array('startup, install' => 'httpd' ));
$gv->addEdge(array('httpd' => 'virtbox.php'));
$gv->addEdge(array( 'virtbox.php' =>'pretty picture' ));
$gv->addNode('virtbox.php',
        array( 'URL'      => 'virtbox.php.html' ));
$gv->addNode('virtual box',
        array( 'URL'      => 'http://virtualbox.org/wiki/Downloads' ));
$gv->addNode('boot .iso',
        array( 'URL'      => 'http://fedoraproject.org/en/get-fedora-options' ));
$gv->addNode('vbox GA',
        array( 'URL'      => 'https://forums.virtualbox.org/viewtopic.php?f=29&t=15679' ));
$gv->addNode('httpd',
        array( 'label'    => 'httpd php graphviz' ));
$gv->addNode('dkms',
        array( 'tooltip'    => 'gcc devel dkms' ));

// draw it
$gv->image();

// *or* dump the gv object. cant do both, rats.
//print '<h4>$gv object</h4><p style="white-space:pre;">';
//print_r ( $gv );
//print "</p>\n";

?>


Note the comments, either let the .php page render the image, or one may turn on the commented code lines to see a dump of the $gv object, with an inline css style attribute so that the text for the object is a bit more legible.

As mentioned in the comment, can't do both the image and other stuff. Oh well, there's always a trade off. Maybe will figure out a way to get the graphviz image into a .php page along with other content, but there is always other important things to see, do, and learn. But first ... 

One could take the boot image .iso file, fire up a CD/DVD burn program and create a boot CD or DVD, go into the BIOS settings and put the optical drive above the hard drive in the boot order list. A totally optional step.

But in the amount of time it takes to burn a DVD, one could just about have Fedora, or Ubuntu, or Mint, or SUSE, or any distribution of linux installed, booted, and a running a new desktop. Perhaps it was Steven Wright who said "Any place is walking distance, if you have the time." Way, way back in 1984 or sometime around then. Maybe we'll go look that up for a proper credit. Soon. But first ...

Skip the waste of making another coaster, and the time. Avoiding a CD or DVD burn step completely by setting up a virtual machine in Virtual Box, point the drive to the  boot image file, and in a moment or three the install is underway.

No hassles with trying to set up a dual boot scheme on your desktop, no mucking about with making a dual boot system work, and keeping it healthy. Updates to your desktop OS may very well break a dual boot setup.

The Fedora Live boot file is easier. Fewer choices, less complicated. Following the KISS principle (Keep It Simple, Silly!) is one way to get a linux host up and running, quickly, without too much fuss. A full DVD boot .iso presents many more install options, perhaps selecting a web server if that is the desired direction one wants to go, and/or a workstation with a few (or several) developer platforms.

All at just the right price. Your time is the price, be careful how its spent. Its one of the things that does not have a "do over" option. Time is a precious resource, and once its used, its gone, there are no take backs.

Now for the downside. The Live boot file is the quick path, and choosing KDE also has drawbacks. KDE does include a web browser, Konqueror, while Gnome has Firefox "out of the box". Overall, firefox is the better browser, but KDE includes a few GUI admin tools, like a runlevel editor, an item not easily added in Gnome.

The Service Management program


For a nice tutorial showing a Virtual Box install see the SysAdmGirl Fedora 17 video, at under ten minutes, it will be time well spent.

SysAdmGirl shows Fedora 17, while 18, and (really soon now) Fedora 19 will be the primary offering at the fedoraproject download page. Oh well, there is usually a downside to everything. Fedora 18 does fit into an 8GB disk, barely, although going for a 10GB partition won't hurt. Its always good to have a bit of spare disk space in the back pocket for any system admin.

For the system memory, a one GB virtual machine is plenty of room for linux. If memory is tight on the host machine, smaller is OK but when it comes to memory, more is generally better. Especially when using a 64 bit operating system.

There are reasons for going the x64 route, but saving memory is not one of them. If the hardware does not support x64, oh well, x86 works fine. Giving the virtual guest host a full 1GB of memory is not required, and do not give it that much unless at least 4GB of RAM is available on the host machine.

One thing I do like to do on a virtual machine setup for linux, shave a bit of space from the main partition and give the space over to the swap partition, bring it up to a full 2GB. That is 2GiB, as in 2048MiB. And one could spend an hour, even more, setting up additional partitions and mount points for guest OS. But first ... more on that later.

And do not expect a particular Fedora flavour to have a particularly long life span, a new version comes out every few months, a downside of choosing Fedora. But when creating a virtual machine, for Linux, do take a moment and glance at the System properties.

One thing to point out, on the Motherboard tab note the section "Extended Features", there is a check box "Hardware clock in UTC Time". Be sure to leave that checked, its quite important. Most any unix server will have its clock on Universal Coordinated Time, a critical point with operating systems, and one of the (many) reasons unix can be a better OS than ... the competition.

Be sure to stay tuned, more on that, and lots of other things too. But first ...

2013-07-05

php graphviz

But First ...
There are always lots of things on the to-do list.

Like learn a new language ... maybe even a spoken one, not just a slightly different way to talk to the machine, in pretty much the same old (or new(ish)) way.

Or try out something new. But first ... there's always a catch.

Its time to paint the garage floor. But first, the car has to be moved. Oh, the couch is in the way as well, will have to take care of that first. But the vinyl collection has to go somewhere, the couch moves much more easily (well, that's relative, can "easy" be mentioned in the same sentence with "moving" ... ) without two hundred pounds of not yet recycled plastic ... and the floor has to be really clean so the epoxy paint can stick, for a period of at least a fortnight ...

The But First dependency diagram, or graph, was drawn with just a few lines of php code. Really. And a couple of php packages too, but first ...

 
<?php

require_once 'Image/GraphViz.php';
$gv = new Image_GraphViz();
$gv->addEdge(array('Paint garage floor' => 'but first ...'));
$gv->addEdge(array('move car' => 'sweep floor'));
$gv->addEdge(array('store LPs' => 'move couch'));
$gv->addEdge(array('move couch' => 'sweep floor'));
$gv->addEdge(array('sweep floor' => 'mop floor'));
$gv->addEdge(array('mop floor' =>'paint floor'));
$gv->image();

?>


Got the first ink-ling for that diagram in an O'Reilly book, one that has been sitting on the shelf for ... a really long time, Mastering Algorithms with Perl. Its probably out in at least a second, if not third, edition. See Chapter 8, Graphs. Maybe its time to go see if those later editions do exist, or not, but first ...

The graphviz package has lots of other stuff. With an addNode(... call attributes can be set, i.e. 'URL' => '...' turns the node into a clickable link. Different shapes to represent the node, the font, font size, fill color, quite a few more items are in there. See graphviz shape docs for the details.

With php, just the graphviz-php package is not quite enough, there is a php-pear-Image-GraphViz "Interface to AT&Ts GraphViz Tools" package which includes the Image/GraphViz.php file. And not to mention setting up httpd for php, but will leave that one for another day.