Friday, November 30, 2007

WebLoad posting form data as files for Ajax applications

I have an application that is doing and Ajax callback XHTMLrequest to an .ashx handler. Web launch WebLoad to record an agenda to capture the Ajax posts WebLoad was recording the agenda using the CopyFile function similar to:

CopyFile("wl3941127422.dat","wl3941127422.dat")

After digging I found out that there was a setting in the recording options "Record unknown post types as file". I un-check this settings and tried again to record the agenda an changed the way the form was posting recording the actual form data in the JavaScript Agenda.


Change this setting by going to:

WebLoad IDE --> Tools --> Recording Options --> Post Data --> and un-check the "Record unknown Post Types as File"

Thursday, November 29, 2007

Google's Grand Central - The New Way To Use Your Phone Number

I recently got an invitation to use Google's GrandCentral online service that allows me to pick a phone number and have it forward to any telephone I want. It simply can be your only phone number for life. At any time you can change the forwarding number.

I used to have AT&T VOIP service and they have an online service where I can check my incoming and outgoing calls, check voice mail and other similar functions.

GrandCentral can send all your voice mails to your e-mail so that you don't miss a voice mail message.

What I think is best is the availability to block callers, reject calls, send calls to your voice mail.

This is how it works:

Caller calls your GrandCentral number  GrandCentral calls your phones  You get a call and you take an action

Here is a screen shot of the control panel:
Google Gran Central Control Panel


So far the service now is for free for one phone number. However, when it comes out of beta I am not sure how much they will charge for the service.

Tuesday, November 27, 2007

How to use the SubSonic Collection Find() method with Predicate

Here is a code example to find a particular item within a collection of entities.




Instead of creating a loop to go over the collection to find your entity, you can take advantage of the Predicates.

Model.Person foundPerson =(Model.Person) personCollection.Find(delegate(Model.Person e) { return e.FirstName == "John"; });




I hope this is helpful. I did not find anything in the SubSonic forums regarding the Find method. This worked for me instead of creating a loop to go over all items in the collection.

Monday, November 26, 2007

SubSonic Updated Templates to Delete Entities With Children

In a recent project that I worked on I had a need to delete a top entity that had multiple children. With the generated code out of the box from SubSonic I found it difficult to delete the parent entity and all the children that depend on the parent entity since I had to specifically invoke the child entity for a delete operation. So I decided to mess with the templates. In particular with the 'Controller' (CS_ODSController.aspx).

I decided to create a method named "DeleteWithChildren()" that will take the primary key id of the parent entity to follow the same controller pattern already in place similar methods.


DeleteWithChildren() will go load the parent entity using the primary key and then invoke the corresponding controller class for each of each children.

For example,



public void DeleteWithChildren(object keyID)
{

// Load the entity
MyCompany.Model.Employee entity = new MyCompany.Model.Employee(keyID);

foreach(MyCompany.Model.SiteEmployee child in entity.SiteEmployeeRecords)
{


MyCompany.Controller.SiteEmployeeCtrl.Instance.DeleteWithChildren(child.SiteEmployeeId);

}


}




This allowed me to simple invoke the parent entity controller such as Controller.ParentEntity.DeleteWithChildren(5000); and have the controller delete everything the hangs off the ParentEntity object by calling the DeleteWithChildren() method for each child. This allows to delete hierarchical entities.

You can download the template file from my online box here.

My template was code to first check that a transaction was started since you might not want to attempt to delete everything from that entity without a transaction.

Dell Inspiron 1720 Windows XP Pro Working Audio Driver SIGMATEL STAC 92XX

After wiping out Windows Vista and installing Windows XP Pro SP2 in my Dell Inspiron 1720 I found my self in trouble. I could not find any where in Dell's web site or forums the driver for the sound device for my laptop.

After several hours of search and trying different drivers I found a driver only available in Dell's German Language for the SigmaTel sound card R153908.exe.

You can download it from Dell's website here or you can get it from my online box here.
Just donwload run the file it will extract all the files to a directory default "c:\dell\drivers" and the setup will be launched.

Wednesday, November 21, 2007

Free Screen Capture For Windows - Cropper

Cropper is an open source screen capture tool written in C# .NET that allows users to mark a region in their desktop and take a screen capture and save it to any image type format.

Its simple, light weight and its free.

Cropper was support for plug-ins (extensions, add-ons what ever you want to call it). You can create your own extension in .NET to enhance the functionality of cropper.


I used it for my development for to take a snapshot of an error for example and then automatically uploading the capture image to the issue management application such as “Mantis”.

Compare to SnagIt, cropper does not have all the features in SnagIt out of the box but there are several extensions for cropper our there that can provide a similar functionality. You’ll find the plug-ins download sites here.

Friday, November 16, 2007

Agile Testing: Performance vs. load vs. stress testing

Here is a good blog about performance and load testing for web applications.

Agile Testing: Performance vs. load vs. stress testing

I am currently working on adding load to an application I have been working for the past six months.
So far I can say that this is probably one of the most time and effort consuming phase of the entire project for me. Lucky I have WebLOAD to create the load scripts and simulate the user for the application.

WebLOAD was easy to get started. Initially I could not getting it work under Windows Vista but when I had my new machine with Windows XP it worked like a charm.

WebLOAD can connect to the web server and collection metrics. It also shows you a nice graph of all the stats collected.

When adding load to the application I was able to identify potential issues what would come up once we bring the application live.

Where I am having some difficulties is identifying the state of the application. I am trying to identify what is an acceptable response/performance so that I can say "The web servers can support x number of concurring users" Or "If you want to support x number of users" here are the specs you need for the web servers.

If any has a good experience with loading testings such as what are the key metrics to collection, please shared them with the public.

Thanks!

xplorer² (Windows File Manager Replacement)

Since I was introduced to Xplorer2 my a friend at work, I have not gone back using the traditional windows explorer.

The first thing I do when my boot my laptop when I get to work is "Ctrl + space which launches the bad ass launch and then I type "xplorer" to open Xplorer2.

Xplorer2 allows you to have dual panes so that you can navigate multiple directory structures. With dual panes you can transfer files from one location to another simply by using the F5 shortcut. You need need to open another windows explorer window.

In the Xplorer2 address bar of your path location you can set filter so that you only see the files you care such "D:\Music\*.mp3 to display all the mp3 files in the Music directory.

The find window allows you to enter multiple filters so that you can find exactly what you are looking for.

Xplorer2 files search dialog


Xplorer2 is $30 bucks and its worth it.
You can download the trial version here.

Thursday, November 15, 2007

String.Format() JavaScript equivalent to .NET

Here is a JavaScript function to format strings on the Client-Side as if you were using in the the .NET String.Format() method in your code-behind.




String.Format = function()
{


// Check for arguments
if( arguments.length == 0 ) return null;
// Get the string which is the first argument
var stringToFormat = arguments[0];
for(var i=1; i < arguments.length;i++)
{
var replaceExpression = new RegExp('\\{' + (i-1) + '\\}','gm');
// Replace argument
stringToFormat = stringToFormat.replace(replaceExpression, arguments[i]);
}

// Return the formated string
return stringToFormat;

}



Alternative you can used the JavaScript prototype framework 'Template' object to do string formatting using variable names instead of argument indexes.

See http://prototypejs.org/api/template for the Template object API.

Wednesday, November 14, 2007

A long night fixing defects....

We did it again...

We work all day yesterday from 7:30am to 10:30am fixing all possible defects log in our defect tracking application "Mantis". We are in a code freeze phase and we are fixing the issues logged from the user acceptance testing group.


Eric Flores working late
Here is Eric with his krispy kreme hat. All happy about staying late fixing all the defects. Eric is great an paying attention to details and can really put him self in the shoes of the user. Its important to have someone like him in a team.

Tuesday, November 13, 2007

Enabling/Disabling ASP.NET Checkbox in client side via JavaScript

If you are wondering why you cannot disable and enable a simple asp.net checkbox in IE using simple script like this...




function ToggleEnableCheckbox(checkboxObj)
{

checkboxObj.disabled = !checkboxObj.disabled;
}





Well the answer is because IE goes one level up and also adds a span which wraps the input checkbox.

<span disabled="disabled">
<input id="myCheckbox" disabled="disabled" type="checkbox">
</span>




To make it work in IE you also need to update the parent node node.




function ToggleEnableCheckbox(checkboxObj)
{

checkboxObj.disable = !checkboxObj.disable;
checkboxObj.parenNode.disabled = !checkboxObj.parenNode.disabled;
}





This was a pain in the beginning until I looked at the output html source of the page. First procedure works fine in FireFox but IE adds the disabled attribute to the span, therefore you have to compile for both browsers.

I hope this helpful.

The next step is to create your own checkbox list control that inherits from the ASP.NET Checkbox List and override the source writing for better simplicity.

Good Luck!

Visual Studio .NET environment fonts that don't hurt your eyes.

After working long hours in the Visual Studio .NET 2005 environment the default colors and environment settings start hurting your eyes.

When working with Alex Lee with Ruby on Rails for his game, I started using E-text editor. I found that "E editor" had a nicer and less ease to your eyes environment with a black background and multi-color fonts. During the day I used Visual Studio .Net 2005 and sometimes in the afternoon I was using E. So I decided to make the environment match so that the transition was not harsh.


Visual Studio .NET 2005 Class Editor Colors:
Visual Studio .NET environment fonts and colors


Visual Studio .NEt 2005 html source editor colors:
html source editor colors


You can download my font setting here.
Use the visual studio Import settings utility under the Tools menu to import the fonts. For the text I use a MONACO font not install in Windows XP by default. You can also download the font here.

Thursday, November 08, 2007

Inspiron 1720 with Windows XP nVidia GeForce 8600M GT driver

About a week ago a got my new Inspiron 1720 laptop from dell.
Of course dell push me to Window Vista Home edition but we all know that developer's cannot work with this. I was running Window Vista Business edition in my previous laptop a Lenovo 3000N100 which a got to say that it was a piece of junk. My friend Alex got the same Lenovo machine and he blog about how bad the keyboard is. Read he's blog post here.


As soon as I open the box with my new Inspiron 1720 I fire it up with the Windows XP Pro CD.
I had difficulties installing the Windows XP Pro, since the laptop was targeting Vista. But thanks to some blogs out there I finally got it working.

However, the trouble came when installing the drivers. Dell doest not have any driver downloads at there website for Window XP operating system, therefore, I had to search the entire internet.

I tried several nVidia drivers from http://www.laptopvideo2go.com/ but what got it working for my nVidia 256mb 8600M GT graphics card was the driver version 163.75 with the modded inf file.

You can download the driver here from the http://www.laptopvideo2go.com/

I hate that Microsoft and the retailers are trying to get everyone stuck with Vista.
I don't have any problem with Vista. But as a developer I need to used reliable tools and applications and many out there are still not up to date for Vista.

If laptopvideo2go.com is down, you can download the driver here.
The modified .inf file you get download it here.

Good luck!

Tuesday, November 06, 2007

SubSonic - Using the Exist() Method using predicates

Here is a simple example on how to use the Exist() method that hangs of the collection entities generated by SubSonic.




for (int i = 0; i < originalentitycollection.Count; i++)
{
Predicate exist = delegate(Model.Person match)
{
if (match.PersonId == originalentitycollection[i].PersonId)
return true;
else return false;
};


if (!distinctpersoncollection.exists(exist))
{

distinctpersoncollection.add(originalentitycollection[i]);
}
}





You can visit MSDN for more information about the predicate delegates:
http://msdn2.microsoft.com/en-us/library/bfcke1bz.aspx

Saturday, November 03, 2007

How secure can you get with PDF files

You have an application that provides a service for your customers where your users are allowed to download a produced pdf document by your application.

To protect your business you need to secure and protect the output PDF documents as much as possible. But can you really protect a PDF document?

Let's step back for a second....

The application's requirement is to protect the produced document and restrict user's from modifying the document. At the same time the produced document needs to be in a standard format that an average user with internet access can download. Oh and did I mentioned that the output document can be many pages long.

We know our constraints:
  • Standard format
  • Average internet user( that means non-technical users)
  • Many pages long

This means we cannot produced a proprietary document that can only be view with a in house viewer. It cannot be an image since it's many pages long. That leaves us with PDF documents.

Yes we can secure a PDF document with Adobe PDF Digital Right Management (DRM).
But at the same time there are several application out there that can removed the protection of the PDF document.

How can you prepare and handle this situation? Well I still have not figure it out. If you can think of a better alternative please comment in this blog.

The reality is that once your document goes out from your control. In this once the user has downloaded the document they can do anything! They can print it, ORC, modified and re-used it. Of course that will mean that the user is violation legal rights.


As the article at this link mentions " The only way to keep PDF secure is to keep it your self"
www.cs.cmu.edu/~dst/Adobe/Gallery/PDFsecurity.pdf


Friday, November 02, 2007