A Quick How-To on Installing IIS and .NET under Windows XP Pro

I’ve got a client that needs a site with a simple navigational program to be hosted under IIS with ASP.NET.

So, I put together IIS on a VMWare XP install and here’s the quick how-to:
1. Go to Add/Remove programs
2. Put the WinXP Pro install CD in the machine.
3. Click on Add/Remove Windows Components and click on the check box next to Internet Information Services (IIS)
4. After installation you should be able to open up a browser and type "localhost" and get the default welcome page.
5. If you get either a You are not authorized to view this page" or a user name and password prompt, make sure that the user account with which you are currently logged in has administrator rights and that you have a password set for that account.
6. Install .NET
7. Register .NET with IIS

Open a CMD window, change dir to
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727(or whatever other version you are registering)

Run the following commands in sequence:
aspnet_regiis -i
aspnet_regiis -s W3SVC/
8. Make sure to include the .aspx extension on your files and you should be all set to start developing .NET applications.

Dynamically Instantiating New Objects in ActionScript 3.0

Let’s say you are building an application and want to be able to dynamically instantiate new objects in AS 3.0 (Flash CS3)?

Read on for the answer . . .

The syntax for doing this has drastically changed from AS 2.0, however there is still one gotcha that remains the same.

In my case, I’m not only dynamically instantiating class names, but also their reference names.

Here’s how I figured out how to do it:

// Import the getDefinitionByName util and your class
import flash.utils.getDefinitionByName;
import com.example:ExampleClass;

// Create a variable to store a reference to your new class
var classReference:ExampleClass;

// Create a class object and use getDefinitionByName to specify the name of the class you are instantiating.
var class_tempClass:Class = Class(getDefinitionByName("com.example:ExampleClass"));
classReference = new class_tempClass();

This works great.  However, what if you don’t know what classes you’ll be instantiating and want to be able to leave that open at runtime?  This is where it’s the same in 2.0.  If you don’t include the reference to the class at compile time (var classReference:ExampleClass; ) you cannot dynamically instantiate this class, regardless of whether or not it is in your class path.

As a result, you are left with having to decide which classes you might want to instantiate at runtime and somewhere in your code, include a reference to each class such that it’s included at compile time.

Another AS 3.0 programmer indicated that it might be possible to dynamically load a swf that includes a reference to that class, but you would have to load and make sure that that swf has initialized before attempting to instantiate the object.

Maybe a way to go about it is to keep a library of swf files that have the same name as the class that you want to instantiate and write a utility that will dynamically instantiate objects.  The first thing it would do is load a swf with a reference to the class, then it would instantiate the object, returning to the calling code a reference to the newly created instance.

I think I’ll give that a try and then post and update to this thread with my findings.

Web Design Safe Areas for Common Screen Resolutions

When you are designing a website one of the first things that you have to decide is the screen resolution that your audience will be using.  There are still plenty of people out there using 1024×768 or, in some cases, smaller resolutions.

800×600 monitors: 760×410
1024×768 monitors: 960×575

Using svn over ssh on Windows to access a Subversion repository

First I downloaded and installed a windows binary of subversion, so that I would have the svn client executables.

I went the extra step and set up ssh keys between the widows client and the server so that I could svn without having to enter a password each time.  To so so:

  • Download plink.exe, pageant.exe, and puttygen.exe from the Putty website.
  • Run puttygen.exe to generate a private and public key.
  • After the key has been generated, click on the "Save private key" button towards the bottom of the puttygen dialogue box.  Put it somewhere handy, you’ll need to refer to it later when calling your ssh client.
  • Towards the top of the window is a field that says "Public key for pasting into OpenSSH authorized_keys file:"  Login to your server where your Subversion repository resides.  Append this string to your home/.ssh/authorized_keys file (if it doesn’t yet exist, create it and add the key string).
    • Make sure that you chmod 600 your authorized_keys file so that it is only readable and writeable by the owner of the /home/.ssh directory, otherwise you won’t be able to use it to ssh to your server.
  • Start pageant.exe and load the private key you just generated.
  • Copy a Pageant shortcut to "Startup" under the "All Programs" item on your Start menu.
  • Add the path to your directory that contains plink:
    • Right-click on My Computer and select Properties
    • Click on the Advanced tab and click on Environmental Variables
    • Append the following to the Path System variables:
      • C:\Path\to\plink\dir
    • Restart your machine
  • Test:  From the command line type: plink.exe username@server
  • If it is set up properly you’ll find yourself logged into your serve without a password prompt.
Next, we’ll configure Subversion to use plink for the ssh client.

  • Before you can edit the Subversion config file, you need to fire up a command line terminal and simply type svn.
  • You should get Type ‘svn help’ for usage.  That means Subversion in installed and ready to go.
  • Once you have done that, your configurations file will have been generated in your users Documents and Settings Directory.
  • Edit the Subversion config file for your user.  You should be able to find it under C:\Documents and Settings\username\Application Data\Subversion\config.
    • In some instances the Subversion directory isn’t created in Application Data directory for the user.  In that case, I’ve included a .zip file attached to this article entry.  Simply download the Subversion.zip file, unzip and place the folder in your C:\Documents and Settings\username\Application Data\ folder.
  • Scroll down until you find the [tunnels]section.
  • Add the following:  ssh=plink
  • To add a configuration for the text editor program that you will use to enter notes with each svn commit command, add the following line:  editor-cmd = notepad

That should do it.

Try checking out a copy from your repository.

  • Open up a Command Prompt and type:
  • svn co svn+ssh://user@server/path/to/repository dir_name_for_code
  • That should check out a version of your code from your repository and you should be good to to.

I’m working on a project whereby I need to access an svn Subversion repository over ssh (svn+ssh) on a Windows box.  Following is a step by step of how I got it all working using the svn command line client on Windows XP connecting to a Subversion repository on a linux box running CentOS 5.

Click on “Read More” for the whole article on how to get it all set up.
First I downloaded and installed a windows binary of subversion, so that I would have the svn client executables.

I went the extra step and set up ssh keys between the widows client and the server so that I could svn without having to enter a password each time.  To so so:

  • Download plink.exe, pageant.exe, and puttygen.exe from the Putty website.
  • Run puttygen.exe to generate a private and public key.
  • After the key has been generated, click on the “Save private key” button towards the bottom of the puttygen dialogue box.  Put it somewhere handy, you’ll need to refer to it later when calling your ssh client.
  • Towards the top of the window is a field that says “Public key for pasting into OpenSSH authorized_keys file:”  Login to your server where your Subversion repository resides.  Append this string to your home/.ssh/authorized_keys file (if it doesn’t yet exist, create it and add the key string).
  • Make sure that you chmod 600 your authorized_keys file so that it is only readable and writeable by the owner of the /home/.ssh directory, otherwise you won’t be able to use it to ssh to your server.

Start pageant.exe and load the private key you just generated. Copy a Pageant shortcut to “Startup” under the “All Programs” item on your Start menu. Add the path to your directory that contains plink:

  • Right-click on My Computer and select Properties
  • Click on the Advanced tab and click on Environmental Variables
  • Append the following to the Path System variables:
  • C:\Path\to\plink\dir
  • Restart your machine

Test:  From the command line type: plink.exe username@server If it is set up properly you’ll find yourself logged into your serve without a password prompt.

Next, we’ll configure Subversion to use plink for the ssh client.

  • Before you can edit the Subversion config file, you need to fire up a command line terminal and simply type svn.
  • You should get Type ‘svn help’ for usage.  That means Subversion in installed and ready to go.
  • Once you have done that, your configurations file will have been generated in your users Documents and Settings Directory.
  • Edit the Subversion config file for your user.  You should be able to find it under C:\Documents and Settings\username\Application Data\Subversion\config.
  • In some instances the Subversion directory isn’t created in Application Data directory for the user.  In that case, I’ve included a .zip file attached to this article entry.  Simply download the Subversion.zip file, unzip and place the folder in your C:\Documents and Settings\username\Application Data\ folder.
  • If you are running Windows 7 or Windows Server 2008 the folder will be C:\Users\username\AppData\Roaming\

Scroll down until you find the [tunnels]section. Add the following:  ssh=plink To add a configuration for the text editor program that you will use to enter notes with each svn commit command, add the following line:  editor-cmd = notepad That should do it.

Try checking out a copy from your repository.

  • Open up a Command Prompt and type:
  • svn co svn+ssh://user@server/path/to/repository dir_name_for_code
  • That should check out a version of your code from your repository and you should be good to to.

Creating Dynamic Scrolling Text Boxes with Flash CS3

Here’s a quick how to for creating dynamic scrolling text boxes in flash.  (This also works with Flash 8, Flash MX, and Flash MX 2004.)
Let’s say that you would like to have a text box in your flash movie and that you will be loading arbitrary amounts of text data into it.  You can set it up so that no matter how much text you add to the text instance you will have the scroll bar controls dynamically update to match.

This requires only two things, a text instance and an instance of the UIScrollBar component that ships with Flash.

  1. Create your text instance on the stage and size it appropriately.  Then drag an instance of the UIScrollBar to the stage.
  2. In the properties window set your text instance to "Dynamic" text, set it to "Multiline", and give it an instance name.  In this case, we’ll call it test_txt.
  3. Size the UIScrollBar instance vertically so that it matches the height of the text instance.
  4. Then next step is slightly different between CS3 and previous versions of flash.
    1. For CS3: Drag the UIScrollBar so that it is over either the left or right edge of the text instance.  When it snaps such that the edge of the text instance lines up with the middle of the UIScrollBar instance release the mouse.  It will move to the outside edge of the text instance and then be associated with that text instance
    2. For Flash 8, MX, MX 2004:  Drag the UIScrollBar so that it is inside the text instance.  Release it closest to either the left or right side of the text instance.  It will move to the outside of the text instance and then be associated appropriately.

Here is some sample code you can add to frame 1 of your sample movie to test it out.  Make sure that your text box isn’t so big that all of this text will be displayed without you having to scroll

test_txt.text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

stop();

Integrating Thunderbird and Firefox Under Linux

Here’s a quick how-to on getting Firefox to start new mail messages with Thunderbird and getting Thunderbird to open links in Firefox under Linux.

For Thunderbird:
All you need to do is edit the prefs.js file in your .mozilla-thunderbird/blahblah.defaults/ (or similarly named) directory.  Add the following (specifying your path to Firefox):
user_pref("network.protocol-handler.app.http", "/usr/bin/firefox" );
user_pref("network.protocol-handler.app.https", "/usr/bin/firefox" );

For Firefox:
Edit the prefs.js file in your .mozilla/firefox/blahblah.defaults/ directory.  Add the following:
user_pref("network.protocol-handler.app.mailto","/usr/bin/thunderbird");