Tuesday, February 27, 2007

Using January CTP of ASP.NET 2.0 Ajax Extensions

So, a bunch of the things I'm reading in my current book (see post below) don't work, because Microsoft whacked off a bunch of the features of their ASP.NET 2.0 Ajax Extensions in order to get to the current release versions (1.0). In order to get these features back, you need to install the January CTP release in addition to the standard RTM (1.0) release. After you goto ajax.asp.net and download the CTP and run the installer, not much has changed.

To get the CTP (aka "Futures") stuff into your scripts, you need to manually add references to the scripts in your ScriptManager, like this:

<asp:scriptmanager runat="”server”" id="”ScriptManager1”">
<scripts>
<asp:scriptreference assembly="Microsoft.Web.Preview" name="PreviewScript.js" />
<asp:scriptreference assembly="Microsoft.Web.Preview" name="PreviewGlitz.js" />
<asp:scriptreference assembly="Microsoft.Web.Preview" name="PreviewDragDrop.js" />
</scripts>
</asp:scriptmanager>

Now you should be able to use stuff like Sys.Preview.UI.Button again (note the need now to puts "Preview" after the first part of the namespaces).

Monday, February 26, 2007

Adding Color to "ls" in Bash

Ever since I installed Debian on our "ol' junker" Poweredge server at work, I've noticed that executing ls doesn't give me the same, colorful output as I used to get with the linux machines at work (and with every other linux install I've seen). I did some investigation, and found the following in in ~/.bashrc:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If running interactively, then:
if [ "$PS1" ]; then

# don't put duplicate lines in the history. See bash(1) for more options
# export HISTCONTROL=ignoredups

# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'

The alias ls='ls --color=auto' should give me the colorful output I desire. What gives? Well, the comment at the top says that this file is executed when a non-login shell is opened. However, I want to see the colorful output even in my Putty terminal, not just in Xterm in Fluxbox or whatever. So, I cracked open ~/.bash_profile:


# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
umask 022

# the rest of this file is commented out.
# include .bashrc if it exists

#if [ -f ~/.bashrc ]; then
# source ~/.bashrc
#fi


Aha! This is the script that is executed for a login shell. After uncommenting the last three lines and re-starting the shell, my ls's are looking very nice.

Update: To achieve this same thing for your root shell, you need only look to /root/.bashrc -- mine already had the color info commented out in that file, so I simply uncommented it.

Foundations of Atlas Problems

I'm reading through the Apress book Foundations of Atlas: Rapid Application Development with ASP.NET 2.0 and when I hit chapter three, I started to notice a lot of the source code is broken. I kinda expected this sooner or later, since the author wrote the book against a CTP edition of what was then codenamed "Atlas." I'm using ASP.NET 2.0 AJAX Extensions version 1.0 which is the release version of the same Microsoft Ajax technology.

I found this to be very helpful:
http://ajax.asp.net/docs/tutorials/EnhancingJavaScriptTutorial.aspx

It seems to be a section-by-section duplicate of the same information presented by the FOA author, except with examples that work with the latest version of this technology!

Internet Explorer vs Firefox XMLHttpRequest.send()

Quick note to self - This will work in Internet Explorer no problem:

XMLHttpRequestObject.send();

However, it will generate javascript exceptions in other applications (such as Firefox 2.0). To get around that, instead do this:

XMLHttpRequestObject.send(null);

Disqus for A Nofsinger's Blog