Archive for the ‘Open Source Software’ Category

Getting WordPress 2.5.1 Going on RHEL3

Tuesday, May 27th, 2008

wordpress.gif

It came up amongst my fellow developers that having a simple blogging install on one of the machines would make it easier for them to maintain a list of what they do each day, and therefore make the creation of monthly reports a lot simpler. Seems reasonable, as I keep a simple HTML journal each day, and converting it to WordPress would be very nice. So I set out to do just that.

The first thing was identifying a machine. Since the requirements for WordPress are PHP 4.3 and MySQL 4.0, it would have been nice to have found an RHEL5 box that could be used, as RHEL5 has those in the standard install RPMs. But that was not to be. I did, however, have a good RHEL3 box that I could use. Unfortunately, the MySQL RPMs with RHEL3 were at 3.2.x - no good. So I had to do some searching.

I ended up finding what I needed at the MySQL web site and downloaded:

    MySQL-client-standard-4.1.22-0.rhel3.i386.rpm
    MySQL-devel-standard-4.1.22-0.rhel3.i386.rpm
    MySQL-server-standard-4.1.22-0.rhel3.i386.rpm
    MySQL-shared-compat-4.1.22-0.rhel3.i386.rpm

I also had to get the PHP RPMs from the CentOS site:

    php-4.3.2-40.ent.i386.rpm
    php-mysql-4.3.2-40.ent.i386.rpm
    php-pgsql-4.3.2-40.ent.i386.rpm

and then I was ready to go. Or so I thought.

The default install for MySQL places the data files in /var/lib/mysql and that worked great. The problem was that I wanted to have them in a different location. Ideally, all I'd need to do was simply move them and put in a symlink back to the /var/lib/mysql directory. But it was not that simple due to where I wanted to put the files and the rules governing placement there.

Basically, I was unable to set the user/group for the files in the location I wanted to put them based on some rules in-place by the Unix engineering team. Understandable, I just needed to find another way. The simplest way to make it work was to have the MySQL server run as another user - in this case, gomer. The trick was that it wasn't that simple to figure out all the places it needed to be changed. In the end, I was able to get it by using the following file as /etc/my.cnf - the default configuration file for MySQL:

    #
    # Point the MySQL server to this location for the databases
    #
    [mysqld]
    user=gomer
    basedir=/home/data/rooster/
    datadir=/home/data/rooster/mysql
    socket=/home/data/rooster/mysql/mysql.sock

    [mysql.server]
    user=gomer
    basedir=/home/data/rooster/

    [client]
    user=gomer
    socket=/home/data/rooster/mysql/mysql.sock

where the location of the files is /home/data/<machine>, and in this case the machine name is rooster. I chose this to make it easy to distinguish the data files for one instance from another - put the machine name in the path and you're pretty sure to not have conflicts.

With this, I could start and run the MySQL server without error. Whew! That was an important step to take. Now we need to get PHP talking to MySQL. In order to do this we need to edit /etc/php.ini and set the MySQL socket reference to:

    ; Default socket name for local MySQL connects. If empty, uses the
    ; built-in MySQL defaults.
    mysql.default_socket = /home/data/rooster/mysql/mysql.sock

and then restart the web server with:

    /etc/init.d/httpd graceful

The next thing to do is to create the user and database for WordPress to hold all it's information. Interestingly, what you need to do is to make the database first, and then assign the rights to the user (thus creating a new user in the process). To do this, we first need to log into MySQL as the root MySQL user and create the database:

    mysql -u root -p

and enter the root MySQL password. Then create the database:

    create database wp_drbob;

I've chosen the convention wp_login so that the databases are easy to tell apart. Then you need to assign right to that database to a new user:

    grant all on wp_drbob.* to drbob@localhost identified by "coder";

where the last argument is the new password for the local account. At this point you can verify the user's database is set up properly by logging out of mysql with a quit and then log in as the new user:

    mysql -u drbob -p

...and enter the new password (coder), and then have a look at all the available databases:

    mysql> show databases;
    +------------+
    | Database   |
    +------------+
    | test       |
    | wp_drbob   |
    +------------+
    2 rows in set (0.01 sec)

One little wrinkle with the PHP 4.3.2 using the MySQL 3.23.58 Client API is that the passwords in MySQL 4.1.22 are stored in a slightly different way. This means that you need to do the following in order to get the password into the old format for PHP. Log in under the root MySQL account:

    mysql -u root -p

give it the root MySQL password, and then issue to following:

    mysql> UPDATE mysql.user
        -> SET password=OLD_PASSWORD('coder')
        -> WHERE user='drbob'
        -> AND host='localhost';
    Query OK, 1 row affected (0.00 sec)

the flush this out to the system:

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

At this point we have a database and we're ready to install WordPress and configure it.

Assuming that the WordPress distribution is in a tgz file called wordpress-2.5.1.tar.gz then as the user gomer go to the location where the blogs are going to be stored and unpack the distribution. It'll be named wordpress - change the name to the user's login (our convention here again). This looks like:

    $ cd /home/data/rooster/blogs
    $ sudo su gomer
    $ tar zxvf wordpress-2.5.1.tar.gz
    $ mv wordpress drbob

at this point, you need to go into that directory, rename the file wp-config-sample.php to wp-config.php and then edit it and put in the correct values for the database connection:

    // ** MySQL settings ** //
    define('DB_NAME', 'wp_drbob');
    define('DB_USER', 'drbob');
    define('DB_PASSWORD', 'coder');
    define('DB_HOST', 'localhost');

You can then install WordPress by going to the web page: http://server/blogs/drbob/wp-admin/install.php (assuming that you have the directory symlinked into the var/www/html/ directory of the web server). This will pull up a simple page where you can set the name of the blog and the email address of the administrator. They will receive an email with the login information which they can then use and customize as they see fit.

It's certainly no easy, and a lot of the little details took me hours to figure out. But in the end, I have something that's working and it's not too terribly hard to set up another. That was the goal, and it's achieved. Good enough.

Twitter Outages Part of a PR Stunt? Not Likely…

Thursday, May 22nd, 2008

Twitterrific.jpg

Making the rounds this morning is an implausible idea that the Twitter downtimes are actually planned to keep people 'wanting more'. While drug dealers have used this in the past, to great success, I don't think the geek-mentality would think this trade-off on the pride of creating a stable, useful system would be worth it.

Take a look at Slashdot... the ultimate geek hang-out. If they went down, it's a scream-fest and they loose credibility - not gain it. Twitter is a communication channel, no one thinks the phone company is good for killing service. Nope. This is something they are trying to prevent, and simply can't. I'm not sure why, but it's got to be that there are things going on behind the scenes that the casual user doesn't see.

The excuse for the latest outage is a database outage due to a routine update going bad. Now this I know about... if you're updating a 'production' database during working hours you need to make sure that you have a back-up, or a fail-over, or something so that if, on the one-in-a-million chance that something goes wrong you aren't out of business. They messed up on their disaster/recovery plan. Maybe it's not big enough to have one of them, but I think it's time they think about it.

In the end, it's nice, and people will use it, but they'd use it more if it were more reliable - not less.

Compiling MAGIC 7.5.140 for Mac OS X 10.5 Leopard

Tuesday, May 20th, 2008

MAGIC.jpg

Today I decided to try and see if I could get the latest source of MAGIC (7.5.140) compiled on Mac OS X 10.5 without a lot of major hassles. Turns out there are a few things you need to know, and I'll detail them here, but the end result is that yes, you can get it compiled and it'll use the X11/OpenGL display and it's not bad at all.

I used MAGIC on some old DEC VAXStations and even an Amiga 1000 back at Auburn University when I taught there. It was a lot better than the home-grown layout tools that I had been using in my graduate work at Purdue - but most of that was likely because the guys at Purdue had to write their own tools - there just weren't any layout tools for the old TEK 4014 screens they had, and they didn't get color screens until late in my work. So it was probably a necessity. But MAGIC is just beautiful.

It can display the overlaps with different visual cues so that you know you have a gate when the poly crosses the n-diffusion. Also it had design rule checks built-in which made it a hundred times easier to really make something in MAGIC as you didn't have to constantly worry if your layout was going to fail in mask fabrication or in the actual foundry. The real kicker for grad students was the MOSIS rules and the pads they created.

With the MOSIS rules and the 'tiny chip' pad, we could have designs sent out to be fabbed at any of a number of silicon foundries in the country. It was an amazing thing to send out the file and see the chips come back and have the students see what they had made. Pretty cool stuff. Anyway, let's get to the building.

First thing is to get the source. I went to the MAGIC site and got the source for 7.5.140. I then unpacked it into a directory and went into the magic directory (a symlink is made in the un-tar).

The only change needed is to edit the configure command due to a linking issue with X11 and OpenGL - as OpenGL is referenced in both the X11 libs and the OpenGL Framework. Apple discusses it here and the fix to the configure script is pretty easy. Replace:

  -lGL

with:

  -lGL -dylib_file \
  /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:\
  /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib

where it's all one line - I just put in the line breaks for readability sake.

Then it's the standard configure, make, and make install and it's installed in /usr/local/bin with supporting files in /usr/local/lib. Make sure you have the path right and you're golden.

I did notice that wish 8.4 segfaulted when I tried to run it, but that was fixed by using the configure command:

  configure --with-interpreter=scheme

so that the default Tcl/Tk interpreter is not used, but the built-in scheme interpreter is used, and then there aren't the issues. I'm sure if I built Tcl/Tk 8.4 from scratch and used that, it'd work, but I don't need an interpreter for MAGIC - I'm not doing that fancy of layouts and I didn't have one in the past, so I'm OK for now. If it gets to be an issue, I can deal with it later.

That's it... it runs.

  magic circuit.mag

and up comes the file. Just like I remember. Pretty sweet.

UPDATE: I tried getting it to work with the Tcl interpreter and it just wasn't going to fly. I'm not sure why, but the segfaults were in wish and that's not a good sign. Also, I had a hard time getting the scroll bars to work and the middle-button emulation wasn't working as I had hoped. So all in all, it's working, but only barely. It's not something I'd use for real. Oh well... it was a good try.

UPDATE: they have implemented the scrolling with the arrow keys, so it's not the scroll bars that's the problem, it's user error and remembering it the way it used to be. So I think I'll keep it for a while. Also, I figured out the middle-button issue - I had to enable 3 button behavior on X11.app in the Preferences. WIth that, I get the same one finger = left... two fingers = right... and Option+one finger = middle. Perfect. Now it's good enough to use. Good.

Blender 2.46 is Out

Tuesday, May 20th, 2008

Blender.jpg

While I'm no artist, that doesn't mean I don't wish I were. Several years ago, I got an SGI Indigo2 workstation with the HighImpact graphics card off eBay. I wanted to do lots of things - including a little graphics work because the graphics capabilities of that Indigo2 were so bloody awesome! I've done a lot with barney over the years, lots of web development, database work, application icon creation - everything I wanted to do but the graphics work.

Back then, there was blender for the SGI - it was free then, even though it was owned by a company, and I was amazed at the speed and grace with which you could create 3D objects in it. When I moved to the Mac a few years ago, I was following the 'buying' of the blender code from the company by an open source group. It was interesting to see them get to the point that they had the money, and then took it over.

They even had a Mac OS X port.

Well today, they have released 2.46 of blender and it's as nice as it ever was, and just as snappy on my MacBook Pro. I'm still no artist, but if I get to the point in my life that I have months and months of time, I'm liable to try my hand at this. Take a few classes at some local college and then practice, practice, practice... Maybe I'll do this as a second career - I could do a lot worse.

Firefox 3.0rc1 Arrives on the Scene

Monday, May 19th, 2008

Firefox.jpg

This morning I noticed that Firefox 3.0rc1 was released... good news! I'm using it all the time on Windows, my Mac, and Linux - I guess I'm converted over. I still think we're a month or so away from full release, but it's nice to get the fixes and such that they are putting in as they polish this release. Still a good browser.

Still... in my tests, Safari beats all of them in speed and stability, but Safari surely does consume the memory. I keep Firefox around because it renders web sites that Safari can't because of the user agent.

Boy, I Wish I Had an In-Memory Database

Monday, May 12th, 2008

CKit.jpg

Today I realized that one of my price injectors wasn't properly updating the data structures. Well... that's not really right... it was working, it just wasn't doing what I needed. Basically, the first cut I had of the data structure was to have a map where the key was the price identifier (RIC for Reuters, BBG Symbol for Bloomberg, etc.) and the value was an array of instruments that would need to be updated if a price with this identifier came into the injector. Pretty simple. Price comes in... we pick off the identifier... we hit the map and get the array of instruments, and then for each instrument we send an update. Simple.

But it's got a flaw.

What if I received a new price identifier for an existing instrument? Then, I'd add another key to the map with one instrument on it. I wouldn't remove the old one, and so there might be two price injections for the same instrument. Bad idea.

The simple fix would be to remove the old instrument from the array in the map - but that would require a large scan - first, of all the price identifiers, and then for each element in the array associated with the identifier. I didn't like this scanning as it was bound to be inefficient when the numbers got very large. So I had to change, or at least augment, the data structures.

What I chose to do was to have another map - this one from the instrument to the identifier so that I could easily look up the identifier given an instrument. This would then allow me to quickly find all the instruments for an identifier, and then the identifier for an instrument. With this, I was able to quickly remove an instrument if the identifier changed, and also easily send out the instrument updates when a price (with identifier) came in.

But it got me thinking... what I really wanted was a simple database table. Something where I could say 'SELECT identifier WHERE instrument=blah', and then 'SELECT instrument WHERE identifier=zip'. This would allow me the freedom to look at the same data two ways, and even if I didn't have the complete relational database, a simple SELECT on a table would be all I'd really need.

There's a lot to think about here. Maybe it would be easier to just use the multimap in STL and see if that doesn't handle all my needs. If I did a multimap of identifier to instrument, I could easily find all the instruments for a given identifier, and with a reverse map, I could find the one identifier for a given instrument. I guess that making a simple template might be all I'd need and then I'd have all this functionality.

But that in-memory database table would be really nice. I can think of a lot of uses for it. I may have to spend more time on this tomorrow. It's a really interesting idea.

UPDATE: I looked more at the STL multimap and I don't like it's insertion methods at all. Yuck. Why not put in the operator[] like the map? It's got to be possible - but I can't fit it in after the fact. The best I can do is to subclass it or something. I'm really a bit surprised at this. In any case, I'm not going to keep going after the multimap for the price feeder. Ick.

Growl Updated Their Web Site – Nice Look

Monday, May 12th, 2008

growlicon.png

I just happened to be checking on a few things this morning, and one of the little unsung heros of my day is Growl. I really think it might be the next thing Apple pulls into 10.6. It's just an exceptionally handy tool to have at the system level - like tabbed terminal sessions (from iTerm) and virtual desktops, it's something that a lot of people like myself use.

Anyway, the point was that for the longest time, Growl had the same web site that didn't look all that great on Safari - at least how I looked at it. Today I noticed that they totally revamped the web site and it's looking much better. No new releases, but now they show the different styles as well as better docs, more screen shots, and a better look to the whole thing.

Nice update.

Upgraded to WordPress 2.5

Thursday, May 8th, 2008

wordpress.gif

While it might not seem like much, being able to upgrade WordPress from 2.3.3 to 2.5 was nice to get done today. It takes a little longer for Fantastico at HostMonster to get the updates, but they work like a charm, and I haven't lost a thing. Can't beat that. Unfortunately, there's already 2.5.1 out, and so I'm still behind. Not to worry, it'll catch up... and if the Google Summer of Code is right, we'll get caching in the default WordPress which would be really nice because the existing caching schemes make it seem a little non-standard.

I'm not about to get Slashdotted anytime soon, so I'm safe. When it's built into the WordPress release, I'll get it. But I do with they had better facilities for Privacy. There's really only the ability to mask out the search engines. I'd like to be able to work on an opt-in policy where I had to give people accounts on the install and then they could read it. That would be nice.

Once Again, MacVim Amazes Me

Tuesday, May 6th, 2008

MacVim.jpg

There were a few things that I had wished were different about MacVim - specifically, the filenames in the tabs had the complete path name, nicely abbreviated, but still, there. I asked the support group about that and they came back with the most incredible answers. Now it's true, I've been using vi/vim for about 23 years, and I'm by no means a wizard at Vim - I use it, and I'm quick with it, but there are a lot of things about it that I'm not aware of. Today was an education.

The Current Directory of the File

The first thing that struck me was that when you opened a new tab with the File Open dialog, you'd get the complete path to the file as part of the name in the GUI tab. Yes, the path was nicely abbreviated, but it was still there, and if I had tabs that I'd opened from the command line, they didn't have the path. When I read the answer it was obvious - the current working directory of the command-line tabs was well know - the ones from the file open dialog wasn't. So what to do? Well, the answer was to change the directory on those files as well.

The brilliant answer came from one of the contributors on the mailing list: have an auto-command change the directory for each buffer you enter. The lines in my .vimrc that controls this are:

    if (has("gui_macvim"))
        :autocmd BufEnter * :cd %:p:h
    endif

The Format of the Tab's Filename

The second thing that can help is to force the tab to have just the filename and not the complete abbreviated path. This is done with a simple set command:

    if (has("gui_macvim"))
        :set guitablabel=%t
    endif

With these two additions I have two things that I really didn't like fixed. When they get the ATSUI renderer working with the mouse support, this is going to be one incredible editor. It's pretty awesome already.

One of My Favorite Databases – PostgreSQL

Monday, May 5th, 2008

PostgreSQL.jpg

About eight years ago I was doing a project at the place I used to work and I needed to have a linux-compatible database that I could use that had C/C++ and Java bindings. At the time, MySQL was very popular, but when I looked at it I was struck by the lack of foreign keys and support for stored procedures. PostgreSQL had both of these, and while it wasn't as fast as MySQL, speed wasn't as important to me then as completeness of the database features. Times have passed, and MySQL has gotten better, new databases for linux systems have come into being, and PostgreSQL is still going strong. I've never regretted the decision I made those many years ago.

Both MySQL and PostgreSQL have corporate backing now, and I'm glad for each as the competition is good for the users. Most of the time, my PostgreSQL databases just hum in the background, but today I'm messing with one and it's really a much a joy to use today as I ever remember it being.

Everything is there that I need. And it's fast. Sure, it may not beat a clustered Oracle installation at 22.5 million rows, but then again, when I get a database that big, I'm sure I'll have the money to get something equally as expensive, and possibly it'll be PostgreSQL on it's clustering solution. But for the databases I'm using - under 100,000 rows per table, this is more than enough. It's fast, dynamically configuring, and it simply just works.

If only more commercial products did that. PostgreSQL... get it. You'll be glad you did.