Greg's Blog

helping me remember what I figure out

Upgrading to Lenny

| Comments

It’s been while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came across some minor issues and these were resolved in minutes as opposed to hours.
  1. MySQL : failed to start, complaining about:[code]/etc/init.d/mysql: ERROR: Using expire_logs_days without log_bin crashes the server. See README.Debian.gz[/code] Commenting out the expire_logs_days in the my.cnf file allowed me to restart MySQL.
  2. After the upgrade of Apache, my virtual hosts weren’t working. A quick search via Google pointed me to this post - a quick edit of all of my host files and it was all working again.
  3. the php-mysql connector somehow hadn’t been upgraded/installed so a quick[code]apt-get install php5-mysql[/code]fixed that problem.
  4. OpenBD : the only thing that remains broken was my tomcat5.5 Open BD install. Tomcat was working fine but Open BD refused to start up complaining about :[code]javax.servlet.ServletException: Open BlueDragon Engine Failed to initialise tags: java.awt.Color[/code]Since I am not really using it, it’s not that important, but at some stage I’d like to get it working again. If you have any suggestions, please leave a comment.

SVN : Authentication With a Windows Domain

| Comments

Finally got round to implementing this for work. As a starting point I followed the instructions found here. The config looked fine, but after restarting the service, I still wasn’t getting prompted for a log in. After re-jigging the order to what you see below and restarting the apache service (we are using 2.0.59), it all worked. Maybe this will help someone else along the way. [code] DAV svn # any “/svn/foo” URL will map to a repository /usr/local/svn/foo SVNParentPath {drive letter}:/path/to/SVN/epositories/ AuthName “SVN” AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIOfferBasic On SSPIOmitDomain on SSPIDomain <domain controller> SSPIBasicPreferred On Require valid-user [/code]

Gnumake: *** No Rule to Make Target `all’

| Comments

I was using MacPorts to install ICU and Jam. After running the installer for the first time I got the following error message: [code]sudo port install icu jam Error: Target org.macports.build returned: shell command ” cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source” && gnumake all ” returned error 127 Command output: sh: gnumake: command not found [/code] Oops forgot to install XCode (you always forget to install something on a new machine :)). Quickly ran the XCode installer, however when I ran the command again I got a new error: [code]sudo port install icu jam —> Building icu Error: Target org.macports.build returned: shell command ” cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source” && gnumake all ” returned error 2 Command output: gnumake: *** No rule to make target `all’. Stop. [/code] Turns out you need to do a cleanup before attempting to run the command again: [code]sudo port clean –work icu —> Cleaning icu sudo port clean –work jam —> Cleaning jam sudo port install icu jam —> Fetching icu —> Verifying checksum(s) for icu —> Extracting icu —> Configuring icu —> Building icu —> Staging icu into destroot —> Installing icu @4.0_0 —> Activating icu @4.0_0 —> Cleaning icu —> Fetching jam —> Attempting to fetch jam-2.5.tar from http://distfiles.macports.org/jam/2.5 —> Verifying checksum(s) for jam —> Extracting jam —> Applying patches to jam —> Configuring jam —> Building jam —> Staging jam into destroot —> Installing jam @2.5_1 —> Activating jam @2.5_1 —> Cleaning jam [/code] Time to continue the Mapnik install.

Joshua Tree National Park

| Comments

[gallery=10]

Up on the 74

| Comments

[gallery=8]

VMWare and Keyboard Input

| Comments

This morning I fired my Windows XP VM on my mac and my keyboard input simply stopped working. After a couple of VM reboots, which had no effect, I did some googling. The first result suggested typing a few commands to determine what had disabled it: [code] $ ioreg -l -w 0 | grep SecureInput | “IOConsoleUsers” = ({“kCGSSessionSecureInputPID”=177,”kCGSSessionLoginwindowSafeLogin”=No,”kCGSSessionAuditIDKey”=0,”kCGSessionLoginDoneKey”=Yes,”kCGSSessionSystemSafeBoot”=No,”kCGSSessionOnConsoleKey”=Yes,”kCGSSessionUserIDKey”=501,”kSCSecuritySessionID”=11622192,”kCGSSessionUserNameKey”=”gregstewart”,”kCGSSessionGroupIDKey”=20,”kCGSSessionConsoleSetKey”=0,”kCGSSessionIDKey”=256,”kCGSessionLongUserNameKey”=”User”}) $ ps auxwwww | grep 177 user 177 7.8 9.2 652520 192788 ?? S 10:51pm 59:09.22 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_110619 user 1155 0.0 0.0 599820 464 s001 S+ 10:44am 0:00.00 grep 177 [/code] According to the post the application that was blocking it was FireFox. “kCGSSessionSecureInputPID”=177 is the info you need to look for, where in my case 177 was the number I needed to use in the next command. Incredulous as I was, I closed FireFox and hey presto keyboard input was working again. Hopefully this post will help others.

AJAX Calls and Expired Sessions

| Comments

I have been updating a bunch of code recently to make use of the new features in Prototype 1.6 and one of the great additions in this release was the introduction of Automatic JavaScript response evaluation. This allowed me to improve on my session checking code without having to fuff around with the response information sent back to the client. The problem was with XHR requests: i.e. if the user initiated such a request when his session had expired, then usually the response would fail or worse just hang. The snippet below shows my new session checking code. [javascript] [/javascript] The trick is to intercept the call when you do your session checking at the back end. Let’s say you have a fuseaction called login.login (see below and yes this is fusebox 3 :S) where you display the login form when a user is not logged in, this is where I inserted the check for an XHR request, by looking at the http headers sent along with the request. The key here is a new header attribute passed in with Prototype “X-Requested-With”. If this attribute exists then I know it’s an XHR request and I can create a custom JSON header with an error struct that holds a key called session with a value of timeout. All I then need to do is encode the struct as JSON and pass that encoded struct back to the browser. [code] xfa.submitform=’index.cfm?fuseaction=login.processlogin’; [/code] Now let’s jump back to the JavaScript code and take a look at the onComplete function again: [javascript] onComplete : function(transport,json) { if(json && json[‘session’]) { setSessionExpired(); } else { //Code to run when the request has completed } } [/javascript] If there’s a JSON object and it has a key of session then I call my setSessionExpired function which redirects the users. Now the json session key only exists in these situations since the call normally just passes back the result of the call.