A Blog by Scott Isaacs

Tag: Development Page 3 of 6

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.

Update #2: More IE Stuff

Early this year I posted a ZIP of stuff for IE context menus.  I just wrote and added another menu item for checking or unchecking any checkboxes in the current text selection.

The file is attached to this post.  Download and use at your own risk.  See readme.txt for summary and instructions.  These will modify your registry and if you don’t know what that implies, then you probably won’t want to install them.

Visual Studio 2005 Toolbox Icons

I’m sure this is something I could fix given some time with my good friend Google, but time is something I don’t have a lot of, and the problem isn’t really that serious — just annoying.

In a nutshell, the icons in my Toolbox (VS 2005, not SP1) are “messed up” — they’re all the same icon (see picture on right).  Does anyone have any suggestions for fixing this?  Especially suggestions that won’t cause me to lose other non-default settings I have changed?

Update: It’s only happening on WinForms apps (web apps are OK), and it is only on three of the control groups in the toolbox: “All Windows Forms”, “Common Controls”, and “Containers”.

ASP.NET Web Application Project Problem/Question

OK, so I have an ASP.NET 2.0 Web Application Project (and here) — opposed to a Web Site Project — that I’m having an issue with.

If I manually add a DLL to the bin folder and navigate to a page that uses it, I get an error:

Could not load type ‘Other.Project.Name.ClassName’ from assembly ‘Other.Project.Name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’

However, if I add a reference to that same DLL in the web app project and navigate to the same page, it works.

What am I missing?  Does adding a reference do more than simply adding the DLL to the bin folder?  Obviously there’s a lot more detail than I’ve described here, but that seems to be the crux of it.

LINQ

LINQ.  Rhymes with Pink.  Maybe my next post will be titled “Think”… [:)]

Based in part on Sean‘s presentation last night, I finally looked at LINQ today for the first time.  As it turns out the latest CTP seems to have been made available for download today.

I’ve looked at it for all of 10 minutes so far, but it looks pretty cool.  I’m a little “behind” on the “future” technology, so I have no idea how performance compares, but it looks like productivity will increase.

Write Some Code — Get 10 Grand

I just read about the “Made in Express Contest” (via Jacob Cynamon).  Summary: write an app in an Express Edition of VS or SQL Server, and you might win $10,000.

Any takers?

More on CS 2.0

OK, so I’ve tweaked the blog skin a little (added a couple things to the side bar), and I’m getting used to it.  I also downloaded this from the CS site.  It lets me type code into my posts and it highlights it for me.  For example:

[code language=”VB.NET”]’ VB
Dim myString as String = “Hello world”[/code]

[code language=”C#”]// C#
string myString = “Hello world”;[/code]

[code language=”T-SQL”]– SQL
select ‘Hello world'[/code]

[code language=”ASP/ASP.NET”]<%’ ASP.NET %>
<asp:Label id=”Label1″ runat=”server” />[/code]

I don’t post a lot of code really, but maybe now I will… [;)]

Mouse Wheel in VB6

Now that VB8 has been out for a few months, and I’m using it as much as I use VB6 (mostly on VB7), I’ve finally found an answer to a problem that has bugged me forever.  OK, well, not forever, but for a long time.

Has anyone ever noticed that the scroll wheel on your mouse doesn’t work correctly in VB6?  A coworker sent me a link today that tells you how to fix that.

So, in case I’m not the only person to not know that such a fix exists (because I never bothered to search), here you go!  Enjoy!

What a great way to end a Friday…  😉

Page 3 of 6

Powered by WordPress & Theme by Anders Norén