Counting the Lines in a Set of Files

I find myself needing this command every once in a while and I can never remember exactly how it goes. It parses through a directory (and subs) to give you a report on how many lines are in each file. It is great for working with csv files.

wc -l `find ./ -name '*.csv'`

I got this from an old post on Dev Shed forums that I participated in. I posted it here so I don’t have to keep seeking out the post every time I am trying to remember this command.

http://forums.devshed.com/showthread.php?p=1857692#post1857692

Connecting to an MSSQL Server (and others) with OpenOffice.org

I have wanted to try out OpenOffice.org Base for some time now, but I have never taken the time to figure out how to make it connect to a relational database system. And as it turns out there doesn’t seem to be all that much documentation to help. Anyway I needed to figure out a way to look over the structure of a Microsoft SQL database and I didn’t have access to a Windows machine, let alone Enterprise Manager.

So OpenOffice.org uses JDBC to connect to various databases, but sadly it does not come bundled with any of the libraries required to connect and communicate. So after researching a little I came across jTDS. And with a little messing around I got it to work. Below is what I did.

  • First you have to download jTDS at http://sourceforge.net/project/showfiles.php?group_id=33291.
  • Second, uncompress the file and store it somewhere out of the way on your computer (such that you don’t accidentally move or delete it). You can store the whole folder or just the jtds-x.x.x.jar file.
  • Third, open up OpenOffice.org and go to Tools, Options…, OpenOffice.org (or NeoOffice), Java and then click on Class Path… and then Add Archive…. Choose the jtds-x.x.x.jar file and hit Open. Then keep hitting Ok until all preference windows are closed.
  • Fourth, you need to close and reopen OpenOffice.org for the change to take effect.

  • Fifth, open up Base and when the wizard comes up choose Connect to an existing database, choose JDBC from the dropdown and then hit Next.
  • Sixth, the Datasource URL is of the form below.

    jtds:sqlserver://[host]:[port]/[database]

    Replace [host] with the hostname of the server, replace [port] with the port that the database connects over (the default is usually 1433) and replace [database] with the name of the database.

  • Seventh, for the JDBC driver class put in the below.

    net.sourceforge.jtds.jdbc.Driver

    You can hit Test class if you want to. It should give you a promising message. After all of the fields are filled out hit Next.

  • Eight, on this screen you can fill out the authentication information. This should be pretty straight forward and you can test it to see that it is connecting properly. And then on the last screen you can set some final options and then save the local connected copy somewhere.

After that you should be able to see and browse the tables, build queries and have fun.

- - - - -

You can also use this jTDS driver to connect to Sybase. All you have to change the Datasource URL to this form.

jtds:sybase://[host]:[port]/[database]

- - - - -

For connecting to MySQL you can follow these same steps except you need to get the MySQL JDBC driver class from the MySQL website (http://www.mysql.com/products/connector/j).

The Datasource URL is:

mysql://[host]:[port]/[database]

And the JDBC driver class is:

com.mysql.jdbc.Driver

Command Line Reference

Came across this on digg today. It is another reference sheet for common Linux/Unix commands and programs. It has a lot of good common uses of good programs like scp, rsync, svn, psql and mysql.

http://cb.vu/unixtoolbox.xhtml

Mailplane for Mac OSX Invitations

Mailplane is OSX application that provides a front-end for Gmail on Mac. I have been using it for a while now and I like it pretty well. I like it because it is isolated from Mail.app and it integrates natively into Growl. It also makes attachments and managing more than one Gmail account easier.

Anyway, I have some invitations for the beta testing program and really no one to give them too, so I thought I would offer it to anyone that was interested. I really want to delete the email that allows me to invite people, but I don’t want the invitations to go to waste. If you would like an invitation, please just post a comment here.

You can find more about the application at:
http://www.mailplaneapp.com

Apple ][ Emulation

I was listening to the RetroMacCast this week and they were talking about the old Apple ][, which was the very first computer I ever owned. It got me in the mood of getting in front of one again; however I haven’t seen one since sometime in the mid 90’s.

Thankfully there is some pretty good emulation software out there.

KEGS (http://kegs.sourceforge.net)

This is the first one I tried but it is a bit more complex to get running, so I quickly abandoned it. However it does work on Windows and Linux as well as OSX.

OSXII (http://apple2.intergalactic.de/intergalactic.de/Software.html)

This one was really easy to setup, however more limited than KEGS. But it was good enough for me.

I got to play around on some really old games, and also try to remember how to write animations for GraFORTH ][. I think I got my fix for another decade or so.

Quick Note Taking Application for Mac (Almost as Good as Tomboy for Linux)

One of the greatest Linux applications I have ever used is Tomboy. It is a simple note taking application that sits in your toolbar and provides quick note creation, searching, basic formatting and linking between notes. It is perfect for the kind of note taking I do on the fly while sitting at my computer.

Long have I searched for a worthy equivalent for Mac OSX without much luck. For a time I used WikityWidget on the Dashboard. The only thing I didn’t like about WikityWidget was that you couldn’t resize the window to allow for more note room.

However on random forum the other day a saw a reference to a OSX application called Sidenote. It hangs out on the side of you desktop and allows you to mouseover and quickly create and jot down notes. It does support some formatting and you can save them externally. It also allows you to drag images and files into the note (I have tried images and pdfs). However it trails Tomboy in that there is no searching or linking between notes.

Overall I really like Sidenote and have been using it like crazy over the past few days. It will definitely be added to my Mac application toolbox. I want to thank Pierre Chantel for taking the time write and then give away such an excellent application.

Sidenote

Thoughts on the Bill Gates and Steve Jobs Interview

I just watched (as I understand it) the first public combined interview of Bill Gates and Steve Jobs. It was in front of an audience at the D5 conference. Which is a conference put on by the Wall Street Journal. Now I am not normally a fan of these mainstream conferences because they tend to very investor controlled. However on the same token an interview like this would have never happened without major funding backing it.

Anyway, the interview itself also suffered from mainstream quality of the event, however I still thought that both Bill and Steve said some very interesting things and had a very good line of dialog. And what was really interesting was how the mentality that they projected in person very much embodied the cultures and focuses of their respective organizations. Even in such mature and large organizations there singular influence still controls the values and focus.

The one point that Steve Jobs made that I really agreed with and latched onto was that in the next five to ten years the big innovations are going to happen with specialized devices (like cell phones and tablets) over the traditional desktop or laptop computers.

The one thing that Bill Gates said that I really agreed with was when they were being asked about the idea of the Internet and the browser destroying the traditional software market. He said that those Internet based applications may be the more visible aspect of modern computing, but it will be because the ‘localized’ software will be more transparent. In the sense that the user will still be relying on the localized operating system to function it just will utilize more natural things like speech and visual recognition over traditional WIMP (windows, icons, menus and pointing devices (mouse)) interaction from the user.

I also thought that the interviewers were more disruptive and cumbersome to the dialog of the interview than they were guiding and contributory. Such that at different times both Bill and Steve would fundamentally ignore what one of the interviewers said in order to expand on a thought or topic that they raised between themselves. I know that these interviewers were working in a very restricted environment, with controlled and noncontroversial questions to pull from, but they really seemed to fail in just basic discussion facilitation.

It is a quite interesting discussion to watch. It is even comical to watch how the two would respond to certain thoughts and statements with facial expression and body language but then cool their heads to maintain the professional and friendly atmosphere of the situation.

The full video and transcript is available on the conference follow up website:
http://d5.allthingsd.com/20070530/d5-gates-jobs-interview

The full video is also available on YouTube (I used these because the player on the main website does not play on the Wii):
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Part 8
Part 9
Part 10

Useful (and free) Mac Applications

A little while ago I got a new MacBook and I spent a good amount of time finding and collecting up all the various applications and tools I commonly rely on when I try to do something geeky (or not) on a Mac.

I thought it would be good to share them here for reference purposes. Besides all of these applications are free to download and use.

Aptanta (http://www.aptana.com)
This is a full featured IDE for coding. It has great support for Javascript and xhtml. However the auto-complete can get a little intrusive. It also has support for FTP and SFTP in its internal file browser.

Battle For Wesnoth (http://www.wesnoth.org)
This is a great turn based tactical game that has tons of additional scenarios and strong online community.

Colloquy (http://colloquy.info)
This is a nice IRC client, with a very slick and easy to use interface. I don’t really chat much on IRC but it is always good to have a client around just in case.

Cyberduck (http://cyberduck.ch)
This a really good, easy to use transfer client that supports FTP and SFTP.

Fugu (http://rsug.itd.umich.edu/software/fugu)
This is another transfer client that supports dual window mode as well as FTP and SFTP. Its window layout is designed for a more power user; however it doesn’t seem to have as many features as Cyberduck.

Gimp (http://www.gimp.org)
This is a bitmap editor similar to Adobe Photoshop. I would say that it is just as capable as Photoshop, but there is a learning curve. There is a reformulation of the Gimp called GimpShop (http://www.gimpshop.net) that restructures the interface and menus to look and act more like Photoshop.

Mozilla Firefox (http://www.mozilla.com/en-US/firefox)
Mozilla Firefox is a top notch browser for any operating system. On the whole I like it better than Safari (which comes with your Mac). There are things that like about each of the browsers. For example I like Safari’s RSS browser better than Firefox’s. On the same token I like the plugins and built in spell checking on Firefox.

Mozilla Thunderbird (http://www.mozilla.com/en-US/thunderbird)
Mozilla Thunderbird is an email client, very much similar to Mail. I keep debating back and forth about which one I like better. They both are very solid email readers but each of them has a few little things I don’t like.

MySQL GUI Tools (http://dev.mysql.com/downloads/gui-tools)
These are great tools for anyone who works as an administrator or a developer in a MySQL environment. They are very well integrated into OSX and can really make life easier.

NeoOffice (http://www.neooffice.org)
This is an open source office suite (similar to Microsoft Office). It is an implementation of OpenOffice.org that is fully integrated into the OSX window environment. I find it to be stabler than the OpenOffice.org implementation for Mac; however it is usually a release behind OpenOffice.org.

OpenOffice.org (http://www.openoffice.org)
This is the open source office suite that NeoOffice is based on. This is probably my most favorite open source project to date. However its distribution for Mac has to be ran through emulation using X11 or the like; which makes it a little awkward to use. The OpenOffice.org team has committed to releasing a native version of it for Mac soon (should have a preview in the next 1-3 months). When they come out with it, I get the feeling that it will put NeoOffice out of business.

Opera (http://www.opera.com)
This is another web browser alternative for Safari. For me it is an ok browser, but I can never really get into it. It is very full featured; so much so that I find it a little intrusive. I do give in credit for being one of the few browsers to pass the Acid2 test.

TextWrangler (http://www.barebones.com/products/textwrangler)
This is a good lightweight text editor that supports syntax highlighting for a large number of languages. It also has built in FTP and SFTP support. It also has a good number of features, but it doesn’t get in your way like an IDE would if you just want to do some text processing.

UnRarX (http://unrarx.sourceforge.net)
This is a utility I just picked up. It allows you to extract RAR compressed files. I needed it because OSX’s built in tool doesn’t support the format.

Windows Media Components for QuickTime
This is a great implementation of support for Windows Media file formats (.wma and .wmv). It runs natively in Quicktime, which means a high level on integration with the system. I would say it handles streaming media better than Windows Media Player on Windows XP because you can pause a live stream and then pick it back up later from where you left off. Whereas on Windows, once you lose the buffer you can only join back in missing out on what streamed by in the gap.

I also plan to write a review on my experience with my new Mac, but it may be a few months (considering it took me about 2-3 months to get this one out).

Finding a running process (pid) by name in Linux

I have always wondered how you find and kill frozen applications and run away programs in Linux, but to be honest I have never known of a good way to find the process id (either graphically or on the command line). So after a little searching I found the ‘ps’ (process status) command. It will give you a list of all of the processes running on a particular machine.

You need to use the ‘a’ option to see the processes by all users and the ‘x’ option to show all of the processes outside of the scope of the shell.

# ps -ax

If you just run that command as is, the results will just scroll by. In order see and browse the results at you own pace you can pipe the list into ‘less’.

# ps -ax | less

Or if you want to search for a particular application process, instead of piping in ‘less’ you can pipe the results into grep.

# ps -ax | grep search

For example I can find the process id of Firefox by doing something like this:

# ps -ax | grep firefox
 3399  ??  S      3:30.90 /Ap ... OS/firefox-bin -ps ...
 3456  p1  S+     0:00.00 grep firefox

This example output is from my MacBook. Now I can successfully kill the app by calling the kill command. In this example I can do this:

# kill 3399

This also works on a Mac, but Mac’s Force Quit features are pretty nice and there is really no need to use the command line.

The mysteries of a Mac server

After failing several times at getting a ppc version of Linux (Fedora) running on my old G3 iMac, I have decided to get my copy OSX 10.3 to run as my new file server/playground web server. So far my research has showed me that most of what I need is already installed. I have found that both Apache and Samba are already running, I just need to dive into configuration. Other than those two things the other stuff that I am going to try to get running are MySQL and PHP.

So far the resources I have found and plan to use are:
http://www.onlamp.com/pub/ct/49
http://developer.apple.com/internet/opensource/php.html

This is more of a perpetual goal than a concrete one, I just want to get some experience at administering OSX. Good Luck to me.

{
}