|
| |
November 6th, 2008
Our third installment is signed, sealed and delivered. Despite a temporary change of cohosts and change of location, it… well… we got through it. That’s all that counts. Check it out!
Streaming live video by Ustream
November 6th, 2008
Don’t you hate it when you go back to some old code and then just want to vomit? I had an experience like that recently. I went into the options form of my pet project Bitter and found this gem:
public OptionsForm : Form { private void ApplyTheme() { MainForm.GetInstance().UpdateColors(); } }
Bleh! Oob! Ick! Seriously, what was I thinking? Right there, the options form is tied to the MainForm. Those two classes can’t be reused elsewhere without some rework. Not good. So how do you fix it? My first thought is usually interfaces. So then I came up with this:
interface IThemeable { void UpdateColors(); }
public OptionsForm : Form { public MyForm(IThemeable themeableParent) { m_themeableParent = themeableParent; }
private void ApplyTheme() { m_themeableParent.UpdateColors(); } }
Ah… so much better. Now if the options form gets reused, it’s parent only needs to implement IThemeable and then I’m good to go. One other method I tend to use a lot (maybe even overuse) is the Observer Pattern. In the observer pattern, you have a subject that sends events, produces information, publishes data, or in whatever way has something that an observer of the subject wants. The subject can zero observers, one observers, or N observers. It doesn’t really care if someone is listening or not. Anyway, here is how I would solve this problem with the observer pattern:
interface IThemeObserver { void OnThemeChanged(); }
interface IThemeSubject { void RegisterThemeObserver(IThemeObserver observer); void OnThemeChanged(); }
public OptionsForm : Form, IThemeSubject { public MyForm(IThemeObserver parent) { RegisterThemeObserver(parent); }
public void RegisterThemeObserver(IThemeObserver observer) { m_observers.Add(observer); }
public void OnThemeChanged() { foreach (IThemeObserver observer in m_observers) { observer.OnThemeChanged(); } }
private void ApplyTheme() { OnThemeChanged(); } }
So those are my modus operandi. How do you fix similar problems?
October 30th, 2008
The second show is in the bag. Talked a little about PDC (which I knew very little about) and a little about Aaron’s upcoming trip. Check it out!
Streaming live video by Ustream
October 30th, 2008
If you’re wanting to combine two URLs with Path.Combine, then you’re likely to wind up with something like “http://bitterware.com\download.html”… and that’s not very good. What we need is something like a Url.Combine. Well, we have something like that. We have Uri.TryCreate, but it’s not as pretty as Path.Combine. So I prettied it up, wrapped it up and thought I’d share:
namespace Bitter { namespace Path { public static class Url { public static string Combine(string domain, string page) { string combinedUrl = String.Empty; Uri baseUri = null;
// create the URI object from the string domain try { baseUri = new Uri(domain); } catch (Exception ex) { baseUri = null; }
// try to combine and create the new URI if (baseUri != null) { Uri value = null; if (Uri.TryCreate(baseUri, page, out value)) combinedUrl = value.ToString(); }
return combinedUrl; }
…
October 24th, 2008
Yesterday was a successful run (at least in our eyes) of our first show. The recording starts a few minutes in, pesky record button, but we have most of it. We have the video stored up on ustream in case you missed it. We’ll be broadcasting again next Thursday, so don’t miss it!!! Unless you have something to do… then watch the recorded version!!!
Streaming live video by Ustream
October 24th, 2008
By now, I’m sure that everyone has seen the little shield image on a button or file:
We all know that it means that you need adminstrator rights, or to log in to an admin account in order to install something or perform some operation that only admins can do. Well recently I’ve been working on an install and on the auto-updating feature of Bitter, so I really wanted the ability to show this so that users immediately knew that it required admin rights. But how do you do this in C#? Well, of course, there’s no simple Button.ShowShield() method or anything as easy as that. You need to import a dll and then call a method with a certain constant. Fun, eh? Anyway, I wrapped all that into a class and thought I’d share. If anyone finds any bugs or improvements let me know. Enjoy!
class ShieldButton : Button { [DllImport("user32.dll")] private static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
// Define BCM_SETSHIELD locally, declared originally in Commctrl.h private const uint BCM_SETSHIELD = 0×0000160C;
private bool m_useShield = true;
protected override void OnCreateControl() { base.OnCreateControl(); SetShield(); }
private void SetShield() { if (m_useShield) { // Set button style to the system style, else the shield image won’t show this.FlatStyle = FlatStyle.System;
// Send the BCM_SETSHIELD message to the button control to show the shield image SendMessage(new HandleRef(this, this.Handle), BCM_SETSHIELD, new IntPtr(0), new IntPtr(1)); } else { // Send the BCM_SETSHIELD message to the button control to hide the shield image SendMessage(new HandleRef(this, this.Handle), BCM_SETSHIELD, new IntPtr(0), new IntPtr(0));
// Set button style back to the system style, since we removed the shield image this.FlatStyle = FlatStyle.Standard; } }
public bool Enabled { get { return base.Enabled; }
set { // need to hide the shield image before disabling, else it won’t disable properly m_useShield = value; SetShield();
base.Enabled = value; } } }
October 23rd, 2008
Aaron Lerch and I have started a new venture. No, it’s not "The Aaron and Mike Show". Ok, maybe it is. Basically we’re going to be talking tech and probably making fools of ourselves along the way. It’s being broadcast at 4pm EST live and we’ll keep the recordings around for later viewing. Check it out.
But there’s also been talk of The Mike and Aaron Show too. So stay tuned…
September 16th, 2008
New software for the Zune for both the desktop and the device was released today.

You can download it, but the Zune desktop software should do that for you. Anyway, it looks like some new features are managing your Zune identity and a new search box on the desktop.
And on the device, there’s games, a clock, tagging a song you hear using the FM radio as well as… purchasing media wirelessly! Awesome. Now if only I could get the wireless to work on my Zune…
September 8th, 2008
According to this other Mike Hall, Vista isn’t all it’s cracked up to be. Apparently it’s too difficult to understand, especially that darn Windows logo:
It’s completely alien to the user until they get used to it. It’s silly little things like where you used to have the Start menu — it’s now a Windows graphic which is harder to explain on a support helpline.
Yeah, training people to click on the logo instead of the "Start" text will take several hundred man hours. Other companies have had "problems" too:
Transfer of files is actually slower than in previous versions
And even though much of that problem has been addressed in SP1, we won’t mention that.
Putting a Vista machine on a desk costs more money
Wait a second here… so you’re telling me that the newest, up-to-date OS with all the new features and better security takes better hardware to run? Ok, wait… slow down… It does more AND it needs more RAM and proc speed? Wait wait… So you’re saying I don’t get all that for free. Ok, you’re still going too fast for me…
What people love to forget is that the same things were said when XP came out. "Why go with XP? We love Windows 2000!" XP was the new, glitzy OS with all the bells and whistles. There were compatibility problems. It took more RAM and beefier processors. But that’s how this game works. But people just love to blame Vista. They want to blame Vista.
What’s worse is that they don’t even want to try it out first, because if they did, they’d probably like it.
August 21st, 2008
When should design trump usability? Can a pretty site be a little less usable if it’s extra beautiful? Or is that always a no-no?
In traditional desktop applications, it’s a common rule of thumb to not hide functionality behind things such as right-click menus, but to expose them more generally through a top level menu or toolbar. Sometimes in web design, web sites themselves can have a learning curve. It may not be immediately apparent how a site works or what to click on. Its learnability may be a little lower in order to accommodate a slicker design. The web site simply becomes less intuitive. Hyperlinked images start looking like regular images and text hyperlinks start looking like regular text until the mouse rolls over it. That’s negative points in the world of user experience.

The actual level of usability needs to be considered too. Preferably your web site is not just usable, but competitively usable. Users should prefer to use your website rather than someone else’s. Since the iPhone has been out a while now, some people have come to realize that on-screen keyboards aren’t all they’re cracked up to be. Even though it is beautiful to behold…

you just can’t beat the tactile response of a hardware keyboard…

So when do you go with usability rather than a beautiful design? Or is beauty sometimes enough to compensate for a less than stellar user experience?
|
| |