Skip to content →

Month: March 2009

Selecting ASP.Net controls with jQuery

Problem: Selecting ASP.Net controls with jQuery can be difficult due to the horrible id tags created by ASP.Net

Solution: Using xpath for your selector you can get direct access to controls.

example:

$(“*[id$=’controlId’]”)

Leave a Comment

How to read pdfs on your iTouch

Problem: I read alot of books, and lately I have downloaded a couple of the Manning Early Access Programme  books in PDF format. However I wanted to read them on my way to work. (A cramped ride on the London Underground)

Solution: iPod Touch & Stanza. The touch is an incredible piece of hardware and creates an excellent ebook reader. Stanza is an application that you can use to conver your PDFs into ebook format and then share them with your touch. Unfortunately the conversion process does remove alot of graphics, tables and formatting, but apparently this is intended as its trying to get the optimum layout for a micro screen. Any how, this has turned out to be an excellent solution which I am really happy with,

Leave a Comment

Commerce Server CatalogTypes

I can never remember what the different “i_classType” are in the “CatalogProducts” table for Commerce Server 2007, so here they are.

Classification Value
Category 1
ProductVariantClass 2
ProductClass 4
ProductFamilyClass 8
Leave a Comment

Posting to Basecamp using Powershell

Problem:  I want to report to the “business” from our webapplication without having to get involved in the massive nightly reporting process.

Solution: The “business” is already familar with Basecamp, so with a little Powershell and a couple of scheduled jobs we can post summary reports to Basecamp for everybody to see.

$request = "<request><post><category-id>10574251</category-id><title>This is a test message</title><body>This is the body of the message</body></post></request>"

$uri = "http://yourbasecampurl/projects/yourprojectid/posts.xml";
$username="username";
$password="password";
$usernamePassword = $username + ":" + $password;
$mycache = New-Object System.Net.CredentialCache;
$uri = New-Object System.Uri $uri ;
$credentials = New-Object System.Net.NetworkCredential($username,$password);
$mycache.Add( $uri,"Basic" ,$credentials);
$encoding = New-Object System.Text.ASCIIEncoding
$headerValue = "Basic " + [System.Convert]::ToBase64String( $encoding.GetBytes($usernamePassword)  );
$req = [System.Net.WebRequest]::Create($uri);
$req.Method = "POST";        
$req.ContentType = "application/xml";
$req.Credentials = $mycache;
$req.Headers.Add("Authorization",$headerValue);
$writer = New-Object System.IO.StreamWriter $req.GetRequestStream();
$writer.WriteLine($request);
$writer.Close();
$response = $req.GetResponse();
$receiveStream = $response.GetResponseStream();
$reader = New-Object System.IO.StreamReader($receiveStream, [System.Text.Encoding]::UTF8);

Write-Output $reader.ReadToEnd();
Leave a Comment