Sunday, December 23, 2012

dpkg: error processing icaclient (--configure)

When trying to install the Citrix Receiver application (icalient) on Ubuntu 12.10 x64, ran into an issue with one of the post installation scripts (thanks Citrix!?).

You will notice that when setting up the icaclient or any package thereafter you get a post installation error as seen below:
dpkg: error processing icaclient (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
icaclient
To fix this, you have to make a simple change to the following file
/var/lib/dpkg/info/icaclient.postinst
Open the file in your favor text editor and find the following line (typically Line Num: 2648)
echo $Arch|grep "i[0-9]86" >/dev/null
Change it to the following (pay close attention to the -E, changes have been bolded)
echo $Arch|grep -E "i[0-9]86|x86_64" >/dev/null
Now the setup should complete successfully after running the following command
dpkg --configure icaclient

Saturday, December 22, 2012

Challenges when configuring i1 Profiler Display Pro

Recently I was requested to assist with developing a color correction profile for photo editing workstation.  I used a XRite i1 Display Pro to develop the profile against a Dell U2410 and a Dell 1907FP dual monitor setup.  I thought this would be an easy 5 minute process.  I was wrong.

Couple of things you need to remember:

  1. Turn UAC off.  Seems that i1Profiler needs to read in LUT values and write new system ICC profiles.  UAC sometimes interferes with that.  You can turn it back on when you have finished with the calibration process.
  2. Make sure that "Use Windows display calibration is set" otherwise you might get the dreaded "Failed to apply video LUTS" error message after the calibration sequence finishes.  Follow the instructions from XRite on how to correct this. 
  1. Open Control Panel and then"‘Color Management", a Color Management setup window for the User Level appears. In the "Devices" tab, add a check to "Use My Settings for this Device". Make sure that the X-Rite created monitor profile is selected as the default. Click on the "Advanced" tab and check the box to "Use Windows Display Calibration" to control loading the video LUTs. Note: if the option "Use Windows Display Calibration" is grayed out, click on "Change System Defaults" bottom left in the window. A Color Management setup window for the System Level appears. Do not apply any changes for assigned profiles here. Click on "Advanced" tab and select the option to "Use Windows Display Calibration". Select "Close" and the exit "Color Management".

After you get everything calibrated, you still might run into issues such as Windows Photo Viewer showing your images a lot darker than you would expect.  Photoshop and Lightroom will show the proper color, luminance and saturation but Windows Photo Viewer will show images that are dark unless you "play" then in Slideshow mode.  If so, the reason is you need to tell i1 Profiler to save the ICC profile in version 2 format.  The instructions here are a little dated but will get you down the right path.

Once you create the ICC profile, verify the profile by opening up the Color Management control page, clicking All Profiles, then selecting your custom profile under ICC Profiles and verifying the version.

Thursday, August 30, 2012

Suppress or Hide Network Error Dialog Boxes

If you are like me, you often work with a portable computer and sleep your computer between commutes from the office, home, and road.  If you wake up your computer on a different network than the one you were on previously, you might be in for quite the annoyance if you had bunch of Explorer windows with UNC paths open.  Suddenly those paths are not found and potentially dozens of "Network Error Windows cannot access \\serverfoo\some\path\bar" messages. Of course, they cannot be accessed, that network is no longer available.  Clicking Cancel on each dialog is annoying.  This is where AutoHotKey can step in.

This nifty program allows you to script all sorts of "macros" to automate various tasks on your computer.  In many ways its similar to AppleScript but more powerful.  You can create shortcuts, remap keys, or in this case, eliminate pesky dialog boxes.

In this script, we are going to create a persistent script, one that will stay running and continue to refire the timer using the interval we specify:


#Persistent
SetTimer, CloseNetworkErrorDialog, 20000
return

CloseNetworkErrorDialog:
SetTitleMatchMode, 2
WinGet, id, list, Network Error
Loop, %id%
{
    this_id := id%A_Index%
    WinGetTitle, this_title, ahk_id %this_id%
    PostMessage, 0x112, 0xF060,,, %this_title%
}
Return


As you can see, this is a really simple script that has a function named CloseNetworkErrorDialog that is called every 20 seconds.  CloseNetworkErrorDialog loops through the open windows whose title contain the phrase "Network Error", gets the exact title of the window, and sends it a Close Window command.  You can read more about creating AutoHotKey scripts here.

Peace at last and it only took 5 minutes to write.

Thursday, October 20, 2011

Installing Lubuntu 11.10 (Oneiric Ocelot) natively on a CR48

I started this because well, for one, ChromeOS is still not ready for prime time. Tabs would sad tab, machine would run slow, etc. Its not a dinky machine. Its a 1.66Ghz Atom processor with 2GB of RAM. Definitely nothing to scoff at. Ubuntu was a lot more stable however its fairly heavy weight so I got the idea to try something user friendly but lighter. Unfortunately, Lubuntu just came out this month and there are no CR48 specific guides for it. In the past 24hrs, this is what I have figured out.

Process
1.Generate a USB stick using UNetbootin and Lunbuntu and make sure to set at least 128MB free for "Space used to preserve files across reboots" else you will end up in a never ending loop of IO errors. http://unetbootin.sourceforge.net/
2. Install InsydeH20 using these instructions
3. Once loaded enter the BIOS by pressing the F2 key (-->) and then load Optimal Defaults, save, and exit.
4. Insert your USB drive in the CR48 and turn on the CR48. It should boot into Lubuntu. If not, hold down the power button to turn it off and then hit F10 (Vol+) to enter the boot menu.
5. I suggest trying before installing because then you can download updates and third party libraries as part of the install process since you can connect to a wireless network. I will assume you do the same
6. Once you connect to your wireless network, click the Install Lubuntu icon on the desktop. Choose your language, then select the options to download updates and and install third party software. Choose to erase all partitions (sometimes labeled as "Something else" so you can define your own partition layout)
7. Once you have the gparted running, click each partition and delete it. There are a lot of them. Don't stop till the drive is completely empty.
8. Once they are all deleted, click your free space, then click Add. Type: Primary, Size: 200MB, Beginning, Ext2, Mount Point: /Boot
9. Click add again: Accept the defaults except choose / as the mount point.
10. Click Install Now. If you get a warning about swap space, just click Continue. By not creating swap space, we are saving the SSD from excess writes. Follow the rest of the prompts while Lubuntu installs.
11. Once you finish with the prompts, open up the terminal, then run sudo gparted Click the your boot partition, and the click Partition -> Manage Flags. Click Boot. Then close gparted. Wait for the install to finish. [For some reason, the installer doesn't set this flag and grub then fails to install, therefore, you have to do this within the first few minutes after finishing step 11 else the grub portion of the installation will fail] Also, keep the mouse moving. When the screen blanks, the backlight doesn't turn back on. If this happens to you, use a flashlight to see the screen.

Hurray Lubuntu is now installed! Now to customize it for the CR48.

Add Sync option to /boot
Since we used ext2, there is no journaling on this partition so we want to make sure that any writes are flushed to disk before the IO call returns. This will keep things fast and reasonably safe from corruption.
1. Edit /etc/fstab as root in an editor.
2. Change defaults for the /boot partition to rw,suid,dev,exec,auto,nouser,sync without the quotes of course.

Add support for the Brightness and Volume keys
1. Open a root prompt (sudo -s in the terminal)
2. Install xbacklight apt-get install xbacklight)
3. Edit your keyboard short cut file (~/.config/openbox/lubuntu-rc.xml) Search for xbacklight. Notice that the entire section for Multimedia Keys and LCD backlight is commented out. Remove the --> and place it at the end of the <!-- comment line. Remove the first keybind section for C-F7. Change C-F10 to F6. Change C-F11 to F7 and change the -inc 10 in the execute section to -set 100
4. Search for amixer. Change XF86AudioRaiseVolume to F10. Change the XF86AudioLowerVolume to F9. Change the XF86AudioMute to F8.
5. Save and close the file.
6. On the root prompt, type openbox --reconfigure Your brightness and volume keys should work now.

Disable Track Pad while Typing
1. Open /etc/xdg/lxsession/Lubuntu/autostart in your favorite text editor and append the following

@/usr/bin/syndaemon -i1 -d
@/usr/bin/synclient PalmDetect=1
@/usr/bin/synclient PalmMinWidth=5
@/usr/bin/synclient PalmMinZ=200

2. Restart the computer.

This is the basics. Feel free to customize in other ways as well. The boot up time is amazing. About 10 seconds after the POST process. 88MB of RAM used after bootup!

--------------------------------------------------------------------
UPDATE NOV-19-2011
_______________________________________
I found that the syndaemon client would sometimes stop re-enabling the mouse after typing. This is likely a bug in syndaemon but rather than hope for a fix, when your mouse doesn't work, you want nothing more than for it to work again. I decided to write a little script and then bind it to the CTRL+ALT+SHIFT+M keyboard shortcut. Here is how I did this.

1. Make a directory in your home directory named scripts (hint, use lxterminal for the below)

mkdir ~/scripts

2. Create a file named fixmouse.sh

leafpad fixmouse.sh

3. Paste the following in, save it, and then close the text editor


#!/bin/bash
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Off" 8 0
killall syndaemon 2>/dev/null
syndaemon -i1 -d


4. Now edit your keyboard shortcut file (~/.config/openbox/lubuntu-rc.xml) and search for </keyboard> Add the following line right above it but replace <USERNAME> with your actual username.


<keybind key="C-A-S-M"><action name="Execute"><execute>/home/<USERNAME>/scripts/fixmouse.sh</execute></action></keybind>


5. Now reconfigure openbox to pick up your changes

openbox --reconfigure

You should now be able to hit CTRL+ALT+SHIFT+M to restart your mouse!

Thursday, June 09, 2011

How to run diskutil in single user mode on OSX Leopard and Snowleopard

After spending some wonderful time troubleshooting a Macbook Pro with a failing drive, I wanted to know if the filesystem was corrupted or if it was indeed a disk failure. In order to know this, I had to read the SMART data off the drive. Here is my attempt

First you need to boot into single user mode by turning on the computer and immediately pressing CMD + S where the CMD key is the Apple key. Continue to hold down command + s until you see the verbose logging appear.

Then mount your drive in r/w mode with:

mount -uw /

Then we need to load a couple of required system modules. DirectoryServices is only required if you want networking support.


launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
launchctl start com.apple.diskarbitrationd
launchctl load /System/Library/LaunchDaemon/com.apple.DirectoryServices.plist
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist

Now you should be able to at least run diskutil. You can run the following to check your specific drive
diskutil /dev/disk0sd2

You can enumerate your drives with

ls /dev/disk *


Right now its hanging for me but at least its running in single user mode which is better than before.

Tuesday, June 29, 2010

ImportError: No module named django

Have you ever installed appengine on a Mac, then installed django and then launched your app only to have appengine scream back at you "ImportError: No module named django"? Well suffer no more. Appengine for some reason expects django in the following folder:

/Library/Python/2.6/site-packages

Provided that your running Python 2.6, just place your un-tarballed django folder in that dir and appengine once again will be happy.

Now this might be confusing because if you just launch python, it will tell you its looking in another directory which might be true but is certainly not what appengine is doing.

>>> import os, django
>>> print os.path.dirname(django.__file__)
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django

Wednesday, May 26, 2010

Voice to Text Input on any Android 2.0 Text Field

Do you have an HTC Android phone? Do you have Android 2.0? Do you want the ability to enter text with your voice? Then this mod is for you.

Here is how you download and enable the Voice to Text IME mod.

1. From the home screen click the Menu button then click Settings then click Applications. Make sure the Unknown Sources check box is checked.
2. On your Android browser, download this file http://www.mediafire.com/?hknzjex4tnm It will load a web page, click the "Click Here To Start Download" link
3. After it downloads, open the HTC_IME_LO_25.apk file that downloaded. It should open in the Market app. Click Install and accept the prompts.
4. After its installed, go back to the Home screen, click Menu, then Settings, then Language and Keyboard. Click the check box next to the HTC_IME mod.
5. Open an application with a text input box (such as the search bar). Long press the input box. Select Input Method then select the HTC_IME mod.
6. You now have a keyboard with a Voice microphone on the lower left hand side.

Enjoy!

Friday, January 08, 2010

Cannot search contacts in Office Communicator 2007 R2

To resolve this issue, first close Communicator, then search for GalContacts.db* and delete any db or db.idx files that begin with GalContacts. Restart Communicator and wait up to 15mins for the address book cache to rebuild.

Thursday, November 19, 2009

Creating a new eclipse project from existing source

After struggling to figure how to create a project form source the first time, I figured it was so easy that I would remember it. Neverless, several months later I failed to remember just how easy this is.

Here is the steps.

1. Click Window -> Show View -> Other
2. Type 'File' in the search box (without quotes)
3. Open the file view
4. Browse to the root of the source folder
5. Right click and click Promote to Project.


Enjoy!!

Saturday, September 12, 2009

Getting StumblerPlus working on the 3.0 iPhone/iTouch

If Stumbler Plus is crashing on your 3.0 firmware of the iPhone or iPhone touch then I would suggest the following:

1. Install Stumbler Plus, wget, and openSSH via Cydia
2. Restart the device by holding down the power button and choosing shutdown then power up again
3. Connect to a wireless network and get the IP (Settings -> Wi-Fi -> click circled blue right arrow for more details)
4. With an SSH client (putty or command line ssh) connect to the device IP. Accept the certificate. Login with "root" as the user and "alpine" as the password
5. Type the following:

wget http://www.iphone.mysticwall.com/download/StumblerPlus-1.2rev1.tar.gz
tar -xf StumblerPlus-1.2rev1.tar.gz
cp -vfr StumblerPlus.app /private/var/stash/Applications.pwn/
rm -vfr StumblerPlus.app

6. You can now launch Stumbler Plus

Wednesday, May 20, 2009

Google Chrome is pissing me off.

First off, let me say I am a big fan of Google, the cloud model, and the approach of Lean, Mean, and Clean. I have to admit that, despite being an early adopter of Google Chrome, and being in love at first sight, my relationship with Google Chrome is starting to sour.

I have three specific reasons why Chrome is going to make me end up running back to Firefox.

  1. Tabbed Browsing: Love it! What I hate is in Chrome, mouse clicks seems to be sticky, that is, if you click a tab and then move your mouse to start prepare to click somewhere else, Google Chrome will sometimes lag and register the mouse up event late and think your doing a tab drag and not a tab focus. Now suddenly instead of bringing focus to the desired tab, you just inadvertently dragged the tab out to its own window and now have to drag it back again. I have this problem on every computer I use from laptop to powerful desktops. I don't have this issue with any other browser. Stop. Just stop it. Even as I write this, this issue is occuring. Its especially exasperated when remoted in via terminal services over a celluar link.
  2. Terrible render performance: Over time, Chrome has gotten much slower when needing to repaint a page (e.g. when switching from one app to another. It seems that a large amount of that page is getting, well, paged. Chrome makes heavy use of its cache which, naturally, is written to disk. It seems when a page has not been in focus for while, Chrome is clearing memory and then having to reload the cache to paint the page when it comes in focus again. Not helpful when your relying on minimizing disk activity to conserve battery on your mobile device.
  3. Safe browsing sucks! The safe browsing DB is used by Chrome for its malware and phishing detection capability. The issue with this is that its slow, causes heavy IO, and again bad for road warriors. They have been making some changes that help limit this so it doesn't cause your system to be unresponsive (which is the main reason I switched to the google DEV channel) however, open FileMon and just watch how often these safebrowsing sql lite dbs are hit. I think I might actually turn off safe browsing and see if it helps.
Google knows its the little things that count when it comes to a user's experience. Even if I end up going back to FF full time, Google Chrome would have still been a success. Its pushing the browser market to reconsider simplicity. Do one thing and do it well. Speed and stability are the second and third most important aspects in a browser behind rendering the page correctly (including images and JS/Flash).

Saturday, April 05, 2008

Registering Google Desktop Enterprise to Lotus Notes

If your one of the unfortunately people that is forced to use Lotus Notes everyday, your going to love what Google Desktop Enterprise can do for you. Google Desktop Enterprise comes with a Lotus Notes plugin that allows for automatic and local indexing of your Notes mail. You might mention that you can setup indexes in Lotus Notes either on your local or server replicas. This is true but searching in Notes leaves much to be desired.

Normally you don't worry about the registration as the installer manages this for you. The problem comes when you have to reinstall notes and forget that you had Google Desktop installed. Not wanting to reindex all your mail again, how do you get that plugin back into Notes?

First locate your notes folder. For me its C:\Notes but it could also be C:\program files\Lotus Notes\. Now locate the notesgdsplugin.dll. You might have to snag this from a coworker if you can't find it anywhere on your computer. Copy this file into the root of your notes directory.

Now locate your notes.ini file and add the following under the [Notes] section. Change path_to_notes to match your installation directory. Restart Lotus Notes and Google Desktop should alert you that its now installed.


AddinMenus=notesgdsplugin.dll
GDSIndexOnIdle=0
GDSFilePath15=C:\path_to_notes\data\bookmark.nsf
GDSIndexEncrypted=1
GDSIndexDrafts=1
GDSIndexDiscussion=1
GDSFreqMinutes=1

Friday, November 23, 2007

IP Communicator Overtakes Port 80

Update 10-19-2011
Just to keep this up to date, I have tested this on IP Communicator 7.0.6.0 running on Windows 7 32bit and confirmed that it indeed still runs a web server HOWEVER, setting the WebServerDisabled registry key no longer works to disable the local webserver.

Now you need to browse to your Cisco IP Communicator install directory (typically C:\Program Files\Cisco Systems\Cisco IP Communicator) and then rename the HTTPService.dll to HTTPService.dll.old. Make sure IP Communicator is not running when you do this. Now start IP Communicator. You might get a COM Surrogate error but it won't prevent you from using IP Communicator normally without that pesky webserver running.
---------

Many companies these days use VoIP (Voice Over IP) as a cheaper alternative to expensive PBXs and the cost and issues of maintain another copper plant (thats industry speak for all that phone wiring). One of the benefits of VoIP is the portability of your phone. With IP Communicator (requires a per seat license from Cisco) and a secure connection to your corporate network, you can work remotely as seamlessly as if you were at your desk even if it is around on the other side of the world.

Despite the benefits, I noticed a downside to the Cisco IP Communicator client. It appears that it contains an embedded webserver from Allegro Software called RomPager which is basically just a super thin webserver capable of HTTP requests and CGI. Its issue: it runs on TCP PORT 80!! You might think "no worries, I am already running a webserver which is bound to TCP Port 80 so when it tries to bind to it, it will fail. Nope, sorry, its smarter than that. What does it display? Basically, it displays connection and settings information in a webpage format presumably so your technology department can determine what settings the client has without walking the user through an annoying series of menus.

A thorough search through the preferences and options revealed no mention of a webserver or management page. My next thought was, "Can I at least change the port". I turned to the Cisco Administrative Guide for more information. Fortunately, they documented a registry key you can set to disable the webserver but no way to change the port. Good enough I suppose.

Here is the registry key for your enjoyment.


1. Start -> Run -> Regedit
2. Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Cisco Systems, Inc.\Communicator
3. Create a new DWORD called WebServerDisabled (skip this step if it already exists)
4. Set its value to 1
5. Restart IP Communicator

Friday, August 17, 2007

Getting an OpenXML (.docx) file to open in OpenOffice.

So someone sent me this .docx file the other day. I don't have office installed and in fact I had no idea what .docx was. I actually thought it was a typo but after a little googling noticed it was the extension for Microsoft's new OpenXML format which is not yet standardized but can be looked up under ECMA 376. So how do you get it to open up in OpenOffice?

If you are using a RedHat, Suse, or other RPM based distribution, then its easy. Just go to Novell and download then install the ODF convertor.

If your running a debian based distribution, its a little more difficult. You still need to download the ODF convertor. Save it to a smart location like /downloads/ODF Convertor

Now if you don't have Alien installed, then you need to install it. Say yes to all the prompts.


root@laptop:~# apt-get install alien


Now we need to convert the RPM to a tar.gz file.


root@laptop:~/ODF Convertor# alien -ct odf-converter-1.0.0-5.i586.rpm


Now that the tar.gz file is generated, you need to extract it. I just used Gnome's fileroller but you can use the cammand line if you want.

Next we need to copy a bunch of files. Browse to the location where you extracted these files. then run the following commands.


root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# cp usr/lib/ooo-2.0/program/OdfConverter /usr/lib/openoffice/program/

root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# cp usr/lib/ooo-2.0/share/registry/modules/org/openoffice/TypeDetection/Filter/MOOXFilter_cpp.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Filter/

root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# cp usr/lib/ooo-2.0/share/registry/modules/org/openoffice/TypeDetection/Types/MOOXTypeDetection.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Types/


Thats it! Now just open OpenOffice and try to open your .docx file. It should work flawlessly.

Tuesday, July 31, 2007

Cloning a MAC address in IPCOP

IPCop is a great SOHO linux firewall distribution that is custom built using the Linux From Scratch (LFS) toolkit. I have been using it for many years first toying with the 1.3.x versions and finally deploying the 1.4.x versions to my home network and in productional enterprise environments. I have been very impressed that given minimal hardware (200MHz PII, 128MB SDRAM, and 10GB HDD), I have been able to obtain darn close to wirespeed routing with NAT translation for 100Mbps connections (actual speeds were able to hit 12MBps sustained). With built in DHCP server, support for up to four networks (public (RED), private (GREEN), DMZ (ORANGE), and a seperate LAN (BLUE often used for wireless networks), there are really a lot of options available.

My biggest gripe has been with their lack of supporting MAC address cloning. As many of you that have cable networks know, cable companies often use poor man's security by adding MAC address restrictions to their DHCP servers. In order to get an IP address that is routable to the the Internet, you need to have the MAC address with which you originally registered with the cable company. Many of us are ditching our Linksys boxes in order to use a better featured and more powerful firewalling solution and therefore our only option is to either clone our MAC or attempt to suffer through the tech support hotline music only to get a rep that has no idea what a MAC address is. Don't you hate it when you the customer have to tell the company's representative how to do their job?

Well, according to many of the blogs and posts out there, thats your only option with IPCop. I am here to say "Not any more." We just need to change the MAC address on the public interface BEFORE IPCop attempts to make a DHCP request. I figured out a real clean way to do this before after spending a few hours in the code base but have long since forgotten where I documented what I did. This time I had less time and had to find a faster way even if it was less elegant.

First log into the box (either on the console or through SSH) and login as root (you remember your root password right)? Edit the following file (vi and nano are installed by default):

nano /etc/rc.d/rc.red

This is merely a perlscript file that will get executed as the last part of the rc.netaddress.up process. Scroll past the first few lines. You will see a boilerplate header, some includes, some variable definitions, and finally, look for the section that says:

# read vars back from file

In my version (1.4.13), there are 4 lines after that line. Add a carriage return to get a new line and add the following line after all those &General:readhash lines:

system ('/sbin/ifconfig', 'eth2', 'down', 'hw', 'ether', '00:12:ef:34:2a:ee');

Replace eth2 with the name of your WAN (RED) interface and, of course, use the MAC address which you want the IPCop box to clone. Save the file, reboot, and enjoy your night free of long monotonous elevator music.

Sunday, July 01, 2007

Designing applications for the enterprise and the home

While working for Purdue University as the Technical Lead for Application Development, one of the topics I stressed the most was designing applications to be Reusable, Extensible, and Scalable. While many people agreed that applications should be designed in a modular fashion, few agreed that even the smallest utility should employ such a design.
Why should I spend an extra hour writing a bunch of classes chock full of properties, methods, and constructors when a simple class with a bunch of "functions" would work just fine?
This is a very valid question. The underlying reason many people even ask this question is because they are thinking small. They don't realize that the functionality or effort that they are placing in their utility could be utilized by someone else for another purpose. This all boils down to coupling. Coupling is the term that expresses how dependent a given module is on another module.

For example, I have noticed that many PHP applications are written in a tightly coupled fashion. In a given method or function, the developer is performing data validation and sanitation, manipulating inputs and performing calculations, and finally is executing data backend transactions. That is highly coupled code. If you wanted to reuse that data cleansing and validation functionality, your only option would be to copy it into your own method. Ok, thats no big deal. Now imagine that the backend database changed and the cleansing requirements change. Now the nightmares begin. In how many different areas was this cleansing code implemented. Worst off, how many different times was it written. Developer B did not like Developer A's variable names so completely renamed all of the variables and changed some of the logic design. In a loosely coupled design, the data validation and cleansing functionality would be abstracted into its own set of classes under some Data Utility namespace. Now requirement changes are a simple line edits in a single location away.

Now rethinking the previous example. Suppose the developer had written the application in a loosely coupled fashion however all this code is stored under the developers local hard drive. How does this help the situation. All code that is written should be stored in a central versioning repository. In addition, an entry should be made into a Wiki or other central publishing store so that other developers can find this code easily by category, namespace, or search. Personally, I really like the MSDN style of documentation. In fact, there are many utilities that can automatically generate this documentation so all you need to do is write up a small blurb about the class, method, etc and some skeleton code as how it should be used.

So what are the disadvantages of designing applications with loose coupling in mind. Well one is performance. I will not try to disagree with the procedural type developers and argue that loosely coupled code is faster. With proper design techniques and resource management you can minimize performance issues. Despite this, the cost of hardware these days is small but the cost of labor is quite high. In addition, having loosely coupled code also allows you to be a lot more nimble as design changes can be easily implemented.

Another difficulty encountered with loosely coupled code is that of deployment. Versioning of all levels of components is CRITICAL! A proper versioning pattern should be in place to ensure that every release (whether beta, alpha, production, release, internal, etc) is properly versioned and its features, bugs, known issues, and API specification is well known. In addition, with loosely coupled code, you want to make sure that your resulting libraries maintain API compatibility through the major version number. That means that if you have a typical versioning scheme of Major.Minor.Revision.Build, a dll with version 1.2.5.6 should be binary compatible with 1.9.12.35. That means, you should be able to reference any 1.x.x.x dll in your application and it should work (minus any bug fixes) without changing a single line of code.

One addition critical element required for loosely coupled design is refactoring. Refactor is the name given to the process of changing the code design without changing the functionality or results of the code. I love the word balance and try to implement it always in my life. I also keep in mind balance when designing applications. Sometimes, I will tolerate a certain degree of coupling because the costs of trying to abstract the code further outweigh the benefits. Since we live in a dynamic world, sometimes the benefits will start to outweigh the costs. As soon as this scale starts to tip, its EXTREMELY important to refactor. Many companies don't encourage refactoring because it does not make them any money. Your not fixing bugs and not introducing new functionality. Despite this, the long term cost advantage is hard to deny.

So whether your a small single developer or a large enterprise, loosely couple code along with proper versioning and refactoring can be a way to dramatically reduce development time and cut costs while increasing quality and delivering greater value.

Yes it is possible to have your cake and eat it too.

Sunday, January 14, 2007

Copyright Chaos

To be honest with you, I am viciously sick of all these copyright laws and discussions being held. Americans and society in general has gotten so self centered yet so apathetic that they don't even realize the horrible rules and laws that are coming down among them. In an effort to curb what seemed to be an epidemic of illegal digital media sharing, the RIAA through the prominent voice of Lars, convinced the guilty public and friendless lawmakers that something needs to be done about this. Encryption technology had started emerging for securing and tethering music to a single computer however the intelligent people at the forefront of this war understood that software is breakable hence the term software. In order to discourage and subsequently legally punish these hoodlums of the new world, our trusty media mongrels convinced our government to pass the infamous DMCA (Digital Millennium Copyright Act) which seeks to apply severe limitations on the older sibling, the Copyright Act. The DMCA gives media distributors and publishers explicit rights to release their works in DRM (Digital Rights Management) package which ensures that the content is only used in the manner they deem allowable. With DRM they can control how, when, the number of times, and on device you choose to consume their content. If they don't want you copying it to another device, DRM can prevent that. If they don't want you to see it more than once, DRM can prevent. If your computer crashed midway through playing the file, oops, too bad. Better buy another license. If your computer crashed and you lost all your data before watching your movie, oops, too bad. If you decide you want to watch it in the comfort of your big lazy boy with a nice bucket of popcorn and a blanket then DMCA can say NO! We will not allow you to copy this here movie to DVD just because the industry says you must use 239829832983 different types of technology. Each technology requires a new license and new payment for that license.

The authors of the original Copyright Law understood that certain exceptions needed to be made however they were not explicitly clear in what was allowed and what was not. It was then left up to the judges to decide what constituted "fair use" and what was an obvious ploy to benefit off other peoples work. The RIAA realized that not all people would try to circumvent their technologies to make a profit, rather, the customers would circumvent their technologies in order to consume the content in a manner and on a platform of their choosing. This meant potentially missing out on huge licensing fees they could charge for the right to play a given file on your computer, DVD player, CD player, laptop, PSP, iPod Video, or else. They wanted each platform or device to require a seperate license. Hence the DMCA which states that distributing tools that allow you to circumvent the copy protection, play protection, and device locking schemes is highly illegal. Now, unless you as the individual know how to crack encryption code, your S.O.L. because the guy that does know how is not allowed to even give you a copy of his tool for fear of being fined billions of dollars. Why would be fined just for trying to help someone else fairly use their media? Well, the media conglomerates are afraid that as soon as you crack your media that your going to distribute it to the world or so that is what they claim. Really, I believe they are pissed because they want to sell you more licenses for each device.

If we carry this same mentality over to the analog world like newspapers, radio, and TV, then what would things look like. Well, every copy of a newspaper you get would be scrambled. You would get a special pair of glasses that allowed you to read the paper normally but as soon as you opened the package, the glasses started to darken until they were no longer usable. This means that you have enough time to read the paper but you better do it all at once because if you set the glasses down to do something else, they will still continue to darken and your paper would be worthless. In addition, you could not just give the glasses to someone else unless you did not plan to read the paper yourself. Forget about saving old editions for reference, all they are good for now is starting fires.

What about radio? This will require a special ear implant. In order to listen to the radio or other audio sources, you would need to get an implant in your ear that will decode the special audio being transmitted. The implant is not transferable. If you try to take it out, it becomes unusable. Soon food will carry such restrictions too. Everytime you go to the grocery, you will have to choose how you will prepare that food item and how many people will consume it. You then buy licenses for this use. Using the food in a manner not consistent with the license purchased is an illegal activity. In addition, spontaneously inviting people over for dinner and sharing that food that you purchased as a single person license is also punishable by the law.

Think I am crazy? Well your right but seriously, think for yourselves. Just how far is too far. We all know that complete freedom means no freedom but regulating everything also means no freedom. We need to start valuing certain freedoms and demanding certain rights and then enact laws to protect those freedoms and rights else these huge inanimate beings called corporations and special interest groups will rape all of humans of any rights we do have. People are waiting for the day when machines rule the world. Well, I argue that machines already do just we don't recognize them as machines yet.

Sunday, December 24, 2006

The Internet is "Everywhere"

Today's world is a lot more mobile than every before but despite our mobility, we still expect to be connected. Whether it be via the phone, email, IM, or even the snail mail, we expect to be able to communicate with others at a moments notice. Well, I am happy to announce to you that such has gotten even easier.

Although accessing the Internet through your phone has existed for a long time, its only recently that T-Mobile has eliminated the need to access the Internet through a proxy. Previously, you could access the Internet only via a few ways: first, you could purchase an expensive data plan and then follow their list of steps to tether your mobile to your laptop, second, you could use the mobile's mediocre screen and input device to handle your communications, or finally, attempt to tether your laptop to your mobile without using a data plan.

TMobile is a GSM network and thus uses GPRS (General Packet Radio Service) to handle data communications which has speeds similar to a very poorly connected 56K (expect speeds on average to be around a 33.6K modem). They also have deployed EDGE (Enhanced Data rates for GSM Evolution) which is capable of speeds closer to that of ISDN. Think 2 - 4 times as fast as GPRS but still dog slow compared to everyday broadband.

Why anyone would want to pay for this service is beyond me. I do have the 2.99$ T-Zones plan which I found out had ports 25 and 110 open to the public Internet. I then set up a proxy running on a computer to listen to port 110 and then pointed the proxy setting for IE to the IP of my computer. This allowed me to then tunnel http traffic past T-Mobiles proxy. It was painfully slow but worked and allowed me to tether too.

A few weeks ago I removed the proxy information and noticed that my Internet connetion still worked, in fact, worked better than ever. Even when I re-tethered, it continued to work. Howard Forums also has some information saying the T-Mobile silently removed the proxies. Now even this very blog will be posted over GPRS (edge is not offered here). I am truly glad for this as it continues to make me want to stick with T-Mobile as a wireless carrier. In addition I a also am looking forward to their HSDPA. After paying around $4 billion in frequency licensing fees, T-Mobile is looking to launch their rollout starting early next year in metropolitan areas first.

Right now, I am not aware of T-Mobile not wanting you to take advantage of the newly opened access. My only recommendation is to be a good stewart and use it responsibly. Don't run P2P clients, minimize traffic to that which is only necessary and don't depend on it for communications. Whenever HSDPA rolls out, I will be getting it. Until then, I will be gingerly using the E/GPRS network as the needs arise.

Wednesday, December 13, 2006

Compensation and Performance Reviews...Where are the Rocks

As you can assume from the title, I am going to be talking about compensation and performance review systems but first, why would I discuss this in a technical blog? Well, for starters, all of us techies and non-techies alike will have to work for someone at some point of our life (minus the occasional very large trust fund individual). Even if your working for yourself, compensation and performance are still very important as you have to be your own biggest critic as your paycheck is directly tied to your performance.

I believe that many compensation systems understand that pay is a hygiene factor. Herzberg stipulated that hygiene factors are those things in a workplace that don't bring job satisfaction however they are critical to preventing job dissatisfaction. This is where performance reviews often completely mess things up.

A performance review is a system or process that is designed to provide feedback to the employee to help them determine which areas of development they need to focus on and which areas are they already really strong in. In
reality, most performance reviews fail to accomplish the objectives that they originally set out to attain. Many people fear their reviews instead of viewing it as an open time of discussion. In addition, many companies perform reviews on an annual basis. The time between reviews is so large that entire company objectives might have changed. Then there is the whole concept of money. Money is only a motivator if its a goal. Once this goal is attained, it no longer motivates. Personally, I would not want my employees working for me, busting their butts with the sole intent of making more money. Instead, I would rather see them fairly and adequately compensated and have them vying for top positions by boosting productivity, education, and experience in order to be qualified to take on even more responsibility.

Despite my desire, not all people are wired to be the best of the best. Some people are what I would call solid individuals. They are the hard workers that have been in a position a long time, know the job, the environment, and all the tricks of the trade but really are not interested in moving up on the corporate ladder. They are happy where they are. They know that management is not for them and that a lateral move would only cause them to lose interest. What do you do with these people. First of all, you need to value them. They are your ROCKS upon which your department and organization can build a foundation; a source of stability. Secondly, two words: job enrichment. I believe that every one desires two things from a job: challenge and recognition. These people would be very beneficial to help new comers acclimate to the team, be able to lead efforts in documentation of team processes, facilitate an active policy of knowledge share, and might even be considered more of a mother hen than the manager is. Remember the hygiene factors? Work relationships can be both a hygiene factor and a motivational factor.

By leveraging these seemingly immobile workers, you can build a competitive advantage that results in less churn and burn and fosters greater knowledge share and creation. I know that when I am interviewing with different firms, one of the things that I really look at is how do the people seem to interact together. I also look at how much of a difference am I going to be able to make.

Having worked in many organizations, I can say that some organizations are too large and too broken far to long for any one individual to try and radically change things. One organization in particular had me excited about the potential to radically change a really dysfunctional team. After spending years trying many different tactics from team based approaches to grassroots efforts, I realized that I was merely just a finger in the dam. Conditions and morale would improve but if I was gone for longer than a week, the same fundamental issues would start to arise again and the dam would burst. It was obvious that I was not creating lasting change. Instead, most of the issues were originating from the top and I was merely acting as a diffuser. As soon as I left, it would turn back to a powerful jet stream, ripping people apart.

As us techies enter the workforce or even move about in it, we sometimes have to stop and realize that its not always about the technology, the projects, or the cool toys we get to tinker with. All workers, whether they be executives, asphalt pavers, or marketers, have certain basic needs. They require status, job security, benefits, and fair pay. They also desire recognition, challenge, and responsibility. Each individual will value each element differently and will also perceive how well each element is being met differently. Some like being congratulated publicly, others rather have a pat on the back and a whisper of "Fabulous job!" in their ear.

Issues of human resources might be incredibly boring to some but I don't think of it as human resources. The HR department to me is really the Department of Autonomous and Superior Logic Processing Computing. The human brain is really the ultimate computer and HR (DASLP if you will) processes is still trying to reverse engineer how we are wired and subsequently programmed. There is no API and each person has a different revision of code. Thinking of things this way helps us have sympathy for their misgivings.

Tuesday, December 12, 2006

PAL 2.0/Windows Vista WPA Issues Resolved

Thanks to our outstanding wireless engineer here on the Data Network Team at Purdue, the issue of Vista connecting to the PAL2.0 wireless service is solved. If you don't have any idea of what I am talking about, I suggest reading the blog entry I created a few days ago to catch up. Turns out that the RADIUS reflector just needed a single line patch to its source code in order to correct the issue. During testing, Windows Vista was able to successfully connect to a test network that was running in an almost identical configuration to the PAL2.0 network (WPA-Enterprise/PEAP-MSCHAPv2 authentication). This does not mean that your Vista machine will connect to the production PAL2.0 network. The security team will still have to certify the change, schedule the deployment through change management, and then deploy the fix which will result in a enterprise outage of PAL2.0. There is no current ETA for when this will be implemented however, there is hope.

If you want to let Purdue know just how much you want Vista to work with PAL 2.0, I suggest contacting the ITaP helpdesk via phone by calling (765) 494-4000, or in person in STEW G-65, by filling out a web form, or by sending an email to itap@purdue.edu. Its only by your feedback that Purdue can really understand how important something is to you. There is quite a bit of truth to the saying "A squeaky wheel gets the oil."