Tuesday, August 28, 2007

Help Help My Shortcut's Repressed!

Well here is another quirky thing that happened on the way to the getting work done. My friend was using Windows XP sp2 when he suddenly noticed he could not right click on the desktop and create a new shortcut. Google searches returned nothing for a fix on this, so I resorted to some trickery to try to find out what was actually launching the shortcut wizard. I fired up Spy++ (included with Visual Studio .NET) and found that the process for the shortcut window was "RunDll32.exe" . Now we're getting somewhere. RunDll32.exe is basically a kickstart for other programs (DLLs). Now a Google search on RunDll32 and shortcut returned this url:

Now he was able to run the command:
RunDll32.exe AppWiz.Cpl,NewLinkHere c:\

and it actually popped up the wizard! So now we have a couple options - create a bat file on the desktop that just calls this wizard or actually get to the root of the problem and fix it. We choose the latter. Most quirky windows problems stem in the registry so I did a find for: "NewLinkHere" and the first place that popped up was:
HKEY_CLASSES_ROOT\.lnk\ShellNew

It has the following REG_SZ (string) entry:
Name: Command
Data: rundll32.exe appwiz.cpl,NewLinkHere %1

Luckily this was missing from his registry. Once he added it, it worked! Just for stuff and giggles a second find in the registry returned the same string in the location:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.lnk\ShellNew


So if you find you are missing the Wizard of Oz er Shortcuts, check your registry.

Friday, June 29, 2007

CryptoAPI is not available - I'm boned!

I currently use Symantec PCAnywhere (10.5) on Windows XP (SP2, however this problem occurred on SP1 as well) to manage various servers. However we also use the Novell client on our work machines. What do these two have in common? Well it means that the sys admins can push junk to your machine without your knowledge. In this case I rebooted my machine today and something was pushed to my machine that caused PCAnywhere to stop functioning. Every time I launch the application and try connecting to a host using Symmetric encryption I get the following error:
Cannot launch because encryption level Symmetric cannot be initialized.  CryptoAPI is not available.  Object already exists.

In the past I had received this message and even went so far as to reinstall PCAnywhere, but to no avail that failed miserably. The first time I got this I said, "I'm boned" and did many Google searches. I came across a post that was completely unrelated to PCAnywhere, but had a brief message about CryptoAPI. I have long since lost this url, however the answer is still fresh in my mind. It turns out that PCAnywhere Symmetric encryption relies on RSA info located at:
c:\documents and settings\[USERNAME]\Application Data\Microsoft\Crypto

This folder contains another folder called "RSA" . To fix your problem, just rename the folder (or delete it, but better safe than sorry if something else breaks - you have been warned!). The next time you launch PCAnywhere and try to connect to a server, the RSA folder will be recreated and you will be all set!

Success!

Wednesday, March 21, 2007

Hootie Rules!!!


Well I'm in the midst of a Sungard Higher Ed conference in Las Vegas now and I have to give props to SCT for putting on a concert with Hootie and the Blowfish. Prior to their arrival on stage was a comedian Frank Caliendo who was awesome! He had actor voices down perfectly. I would highly recommend seeing him if you get a chance. Now back to Hootie. They played a good mix of their new and old stuff and came out for 2 encoures - good job guys! Here is a vid I took on my super schweet S1IS.

Thursday, February 15, 2007

Cairngorm, good to the last drop, or just a drop in the bucket of other frameworks

Well tonight I, along with my comrade in arms Brian, braved the wintery weather of NYC to go to a Flex conference hosted by the New York Flex User Group. This was my first visit to the group and I am fairly new to flex so I thought that this would be a great opportunity to see what others are really doing with flex. Tonight's topic: Moving to Cairngorm, by Michal Glowacki. Right off the bat you can easily tell that Michal is quite intelligent. He was one of the cofounders of the Cairngorm framework (which was eventually bought out by Macrobe and is still in use today by Adobe).

Basically this framework works as a means of standardizing the location of code when developing projects. With this framework he breaks it up into three layers: View, Control and business logic (I know this is not what he said, I'll have to fix this later, but this is the essence of it). In short you put all your display code in one folder, the handling of 'gestures' (button clicks, mouse movements etc) in another, and any other business logic in a third. The really good part about this framework is that if you have multiple developers working on a flex project, they can all work on separate pieces without stepping on each other's toes. However, if you are a single developer or your application is very small, this is basically overkill. Michal opened by saying that if you include all of the Cairngorm libraries, your movie size will be 300k+ larger - yikes. Perhaps he meant source code size, but it wasn't clear. I know you can just import the libraries you need so that problem is out the window.

I won't delve too much into the actual presentation, but just a note for any future developer/presenters, not only does PowerPoint kill, but if you code an application from scratch in front of an audience, yes it is quite a feat, however it is boring as hell to watch. Just show the audience the end product and explain each piece, or save a few lines for the audience and then wow them with the result, or show a completed product and ask the audience for suggestions on what to build into it.

So overall here is a quick breakdown of Cairngorm:
  • Great for multiple developers
  • Crappy for single developer shops, or very small applications
  • Don't bother retro fitting existing applications (Michal basically dodged a question as to whether it was worth rewriting existing applications)
  • New applications or potentially complicated applications can benefit from a standardized framework of code - not necessarily Cairngorm, just a standard framework

[rant]NOW for the rant of the day - DO NOT come out with a radically different framework when going from version 2.0 to 2.1. That is just stupid. What good is a standardizing framework if it keeps changing??? UGGG - I won't be using this framework until version 20, or whenever they decide to make it consistant.[/rant].

OK any advocators of Cairngorm who wish to turn me around feel free to post. I just don't see it - maybe I'm just a flex neophyte, or maybe it was the cold weather (and stepping in a very cold puddle), but I just don't see it yet...

Want to play with Cairngorm:

Thursday, January 11, 2007

Windows XPSP2 and SQL Server 2000 - Evil?

<rant>XP SP2 IS EVIL - read more to find out why<rant>

I knew there was a reason why I held off on upgrading to SP2 on XP. I know sp2 has been out for many months, but I knew that it was evil when I first upgraded my home machine months ago and it fried it (BSOD - had to do full reinstall). So naturally I was apprehensive when it came time to upgrade a desktop at work (we are being forced to upgrade our machines to sp2). Well I figured that I would run the installer myself so I could tell right away what breaks. Running the installer went ok and after several reboots I killed the windows firewall and restarted my ZoneAlarm and then started SQL Server 2k and CF 7. Suprisingly all started fine. However when you try to connect to a datasource defined in the CF admin, I kept getting an error about not being able to connect. Within my CF admin, I was connecting to 127.0.0.1 on port 1433 as a normal sane person would.

Ok so after bashing my head against the wall and trying all of the "fixes" by microsoft which all regard adding ports to the windows firewall (which is disabled I remind you) I took a stab in the dark. I added datasources to the ODBC control panel in the System tab since that can connect to (local) and CF can connect to it via ODBC connectors. One more note, I still can't connect to my server via 127.0.0.1, rather I have to use (local). Now inside the CF admin I connect via ODBC and everything is fine. This is one more annoyance that Microsoft has given me. GRRRRR.

If anyone has a solution to this I would greatly appreciate it.

Sunday, January 07, 2007

SQL Server 2000 Massive Transaction Log Fix

Ahhh the sweet smell of a full hard drive - isn't wonderful, NOT (think Borat). Ok so today I was checking out a computer running SQL Server 2000 when I noticed that an application was throwing errors that the disk was full.

I took a look and sure enough it was! I knew this box was getting low on space for a while, but I ignored it (not a production box, just a test). I tried to clean up space the usual windows way, run the low disk space cleanerupper. Then I went through and looked for logs in various applications and wiped them, but this was not enough.

Then I did what is one of the more clever things to happen to the windows search - a search based on file size. It has been in windows since at least 2k, but I'm pretty sure it was there in 98. I looked for files greater than 100mb and sure enough an 8GB file popped up at the top. What was it? well my SQL Server 2k transaction log (.LDF) for a database that has fairly high traffic. Since this is a transaction log in general you don't want to just wipe them. I did a couple google searches (<rant>btw Microsoft's MSDN site sucks for SQL server - at least in this instance. They had a dozen articles on shrinking the db, but not one that actually showed a command to do it. Anyone can talk about theory, but just a simple example would be nice.</rant>).

Ok well now it has been about a half hour and I came across:

This was perfect (and at least 2 pages in on my google search). From the page:
In SQL Server 2000 Query Analyzer run the following command (doesn't matter what db you are in):
backup log [database name] with truncate_only
(don't include the square brackets)

Open Enterprise Manager and navigate to your database:
--Right click on the database
--Highlight 'All Tasks'
--Choose 'Shrink Database...'
--On the bottom of the window on the right, click the 'Files' button
--In the drop down at the top make sure you choose the '_Log' option. By default it is the '_Data' option
--Leave the shrink action as: 'Compress......'
--Click 'OK'

At this point depending on the size of the file, it may take a minute or two or more and then it will give a success message. I took a look at my LDF file again and it went from 8gb to ~2mb.

Success!! Now rejoice by clicking the play button below (this is in my head every time I do something successfully)!

Wednesday, January 03, 2007

MythTV Part II - Getting the remote to work

I love ravioli. What does that have to do with getting a remote to work within MythTV on CentOS - absolutely nothing, but it was really good for dinner tonight! Whew I feel better, now on with the show!

Getting my Hauppauge IR Blaster (aka remote) that came with my Hauppauge WinTV PVR 150 to work has been the bane of my existance since my last MythTV post. When I first started, I saw that Jarod Wilson explained how to set up LIRC using YUM here and suggested using the following:
yum -y install lirc-kmdl-$KVER
yum -y install lirc

I ran that and it seemed to install properly. I then ran the following:
cp /usr/share/doc/lirc-*/remotes/hauppauge/lircd.conf.hauppauge /etc/lircd.conf

and that too worked. Then as per the instructions I added code to my /etc/modprobe.conf so that lirc would load before ivtv. Now my /etc/modprobe.conf looks like the following:
alias eth0 tulip
alias snd-card-0 snd-emu10k1
options snd-card-0 index=0
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-emu10k1 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
alias usb-controller ohci-hcd

# LIRC stuff
alias char-major-61 lirc_i2c

# ivtv modules setup
alias char-major-81 ivtv
alias char-major-81-0 ivtv

# LIRC stuff
install lirc_i2c /sbin/modprobe ivtv; /sbin/modprobe --ignore-install lirc_i2c

Then finally I tried to run:
/sbin/depmod -a
/sbin/modprobe lirc_i2c

to start up the lirc stuff and no dice, I received the following errors:
lircd: could not open /dev/lirc
lircd: default_init(): No such device


After much searching it turns out that the version of lirc_i2c that you use must be compiled with the same compiler that your os was compiled with (or something to that effect). So then I thought that I should take the plunge and compile it myself. Nothing like rolling up the sleeves to get down and dirty. But before I try to get down and dirty, I want to know what I'm getting into so after uninstalling the lirc stuff via yum, I proceeded to check out this very skimpy how to guide by mythtv.org - here. I was hoping for something a little more in depth so I then checked out the install guide provided by LIRC themselves here and that was great. I downloaded version: lirc-0.8.0 (the latest stable at the time). NOTE: 9/2/2007 - these instructions work with lirc-0.8.2 as well) After extracting all of the files to a folder on my desktop (yep the desktop - it's the Windows in me), I then proceeded to follow the "Compiling" instructions on the LIRC site listed above. I ran:
./setup.sh

and the wizard popped up and I populated all of the necessary fields and chose to have it run the configure (since it autopopulates the config options). Now it was either at the "make" step where I received an error something to the effect: "lirc_dev: class_create failed" This was bad. I spent many an hour searching for the fix to this. Then I tried just going into the code of the installer where it said it had the problem and just commented out the lines. What's the worst that could happen - well it bombed in a second point and I killed that line too. Then it worked! Well before I get too happy I tried "make install" and that ran. This was too good to be true, but there had to be a reason for those lines of code so I tried to run:
/sbin/depmod -a
/sbin/modprobe lirc_i2c

but that bombed out too. Ok it looks like those lines were really meant for something. So I backed out:
make uninstall
make clean

and Googled some more.

Then I finally came across: RE: Centos 4.3/4.4 unable to compile any LIRC version (0.7.2, 0.8.0, CVS). It wasn't my version, but heck it was worth a look. The problem as I found out was in the installer scripts on the lines I commented out. "...the recent kernel has two new functions and macros (named class_create and class_destroy) which conflict with the same lirc functions." His suggestion was renaming the functions by prefixing it with "lirc_" in every instance and wouldn't you know it, that worked!

The two files that needed changing are:
[installer location]/drivers/kcompat.h
[installer location]/drivers/lirc_dev/lirc_dev.c

I ran configure/make/make install and everything went smoothly. Then I tried:
/sbin/depmod -a
/sbin/modprobe lirc_i2c

and no errors in /var/log/lircd !!! This was jolly good. I went back to the LIRC site and continued on to installation. They mentioned this and it happened to me - when you first get this running you'll find the lirc running in /dev/lirc but after a restart of services/computer etc, for me it is now running in /dev/lirc0 . This is important, because when you want to start up the daemon later you need to point to the device like this:
lircd -d /dev/lirc0

After testing with mode2 and irw it was back to Jarod's guide to continue with getting it to work with MythTV.
wget http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt
mkdir ~/.mythtv
mv lircrc-haupgrey.txt ~/.mythtv/lircrc
ln -s ~/.mythtv/lircrc ~/.lircrc

This is great at this point I tried running MythTV and my remote was working! Ok so the next logical step is to make sure this works after a restart - well for me it was a bust. I have a feeling that it has to do with order of startup and using something like rc3.d (which I don't know about yet). So what I did when I got the machine up and running was open a terminal and run the following commands manually:
/sbin/depmod -a
/sbin/modprobe lirc_i2c
lircd -d /dev/lirc0
echo 16384 > /proc/sys/vm/min_free_kbytes
/sbin/depmod -a
/sbin/modprobe ivtv

This seemed to work sometimes (sometimes the remote would only work with mode2 but not MythTV). So then I thought about doing something like a startup script and putting them in there. After searching, it appears that there is a startup script area within ~/.kde/Autostart where you can throw an executable .sh file and it will run at some point during start up (I'm not really sure when). I created: myth-load.sh with the following:
#!/bin/bash

# Only do this stuff if we're on the main display
# (i.e., don't do this in a vnc session)
if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
echo "myth-load.sh starting..."

echo "loading lirc..."
# Load LIRC (remote control)
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe lirc_i2c"
/sbin/modprobe lirc_i2c
sleep 4s
echo "running: lircd -d /dev/lirc0"
lircd -d /dev/lirc0
sleep 4s

echo "loading ivtv..."
# Load IVTV (capture card)
echo 16384 > /proc/sys/vm/min_free_kbytes
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe ivtv"
/sbin/modprobe ivtv
sleep 4s
echo "myth-load.sh completed"
fi
exit

Now I have the "sleep" in there just to make sure everything has a good enough amount of time to run. It is probabaly not needed. Now one note about shell scripting that I fell prey to because I was borrowing an example without fully understanding what a command does - If you use an "&" after a command like this:
/sbin/depmod -a &
lircd -d /dev/lirc0

then BOTH command will run simultaneously. The one with the "&" is set as a background process. This was messing me up for a long time. As of tonight and a couple restarts later I am not having any problems with my remote.

WHEW!