Monday, June 04, 2012

Solution-ish: CF10 SQL Connection Timeout After VPN Disconnect

When doing CF 9&10 development locally I would constantly run into a SQL connection timeout issue where any page that required a database connection would throw the following error.

Error Executing Database Query.

[Macromedia][SQLServer JDBC Driver]The requested instance is either invalid or not running.
My initial searches for solutions to get right back to work weren't fruitful and the only thing that worked for me was a full machine reboot. Sometime last week I got fed up with doing full reboots and spent a little more time digging. Before I had attempted to restart the usual suspect services: CF, CF ODBC, SQL, etc. but it wasn't until I read an article that mentioned DHCP that I thought to restart the DHCP Client service. Bingo! Maybe there's a more elegant solution or I'm missing some simple configuration option somewhere as other people who work similarly don't have this timeout issue. However, if you run into this issue there's a good chance that you just need to cycle the DHCP Client service anytime you disconnect from the VPN.

SQL: Adding and populating an order column in an existing table

Found this post in my drafts folder. I don't remember doing this, but I might as well put it out there.

I'm sure I'm going the long way around the tree here, but recently I had to add an OrderId column to a table where I was going to implement ordering that hadn't been there before. In my brain I was sure I could just temporarily change the column to an identity column so that SQL could do the initial ordering for me. I'd then remove the identity from the column and allow my users to change the OrderId. SSIS didn't agree. Maybe it was the lack of sleep or caffeine. So, here's how I ended automating this process. If this was SQL 2005+, I'd be able to use some nifty functions, but in SQL 2000 they don't exist.

UPDATE [mytable] set orderid = rank
FROM (
SELECT t1.RecId, t1.CategoryId, t1.RecName, COUNT(*) AS rank
FROM [mytable] t1, [mytable] t2
where t1.CategoryId = t2.CategoryId and t1.RecName <= t2.RecName
GROUP BY t1.CategoryId, t1.RecId, t1.RecName
)
o where [mytable].RecId = o.RecId

Thursday, May 26, 2011

When Shockwave/Flash Breaks in Chrome

Just a tip, if Shockwave/Flash breaks in Chrome, you can restart just that plugin and refresh your pages (no need to restart all instances of Chrome).

When Chrome is in focus, press shift-esc, find the plugin "Shockwave Flash", click on it and press "End Process". Reload your page and you should be good to go.

Thursday, February 10, 2011

Windows 7 New Folder Lag - Solution

Recently at work I've been doing tasks that require me to download files into specifically named folders. Creating new folders from the download dialogue was really frustrating as it would take up to a minute from the point of clicking "New Folder" to the time I got the prompt to name it. This issue only cropped up after the first time my computer hibernated (which is every evening).

A little Googling later and here's the solution:
  1. In an Explorer window, make the Menus visible by clicking Organize - Layout - then checking Menu bar.
  2. Now click the Tools menu and select Folder Options...
  3. Click the View tab.
  4. Scroll down and check [ ] Launch folder windows in a separate process.
Go ahead and uncheck your Menu bar to get back to normal looking folders.

Thursday, October 07, 2010

SMTP Development Solutions

I needed to send mail for a user control I was writing and since the move to Windows 7, I hadn't yet figured out what to do about W7's lack of a SMTP server.

Here are two solutions that I found and I'm kind of on the fence about:

The first is a full blown local SMTP server called, Free SMTP Server and I've used it in the past. Not much to say here. It just works.

The second, smtp4dev,  is interesting in that it doesn't actually send email messages. This is great, for when you are just testing the format of a message and would typically go through multiple revisions that you'd then have to delete. Sure, it's a minor irritation to find those emails peppered among your other daily messages, but another benefit is that smtp4dev sits in your system tray and can be configured to display the "email" as soon as it is received instead of you having to browse to your email client and open the message. My only wish is that there could be a "we'll do it live" switch that would actually send the email for those cases when your email needs to be processed by another system. I don't like the idea of installing two SMTP servers.

MD Hands-Free Details

In case you were wondering about the new hands-free law as I was:
Prohibiting a driver of a motor vehicle that is in motion from using the driver's hands to use a handheld telephone except to initiate or terminate a wireless call or to turn on or off the handheld phone; providing that a violation of the Act may be enforced only as a secondary violation; establishing penalties of $40 for a first offense and $100 for a second offense; prohibiting a driver of a school vehicle or a holder of an instructional permit or provisional driver's license from using a handheld phone while driving; etc.
Source: http://mlis.state.md.us/2010rs/billfile/SB0321.htm

Wednesday, November 25, 2009

Wednesday, July 29, 2009

Vim Non-Greedy Search

Just a self-post here to help serve as a reminder that the non-greedy search operator for vim is .\{-} instead of the .*? in most languages. This was useful when attempting to replace bad image paths for a template file that contained lots of images that were hosted on various servers and I wanted to consolidate them to get around security warnings. The search command string in vim then ends up as:
:/src=\".\{-}\.\(gif\|png\|jpg\)\"/
This can be combined with a search and replace command as:
:%s/src=\".*\(\/.\{-}\.\(gif\|png\|jpg\)\)\"/src=\"myimagelocation\1\"/gc
Oh, and a super nice thing to know is that you can copy and paste from the cmd line in vim by hitting ctrl-f to open a new cmd window. This is great for saving thost extremely wordy vim regexes that you need to type over and over.

Monday, April 13, 2009

Wednesday, February 04, 2009

I need to learn Vim

Today I stripped out lines not containing a certain string, removed all text but the codes I cared about from every line, sorted the remaining lines while removing duplicate lines and it only took 3 commands.

In short, I need to learn Vim.

Monday, December 22, 2008

8-bit Holiday Cheer

Love 8-bit NES-style music? Love Christmas tunes? Well, in another Reese's moment, you just got your 8-bit in my holiday cheer.
Just in time for Christmas, it’s the full version of 8-Bit Jesus: Classic Christmas Songs in the Style of Classic NES Games. This full release contains 18 tracks total, including improved variations of a few of the original nine!
[DoctorOctoroc.com]

Wednesday, December 10, 2008

Selling 32GB 1G iTouch

Anyone looking to pick up a slightly dropped 32 GB 1st generation iTouch? I'm going to post it on eBay if no one's interested.

Wednesday, December 03, 2008

Ever have one of those days...

... where after talking to a friend at lunch you go back and listen to the first album your band ever recorded and you think, "I'd sure like to get the band back together!"?

Yeah, me too.

Tuesday, November 18, 2008

Star Trek

Wasn't that excited about this until I saw the 2nd trailer!
http://ping.fm/pFJKi

Thursday, September 18, 2008

Outlook 2007 Search and RDS Ctrl-Alt-End

I don't know why this is so hard for me to remember, but maybe blogging about it will help.

Searching a date range in Outlook 2007 can be accomplished with the following syntax:
received d:(>=08/01/2008) received:(<=08/31/2008)

Sending a ctrl-alt-delete key combination to the machine you are remoting into is accomplished by pressing ctrl-alt-end.

Quiz me later!

Monday, September 15, 2008

Vista WS4 Bug

I ran into a bug in Vista this weekend. This is really the first major bug I've seen (if you don't count the EXTREME slowness in IE 8b with the Google toolbar loaded) and after hours of troubleshooting I was tempted to go buy another license of XP. The problem was only cropping up when I tried to create a folder, move a file or delete a file. Only. In any of those instances, the Explorer window involved would hang. The file operation would complete, but the prompt or window would stay unusable. If I killed the Explorer process and ran a new instance, then the computer ran just fine until the next rename, move or delete. Then I'd have to kill Explorer and kick off a new process. In short...this really stunk up a weekend where I had several hours of development that needed to be done.

I spent several hours revering to various restore points, but the problem always remained. It wasn't until early this morning that I found a forum post that indicated that Window Search might be the problem. In the case of the forum poster it was an upgrade that solved his problem. For me, I downgraded by uninstalling Windows Search 4. My initial test delete worked like a champ so I went to bed. I really hope that fixed the problem and I can get back to work this evening.

Tuesday, September 09, 2008

SQL: Replace strings for TEXT datatype

There might be a simpler way to do a replace of all occurences of a string in a SQL TEXT field, but this is the solution I came up with way back when. I needed it again tonight so I figured I might as well pin it to the interwebs.

-- UPDATE [TableToUpdate]
-- SET [Column] = cast(replace(cast([Column] as varchar(max)),'[StringToReplace]','[ReplacementText]') as text)
-- WHERE [Column] like '%[StringToReplace]%'

Tuesday, September 02, 2008

Google Chrome

Downloading and installing Google's new web browser, Chrome.

Sunday, August 24, 2008

Prius crisis averted. It's too much money and the Element looks brand new (to me) again after a weekend of cleaning.

Friday, August 22, 2008

I need an intervention, otherwise I might start payments on a Prius this weekend...