Tap My Mind

A Blog by Scott Isaacs

Month: August 2007

New Tool: Folder Finder

I’m on a roll here with the little utilities…

My dad called the other day as he was leaving his office (in California).  Due to the nature of his business and the way their network is setup, he and his team work with a large number of folders on a network share.  Each of these folders contains information about a particular project or potential project, and they are all contained within a single parent folder.  For example, the parent folder might be P:\Projects, and there may be hundreds of project folders such as P:\Projects\Project 023A, P:\Projects\Project 023B.  I don’t really know the names of the folders (I just made those up), but the names mean something to him and his team.

At any given time, though, there could be a couple hundred folders in the project folder.  Some come and some go, but overall the number seems to be increasing.  So it is getting harder for them to find the necessary folder when they need to do some work or reporting for that project.

FolderFinderNow, I can imagine that there is plenty of room to engineer some system (or buy something) that will help them better manage this, but what he really needed right away was a faster way to find a folder.  So I wrote Folder Finder.

It’s a very simple app to use and I only spent a couple hours on it.  Basically, you download the app and place it anywhere you want (.NET 2.0 required).  You run it and choose a base folder, which gets saved and re-used each time you run the app (C:\Projects in my example).  Then you just start typing a portion of the folder name.  Since the names mean something to you, just type the part you know.  It doesn’t matter if it is the beginning, middle or end of the folder name.  The list filters automatically.  At anytime you can double click your folder to open it, or if it is the first in the list you can simply press Enter.

That’s it.  All there is to it.  It doesn’t do anything super high-tech or magical.  It just lets them find their folders faster.

So if you want to download and use it, feel free.  As always, use it at your own risk, but I’d appreciate it if you’d let me know if you use it — especially if you have any comments or suggestions.  Also, feel free to share it with anyone who might think it is useful.  If anyone wants the source for any reason, let me know and I’ll make it available.

200

Well, according to my blog control panel, before this post I’ve posted 199 times.  That makes this post #200.  As you can see from the table below, my post frequency had suffered for a number of months last fall and winter, but I’ve been making an effort to pick that up again.  I think my goal is to average at least 1-2 posts per week.

Post Frequency

  Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005   9 14 11 15 13 14 11 6 6 4 5
2006 10 14 6 7 7 4 1 3 4 5 0 2
2007 1 1 1 8 2 4 5 6        

One of my plans for blog topics is to look at my site logs and try to choose topics based on traffic and search terms that lead to the site.  A quick examination, though, leads me to believe that I should be writing more about Chuck Norris.  That can’t be right, can it?

Interop Issue With Winsock

Error: Method ‘~’ of object ‘~’ failed

So yesterday at work, I was working with a sample app from one of our product vendors.  The app was a VB6 Windows EXE showing how to interact with their equipment using sockets — Winsock.  Since I’m under some pretty heavy time constraints, I wanted to make use of this code rather than pick through it and see what’s happening and translate to .NET.  I was able to quickly turn the VB6 Win EXE into a VB6 COM DLL, and tested it from a VB6 test app, and it worked perfectly.  However, when I reference the DLL from my .NET test app, things were not so great.

I had a few methods in the COM DLL that I was calling from my .NET code:

  1. Sub Connect — news up the Winsock object, sets the remote host and port, then connects.
  2. Sub DoSomethingWithWinsock (not the real name, but I don’t have the code here to look up the real name, but rest assured, it was equally as descriptive) — does a bunch of unimportant stuff, and then calls Winsock.Send(…)
  3. Function TestMethod — returns the current date/time as a string for testing
  4. Sub Disconnect — closes Winsock and sets it to nothing

When I call methods 1, 3 or 4 all seems to work well.  When I call method 2 I get the error mentioned above: Method ‘~’ of object ‘~’ failed.

So, two questions to anyone that might read this:

  1. Any idea what the problem is and how to resolve it?
  2. Is there some way I can step into the VB6 code while debugging from VS2005?

I’ve already started picking through the code and rewriting with .NET equivalents, but I was hoping to avoid that.

Update: Sarma, a contractor that I’ve worked with recently, e-mailed me this link that has some good info.  I haven’t tried it yet, but it sounds promising.  If you’re looking to debug VB6 from VS, I’d definitely check it out.  Thanks, Sarma! 

By the way, Sarma was recently looking for a new contract.  If anyone is hiring, contact me and I’ll connect you.

New Tool: App Dashboard

Many times I find myself with way too many files, folders and shortcuts on the desktop for things that I am currently working on and/or testing.  That’s in addition, of course, to the things I have on the desktop because I use them all the time.  Because of the way I’ve grown to work over the last several years, having an overly cluttered desktop makes me inefficient.  In fact, I’ve found that I need to have certain types of icons in certain places, and “empty space” on the desktop in certain other places.

AppDashboard Yesterday, I found myself with too many shortcuts on the desktop, all related to my current project at work.  So I wrote a little utility that I called App Dashboard.  Basically, it’s a series of buttons that launch the applications I previously had a bunch of shortcuts for.  Initially, the paths were hardcoded, but I quickly changed my mind and allowed them to be user defined.  Then I decided that rather than define them in a config file of some sort, to actually create a document type for these groups of applications.

Thus was born App Dashboard.  You can download the binaries and/or the source below (usual disclaimer stuff here — use at your own risk, etc.).

Now I’m a big fan of SlickRun, so you’d think I’d just add MagicWords for these things, but the items I use App Dashboard for are more likely to fall into one of two categories:

  • They are temporal, and will only require quick access for a limited time, and I don’t feel that is worth adding them to SlickRun (just my personal opinion — take it or leave it).
  • They are items that I use a lot, and clicking a button is easier than typing a command when my hand is already on the mouse.  Actually, many of these things have MagicWords already, but switching from mouse to keyboard is a pain.  (It’s the little things…)

However, since App Dashboard has its own document type, I can easily create a MagicWord to open this dashboard or that dashboard.  I see myself using them both in various combinations.

Additionally, I’ve included some basic functionality for associating a file type with the app and for using an identifiable icon for the dashboard group files.  It’s optional, but you can run the install.bat file to setup these file type associations.  The application will work fine without running that, but installing will allow you to simply double click on a *.adsh file to open that dashboard.

Anyway, I welcome any comments or suggestions.  I don’t claim this to be a model example of how to accomplish any particular task.  I only claim that it may help you as it has helped me to keep myself and my computer slightly more organized and efficient.  If not, just delete it.  (Note that if you did run the install.bat file, I recommend you run uninstall.bat before deleting to remove the file type associations.  No need to leave that hanging around in Windows if you decide to not use App Dashboard.)

Google Search Results In Community Server 2007

I was having issues with the built-in search in CS2007.  Basically it was loading a blank page (no HTML at all) instead of the search results page.  I’m sure I could find some info about the issue in the forums, but decided I would take a few minutes to try to implement Google’s Custom Search instead.  I spent more time futzing with the CS files than necessary to figure it out, but in the end the changes were pretty simple.

Step 1: First, sign up on Google to have a custom search engine.  I’m not going to walk through this since it’s not that hard, and I’m sure you’re smart.  After your site is setup, go to the Code link in the control panel.  Expand the “Search box and search results code for your website” panel.  I recommend using the watermark text box because it will most likely match your site better than the other options.

Step 2: Backup these two files: /Themes/Blogs/YOURTHEME/theme.master and /Themes/Blogs/YOURTHEME/search.aspx.

Step 3: Open /Themes/Blogs/YOURTHEME/theme.master and remove the section for <CSBlog:SearchForm … />.  Replace that with code similar to the following, with variables changed based on what you get from Google:

<div id=”Search” align=”right”>  <table cellpadding=”0″ cellspacing=”0″ border=”0″>    <tr><td>      <input name=”q” id=”q” type=”text” class=”searchBox” 
Button=”SearchButton” onkeydown=”javascript:if((event.which
&& event.which == 13) || (event.keyCode
&& event.keyCode
== 13)) {GoogleSearch();return false;}else return true;”
/> </td><td> <span class=”SearchButtonOuter”> <a id=”ctl00_ctl06_ctl00_SearchButton” class=”SearchButton”
href=”javascript:GoogleSearch2();”>Search</a> </span> </td></tr> </table> </div><script language=”JavaScript”>function GoogleSearch2(){window.location =
“http://www.tapmymind.com/blog/tap_my_mind/search.aspx” +“?q=” + document.getElementById(“q”).value +“&cx=014327199496625865409:3nxxz5mvxtw” +“&cof=FORID:10” +“&sa=search”;}function GoogleSearch() { window.setTimeout(“GoogleSearch2()”, 200);}</script><script type=”text/javascript”
src=”http://google.com/coop/cse/brand?form=aspnetForm”></script>

You may have to change some HTML for layout purposes.  I am using the Paperclip theme and this worked for me.  I basically copied the resulting HTML from a source view of the unmodified page, inserting stuff where I thought was appropriate.

Also, the setTimeout was to cause a delay before submitting the form with the Enter key (the whole bit about event.keyCode, etc.) due to some issues I found with IE’s autocomplete not, ummm, completing before the form was submitted.  Also note that I am using the current search URL.

Step 4: Open /Themes/Blogs/YOURTHEME/theme.master and remove then contents of the <asp:Content … /> item — just the contents, leave the asp:Content element itself.  In it’s place add code like this (again, based on what Google gives you):

<h2 class=”pageTitle”>Google Custom Search Results</h2>These results are coming directly from Google’s search engine.  
Consequently, some items do not show up in the results right
away. If you are search for a post you expected to find, but
it is not listed, please try the same search on <a href=”http://blogsearch.google.com/blogsearch?as_q=<%
Response.Write(Server.UrlEncode(Request.QueryString[“q”]));
%>&bl_url=tapmymind.com”>
Google’s Blog Search tool</a>.<br /><br /><!– Google Search Result Snippet Begins –><div id=”results_014327199496625865409:3nxxz5mvxtw”></div><script type=”text/javascript”> var googleSearchIframeName =
“results_014327199496625865409:3nxxz5mvxtw”; var googleSearchFormName = “aspnetForm”; var googleSearchFrameWidth = 500; var googleSearchFrameborder = 0; var googleSearchDomain = “google.com”; var googleSearchPath = “/cse”;</script><script type=”text/javascript”
src=”http://www.google.com/afsonline/show_afs_search.js”></script><!– Google Search Result Snippet Ends –>

Note that I specified the search form name as “aspnetForm” (here as well as in the previous step).  This is the name/id the resulting HTML form has and correctly specifying this allows Google to properly add the watermark, as well as pre-populate the text box with the current search term automatically.

I also added a link to do the same search on Google’s Blog Search (GBS) tool.  I noticed that a post I recently added was not showing in the results because it hadn’t been indexed yet (I assume), but it does show in GBS because of pings that CS2007 sends for me.  So I coded the link to automatically search my site (you’ll want to change the value for bl_url) and the current search term.

Step 5: This step may or may not be important to you, but I also had to modify styles.css for the current theme so that the text box was wide enough to show the Google watermark.  I don’t have that file handy at the moment, but I think I changed the width to 140 or 150px.

As far as I can remember, that’s all I did, and so far it works for me.  I imagine many other people have already tried this and figured it out, but I didn’t bother searching for examples.  I didn’t really test this heavily, so please let me know if you find bugs or have suggestions.  I just have to remember this if I change themes or upgrade CS (hence this post).

Be sure to be aware of wrapping issues with the code I have posted here.  Also, I strongly recommend you backup everything you are going to edit first.  I’m not responsible for any damage you cause to your site.  [:)]

If anyone has an easier way, let me know.

Database Publishing Wizard

I don’t think I’ve written about this tool yet, but it’s one of my favorites.

Microsoft has release (on Codeplex) a SQL Server Hosting Toolkit (it’s free).  The entire toolkit is, I’m sure, full of goodness, but there is one part in particular that I really get a lot of use out of it.  I just shared it with Gerry to help him get his blog back up and running (finally), so I thought I’d post about it here.

The part that I’m in love with is the Database Publishing Wizard (download).  As the name implies, it’s a wizard and it will script out all or part of a database to a SQL file.  If your SQL Server host has installed the corresponding server-side bits, you can publish the database right to your remote DB instead of to file, but I personally like exporting to file.

Anyway, on the first screen you specify a connection to a SQL Server database server (2000 or 2005).  Then you step through a few screens and specify other options, such as which catalog to connect to, which tables to script, the target database version (2000 or 2008), and decide if you want to script the schema, data or both.  Then you “Hit Go” and a moment later you have a single .SQL file, suitable for executing in Query Analyzer, or whatever it is that they call the 2005 version of that.

I’ve used it for backing up a database at a particular point in time, so that, for example, I can revert to a version of the database that matches a particular version of my source (from VSS).  It’s also very handy for moving a database from one server to another, such as what Gerry needed to do.

I can think of a number of things that could be neat features to add, but it could easily get bloated unnecessarily.  So, with that in mind, there are only a couple things that I would like to see changed/added in this app:

  1. Ability to save my settings to a “project file” of sorts.  Perhaps, .DBPPROJ?  I’d rather not have to type in my server name, connection info, and script preferences each time.
  2. I’d prefer the default name for the generated script to be something along the lines of SERVERNAME_CATALOG_yyyymmdd.sql

Those aren’t that big of a deal, really, but I think it would be a relatively small investment on the part of the team that made this thing, and those features could save me minutes of time over the course of a week.  🙂

So if you’re a developer working with SQL Server databases, I’d definitely recommend checking out this piece of free software.

Remember When 56K Was Fast?

Back in the old days (12-13 years ago) my first modem clocked in at a whopping 14.4K.  Soon after I upgraded to a 56K modem and thought I was in heaven.  That’s four times as fast!

Flash forward to today at work when out DSL line was down for a couple hours, thanks to some mistake at CenturyTel.  Normally I would just work offline, but I had a few things I had to do online, so I plugged a long phone cord into the fax machine and used the modem built-in to my computer.

So.  Painful.

I had to send a couple e-mails, which wasn’t so bad, but I also had to download a 5MB file.  It took about 20 minutes.  After the line came back up I downloaded a 50MB file in only a couple minutes.

It just goes to show how spoiled we’ve (I’ve) become.  I’ve heard rumors that some people still use dialup.  Those must be the same people that whip themselves with ropes laced with shards of glass and stuff.

Stupid Things I’ve Done

So I’m starting a new category/tag on this blog.  Based on the title of this post you might have guessed that it’s called “Stupid Things I’ve Done”.  I’ve done a number of Things (capitalized because in this case it is a proper noun) in my 32 years that were stupid, and looking back it’s a miracle I didn’t get hurt or worse.  At the very least I’ve done a number of Things that I just can’t believe I ever thought were good ideas, even if I wasn’t in mortal danger.

Most of these Things are Things I’ve done with a good friend of mine, Jeff.  Now Jeff and I are both people of what I would consider to be above-average intelligence.  However, somehow, without any scientific explanation, we seem to come up with ideas that are stupid.  To my credit, most of these ideas are his, but he’s not here to defend himself, so I shouldn’t really bring that up.

So in this new category, I plan to occasionally add little stories of Things that I’ve done that were stupid.  Granted, I’ve done a lot of stupid things (not capitalized here because these things aren’t stupid enough to be Things), but this will just be some of the stupidest Things.  I imagine that most of these things will only be funny to me, but there may be some lessons that my dear readers can learn from my decision.

The First “Thing”

Like many of the Things that will fall into the Stupid Things I’ve Done category, this first story is about trying to do Something I don’t know how to do.  It’s not that the Thing itself is impossible or stupid — the problem is that I have no idea what I’m doing.  In fact, the Thing is typically a very common thing, which can be easily done by those that are qualified and/or informed.

So the first Thing was actually something Jeff and I tried to do just last night: move his Hot Tub from his old house to his new one — by ourselves.  To give you an idea of our situation, I’ve illustrated the layout of things here.

Looking To The North

lookingnorthAs you can see in this image (click for full size), the Hot Tub is gently nestled into the corner against the back of the house on the west, a fence on the north, and a Large Tree to the east.  Not shown in this image, to the south, is a small sidewalk surrounded by more Large Trees, air conditioning condensers, some garbage cans, and a deck.

Note: His Hot Tub is not really blue.  I just chose blue for this illustration since water is often indicated by a blue color.  See this page for an example.  Also, I don’t remember what color the Hot Tub cover was so I decided that it should be orange.

Looking To The West

lookingwestNow, this image (click for full size) shows what you would see if looking to the west.  It’s here to add a little more perspective and dimension of the Hot Tub, house, fence and Large Tree, as well as illustrate the contour of the yard to the north.  This contour includes a slope, some shrubs, a steeper slope, and another fence before you finally reach more grass at the street level.

Some History

Apparently, two descendants of Paul Bunyan himself carried (literally carried) this Hot Tub into its current resting place.  I haven’t figured out how two people got this Hot Tub into place by themselves without the aide of a crane or chain saw, but that is what I’ve been told.

Flash Forward To Last Night

Flash forward to last night, and Jeff and I find ourselves discovering that our best option* for moving this Hot Tub is as follows.

Step 1: Take down the section of Fence to the north of the Hot Tub, and carefully lay it on the ground for use in Step 7.

Step 2: Pry the edge of the Hot Tub up with a crowbar, floor jack (as would be used to work on your car in your garage), and various scraps of lumber.

Step 3: Slide two long 2x4s all the way under the Hot Tub from the south to the north, such that they are protruding over the beginning of the Grassy Hill.  These 2x4s are to be our “skis”.

Step 4: Use various ropes and straps to affix the 2×4 skis to the Hot Tub.

Step 5: Using a hand truck and our brute strength, attempt to move the Hot Tub away from the House, giving us at least several inches of clearance.

Step 6: Tie more ropes/straps around the Hot Tub, connecting the other end of said ropes/straps to a Dodge Ram (not pictured) parked in the street below the Grassy Hill, Shrubs, Steeper Hill, and Another Fence.

Step 7: Using the Dodge Ram, pull the Hot Tub onto the fence taken down in Step 1.  This fence is now our “sled”.

Step 8: Carefully slide the Hot Tub on its skis on its sled over some other pieces of lumber carefully laid out over the Shrubs (flattening them) and the Steeper Hill between the Grassy Hill and Another Fence.

Step 9: Magic happens.

Step 10: Securely fasten Hot Tub to a trailer on the other side of Another Fence, connect said trailer to the Dodge Ram, and leave.

Conclusion

After completing steps 1 – 5 and part of 8 (Shrub flattening), after moving the Hot Tub a few feet, and after a few visions of falling into the valley that is the Steeper Hill between the Shrubs and Another fence just waiting for the Hot Tub to crash through Another Fence, crushing my ribs into my lungs and heart killing me nearly instantly although it feels like an eternity, but somewhere before Step 9, we decided this was a bad idea.

Jeff is probably making a call to Paul Bunyan’s grandkids at this very moment.

* This really was the best option we could come up with for the two of us to move this thing by ourselves without the help of other strong people, cranes, or massive amounts of steroids.

Powered by WordPress & Theme by Anders Norén