Posts archived in Coding

I’m currently working away on improving Smitter R3, and part of that is improving the way proxies are handled.

Currently, there’s four situations it supports quite fine:

- No Proxy
- Proxy, without Authentication
- Proxy, with BASIC Authentication (using specified username/password)
- Proxy, with NTLM Authentication using your current Windows Account (aka Windows Integrated Authentication).

The problem comes you’re in this fifth situation:
- Proxy, with NTLM Authentication using a specified username, password and domain.

Initially, I was using code like:

WebClient client = new WebClient(url);
client.Proxy = new WebProxy(proxyurl, true);
// if proxy-auth required:
client.Proxy.Credentials = new NetworkCredential(proxyusername, proxypassword, domain);
// ...etc

But, this fails with “407 Proxy Authentication Required”
The crazy part is that it actually is doing NTLM authentication, but it appears to be attached in the headers for twitter.com (!?).

So, I tried using WebRequest, and also HttpWebRequest and specifying proxy-keep-alive.
I also tried setting the .NET Default proxy to my specified proxy or just adding authentication credentials.
But, still nothing appears to be working.

Almost all the solutions online are using the DefaultCredentialCache – but that really doesn’t help (I tried), because I’m not logged in as the user that I want to authenticate as. Cretaing a new CredentialCache and adding the details to that – still no help.

All in all, very frustrated!

If you want to have a crack at solving it – download the SmitterR2 source and check out Smitter.Core.TwitterService.GetStatuses (in SmitterClasses\SmitterCore.cs).

There’s currently a line like:
using (WebClient client = BuildWebClient())
Ignore/remove it and create your own WebClient/WebRequest/etc to test on. That’s the first (network) function called when Smitter starts up, and is pretty quick to return a result one way or another.

Just make sure you’re using a proxy which requires NTLM / Kerberos Auth, and isn’t on the same domain as your current account. Any other situation seems to work A-OK.

If you can solve this, I’d be much in your debt.

Reserved Seating at Greater Union Cinemas, Glendale

Reserved seating is, in my mind, meant for places where there’s either a need for people to sit in specific seats. Or where most, or all of the capacity of the place is being occupied. Think planes, coaches, or sports stadiums.

So, when I went to the local Greater Union Cinemas, I was surprised when I was asked where I wanted to sit when buying my ticket. Given I was already running 15 minutes late to the film (10 of that due to the slow process of actually waiting in line for the 6 people infront to get served), I just said “Wherever”, not knowing that they were actually serious about this seating business.

I got into the theatre, trying to be as unobtrusive as possible, and sat at one of the first seats I could find. They wern’t great seats (off to the side) – but hey, Donkey, Shrek, and Fiona were already on screen. I did note that the cinema was 3/4 empty – and that there were plenty of seats infront, behind ,and beside me.

About another 10-ish minutes afterwards, I saw someone walk past me (given I was sitting in the second-from-the-end seat), and then walk back out.
A few moments later, theres a manager beside me “Sir, you’re sitting in someone elses seat”. I was a bit stunned/confused, given the large number of empty seats around me – and replied something like “Uhh, there’s an empty row infront and behind me”. But the Manager persisted “Sorry, but I’m going to have to ask you to move”. Given I was missing the movie, I couldn’t be bothered arguing over it and got up and moved the next row down.

Heck, if the mother and daughter who wanted to sit there had been disabled in any way, or I was sitting in specially assigned seats, or I was just in the way of them getting to the rest of the group they were with, I wouldn’t have had any issue moving. But, no, there wasn’t any reason I could see – it was just a pedantic manager and (presumably) mother.

Windows Vista’s Scheduled Tasks & Windows Update
I really like Windows Vista. There’s a whole bunch of small things that add up to make it a real pleasure to use.

There are two things, however that do drive me up the wall.

The recommended option in Windows Update is for it to download and install items for you automatically. It’s a good idea too, after all – having most users be in charge of which critical updates get installed isn’t usually the best way to keep a PC secured and up-to-date.

The thing that really annoys the crap out of me, is that it will automatically reboot your computer, regardless of what you had open or what it was doing. So, if you were, say, downloading a large file, or processing a report – your computer reboots, and unless the software is designed to resume from it’s last point – you’ll have lost all that effort. This is especially annoying if you’re trying to download/process some data in an after-hours/off-peak timeperiod. Because Windows doesn’t return you to the point at which it rebooted (technically infeasable without security issues) – the software can’t resume from it’s last point.

The only work around I’ve found is to disable Windows Update from installing updates automatically.

Scheduled Tasks
Another thing that’s kinda cool about Windows Vista (and possibly XP too, however I never experienced it) – is that Schedule Tasks can wake the computer from a sleep, hibernate or even shutdown mode – as long as the computer still has power.

The most visible example of this is Windows Media Centre. It will wake the computer automatically to record TV Shows, which is good – however it also wakes the computer to update the TV guide. At 3am. Some people happen to have cases which in certain circumstances can vibrate, seting up a resonance in the desk which amplifies the sound of the vibrating case. So, everyone in the house, at 3am, knows the computer is downloading TV guides. Resulting in the power cord getting yanked out.

A more, err, sociable setting would be to wake it during the day, if the guide hadn’t been updated in the last 4 days or so.

Update: 17/July/2007: Just got another one, despite not having an account anymore.

Some time ago (before YouTube was acquired by Google) – I created a YouTube account so that I could access some video clips that weren’t available to the general public. 

youtube-email

About a month ago I started receiving weekly “newsletters” from YouTube, I didn’t update my account, and I didn’t request this. The first time I received it, I went through the steps to unsubscribe.  It didn’t help.

youtube-settingsHave a look at the screen shot of my email account settings.

See? No options are set to ‘Email me this crap every week’. Yet I still get this spam from them.

I even went through their help/FAQ site – however it provides no assistance for unsubscribing.

So, now I’ve closed my account – here’s hoping THAT will stop them from spamming me.  I’m not holding out a whole lot of hope though.

This blog has taken a rather negative tone for the last few days, maybe it’s just the weather, or maybe it’s because I’d really just like people to produce better software.

So, to illustrate the difference between adding a mod to, say, WordPress and PHPbb 3, I’ve drawn up this flowchart.
I think it’s quite obvious the difference in complexity (and thus, ability of non-experts to manage and maintain a forum running PHPbb).

Wordpress vs PHPbb - Patch vs Interface Model

As if my previous pastings of Windows Live Writer wasn’t enough, I’ve got some more complaining to do about Windows Live Writer’s latest update.

Page Authoring

snippet2 The latest update advertises that it now supports Page authoring (such as my About Page) – which is true. However, what it doesn’t tell you is that you need to jump through some hoops to get it.

wp-wlw-basicWhen I register my blog in WLW, it defaults to a generic WordPress configuration. This config, unfortunately, doesn’t let me author pages. wlw-basic-pages

It is possible to get it – but it depends upon your setup, and how much stuffing around you’re prepared for.  Here’s how I did it, but I’ve got my blog in it’s own root directory.

Step 1: Add a new blog

step1 Just as you normally would, select “Another weblog service”

Step 2: Lie to Live Writer

step2 Feed it a false URL – it really doesn’t matter the URL as long as it’s not your blog’s default page. I Just added an ‘x’ to the end.

Step 3: Let it Error

step3-a It’ll try detecting your blog settings, and then error when it doesn’t work. Now select WordPress 2.2+ as the blog type, and give it the correct XMLRPC URL. step3-b

Step 4: Done!

step4 Done! Go have a beer or something. wlw-advanced-info

There is a bug that I’ve got, where categories fail to show up now – looks like it’s a bug with WordPress though.

Jumpy posts.

Whenever I have a blog post (such as this one) which gets long and has a scroll bar – WLW develops a nervous tick.

If I try and drag and drop an image into the text at the bottom of the page – I suddenly find myself at the top of the post hovering with my selected image results in it scrolling down by a few lines at a time until I hit the bottom – and then it immediately jumps to the top of the post again.  This ends up being a right royal pain in the backside if you’re using a touchpad.

It’s not an issue with my particular setup either – I’ve tried it in three different PCs (two Vista, one XP), and all exhibit the same behavior.

More finicky Title Editing.

I think the WLW guys want you to write the title only once. Any time I try and click inside the title, it jumps the cursor to the start of the title. Selecting text isn’t possible either – I just get the ‘Forbidden’ icon, and nothing happens.

I run a relatively active forum for an online (unpublished) Author. We run on phpBB, because that’s what the previous hoster was running, and it’s open source - so no licensing fees.

Unfortunately, PHPbb2.x has some issues – there’s no easy way to track mod actions or user-notes, the anti-spam stuff is a joke (it all comes down to requiring registration, and battling spam-bots at the registration page), and mods (the PHPbb word for plugin) are, frankly, a pain in the backside to install.

A few weeks back PHPbb3 RC1 was released, and I was running a test board just to try it out.

It has a number of major improvements – performance seems to be improved, and overall management is significantly better. You can track what moderators and admins have done too, so there’s more transparency on that end. 

However, when I tried to install a mod (to provide a basic RSS feed from the forums) – I got a bit stuck. In PHPbb2, there was a mod which allowed you to upload other mods, and install them with just a few clicks. Somewhat similar to WordPress’s plugin model, though more prone to breaking things.

I thought that the PHPbb3 developers would have taken a leaf out of WordPress’s book, and implemented a proper plugin model – and given that there’s now this MODX format (basicly a zip file, with a bunch of other files in it, in a certain structure) – it seemed like that would be the approach.

The problem I was having was that I couldn’t find the location where to upload the MODX file. So, I jumped onto the PHPbb irc site hoping someone could quickly set me straight.

Here’s what happened (ps: “Spec8472″ is me)  – trimmed for brevity, but otherwise people’s comments are as written.

Start of #phpbb buffer: Sun Jun 17 15:52:59 2007

* Now talking in #phpbb
<Spec8472-> Okay, question that’s probably really obvious to some, but I can’t find an answer online… where do I actually upload the mods to, in the phpbb3
  directory?
<iWisdom> …
<iWisdom> You don’t.
<iWisdom> Unless, of course, the MOD instructs you to upload a file
<iWisdom> In which case, you follow the directions included in the .MOD file
<Highway_of_Life> .xml file
<iWisdom> There is no automated MOD installer
<Spec8472-> There’s not an automatic mod installation thingy like easyMod for PHPbb2?
<Spec8472-> damn :(
<iWisdom> Just open the .xml file in a web browser
<Highway_of_Life> no, spec, and don?t curse

Okay, so there’s no automated installer… Thats… disappointing. 

<bsdboy> how hard is it to install mods manually?
<bsdboy> i dont think ive ever automatically installed a mod
<iWisdom> bsdboy: Not hard
<Spec8472-> Brilliant… that, and no event hooks… 
<iWisdom> Spec8472-: Pardon?
<Highway_of_Life> bsdboy: it would depend on your level of expertise, for me it?s like combing my hair in the morning… well, easier actually… coming my hair can be difficult at times…
<iWisdom> Highway_of_Life: That’s since you basically live in the Olympus codebase
<karlsemple> following txt instructions on what changes to make is easy whether you know the code or not :p
<Highway_of_Life> But for some, they never seem to get it right, no matter how many times they try… but it usually depends on the quality of the instructions and how many code changes need to be made
<Spec8472-> Mod installation, should imo, be automatic – upload a file somewhere, click a few things,   hey-presto you’ve got some new functionality (see WordPress) – sure, you might need to include some stuff in your presentation layer, but that’s all.
<WizardJames> ..
<iWisdom> …
<Highway_of_Life> ….
<iWisdom> Well, each person has the right to their own opinion
<iWisdom> But frankly that doesn’t mean we agree
<bsdboy> Spec8472-: You’re bloody lazy.
<iWisdom> Personally, I think it would be a bad idea
<iWisdom> It encourages users to go MOD crazy
<iWisdom> Which makes for a support hell
<WizardJames> bsdboy said my thoughts
<iWisdom> And it also increases the chances of things breaking during upgrades
<bsdboy> Highway_of_Life: Thhey shouldnt be allowed to live.
<iWisdom> It also encourages users, as bsdboy said and WizardJames echoed, to be lazy and not learn their way   around the codebase
<Highway_of_Life> I prefer to control the whole aspect… but still, MODs should be of good enough quality   that only a very small handful of changes need to be made
<Spec8472-> bsdboy: I don’t believe in extra effort, where effort isn’t needed.
<bsdboy> lol
<iWisdom> Spec8472-: To each his own
<bsdboy> Then write a fucking mod to install mods.
<bsdboy> Dont expect someone else to do it.
<karlsemple> please do not swear
<Spec8472-> bsdboy: Well, I would, except that I don’t code in PHP. Besides, that’s just more effort ;)
<Highway_of_Life> you don?t need to code in PHP to install a MOD
<bsdboy> Spec8472-, go shove it where the sun don’t shine if you expect someone to come on IRC and make your   mods auto install. IF you don’t know at least basic PHP you shouldnt be running phpBB.
<Highway_of_Life> you just have to be able to follow instructions, that is all
<iWisdom> Copy/paste
<bsdboy> I didnt know PHP when i first started using phpBB, but you know what< I went and RTFM and followed   the instructions
<iWisdom> It’s not complicated
<bsdboy> its nNOT hard.
<iWisdom> Considering the endless hours MOD authors invest
<iWisdom> It’s not work at all
<WizardJames> not that hard,  just open file, find,  paste, save, next file..
<Highway_of_Life> bsdboy: knowledge of PHP isn?t necessarily required to run phpBB, but it might be required if you want to modify your board in any way…

I don’t agree with the approach that PHPbb3 devs are taking to it – they’re obviously not taking the (quite active) modding scene into account, and it just makes both administrators and modder’s lives more difficult.

Defined interfaces make things much easier all around – take for example something that we all use every time we use a computer – Device Drivers for hardware.

Hardware manufacturers, for the most part, stick to defined interfaces for their drivers. They don’t need to patch the kernel or other parts of the operating system. When they do step outside those bounds, things get… interesting. Updates to the OS, or indeed changes by other drivers can trample all over each other, and result in system or driver crashes.  All in all, a messy situation.

The same goes for other bits of software – if you need to extend Windows Live Writer, you use the SDK to create a plugin that conforms to certain specifications. You don’t need to patch the application’s code to add new functionality. 

I don’t think I’m wrong in asking that PHPbb also take this model – and I think over time it would reduce the level of work required by the developers and support staff.

I’ve been using Gmail for quite a while now, and I’ve grown rather attached to it – having searchable access to my email anywhere I have internet access is great.

Apart from universal access, The other great thing is the spam detection stuff. For the most part, it does a great job. In the last 30 days or so, it successfully picked up nearly 10,000 spam emails. 

GMail’s spam detection is also my greatest annoyance. 

Gmail Needs a “Whitelist” function

image I’m subscribed to a fairly high-traffic mailing list.  I’ve got GMail set up to automatically tag the mailing list traffic, and push it into the archive so it doesn’t clog up my inbox.  

However, for some reason every day several of the emails will get marked as spam, for no apparent reason. There doesn’t appear to be a way to ‘white list’ the mailing list address either.  So, every day, I’ll miss out on certain posts in a thread, which will make it difficult to read. Sure enough, if I go look in the spam folder – there they are. 

Gmail also needs a “Blacklist” function

Because of certain choices I made a while back, I need a ‘catch-all’ enabled on my domain (ideally it’d be a partial catch-all, but my host doesn’t permit that). For some reason my host also enables mail on the mailserver domain with the same rules as the primary domain.  This leads to really large quantities of spam being received.

Google catches the majority of it – however there are certain things that I can filter that I can guarantee are spam.  Google however doesn’t let me add a rule to let me push things into the Spam box, so it can learn from these – instead, I have to push them into the Trash.  Which works much the same as the Spam box, but instead of GMail learning from these, it just deletes them.

Having Google Reader available when I’m not connected to the ‘net, is something I’ve wanted for a while. 

Luckily for me (I think) Google released Google Gears the other day – and made Google Reader implement it.

The idea itself is good – Being able to read your RSS feeds when you’re not connected to the ‘net, and have it sync back to the “mothership” (as the Googler’s put it) when you reconnect – marking read items as read, and downloading new content.

There’s a few key things missing though:

#1 – No Automatic Synchronisation.
I was hoping this would be something like Outlook in Exchange mode – i.e, I connect to a network, it realises it’s connected and updates all my items, sends mail that needs sending, downloading new bits, etc.

Google Reader however, doesn’t do this – it requires you to hit the Offline button, whence it takes a snapshot of some 2000 items (read? unread? latest? who knows).  Ideally it should do the synchronisation in the background – i.e when you’re connected, and it’s setup for offline usage – it should just sync in the background.

#2 – Doesn’t download even basic post resources (like images).

I CAN HAS CHEEZBURGER without images? ’nuff said. 

PS: Even if you’re actually connected, but that Offline button is pressed, you don’t get images.

#3 – Doesn’t remember previously sync’ed items (I think)

I go online. Then click offline – it pops up this little progress meter:

image

Once it’s finished syncing – if I hit online again, then offline – it pops up the same sync thingy, and takes just as long to download.

Okay, so Gears is a very very early beta*, and this is just the first implementation of Reader Offline, but I do hope they’ll fix these things and make it a truly seamless experience in later iterations.

Technorati Tags: , ,

* Aaron Boodman said something like “Google Gears is a real beta, not like our usual level of Beta” about a dozen times during his talk.

Silverlight really needs to get with the pre-loading and obvious controls thing.

Edit: Correction – okay, so like Paul says – it’s not Silverlight itself, it’s the templates that people are using. Still, they’re templates that come with the various Silverlight capable applications (Blend, Expression, and Media Encoder) – so they’re going to be used fairly frequently.

Here’s a Youtube video:

How do you play/pause, or skip to a certain portion? How do you know how much of the video is loaded? 

They’re fairly obvious after about 5 seconds of watching the player run. The little red bar runs to the right as it loads, and the dot follows along as it plays. Drag the dot – you start playing at that point.  

What about a QuickTime video?  (I’m not exactly a fan of QuickTime either)

  

Yep, that’s reasonably obvious too. There’s the play, skip/etc controls – and a similar style of displaying the amount of video loaded.

Now let’s take a look at this Silverlight video:

Well, we’ve got skip back, play and skip forward.. err.. how do I tell how much has preloaded?  Oh – that’s right – with this helpful little glyph:

What does the 36 signify though? It’s not until you actually watch what it does for a while, that you realise it’s not some sort of countdown timer until you can start the movie  – it’s a percentage counter of how much it’s loaded. (Silverlight will start playing the moment it has some video loaded – regardless of whether the connection between you and the server is fast enough to keep it up).

Okay, so, how do you skip forward in the video… err.. .wait… can you? Well, assuming it’s been pre-loaded – yes, there’s a little blue bar with a white gradient — that’s the play position indicator. You can drag the white bit around to set the current play position.

The only issue is – it breaks the common UI visual cues’, so it took me about 30 seconds to find the control (it’s really not obvious). What’s the likelihood that my Grandmother is going to know how to use it? 

One of the minor annoyances I’ve had for a while now with various Windows apps – is that they unneccesarily generate sounds. 

For example – ActiveSync on Windows XP generates a ‘connected’ and ‘disconnected’ sound.   I can disable the sounds in the Sounds control panel, but if I do – it generates a System Speaker Beep instead.  A really loud beep too – especially, say, when you’re trying to (quietly) sync your PDA to at 1AM (or in a meeting).

On most PCs this is an easy fix – simply unplug the System Speaker from the motherboard.  On a laptop, however, it’s not quite so simple (and I don’t want to violate the warranty just yet by opening it up and disconnecting/desoldering the offending bit).

So, I did a search, and low and behold – there’s a Registry setting to disable the System Beeps.

  1. Open up the Registry Editor (start -> run -> regedit)
  2. Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Beep
  3. Set the Start value to 4
  4. Reboot

Yay, no more beeps.

 

Disclaimer: If you break your PC by fiddling with the registry (highly likely if you make a habit of deleting or changing random keys for which you have no reason to be touching) – don’t blame me.