Thursday, March 31, 2011

Install TSM 6.2.2 on RHEL6 64-bit

Download the tar from IBM and extract it:

tar -xf 6.2.2.0-TIV-TSMBAC-LinuxX86.tar
Grab dependencies from RHN and then install:
yum -y install compat-libstdc++-33 compat-libstdc++-33.i686 libstdc++-4.4.4-13.el6.i686
rpm -U gskcrypt32-8.0.13.4.linux.x86.rpm gskssl32-8.0.13.4.linux.x86.rpm
rpm -U gskcrypt64-8.0.13.4.linux.x86_64.rpm gskssl64-8.0.13.4.linux.x86_64.rpm
rpm -ivh TIVsm-API.i386.rpm TIVsm-API64.i386.rpm TIVsm-BA.i386.rpm

Add EPEL Repository to RHEL6

  1. Enable EPEL repo:
    wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    rpm -ivh epel-release-6-5.noarch.rpm
  2. Enable the 'optional' RHN Channel:
    1. Go to RHN Website
    2. Click into your system's profile
    3. Click Alter Channel Subscriptions at the bottom left next to Subscribed Channels
    4. Check RHEL Server Optional (v. 6 64-bit x86_64) and press Change Subscriptions
  3. Change all https to http in /etc/yum.repos.d/epel.repo and epel-testing.repo

Tuesday, March 15, 2011

Change Keyboard Language At Windows 2008 Login Screen

If you're only given one keyboard layout option at the Windows login screen, and it's not English but you need some special characters only available on the English layout, login via RDP (which will allow you to pass the correct characters from your client) and fix the following registry key:

[HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
You should see string values like:
"1"="00000407"
"2"="00000409"
407 = german, 409 = us, etc. You can add more languages 3, 4, 5, etc. Now at the login screen press CTRL+ALT+DEL. When you click [Options] you see the default language from key 1 (in this example DE) in the lower left corner. When you Press ALT+SHIFT you can switch all languages you have defined under this registry key. via TechArena

Monday, March 14, 2011

Export MSSQL Database Structure

Right click the database in Management Studio and select Tasks-Generate Scripts. Run through the wizard, selecting what you want exported. Assuming you only want the structure, without data, in the Scripting Options tab click Advanced and make sure that General-Types of data to script is set to Schema only. You can save to file, clipboard, or a new query window.

Sunday, March 6, 2011

PHP Google Maps Geocoder Tutorial

The goal of this tutorial is to plot a series of points on a map based on their addresses and optimize for viewing on an Android phone via the Android Browser.

Background:
"Geocoding" is the process of turning the addresses into their corresponding latitude and longitude coordinates, which can then be plotted on a map. Something to keep in mind is that your server is limited to 15,000 geocoding requests per day using the free Google geocoding service. If you have a large number of addresses to map, or expect a lot of traffic, you should cache the latitudes and longitudes in your database along with the addresses so that you don't hit this limit. Caching would also improve speed.

Assumptions:
You're comfortable accessing the addresses in your database and manipulating object-oriented PHP code.

Before getting started, you need to sign up for a Google Maps API key.

Helper classes which shouldn't need editing:
point.php
placemark.php

Classes you need to edit:
genxml.php
At a minimum, insert your Google Maps API key on line 7, your database connection information on line 36, and your table name on line 40. Modify the SQL query to match your database and your needs, as well as the associative names in the while loop. You can also include more XML attributes for each address, which could then be printed out on their onClick pop-ups later on.
dmap.php
At a minimum, insert your Google Maps API key on line 8. If you added more XML attributes, add them to the createMarker function and define them in the GDownloadUrl inside function which reads the XML. If your application needs a zoom level less than 10, edit line 33.
geocoder.php
The only function you'll care to edit here is the lookup function (line 40). All of my addresses were for one city, so I appended the city and state to the end of the address before geocoding. You could just as easily read these out of your database. Just pass them as new arguments to the lookup function, update the $search string and, back in genxml.php, the call to the lookup function by $placemarks on line 18.

What's going on here?
Most of the tutorials I found online involved just JavaScript. Well you're not going to be reading values out of databases using JavaScript. The trick is the geocoding, which you need to put into XML format (or some other format that Google supports, like JSON) before you can map it. In this tutorial, this is done by genxml.php. Visit it in your browser to see what the XML output looks like. dmap.php reads the XML, outputs the map using JavaScript, and formats it for the Android Browser using CSS and the viewport meta tag. During the output process, a bounding polygon is drawn around the points which is then used to determine the optimal center point and zoom level.

Download the source files for this tutorial.

Known Bugs:
The pinch to zoom feature that we're all so used to with mobile Google Maps does not work properly in the Android browser. There is no known work around, but the word is that they're working on adding the feature in Android 2.3.

Another thing to keep in mind is that this tutorial uses Google Maps API v2, which is depreciated but still supported. I would have used v3 but there weren't as many resources for it as for v2. You should probably look into using v3, especially if you want pinch to zoom to work whenever that Android update comes out.

Sources:
Geocoding with PHP and the Google Maps API
Using PHP/MySQL with Google Maps
Google Maps API v3: Developing for Mobile Devices
Google Maps JavaScript API V2 Reference

Friday, March 4, 2011

Recovering a Corrupt Windows 7 Profile

This morning when I logged into Windows 7 all of my icons were blank. So I rebooted. This time when I logged in it was like I was a completely new user, and some things were broken (for example, Folder View Options list was completely blank). Corrupt profile, I figure. So here's how I recovered:

  1. Since I was logged in as some TEMP profile (check: Go to My Documents. It's blank. Now go to C:\Users\username\My Documents. It's not blank. You're not logged in as username even though you should be), and was a member of the local Administrators group, I went ahead and copied C:\Users\username to C:\username.
  2. Run regedit. Go to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList" and expand it. You'll see several S-1-5-# keys under it. Go through each one, checking the value of "ProfileImagePath" to find username's profile. When you find it, delete the entire S-1-5-# key.
  3. Reboot. Log in as username again. A new default profile will be created. When it's done loading, log out.
  4. Log in as a local Administrator other than username. Copy C:\username back to C:\Users\username. Choose Yes to all merge and overwrite prompts. Choose Skip to any permission problem prompts (as long as you're a local administrator it doesn't matter).
  5. Next time the user logs in everything should be back to normal. Some shortcuts may have to be re-established (for me: Taskbar Toolbars), but the bulk of the profile is as it originally was before corruption.