Javascript bookmark to aid with page layout

A coworker sent me this link.  You just bookmark it, and then click the bookmark when you want to examine the layout of your page elements.

javascript:prefFile='';void(z=document.body.appendChild(document.createElement('script')));void(z.language='javascript');void(z.type='text/javascript');void(z.src='http://slayeroffice.com/tools/modi/v2.0/modi_v2.0.js');void(z.id='modi');

And it will add a little floating window in the upper left corner to show you everything you mouse over:

Advertisements

Excluding weekends from a SQL date range

Recently I wanted to find the time between 2 datetimes, but I wanted to exclude weekends.  To further complicate matters, I wanted to know hours, not just days.

The “standard” way to do stuff like this is to build out a calendar table that has every date for the next 50 years, along with info like “IsWeekend” or “IsHoliday”.

But I found some snippets around that I hoped to use to my advantage, and what I came up with works very well:

DECLARE @start DATETIME
DECLARE @end DATETIME

SET @start = '3/7/08 12:50 pm'
SET @end = '3/11/08 1:50 am'

SELECT (DateDiff(hh, @start, @end) - DateDiff(ww, @start, @end)*2*24)/24.0

I won’t spend a lot of time explaining why it works, but it basically counts the number of weekend “jumps” that are crossed between the 2 dates, and subtracts accordingly.

 

Could not load file or assembly Microsoft.ReportViewer.XXX

Are you getting one of these errors?

Could not load file or assembly Microsoft.ReportViewer.WebForms

Could not load file or assembly Microsoft.ReportViewer.Common

Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectModel

The problem is that some of these assemblies are supposed to be in the GAC, or at least when you create a basic application using .net, the application is expecting to find them.

You can deal with this in one of 2 ways.  You can find and download the ReportViewer.exe from Microsoft on the clients.  Or, you can copy the missing DLLs out of the GAC on your computer, and add them into your project.

Because I didn’t want to have to download extra software to my clients, I decided to take the second option.

To do this, follow the instructions here:

http://www.chrismay.org/2006/08/09/Accessing+DLLs+Stored+In+The+GAC.aspx

To pull the dlls out of the GAC (you can just copy them).

Then add them into your project at the root level (not as references, but just like you were adding another file).  Then, in visual studio, highlight them and select “Copy always” as the option for the “Copy to Output Directory” field.

This will make sure that the DLLs are copied into the BIN directory for deployment.

 

Visual Studio .Net 2008 – Making sense of all the versions

Microsoft really does a terrible job explaining all the variations of Visual Studio .Net 2008 (and there are many):

  • Visual Web Developer 2008 Express Edition
  • Visual Basic 2008 Express Edition
  • Visual C# 2008 Express Edition
  • Visual C++ 2008 Express Edition
  • Visual Studio 2008 Standard Edition
  • Visual Studio 2008 Professional Edition
  • Visual Studio Team System 2008 Architecture Edition
  • Visual Studio Team System 2008 Database Edition
  • Visual Studio Team System 2008 Development Edition
  • Visual Studio Team System 2008 Test Edition
  • Visual Studio Team System 2008 Team Suite

After a lot of searching, I finally found this data sheet that explains most of it.

Why this was so hard to find is anyones guess.

Remove pingback spam from dasBlog

One one of my dasBlog sites that was built before Akismet was supported, I accientally allowed for pingbacks to be tracked.

Ping backs are supposed to happen between blogs whenver you link to another blog article.

It’s really a great idea!  If you are reading a blog post, you might see a list of 4 ping backs at the end.  These URLs are the locations of other blog articles that reference the article you are reading, so you might want to check some of those out to get those authors poing of view on whatever topic is being discussed.

But, of course, spammers ruin it for everyone.

Yesterday I got 18,000 pingbacks from sites selling prescription drugs in a matter of a hour or 2.

So I turned off ping backs, but that left me with a ton of spam to clean up.

Lucky for me, someone else has already run into this, and built a tool for stripping it out!

Really nice!  The only problem I found was that it didn’t report issues with my config file (I had a bad character in there).  Actually, it WOULD report them, but would immediately begin processing the files (with no patterns to match against) so you couldn’t tell that it was reporting it.

So if you run into a problem with this tool, try putting in a bad content path.  This was throw an exception and you will have time to read any debug info in the command terminal indicating if there was a problem with your config file earlier in the process.

After I fixed this issue, it worked great!

Thanks!

 

UPDATE: What happened to my drive space (on my Lenovo laptop)?

I recently wrote about some issues I was running into with Lenovo computers losing drive space.

I detailed it in this article:

What happened to my drive space (on my Lenovo laptop)?

Well, I think I found the solution.   My Lenovo came with built in Rescue and Recovery software (Under Thinkvantage).

This software tries to make local backups so you can rollback if you get a virus or something.

The problem is, it is very tricky, and doesn’t let you know that it is eating up your hard drive. 

The files never show up on your C:.  So, right now your C drive might show 80 GB total, 500 MB free… but if you show all files on the C drive, and select the properties of them, they all only add up to 45 GB (where is the rest?).

Well IBM hides these backup files somewhere.  I just noticed now that mine, even though I have never knowingly clicked “OK” when prompted to do a Rescue and Recovery backup, is saving 30GB of backup data.

So if you want to delete these, you can do the following:

  1. Run Rescue and Recovery
  2. Click on Advanced in the lower left hand corner
  3. Click on Advanced (again) in the title bar
  4. Select “Delete backups”
  5. Select some backups to delete.

Thats it!