Friday, March 22, 2013

Crazy vim one line expression to search for something and replace it with a different search relative to the first match

vim search to find idnum=XXX& and replace the XXX part with a search from the line before that line of i=999:


:%s/\(idnum=\)\@<=[^&]\+/\=matchstr(getline(search('\(i=\)\@<=\d\+','b')),'\(i=\)\@<=\d\+')/

And it's much easier to explain that it was to figure out how to do it, or how it looks.

If anyone has an easier way, I'd love to hear it. I'm not very happy with the "getline" having to do the same search backwards, but I couldn't figure out the syntax for .-1 (by itself errored, ".-1", '.-1', "."-1 all failed).

Tuesday, October 30, 2012

Road Closures in Montgomery County

The following roads are closed or have a portion closed due to water, trees down, or wires down.

** As a reminder, Montgomery County urges residents to stay in a safe place and avoid traveling today. Hazards including winds and flooding may still occur and create unsafe road conditions. **

Flooded Roads -
• Howard Chapel Rd.
• Edwards Ferry Rd.
• Emory La.
• Gold Mine Rd.
• W. Old Baltimore Rd.
• Newcut Rd.
• Zion Rd.
• Brookeville Rd.
• Kensington Pkwy.
• Quince Orchard Rd.
• Log House Rd.
• Brighton Dam Rd.
• Gue Rd.
• Elton Farm Rd.
• Fleming Ave.
• Brink Rd.
• Stockton Rd.
• Riffle Ford Rd.
• 25815 Woodfield Rd.
• Strathmore Ave. @ MD355
• Colesville Rd. (a mile north of University Blvd, just south of Lockwood Dr)

Tree Down w/Wires -
• Chesterfield Rd.
• Peach Tree Rd.
• Watkins Rd.
• Brink Rd.
• Astoria La.
• Davis Mill Rd.
• Arrowood Rd. @ Kittery La.
• 5950 Grosvenor La.
• S. Glen Rd. @ Glen Mill Rd.
• MacArthur Blvd. @ Whiterim Dr.
• 13108 Brandown Wayr
• 5310 Oakland Rd.

Tree Down –
• White Ground Rd. @ Schaffer Rd.
• 12700 Middlebrook Rd.
• Montgomery Village Ave. @ Walkers Choice Rd.
• Shiloh Church Rd. @ Conrad Springs
• Scenery Dr. @ Germantown Rd.
• Peachtree Rd. @ Comus Rd.
• Doubleland Rd. @ Frontwell Cir.
• W. Old Baltimore Rd. @ Peachtree Rd.
• Twinbrook Pkwy @ MD355
• Hipsley Mill Rd. @ Damascus Rd.

Park Roads –
• Little Falls Pkwy.
• Beach Dr.

Re-Opened Roads –
• Arcola Ave.
• Georgia Ave.
• Killdeer Dr.
• Westlake Dr.

Thursday, April 5, 2012

Catch 22

How am I supposed to complain about this:

Usually snarky comments go up on Facebook, but they expect that I can wait a "few hours" before whining to the world?

Wednesday, March 28, 2012

The NOT IN clause in LINQ to SQL

Just what the Doctor ordered.
Programmers used to write SQL queries often want to know a LINQ syntax equivalent to the SELECT NOT IN clause in SQL. Marco Russo : The NOT IN clause in LINQ to SQL
Still can't completely wrap my mind around the LINQ dynamic sometimes, so glad we have Google and people who still blog about solutions.

Thursday, March 15, 2012

C# – Keep user settings between versions

Unless you’re using the ClickOnce deployment method for your applications, user settings are usually not transferred when updating to a new version of a C# desktop application. There’s in fact a quick and simple way to always keep the settings between versions.
The trick is to call the .upgrade() method your app settings object. The system will look for previous versions of your application in the App Data directory and copy the user settings to the new version automatically.

Thanks NGPixel, *bawk* *bawk*.

Wednesday, August 24, 2011

New Laptop, New Skin

The other day a couple people I know got brand new laptops from Dell. Made me think, it's about time for me to upgrade as well. My work laptop always seemed to have some kind of issue, and after a year and a half, it seems like a good idea to start fresh. With so many new laptops, how would I be able to easily tell mine from the rest? (Since I thought I had the same model they did, though it turned out I didn't) All I need to do is skin it! Back in the day, my main laptop had a nice skin:

Working hard

Though clearly I had too much hair, and not enough beard... Those two items rectified, and new skin ordered from the same website, but now with a much more Islamish look:

New Laptop Skin with Peter Gould art!

The artwork is courtesy of Peter Gould, a contemporary Muslim artist from Australia who works in multiple media. Seriously, as good as it looks on a wall, or your PC desktop, or even your Facebook buddy icon, it looks très sharp skinned on the back of my laptop. Sidi Peter mentioned something about vinyl stickers that he's working on, and will be available in a few months, though I know I'd like to see him hook up with Skinit somehow, to make his art available for all kinds of devices, and make sure he gets a piece of the action for his hard work and talent, though I have no idea how he would even start. And if you're thinking about just snagging the art from the website and using it without permission or licensing, know that it wont' be as good quality, and you won't be doing yourself any favors.

Friday, August 19, 2011

Woo hoo! Dialog and error are gone!

This was a crazy one to fix. For years, sometimes when building a "setup" project in my VisualStudio 2005 solutions, I would get a bizarre SQL Tools error via a Dr. Watson dialog. Somehow on my old machine I made the dialog disappear, but the building always reported "1 failed" even though it actually built the project. This month I got a new laptop, and the dialog is back. So I tracked down a fix. There were 2 suggestions regarding a user group SQLServer2005NotificationServicesUser$COMPUTERNAME, and either giving it extra permissions or adding the logged in user to the group. Neither of those worked. But here is what worked (and saved here for future reference):
The installer runs for SQL Server 2005 Tools (64-bit) and comes up with0:Watson 1:1304 2:StreamSupportFiles 3:streamBinaryToDisk 4:55:e:\sql9_sp2_t\sql\setup\darwin\sqlcastub\streamca.cpp 6:238 7:sqlcastub.dll 8:sqlrun.msiWhen clicking ok, I get 'Error writing to file: . Verify that you have access to that directory. [ http://connect.microsoft.com/VisualStudio/feedback/details/327997 ]
The recommendation is to:
Please refer to workarounds mentioned in this thread - http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=113155
Which details the issue again with a recommendation from Microsoft to:
This appears to be an issue with the SQL install. Specifically, there seems to be a problem with the install mergemod.dll. Installing a later version of mergemod.dll seems to fix the issue. You can install a later mergemod.dll by installing Orca: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/orca_exe.asp
So it's off to install Orca, however the page to install Orca points out it is only available via  Windows SDK Components for Windows Installer Developers, so let's go install that, except of course the link doesn't go to the download page, it's over at Microsoft Windows Software Development Kit (SDK). Excellent, easy enough, however first, apparently, I need to upgrade to Microsoft Visual Studio 2008 Service Pack 1.

Now if you are anything at all like me (which apparently is not likely) then you're likely thinking, this is crazy, how on earth could this cookie crumb trail of suggestions lead to anything that would solve my problem, but lo and behold! Problem fixed. No dialog. No error.

And now saved here, so next time I can just look at my blog for the fix.