Monday, August 13, 2007

Why DRM Sucks!

So here's the scoop. Google video is closing its doors, and when that happens their DRM service will no longer function. Why does that matter? Well even if you shelled out $19.95 or whatever to purchase the video you no longer can view that file.  This is the equivalent of having Bestbuy go out of business, and all the DVD’s you’ve every bought from them melt inside the case… bogus!

 

Ars Technica Article

 

 

Thursday, June 14, 2007

Using SharpDevelop as a Portable App

Lately I’ve been messing around with SharpDevelop.  Mainly because I think I’m going to pick Boo as my one new programming language each year.  As part of my research I’ve discovered that it can be used as a Portable App.  That is, it can be run directly from a USB thumb drive without an install.  In it’s simplest form all that is needed is to copy the files from the install directory to the thumb drive and away you go.  However if you are using the PortableApps Suite and want SharpDevelop to show up in you menu it’s a little harder.

 

First the PortableApss Suite expects all its applications to exist in folders that end in “portable”.  This isn’t hard to do just create a ShpapDevelopPortable folder under the PortableApps directory and copy the files there.  Now, the second hurtle is that the Suite menu expects the executable to be in that root folder; SharpDevlop is not, it’s in a bin folder.  You could probably move the assemblies to the root directory but it would probable create problems with some of the resource dependences.  So, I decided to create a proxy exe that would call the real one.  Here is the entire source code.

 

/*

 * Created by SharpDevelop.

 * User: Trevor Michealson

 * Date: 6/13/2007

 * Time: 11:17 PM

 *

 * To change this template use Tools | Options | Coding | Edit Standard Headers.

 */

using System;

using System.Collections.Generic;

using System.Diagnostics;

 

 

namespace SharpDevelop

{

       class MainClass

       {

             

              public static void Main(string[] args)

              {

                        string apploc = @"/bin/SharpDevelop.exe";

                            Process SharpDev = new Process();

 

                if (System.IO.File.Exists(apploc))

                    SharpDev.StartInfo.FileName = apploc;

                else

                    SharpDev.StartInfo.FileName =

                    @"/PortableApps/SharpDevelopPortable/" + apploc;

                SharpDev.Start();

               

              }

       }

}

 

 

The if statement determines if you are running from the menu or if you’ve run the exe directly, it gets a different working directory in both.

 

Note: when I brought it to work it ran in completely different working directory.  I’m not sure if this is Windows 2000 or a profile setting but this code did work on both my Home PC (running XP) and my Laptop(running Server 2003).

Wednesday, June 06, 2007

Programmer Personality Type

 

Your programmer personality type is:

   
DHTB

You're a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.


You like coding at a
High level.
The world is made up of objects and components, you should create your programs in the same way.


You work best in a
Team.
A good group is better than the sum of it's parts. The only thing better than a genius programmer is a cohesive group of genius programmers.


You are a li
Beral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We're not writing on paper anymore so we can take up as much room as we need.

 

Get your programmer personality type at

http://www.doolwind.com/index.php?page=11

 

Monday, May 14, 2007

Reporting Services Table Column Headers in Excel

Recently I've been working with SQL Reporting
Services. I have a generally high opinion of
the product, but I have discovered a fairly large
problem. It does not support repeating column
headers when exported to Excel.

What I have found is that this isn't a bug
in fact it was a design decision to put headers
in the repeating rows in order to support
images. With the repeating rows in use;
there is no other way to repeat information
on each page.

The header can be moved to the excel header
by setting the UseSimpleHeader tag in the
device directive, but even then the table
header row won't repeat. My personal
opinion is that this shouldn't be a big deal
because if the report is exported to PDF
the column header repeat just fine, I have
to imagine that plenty of offices won't view
that as an expectable solution.

By the way, I'm not a Reporting Services
expert, if there is something I've missed
please tell me.

Saturday, April 28, 2007

Richmond Code Camp 3

So I decided to skip a session at the Richmond Code Camp, and I thought now would be a good time to write a blog post; so here goes. This is the third code camp here in Richmond and it’s been a great success, other then the fact that it rained for the third time as well. It’s the biggest one yet, or so they tell me, and I love that. The quality of speakers is excellent and just gets better every time, it’s a shame nobody from my office comes with me. My only real gripe is, as always, the name; couldn’t we call it the “Richmond Day of .Net” why must I be ridiculed for trying to better myself as a professional, dang! Oh well, time to head to the next session catchya later.

T

http://www.richmondcodecamp.org/

Thursday, April 12, 2007

Current Tech Podcast lineup

I've become a bit of a podcast enthusiast lately. I'd posted before about
listening to tech podcasts but I thought it was time to revisit the topic.
Now that I actually have an Mp3 player I find myself listening to podcast in
the car as well as at work. They are a great way to keep up with current
trends without having to spend hours a day reading, though I do that too.
So here's a list of what I'm listening too. This list usually amounts to
about five hours of listen time a week which cover my commuting time nicely.


.NET Rocks <http://www.dotnetrocks.com/>
ARCast <http://channel9.msdn.com/>
Hanselminutes <http://www.hanselminutes.com/>
this WEEK in TECH (TWiT) <http://www.twit.tv/>
Windows Weekly <http://www.twit.tv/>

Friday, March 30, 2007

Using Forms Authentication with Callbacks

We use callbacks all over the place in our asp.net applications. Because of
various security and technical concerns we also use forms authentication by
default. Well this creates a problem when the forms authentication ticket
expires. In the traditional model using postbacks when the authentication
ticket expires you are redirected to the login page however when a callback
occurs there is no action by default. After discovering this I began
googling for information and found this blog post
http://blogs.msdn.com/irenak/archive/2007/03/12/sysk-304-how-to-detect-and-h
andle-form-based-authentication-timeout-during-asp-net-script-callback.aspx.
Admittedly it is a little hacky but I think it works well for our purpose.
Read the article, but the jist is this:

Micorsofts callback javascript handler expects a response that either begins
with an 's' for success or 'e' for error. The authentication failure does
not return either of these

To get around you add a handler for the Application_AuthenticateRequest
event in the global.asax. In the handler, write a message to the response
the begins with an 'e' then you can redirect to the login page from within
the the Callback error javascript.

Wednesday, March 14, 2007

Use Once Dialog

In my post on Handling alerts in WATIN
<http://tmichealson.blogspot.com/2007/01/handling-alerts-in-watin.html> I
referenced a class called UseDialogOnce and did not show the code for it.
This is an adaptation of the one that is in the WATIN Unit tests file
IeAndMainDocument.cs

using System;
using WatiN.Core;
using WatiN.Core.DialogHandlers;

namespace Framework.UnitTesting
{

public class UseDialogOnce : IDisposable
{
private DialogWatcher dialogWatcher;
private IDialogHandler dialogHandler;

public UseDialogOnce(DialogWatcher dialogWatcher,IDialogHandler
dialogHandler)
{
this.dialogWatcher = dialogWatcher;
this.dialogHandler = dialogHandler;

if (dialogWatcher != null)
{
dialogWatcher.Add(dialogHandler);
}
}

#region IDisposable Members


public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
return;

}

protected virtual void Dispose(bool managedAndNative)
{
dialogWatcher.Remove(dialogHandler);

dialogWatcher = null;
dialogHandler = null;
}

Wednesday, March 07, 2007

NOVA Code Camp

There will be a Northern Virginia Code Camp on April 14

http://novacodecamp.org

Wednesday, February 07, 2007

Richmond Code Camp

There will be another Richmond Code Camp on Sat. April 28.

http://www.richmondcodecamp.org/default.aspx


For those of you that don't know a Code Camp is really just a one day
conference. There will be five tracks and five sessions. They'll have
breakfast and lunch, and they'll givaway prizes. Best of all it's all FREE.

Hope to see you there.

Trevor

Monday, January 29, 2007

FXCop Custom MSBuild Task

FXCop is great for checking code, and it's easy enough to run the command
line utility from MSBuild. This will run the analysis and produce a report
of all the issues, but this has no "teeth", that is, nothing makes anyone
look at the report and fix the issues. In order to have FXCop actually
break the build you need to write a custom task the following is an example
of a simple task that breaks the build if there are any issues. It does
need to be told where to find the report via the report location property


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.IO;
using System.Reflection;
using System.Diagnostics;
using System.Xml;

namespace Framework.Build.CustomTasks
{
public class CheckFXCop : Task
{


private string _reportLocation;


[Required]
public string ReportLocation
{
get { return _reportLocation; }
set { _reportLocation = value; }
}

/// <summary>
/// Executes the Task
/// </summary>
/// <returns>true if the task successfully executed; otherwise,
false.</returns>
public override bool Execute()
{

bool returnVal = true;
int numIssues = 0;

try
{

FileStream xmlFileStream = new
FileStream(this.ReportLocation, FileMode.Open);

XmlTextReader fxReport = new XmlTextReader(xmlFileStream);

while (fxReport.Read())
{

if (fxReport.LocalName == "Issue")
{
returnVal = false;
numIssues++;
}


}

if (!returnVal)
{

Log.LogError("There are " + numIssues.ToString() + "
FXCop issue(s). Please review the report");

}


return returnVal;

}
catch
{
return false;

}

}


}
}

Thursday, January 25, 2007

Handling alerts in WATIN

Update: I posted a response awhile ago as a new blog entry http://tmichealson.blogspot.com/2007/03/use-once-dialog.html



One of the most common user interaction on a website is the javascript
"alert" funcions.
With a syntect of:

alert('message');

This function displays a message to the user and requires that they click a
button labeled OK before continuing.

Creating an automated test for a website that uses this poses a couple of
problems. First the is no DOM object
for the window, and second the window runs under a different thread then the
main browser window. Luckly any
web automation tool worth its salt will address both these issues and WATIN
is no exeption. The following code is an
example of how to use the alertdialog handler.


using( IE ie = new IE("http://hostname/pagename.htm"))
{


AlertDialogHandler alertDialogHandler = new AlertDialogHandler ();
using (new UseDialogOnce(ie.DialogWatcher, alertDialogHandler ))
{


/*************************************
* -- code to generate alert -- *
* *
* must use the "nowait" to allow *
* the code to goto the next line *
* *
*************************************/

alertDialogHandler.WaitUntilExists();


alertDialogHandler.OKButton.Click();

IE.WaitForComplete();

}

}

Wednesday, January 24, 2007

WATIN vs WATIR

I've been messing about with WATIR for awhile now and am very impressed. Very powerful, very flexible and I love any excuse to learn a new language (ruby). However, most of my coworkers do not share my thirst for knowledge. Nobody seamed interested in the amazing things that I was doing. Guess they were to busy getting the bug count down, forget that what I'm doing could keep it from getting high in the first place. Knowing this I've moved on to WATIN which so far seems to have most of the same features comes with an IDE and intellisense. Oh and lets not forget the US Navy and its list of approved software. The couple of DLLs that make up watin can be included in a project, but I don't think that an entire interpreter could be thought of in the same way.

New Blogger

So I'm on the new blogger now. To be honest, I'm not sure what that means exactly. But hey, if it's new it must be better right?

Monday, January 22, 2007

Super Hero Results

Your results:
You are Green Lantern
























Green Lantern
70%
Iron Man
70%
Spider-Man
70%
The Flash
65%
Catwoman
60%
Hulk
60%
Superman
60%
Robin
47%
Supergirl
40%
Batman
30%
Wonder Woman
20%
Hot-headed. You have strong
will power and a good imagination.


Click here to take the Superhero Personality Test