Skip to main content


Showing posts from 2010

Setup Passive FTP on Windows 2003 and IIS6

Two key items need to be completed for this: Configure FTP to use a specific range of passive ports so only a short range need be allowed through Windows Firewall. Setup the passive FTP port range to work through Windows Firewall. Configure FTP to use a restricted range of passive FTP ports By default passive FTP under IIS 6 will use a port in the range 1024 – 65535. When setting your own range of ports the range must be within 5001 – 65535. Enable Direct Metabase Edit in IIS 1. Open the IIS Microsoft Management Console (MMC). 2. Right-click on the Local Computer node. 3. Select Properties. 4. Make sure the Enable Direct Metabase Edit checkbox is checked. Configure PassivePortRange via ADSUTIL script 1. Click Start, click Run, type cmd, and then click OK. 2. Set the directory to Inetpub\AdminScripts. Depending on your system configuration this can either be achieved by entering cd Inetpub\AdminScripts and then pressing ENTER or cd C:\Inetpub\AdminScripts and pressing ENTER or

AJAX jQuery GET caching

It seems the HTTP specification allows anything in a GET request chain to cache the results of a request.  Internet Explorer has apparently been well known for this but now Firefox has started to exhibit the same behaviour. If using jQuery ajax GET requests you need to do this to prevent it:     $.ajaxSetup({cache: false}); In addition, to ensure the results are definitely not cached a random string can be added to the end of the request URL e.g.     var randomNumber = Math.floor(Math.random() * 1000);     var url = targetUrl + '?rnd=' + randomNumber;

Convert Wordpress to Blogger format

Having tried out Wordpress on a cheap host the experience was just too slow so now moving back to Blogger. If for any reason you need to move from Wordpress to Blogger you will need to convert the XML export file. For Small Blogs Wordpress2Blogger web service provides a simple Wordpress to Blogger conversion. Login into your Wordpress blog then goto "Manage" or "Tools" tab and export your blog as an XML file. Now upload the file to Wordpress2Blogger online service to make it Blogger compatible. Download the resultant file and import it into Blogger via the Blogger dashboard. Your Wordpress posts will be imported as drafts, from there you can check and publish then as necessary. This method works for export files up to 1Mb. For Larger Blogs Larger blogs require a different method. Take a look at the Google Blog Converter project. As pointed by Google OpenSource blog this new Open Source project provides the ability to easily move blog posts and comments from

Windows 7 Shortcut Keys

Windows + ↑ (Up Arrow) – Maximize window Windows + ← (Left Arrow) – Snap window to left side covering half of desktop space. Continue pressing the keyboard shortcut will rotate the window between snap to left, snap to right and restore to normal position. Windows + → (Right Arrow) – Snap window to right side covering half of desktop space. Continue pressing the keyboard shortcut will rotate the window between snap to left, snap to right and restore to normal position. Windows + ↓ (Down Arrow) – Minimize the window. Restore to normal size and position if the window is currently maximized. Windows + Home – Clear all but the active window. Windows + Space – All windows become transparent so you can see through to the desktop. Windows + Shift + ← (Left Arrow) – Move the active window to the adjacent monitor on the left for dual or multiple monitors setup. Windows + Shift + → (Right Arrow) – Move the active window to the adjacent monitor on the right for dual or multiple monitors set

SQL Server 2005 Error When Creating SQL Agent Job

I am running SQL Server 2005 Workgroup Edition, I get the following error when creating a SQL Server Agent Job: Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo) Not good! The error can have a number of causes. Solutions include: Installing SQL Server 2005 SP2 (claimed by a number of individuals to work). If you are accessing the SQL Server across a network, logon to the server using remote desktop or similar and attempt to create the job locally.

Environment SpecialFolder directory paths

The Environment.SpecialFolder enumeration can be used to obtain the full path to system special folders. The enumeration includes: ApplicationData Common repository for application-specific data for the current roaming user. CommonApplicationData Common repository for application-specific data that is used by all users. LocalApplicationData Common repository for application-specific data that is used by the current, non-roaming user. Cookies Common repository for Internet cookies. Desktop The logical Desktop rather than the physical file system location. DesktopDirectory The directory used to physically store file objects on the desktop. Favorites Common repository for the user's favourite items. History Common repository for Internet history items. InternetCache Temporary Internet files folder. Programs The directory that contains the user's program groups. MyComputer The My Computer folder. n.b.

HTC Phone Comparison

I currently have an HTC Touch Diamond and have been looking at changing to an Android phone. A quick comparison of the main options of HTC Desire, HTC Legend and HTC Wildfire. Touch Diamond Desire Legend Wildfire CPU Speed 528 MHz 1 GHz 600 MHz 528 MHz CPU Type Qualcomm® MSM7201A Snapdragon Qualcomm MSM7227 Qualcomm MSM7225 Width 51 mm 60 mm 56.3 mm 60.4 mm Height 102 mm 119 mm 112 mm 106.75 mm Depth 11.35 mm 11.9 mm 11.5 mm 12.9 mm OS Windows 6.1 Android 2.1 Android 2.1 Android 2.1 Control TouchFLO 3D HTC Sense HTC Sense HTC Sense ROM 256 Mb 512 Mb 512 Mb 512 Mb RAM 192 Mb 576Mb 384 Mb 384 Mb Internal Storage 4Gb Additional Storage Micro SD up to 32 Gb Micro SD up to 32 Gb Micro SD up to 32 Gb Weight 110 g 135 g 126 g 118 g Display 2.8 in TFT-LCD VGA 3.7 in AMOLED WVGA 3.2 in AMOLED HVGA 3.2 in QVGA Network Tri-band Quad-band Quad-band Quad-band GPS GPS & GPS-A GPS GPS G

Orange Mobile Contract Renewal - Beware

For any existing Orange customers hoping to obtain a competitive renewal on their Orange contract, beware! A number of phone companies commit to providing the same deals to their existing as they use to lock in new customers. Some, T-Mobile for one, even claim to offer better deals to their existing customers. Orange used to be fair handed on contract renewals and would assess past usage, upgrade phones and commitment to future usage on a new contract. This is no longer the case. Their policy is now to base all new deals (both contract and phone) on the past usage, regardless of the new contract value. In addition to this certain phones are flagged so Orange reps are unable to offer competitive deals to existing customers – this applies to the most popular handsets. For a new customer it is possible to obtain an HTC Desire from almost any network for free on a £30 a month contract, this includes Orange on the rare occasions they have any in stock. My mobile usage is average but not

Apple iPhone and iPod WebClip icons

The iPhone and iPod Touch devices allow a user to save a WebClip bookmark to a site on their Home Screen. To specify a bookmark icon for all pages of a web site, place a PNG image named " apple-touch-icon.png " in the root directory of your web site - similar to the "favicon.ico" for site icons. To override the site bookmark icon on a specific web page, insert a <link> element similar to <link rel="apple-touch-icon" href="/customIcon.png"/> within the <head> element of the page. The bookmark icon dimensions should be 57x57 pixels. If the icon is a different size it will be scaled and cropped to fit. Safari will automatically composite the icon with the standard "glassy" overlay so it looks like a built-in iPhone or iPod application.

Programmatically grant user privileges

When installing services, in particular SQL Server, it is a frequent requirement to create a service user and assign certain rights. To assist users during installation it is helpful to gather the required information (e.g. username + password) amd programmatically create the user for them. To achieve this you will need to create the user, assign it to the appropriate groups and grant any specific rights. Granting privileges and impersonation is covered in Corinna John's CodeProject article: How to add a user to the local system using C#: How to add a user to the domain using C#:

Compress and de-compress strings in C#

A collection of resources on compressing and encrypting strings in C#. Microsoft documentation on the System.IO.Compression.GZipStream class: Helpful example class utilising GZip: The GZipStream class is predominantly used for file compression but can be used efficiently for compressing strings of 300-400 characters or more. Below 300 characters there isn’t any measurable gain from the compression and for particularly short strings the compressed version may in fact be larger. Class provided by C Sharp Help : using System.IO.Compression; using System.Text; using System.IO; public static string Compress(string text) {     byte[] buffer = Encoding.UTF8.GetBytes(text);     MemoryStream ms = new MemoryStream();     using (GZipStream zip = new GZipStream(ms, CompressionMode.Compress,

Drop Default Constraint

The basic syntax for dropping a constraint is quite simple: ALTER TABLE {{MYTABLENAME}} DROP CONSTRAINT {{CONSTRAINTNAME}} The problem comes if you have created unnamed constraints as SQL will have assigned a random name. You need to discover the constraint name before you can drop it. To discover the constraint name: SELECT name FROM sysobjects so JOIN sysconstraints sc ON = sc.constid WHERE object_name(so.parent_obj) = '{{MYTABLENAME}}' AND so.xtype = 'D' AND sc.colid = (SELECT colid FROM syscolumns WHERE id = object_id('dbo.{{MYTABLENAME}}') AND name = '{{COLUMNNAME}}') To discover and drop the constraint: DECLARE @defname VARCHAR(100), @cmd VARCHAR(1000); SET @defname = (SELECT name FROM sysobjects so JOIN sysconstraints sc ON = sc.constid WHERE object_name(so.parent_obj) = '{{MYTABLENAME}}' AND so.xtype = 'D' AND sc.colid = (SELECT colid FROM syscolumns WHERE id = object_id('dbo.{{MYTABLENAME}}

Modify local security policy to grant service rights

Specific rights must be granted to user accounts to allow the account to be used to run as a service. There are a number of possible methods. Method 1: Grant rights using Group Policy This can be achieved using group policy: Method 2: Grant rights using Security templates Similar to method 1 but using Security templates to change the permissions on system services.    1. Click Start, click Run, and then type MMC.    2. On the Console menu, click Add/Remove Snap-in.    3. Click Add.    4. Select the Security Configuration and Analysis snap-in, and then click Add.    5. Click Close, and then click OK.    6. In the MMC, right-click the Security Configuration and Analysis item, and then click Open Database.    7. Give a name for the database, and then browse to where you would like to store it.    8. When prompted, select a Security Template to import. For example, the "basicwk.inf" contains values fo

SQL 2005/2008 Ad hoc access to OLE DB provider has been denied

I have a previous post on enabling adhoc access for SQL 2000 ( ), SQL 2005 and 2008 are a little different. SQL 2005/2008 returns the following: SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online. To enable OpenRowset and OpenDatasource: Launch the "SQL Server 2005 Surface Area Configuration" tool. Click "Surface Area Configuration for Features" Select "Server Name > Database Engine > Ad Hox Remote Queries" Tick "Enable OPENROWSET and OPENDATASOU

Free Port Scanner

Concerned about open ports and security problems. You can make a start with the free port scanner provided by Security Metrics . They offer two flavours of scan, either home or business. Home Quick Port Scan of 22 ports Immediate results Security recommendations available via email Business For Webmasters, Network Administrators, and Executives - test up to three  servers. Comprehensive - Port Scan - 65,535 TCP ports & many UDP ports - Thousands of Vulnerability Assessment tests - Mail Proxy test for open relays - Test for hundreds of default username/passwords - Website html spidering for XSS & other leaks Email notification when the tests are completed Upon authentication you will receive complete vulnerability assessment results

jQuery Lightbox Scripts

jQuery Lightbox Plugin jQuery lightBox plugin is simple, elegant, unobtrusive, no need extra markup and is used to overlay images on the current page through the power and flexibility of jQuery´s selector. lightBox is a plugin for jQuery. It was inspired in Lightbox JS by Lokesh Dhakar. Supports: images. Main site: Fancybox FancyBox is a tool for displaying images, html content and multi-media in a Mac-style "lightbox" that floats overtop of web page. It was built using the jQuery library. Licensed under both MIT and GPL licenses Supports: images, HTML, iFrame content Main site: Shadowbox Shadowbox is a web-based media viewer application that supports all of the web's most popular media publishing formats. Shadowbox is written entirely in JavaScript and CSS and is highly customizable. Using Shadowbox, website authors can showcase a wide assortment of media in all major

Windows 7 Disable UAC

Particularly when using a PC for development purposes the inbuilt user account control ( UAC ) can be a pain. The following steps will disable UAC completely, the same process can be used to reduce the level of UAC on the system. Choose "Start" Enter "Action Center" in the search box Press Enter Click "Change User Access Control settings" Move the slide to "Never notify" Click OK Restart the PC

Enable IIS in Windows Vista

In Windows Vista and above all of the available features are installed by default but aren’t necessarily enabled. By default IIS is disabled in Windows Vista, the following steps will allow you to enable the feature. Open Control Panel Click "Programs" Click "Turn Windows Features on or off" Expand "Internet Information Services" Expand "Web Management Tools" Tick "IIS Management Console" Expand "World Wide Web Services" Expand "Application Development Features" and tick ".NET Extensibility" and ASP.NET Expand "Common Http Features" and tick "Default Document", "HTTP Errors" and "Static Content" Expand "Health and Diagnostics" and tick "HTTP Logging" and "Request Monitor" Expand "Security" and tick "Basic Authentication", "IP Security", "Request Filtering" and "Windows Authentication

Exception Types

SystemException A failed run-time check;used as a base class for other. AccessException Failure to access a type member, such as a method or field. ArgumentException An argument to a method was invalid. ArgumentNullException A null argument was passed to a method that doesn't accept it. ArgumentOutOfRangeException Argument value is out of range. ArithmeticException Arithmetic over - or underflow has occurred. ArrayTypeMismatchException Attempt to store the wrong type of object in an array. BadImageFormatException Image is in the wrong format. CoreException Base class for exceptions thrown by the runtime. DivideByZeroException An attempt was made to divide by zero. FormatException The format of an argument is wrong. IndexOutOfRangeException An array index is out of bounds. InvalidCastExpression An attempt was made to cast to an invalid class. InvalidOperationException A method was called at an invali

Recover a stolen laptop or device with Prey

Very handy open source utility for remotely monitoring your laptop/device in the hope of capturing details of the miscreant! Prey helps you locate your missing laptop by sending timed reports with a bunch of information of its whereabouts. This includes the general status of the computer, a list of running programs and active connections, fully-detailed network and wifi information, a screenshot of the running desktop and — in case your laptop has an integrated webcam — a picture of the thief.

Microsoft Leaks Office 2010 Upgrade Plan

Originally posted to the Microsoft partner site and then hastily removed Microsoft have revealed the specifics of their upgrade plans for purchasers of Office 2007 to be able to update to 2010 when it is released. Original page. Google cached version. Original text: Microsoft Office 2010 Technology Guarantee Program Sell Office 2007 today and your customer can download Office 2010 free! How the program works: Purchase Office 2007 —Customer buys qualifying Office 2007 product (with or without a new PC) from an authorized reseller between March 5 – September 30, 2010. Install and Activate Office 2007 —Customer installs and activates Office 2007 by September 30, 2010. Download Office 2010 —Customer simply downloads Office 2010 for free when Office 2010 is available, or orders a DVD for a fee. Customer must request upgrade by October 31, 2010. Below are some of the Office 2007 products your customer can purchase and activate between March 5 and September 30, 2010 to be eli

Connect Coldfusion to SQL Server Express

Having recently installed SQL Server Express 2005 on a client server running CFMX 7 I have had to work through the torture of attempting to make the existing SQL Server database driver and then realising it will not work with anything higher than SQL 2000! The instructions below are based on FusionCube but have been modified for my needs. These instructions assume you have already install SQL Server Express and Management Studio Express. Prepare the database server Open the SQL Server Management Studio Click on the Registered Servers button in the toolbar Right-click the SQL Express server. Select “SQL Server Configuration Manager” If needed, enable the TCP/IP protocol under SQL Server Configuration Manager > SQL Server 2005 Network Configurations > Protocols for SQLEXPRESS Double-click the TCP/IP protocol to view the properties. Click on the IP Addresses tab and make sure that the TCP Port is set to 1433 for every IP type. Close the configuration manager. Right-c

Good quality icon packs for web and Windows development

Thanks to a helpful post from: Circular Icons bwpx.icns Gallery 2 Icons KDE Icons Credit Card Icons Fugue Icons Diagonal Icons Danish Icons LED Pixel Icons Flag Icons Mini Icons Onebit Icons WYSIWYG Sapphire Icons Watercolor Icon Pack Sweetie Basepack Icons Sweetie WebCommunication Icons Brand Spanking New Mini Icons TwoTones Icons Twotiny Icon Set Splashy Fish Icons Web Injection Icons Mania Icons

Take website screenshot using ASP.NET

Utilising a hidden web browser control it is possible to take a screenshot of any website. The code shown below is based on an article at  (sorry the site now appears to be offline May 2012) but I have translated it from VB.NET to C# and will work in .NET so theoretically for any Windows or ASP.NET web project. using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; using System.Diagnostics; namespace WebsiteScreenshot { public class GetImage { private int s_Height; private int s_Width; private int f_Height; private int f_Width; private string myURL; public int ScreenHeight { get { return s_Height; } set { s_Height = value; } } public int ScreenWidth { get { return s_Width; } set { s_Width = value; } } public int ImageWidth { get { return f_Width; } set { f_Width = value; } } public int ImageHeight { get { return f_Height; } set { f_Height = value; } } public string Websit

iPad is finally confirmed

Apple’s new all singing all dancing device has been announced! See the live feed here: Here’s what the Apple iPad looks like. Image courtesy of