May 25 2010

A Search For A Putty Alternative – Putty Tray and Putty Connection Manager

After getting my beta key for Starcraft 2 I’ve been spending a lot of time in Windows. Windows 7 is a huge improvement over Windows XP but I really miss the transparent tabbed terminals in Linux. I’ve become so used to having numerous SSH tunnels and sessions going in multiple tabs that the classic Putty Client in Windows 7 seemed very restricting. I’ve explored a few Putty alternatives and it seems that a transparent tabbed SSH client isn’t an option in Windows. I hope that there is an application that I’ve missed, but at the moment it seems you can either have a transparent Putty client with text that also becomes transparent and illegible with Putty Tray, or you can have a buggy tabbed SSH client with Putty Connection Manager. Both of these applications are less than desirable, but I have settled on Putty Tray. With Putty Tray, the console windows will minimize to the tray and not take up valuable real estate in the task bar. If used with Pageant, Putty Tray is far superior to Putty Connection Manager and it doesn’t have the usability issues that Putty Connection Manager does.

I’m still tempted to install a virtual machine and run some flavour of Linux just for the clean and visually appealing consoles.

Share

Aug 18 2009

Automated MySQL Install On Windows

If you need to install MySQL databases on a number of machines with roughly the same configuration then it becomes extremely tedious to run the installer wizard on each machine. You can download the MySQL server as a msi package which allows you to install with the MSIEXEC DOS command in windows hands free. To install all the necessary files for MySQL to run you need to type this command at the console:

msiexec /qn /i mysql-essential-5.1.37-win32.msi INSTALLDIR=C:\MySQL

The ‘/qn’ switch makes this install quiet. In this example I chose ‘C:\MySQL’ as the install directory. Feel free to replace that path with whatever you choose.

Just because MySQL is installed and has all the appropriate files registered doesn’t mean that it’s useful. You will probably want it to run as a service, have it listen on a certain port, and have a root user already set up. This can be done with the MySQLInstanceConfig.exe program, although the arguments are a little more involved.


C:\MySQL\bin\MySQLInstanceConfig.exe -i -q 
"-lC:\MySQL\mysql_install_log.txt" 
"-pC:\MySQL\bin" "-tC:\MySQL\my-template.ini" 
"-cC:\MySQL\my.ini" -v5.1.37 
ServerType=DEVELOPMENT 
DatabaseType=MIXED 
ConnectionUsage=DSS 
Port=3306 
ServiceName=MySQL
RootPassword=root1234 
SkipNetworking=no 
AddBinToPath=yes

The entire string above must be run as one line. If you just copy and paste then the console will error out. Most of the arguments above are straight forward if you’ve ever configured a MySQL server before but just in case I’ve detailed the parameters below.

-n product name
-p path of installation (no \bin)
-v version

Actions:
-i (install instance)
-r (remove instance)
-s (stop instance)
-q (be quiet)
-lfilename (write log file)

When launched manually, these can also be submitted
-t<.cnf template filename>
-c<.cnf filename>

Use the following options to define the parameters for the configuration file generation.
ServiceName=$
AddBinToPath={yes | no}
ServerType={DEVELOPMENT | SERVER | DEDICATED}
DatabaseType={MIXED | INNODB | MYISAM}
ConnectionUsage={DSS | OLTP}
ConnectionCount=#
SkipNetworking={yes | no}
Port=#
StrictMode={yes | no}
Charset=$
RootPassword=$
RootCurrentPassword=$

So if you use the example above you will get a basic mysql installation. When I used these commands I put them in a batch file followed by this command:

mysql –user=user_name –password=your_password db_name < create_database_and_tables.sql The ‘create_database_and_tables.sql’ obviously has all the sql code to create the MySQL databases and tables that are needed. The batch file installed, configured, and structured my MySQL databases. I spent awhile yesterday looking for a post like this so hopefully this saves someone some time.

Share

Aug 16 2009

Re-Enable Grub For Linux After Windows Install

Following the installation of Windows 7 on my desktop machine that was previously running Ubuntu 9.04, I realized that one of my partitions was missing. It was formatted as ext3 so of course it wouldn’t show up in windows. When I went to boot back into linux the grub boot manager was gone. The machine just booted straight into windows 7.

To re-enable grub was a lot simpler than I thought it would be. Since the Ubuntu 8.04 install disc that I had lying around also works as a live disc I booted my desktop off that. Once Ubuntu started up I opened up a terminal and typed these commands:


sudo grub
root(hd0,7)
setup(hd0)
quit

I then rebooted and grub was back to normal with both my Ubuntu operating system and windows 7 listed. Note that hd0,7 was the partition where I installed Ubuntu. If you installed linux before windows then you will probably want to use hd0,0. I installed windows 7 over a broken windows xp partition that I had installed before everything else.

If you installed ubuntu before you installed windows then you’re probably going to have to edit your ‘/boot/grub/menu.lst’ file. The grub documentation may be helpful.

Share

Aug 15 2009

Windows Batch File Without Popup Console

Sometimes you need to schedule a batch file to run some script periodically on a windows server. I found myself having to run one fairly often and it would always pop up that annoying console window whenever I was in the middle of typing something. This sent me searching for a way to run the script without the pop up console window. There was a few ways to do this but I didn’t want to download and install any other software so I went the vbscript route. Here is what I did.

First create a file and call it ‘somefilename.vbs’ and put it in the same directory as the batch file that you want to run.
Next put this code in it :


Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "my-batch-file.bat", 0, False
Set oShell = Nothing

Now when you set up the windows scheduler you want to point it at the ‘.vbs’ file and not the ‘.bat’ file. That seemed to be the easiest and quickest way to get rid of the console popup when running a batch file on a windows server. If anyone has another method that doesn’t require the creation of a new file I would like to hear it. You could always do some reading on vbscript and just code everything in vbscript and not use a batch file at all but I didn’t bother.

Share