I did not win
Lately, all of my focus has been on the Olympics so things have been a little quiet. In my last post I talked about an ASP.NET Random Number Generator created with BDS 2006. Believe it or not, it is surprisingly simple to get something like this up and running. I have worked on a number of ASP.NET applications developed with BDS 2006, in both the internally and externally hosted environments. Typically, any SNAFUs that I have encountered (excluding code typos and incorrectness) have been due to server configuration issues and not a problem with the tool used to create the application.
To get the Random Number Generator running I first needed a Virtual Directory on the server hosting the application. I started out with a new ASP.NET Web Application and saved it with the same name as the application name for the Virtual Directory (by default it the name of the virtual directory).
I then created a ‘form’ and decorated it with a few items from the Web Controls section of the Tool Palette.
With the layout of the form in place a few lines of code were needed to get things going (I created a few functions of my own for dealing with input):
function TWebForm1.IsNumeric(str: string): Boolean;
Result:= (code = 0);
function TWebForm1.ToInteger(str: string): Integer;
if (code = 0) then
procedure TWebForm1.txtCount_TextChanged(sender: System.Object; e: System.EventArgs);
if Not(IsNumeric(TextBox(Sender).Text)) then
procedure TWebForm1.btnGenerate_Click(sender: System.Object; e: System.EventArgs);
i, y: Integer;
lowerbound, upperbound, counter: integer;
// mylist: System.Collections.Hashtable;
// mylist:= Hashtable.Create;
if (IsNumeric(txtUpperBound.Text) and
For i := 1 To counter do
intRnd := Int((upperbound - lowerbound + 1) * Random + lowerbound);
// HashTable for statistics
if Not mylist.ContainsKey(intRnd.ToString('#,###')) then
y:= ToInteger(mylist.Item[intRnd.ToString].ToString) + 1;
if (chkDupes.Checked and
(lbNumbers.Items.FindByText(intRnd.ToString('#,###')) = Nil))
or Not(chkDupes.Checked) then
// enumerate hash for statistical output
Enumerator := Mylist.GetEnumerator;
while Enumerator.MoveNext do
DictEntry := DictionaryEntry(Enumerator.Current);
z:= (ToInteger(DictEntry.Value.ToString)/counter * 100);
st.Append(z.ToString('00.00') + '% - ');
st.Append(DictEntry.Key.ToString + ' - (');
st.Append(DictEntry.Value.ToString + ' entries)');
That’s pretty much all the code that is needed. In order to ‘manually publish’ the application, after testing the code and ensuring the application functions as desired, copy the .DLL from application’s Bin directory and the form’s .aspx file to the hosting site (if you do not have a web.config file on the published site you will need to copy that file as well).
With BDS 2006
you can get this up and running rather quickly, I think it takes longer to write this post; unfortunately it didn’t serve up any winning numbers for me…….
Looking back on a post made in response to a question about changing a cursor to text, I decided to change the code around a little for use in a local utility. The idea is to display ‘text’ as a cursor instead of an ‘image’. I toyed with passing a TIcon (a cursor and icon are the same structure) back as a back as a function result and passing a preexisting TIcon as a parameter. After coming up with an overloaded function, passing it back ‘felt better’. However, I prefer that the ‘cursor’ be created and destroyed outside of the function.
A function is as follows:
function TForm1.CreateCursorText(thecursor: TIcon; const cursortext: string;
fontcolor: TColor; fontsize: Integer; hs: TPoint): Integer;
iconheight : integer;
An example of how to use it would be something like:
crMyCursor = 5;
CreateCursorText(aicon, edit1.Text, clBlue,8,hotspot);
A Few Good Shows
I have never been a television or movie buff. A vast majority of my time is spent in front of a computer. A typical day finds me with about 13 hours in front of ye ole' monitor, followed up by some technical reading (two of my recent selections are here and here). This has been going on for so long that I haven’t a clue about much primetime television. If I am watching television it is typically sports, TLC, Discovery or the History channel. (TechTV used to be there until G4Tv completely killed it) Besides the Revolution, Patriots, Red Sox and the morning news it is rare for me to have a ‘must see’ television show.
I do have shows that I enjoy a lot (Dirty Jobs), but none I can say that cause me to drop everything. Someone did recently tell me to watch The Office. I caught an episode last week and though it was hilarious. The jury is still out though....
Over the past few months I must say I finally found a 'must see' --Criminal Minds. This show has me hooked and I can now say that there is a show that without a doubt I’d turn of the computer for. Wednesday nights now are on my calendar. With my luck, they’ll end up canceling it, which, well, would piss me off. Remember The 4400?