SQL Server – count the records in every table in your database

Posted by Andy on January 24, 2012
Computers / No Comments

Here’s a script to create a simple text-based report containing the record counts for every table in your database:

SQL Server – kill all processes connected to a database

Posted by Andy on April 27, 2011
Computers, Software Development / 7 Comments

Below is a little script to kill all the processes which are currently connected to your SQL Server database.  I’m posting this mostly for myself for future reference.  The preferable way to do this is to use the alter database set single_user thing, but that doesn’t always work, so this is the “drastic measure” option.

Window Mobile (6.5 and below) Development Tips

Posted by Andy on September 01, 2010
Computers, Software Development / No Comments

I wanted to link to a few good blogs/articles regarding the wonderful world of Windows Mobile  development.  I’m not talking about Windows Phone 7, this is the old-school Windows Mobile 6.5 and below.

This first article has some must-know tips for writing Windows Mobile apps that can run on either the full or compact frameworks.  Following these conventions gives you the ability to run the same application on either a Windows Mobile device or emulator, or as a full .NET framework desktop application (without re-compiling or re-configuring).

Write Code Once for both Mobile and Desktop Apps

Of course, you can’t have this both ways:  You cannot run full-framework code on Windows Mobile, you can only go in the other direction and run CF code on the full framework.

This next article (written by the lead developer at my company Blue Dot Solutions), shows how to setup Visual Studio to debug .NET CF apps on your PC, rather than the emulator.  This is a super-useful trick that makes Windows Mobile development much faster, and almost tolerable.

Deploy to My Computer

The following articles talk about “provisioning” of Windows Mobile devices.  “Provisioning” is a term you don’t hear too often, unless you work in an “enterprise” environment.  Provisioning has to do with the initial configuration of a device (applications, settings, etc.) by the manufacturer, or continuous setup and configuration by an administrator or user.  There are several industry standard mechanisms for provisioning devices, and Windows Mobile supports several of these, including OMA Client Provisioning and OMA Device Management (among others).  This set of documents is pretty poorly organized, but it contains a ton of really useful information, and provides examples on all the different things that you can provision.

Managing Windows Mobile Devices

Configuration Service Providers

I hope to add more links as I come across more information.


The quest for MacOSX 10.5, Apache, Python, Django, and mod_wsgi

Posted by Andy on October 02, 2009
Computers, Internet, Software Development / 4 Comments

It all started when I decided to learn the Django web framework for Python.  I ran through a bunch of examples on the Django site, and in the book Practical Django Projects, Second Ed. and was overall really impressed with the framework and the provided tools.  It has a lot of really useful features, and makes web development a lot of fun.  During my “evaluation” of Django, I was testing everything using the out-of-the-box dev web server that comes with Django, but I eventually came to the point where I wanted to try to host a Django site “for real” in Apache.  I checked the Django deployment documentation, and decided to try to get the suggested mod_wsgi module setup in my local Apache web server, on my Mac Mini (version 10.5.8 – “Leopard”).

At that time (a few hours ago), I was using the default install of python that came with my Mac Mini: version 2.5.1.  I thought it would be a good idea to download and install the latest version of Python (at least the latest 2.x version, as the 3.x versions are still not fully supported by most Python toolkits), so I could be on the bleeding edge.  Little did I know that the latest version 2.6.3 was being released as I spoke (Oct 2)!  I went to download the 2.6.3 version, and found that the MacOSX .dmg download link was broken on the Python download page.  (This will probably be fixed by the time anyone reads this, but this link was throwing a 404 error when I tried!).  Since the .dmg was not available, I had to give up on the “easy route.”  The only download of 2.6.3 available was the source code .tar.gz.  After download this and screwing around with it for awhile (couldn’t figure out exactly which options to use in configure and make…), I decided to chicken out and look for the most recent version that provided a .dmg install for Mac.  2.6.2 from April 2009 had a .dmg, so I went ahead an installed that.  After removing the default /usr/bin/python related links, I now had a new install of Python 2.6.2 in /usr/local/bin.  So far so good.

The next step would be to get mod_wsgi setup in my current Apache install (version 2.2).  I followed the directions on the mod_wsgi install documentation, and almost got through them.  I read through the MacOSX-specific install instructions, and didn’t really see anything that applied, so I figured I was okay.  I modified the httpd.conf file to load the mod_wsgi module, and this is where the fun started.  When I tried to restart Apache, I got the following error:

httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf:
Cannot load /usr/libexec/apache2/ into server:
dlopen(/usr/libexec/apache2/, 10):
Symbol not found: _PyExc_RuntimeError
  Referenced from: /usr/libexec/apache2/
  Expected in: dynamic lookup

I searched around for some more info, and after reading through a bunch of blog posts and forums, I learned that this was most likely happening because the Python shared library was only build in 32-bit mode, whereas, the default build of Apache on MacOSX 10.5 runs in 64-bit.  At least that’s what I made of it, not sure if that’s completely accurate…  The docs on the mod_wsgi site for MacOSX mention that you need to add extra -arch flags to the Makefile when building mod_wsgi for 64-bit, but that wasn’t the problem.  Those flags were correctly generated by the configure script, and my library was built with full 32 and 64-bit architecture support.  The problem appeared to be that when Apache tried to load the, the was trying to load the default Python library, which was only built for 32-bit.

I searched around some more, and found this excellent blog post: on this very subject.  The post describes the exact problem I was having, and provides the steps necessary to build Python in the full “fat” architecture (all 4 archs), as well as mod_wsgi.  I was about to try out the described steps, when I noticed a link to another blog:  This procedure seemed much simpler, so I decided to try that first.  It would involve over-riding the default launchd configuration for Apache, so that the process would be launched in 32-bit mode, rather than 64-bit when the Mac starts up.  I tried this out and eventually got it to work, but the problem with this is that if you do a “sudo apachectl restart”, it ignores your launchd configuration and starts apache up in the normal 64-bit mode.  I decided to give up on this and keep looking.

I then found this blog post:  This post presents a novel idea:  avoid all the trouble with 64-bit, and just dumb Apache down to the sane level of 32-bits!  I’m not sure why Apple decided to have Apache run in 64-bits when everything else basically runs in i386 (32-bit) mode.  I thought this might be a nice, simple approach, so I’m going to give it a whirl…

This post is already too long, so I’ll post an update if I come up with any new information!

Tags: , ,

The Web of the 90s (Web0.9beta)

Posted by Andy on May 09, 2008
Computers, Internet / No Comments

I just read an article: “RIP Web Trends of the 90s,” and it reminded me how much I miss the earlier days of the wide world of webs. (Not really…) I’m talking about the 90s web; the days of old when Prodigy and AOL ruled like kings, and Geocities and Tripod hosted pretty much every personal site, free of charge. These were the days of yore when PCs were a creamy beige in color, and still had that nice 5 ¼ inch floppy drive, which would allow you to store away up to 5 of your favorite animated gifs for future viewing.

Here are a few of the web trends from that great era (some of these are repeats from the article above, but they’re classics, so I thought they were worth reiterating):

  • Animated gifs (as mentioned before) – who could forget that explosion gif featured on the nearly every heavy metal fan page, or that fist gif that was continuously punching its way out of the page? I also like the “Under Construction” banner that everyone used, and the little construction guy, tirelessly working away to finish construction on your Metallica web-ring page (hosted on geocities of course).
  • Webrings – speaking of webrings, what ever happened to those? I guess now that we have these search engines, it’s no longer useful to insert your site into a ring of links.
  • “Best Viewed With” links to Netscape or Internet Explorer. I guess these were probably valid back then – pages probably looked quite a bit different in those old browsers. Interestingly enough, this “Best Viewed With” nonsense went out of style for awhile, but now smug Firefox users are trying to bring it back in an attempt to usurp the dominance of Internet Explorer.
  • MIDI music – before mp3s assumed their rightful place as king of all things downloadable, I remember scouring the web for MIDI interpretations of my favorite songs. These, along with your collection of animated gifs, could be conveniently stored on floppy disk for future listening pleasure.
  • Modem sounds – I have a friend whose cell phone ringer is a recording of the beeps and hissing of an old modem dialing up to the net. I think that’s pretty funny. Now that I think about it, having to dial-up to the internet seems way old, but it wasn’t really that long ago.
  • Hit Counters – on my very first webpage, I felt compelled to include one of those odometer-style hit counters at the bottom of the page (a must for any 90s website). I quickly discovered that I could grant myself instant web credibility by clicking the browser’s refresh button over-and-over in a rapid fashion.
  • <marquee> or <blink> text – The telltale sign of a true 90s website is blinking or scrolling text. Often appearing in the vicinity of a glittery panda gif, colorful rainbow dots, or a barb-wire horizontal divider, the blinking and/or scrolling text adds just the right amount of class to any Web1.0 site.

I guess that about does it, feel free to comment with your favorite Web1.0 (or Web0.9beta if you prefer) trend.