Thursday, December 16, 2010

Sitefinity Twitter Control

My latest submission to the Sitefinity Marketplace:

Sitefinity Twitter Profile Widget Control
CodePlex Project - Sitefinity Controls

Friday, December 10, 2010

Windows 7 Keyboard Shortcuts

Win+T will cycle through taskbar programs. This is similar to just hovering over the item with your mouse but you can launch the program with Space or Enter.
Win+Home minimizes all programs except current the window.
Win+Pause/Break will open your system properties window. This can be helpful if you need to see the name of a computer or simple system statistics.
Ctrl+Shift+Esc will open the task manager.
Alt+Shift+Num lock opens the virtual mouse.
Win + Left : move application to left 50% of your screen.*
Win + Right : move application to right 50% of your screen.*
Win+Space to glance at your desktop.
Win+Shift+Left or Win+Shift+Right will send the current window to the other monitor.
Win + TAB = similar to Alt + TAB, but fancier.

Thursday, October 7, 2010

VSTO: The breakpoint will not currently be hit.

Problem
Whenever I debug my VSTO project and set a breakpoint I get "The breakpoint will not currently be hit. The source code is different from the original version". It also will never run my new code.

Solution
This occurrs when you have deployed the VSTO solution to your development machine. It runs the deployed code every time instead of your modified code. Remove the installed version and everything will work as expected.

Thursday, July 8, 2010

Calculating batch file elapsed time

Recently I was tasked with writing a rather lengthy batch file and I thought I would output the total elapsed time at the end so the user could see how long it took. Batch files don't have date math so I wrote this batch file to calculate the time for me and display it in minutes, or seconds if less than 60 seconds.

@echo off

REM --------------------------------------------------------------
REM  Elapsed Time Calculator
REM --------------------------------------------------------------
REM  Elapsed time calculator only good for 
REM  time spans that are less than 24 hrs.
REM --------------------------------------------------------------
REM  Inputs:
REM    starttime
REM    endtime
REM --------------------------------------------------------------
REM  Outputs:
REM    Displays processing time in minutes.  
REM    Seconds shown if less than 60 seconds.
REM --------------------------------------------------------------

set /a daysecs=86400

REM --------------------------------------------------------------
REM  Calculate starttime seconds.
REM --------------------------------------------------------------

if %starttime:~0,2% LSS 10 (set /a starthrs=%starttime:~1,1%) 
else (set /a starthrs=%starttime:~0,2%) 
set /a starthrs=%starthrs%*3600
 
if %starttime:~3,2% LSS 10 (set /a startmins=%starttime:~4,1%) 
else (set /a startmins=%starttime:~3,2%) 
set /a startmins=%startmins%*60
 
if %starttime:~6,2% LSS 10 (set /a startsecs=%starttime:~7,1%) 
else (set /a startsecs=%starttime:~6,2%)  
set /a startsecs=%startsecs%+%startmins%+%starthrs%

REM --------------------------------------------------------------
REM  Calculate endtime seconds.
REM --------------------------------------------------------------

set /a endhrs=%endtime:~0,2%
if %endtime:~0,2% LSS 10 (set /a endhrs=%endtime:~1,1%) 
else (set /a endhrs=%endtime:~0,2%)
set /a endhrs=%endhrs%*3600 
 
set /a endmins=%endtime:~3,2%
if %endtime:~3,2% LSS 10 (set /a endmins=%endtime:~4,1%) 
else (set /a endmins=%endtime:~3,2%)
set /a endmins=%endmins%*60
 
set /a endsecs=%endtime:~6,2% 
if %endtime:~6,2% LSS 10 (set /a endsecs=%endtime:~7,1%)
else (set /a endsecs=%endtime:~6,2%)
set /a endsecs=%endsecs%+%endmins%+%endhrs%

REM --------------------------------------------------------------
REM  Calculate total time difference.
REM --------------------------------------------------------------

if %endsecs% GTR %startsecs% GOTO SAMEDAY
if %endsecs% EQU %startsecs% GOTO SAMETIME
GOTO CROSSDAYS

:SAMETIME
set ElapsedTime=0 Seconds
GOTO OUTPUT

:CROSSDAYS
set /a totsec=%daysecs%-%startsecs%
set /a totsec=%totsec%+%endsecs%
set /a totmin=%totsec%/60
GOTO RESULT

:SAMEDAY
set /a totsec=%endsecs%-%startsecs%
set /a totmin=%totsec%/60

:RESULT
if %totsec% LSS 60 (set ElapsedTime=%totsec% Second^(s^)) 
else (set ElapsedTime=%totmin% Minute^(s^))

REM --------------------------------------------------------------
REM  Output total elapsed time.
REM --------------------------------------------------------------
:OUTPUT
echo Total Processing Time: %ElapsedTime%

Thursday, June 24, 2010

Add Stemming or wildcard to SharePoint Search

Out of the box SharePoint does not provide wildcard or partial word search. If you want this to happen you have to either buy a third party product or add items to the search thesaurus for the language you are using.

You can learn how to do this here: http://support.microsoft.com/kb/289652

When you configure these thesaurus files, you can specify synonyms for words so that the Search feature automatically replaces words in a query with other words that you specify.

Pre-fill New List Item

Have you ever wanted to pre-fill a form with a link? There is handy little jQuery addin that will do the trick for you with minimal effort: http://spff.codeplex.com/

The SharePoint Form Field Assistant (SPFF) can be added to any new or edit form in SharePoint 2007. With SPFF loaded, you can manipulate form fields through query string parameters.

For example, you just add a query string item for the name of your field and what you want the value to be: ...NewForm.aspx?Title=NewListItem&Name=Joe Jones

SharePoint 2007 Calender Reminders

SharePoint 2007 does not come with the ability to add reminders to calendar events. If you want to have a reminder for one-time or recurring event you will have to get creative, write a timer service, or buy a third party product. Here are options for all three:

Creative Approach
You can use a task schedular outside of SharePoint and provide a link in the reminder email that leads them back to a SharePoint site or list. The link can also pre-fill a NewForm using a little jQuery.

Timer Service Approach
You can create a custom timer to evaluate a calendar and send reminders for all events due on that day. Here is an article on how to do that: http://msdn.microsoft.com/en-us/library/cc406686.aspx

Third Pary Approach
The leader in this area seems to be a product called Pentalogic Reminder. It can be pricey but if it will do everything you are needing to do except create a new item in an existing task list. It will only send emails. http://www.pentalogic.net/sharepoint-products/reminder