Entries Tagged 'OS X' ↓

Eleven Months

Yesterday, the day that Leopard was released for Macs, was also my white MacBook's eleven month anniversary. What better way to celebrate than to get the upgrade and a free shirt!

So on my way home I stopped by the Apple store near the house at 6:20 and found a short line stretching about 3 storefronts. The line moved fast and I had a good time talking to my neighbors about Macs and iPods.

Inside the store was packed, I saw at least a dozen black MacBooks checking out at once. I got a t-shirt and a copy of Leopard and I was back to my car 25 minutes later.

Back at home I backed up, tested the backup, rebooted, installed, waited about an hour, it rebooted, I logged in, I waited about another 10 minutes — and then, it finally booted.
I really like what I see so far. I have had the System Preferences app crash a few times, but over all I'm happy with all the changes.

I'd like to point out that Michael Tsai, creator of SpamSieve (my spam tool of choice) sent out an excellent email announcing his products compatibility with OS X and providing very simple instructions on how to re-enable the plugin after the update. Thanks, that went just as easily as described.

The surprise feature that I love the most is the updated Bluetooth File Exchange app.

I was able to browse the memory stick on my W810i and have been transferring the files (hundreds) for the last 20 40 60 minutes! In that time I've had two phone calls too. Once I get a folder that is in sync I'll automate the process and have it upload to my flicker stream too.
If you've got a Mac, get the update. If you don't have a Mac get one now — its better than ever.

LinkButton as the DefaultButton fix for ASP.Net 2.0

The Problem: I don't like using the ASP:Button control on the ASP.Net Applications that I build. Mainly because I have little control over how they appear and act. The ASP:ImageButton is better, but it requires that I (or someone) make images with the text required - and when going international that work snowballs quickly.

The ASP:LinkButton is my control of choice. I can use CSS to make rollover and hover states, use what ever text I'd like. Out of the box, as long as IE is the browser everything works - but as soon as you try to submit a form with a LinkButton as the default button in FireFox, the form just reloads and any values that were input are lost.

The Investigation: I found several posts and examples, but most of them were for extending the ASP:Button or ASP:ImageButton controls. I also noticed that they were trying to submit the form via a PostBack method and with the LinkButton it just wasn't working.

The Solution The answer was right there in the page's source as sent to the browser. The LinkButton control gets rendered as a link [A] to the browser. All you need to do to cause the button to fire is go to the address in the HREF.

The Code: Add this code to a SCRIPT block in your MasterPage (or better yet, to a seperate .JS page that is linked to your MasterPage).

function DefaultButtonKeyPress(evt, thisElementName) {
if(evt.which || evt.keyCode)
{
if ((evt.which == 13) || (evt.keyCode == 13))
{
// alert('post back href: ' +
document.getElementById(thisElementName).href);
location =
document.getElementById(thisElementName).href;
return false;
}
}
else
{
return true;
}
}

All that code does is send the browser to the location that you'd go to if you clicked the link, but only if you hit the ENTER button when in a TextBox that calls the JavaScript method.

To get your TextBoxes to call that method, you need to add the following method to your project somewhere. (I have a PresentationLayerTools.vb class where I put all this code, you might like it somewhere else).

Public Overloads Shared Sub DefaultButton(ByRef TextBox As System.Web.UI.WebControls.TextBox, ByRef LinkButton As
System.Web.UI.WebControls.LinkButton)
TextBox.Attributes.Add("onkeydown", "DefaultButtonKeyPress(event, '"
& LinkButton.ClientID & "')")
End Sub

All that code does is add a OnKeyDown event handler to fire the JavaScript method above to the specified ASP:TextBox. The method listens for KeyDown events, if if finds one, it checks to see if the Key you pressed was the ENTER - if it is then it send the browser to the location of the ASP:LinkButton's HREF attribute (which, buy default is a call t another ASP.Net controlled JavaScript method that fires off a PostBack; I'm not sure what all else it does, but it works so I'm happy).

Finally, you need to add the following to the code behind for your pages to tell ASP.Net to execute the DefaultButton method above. I suggest doing it during the page's PreRender event; but it could go other places too.

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.PreRender
Page.Form.DefaultButton = LinkButtonLogOn.UniqueID
PresentationLayer.Tools.DefaultButton(Me,
TextBoxEmail, LinkButtonLogOn)
PresentationLayer.Tools.DefaultButton(Me,
TextBoxPassword, LinkButtonLogOn)
End Sub

Please note that you have to add a call to the DefaultButton method for each TextBox you have on your form that you want to submit the form on.

The Conclusion: I hope that makes sense and works for you, it took me a half a day of banging my head as I searched the Web for a fix. This morning after a nice nights rest the answer was obvious; but because I couldn't find any other similar suggestions I figured I ought to post this to help someone else out.

This code has been tested with: IE 7 and 6 on Windows Server 2003 and Windows XP, FireFox 2 on Windows Server 2003, FireFox 2 on OS X 10.4.10, and Safari 2 on OS x 10.4.10. If you try it on other platforms please let me know how it works!

“Mac has issued a salutation, deny or allow”

A few words about my current set up at home.
I've got a computer with a 2.4Ghz AMD processor and tons of disk installed. I think the current total is about 750GB. I've got a supper sweet ViewSonic 21 inch CRT that I borrowed from work, and a ton of other peripherals too. The most important addition is the TV Tunner (Haugepauge TV-250, fyi).
Late last year I picked up a white MacBook, with a 2Ghz Core 2 Duo and a DVD burner. I have since upgraded the internal hard drive to a 160GB drive and last week I upped the memory in it to 2GB.
The MacBook has the latest build of Parallels Desktop with a copy of Windows XP to make sure that I can get work done.
The computer has my own copy of XP installed, as well as MSDN 'evaluation' copies of Windows Media Center and Vista Ultimate.
In the future I'll detail how I've managed to connect everything, and of course I'll keep you posed on my views of Vista.