18 July 2013

Unicode URL-handling in web.py

Web.py is a lovely tool I'm currently using for a silly project (warning: explicit Italian language). Unfortunately, it does some clever things to support URLs containing Unicode, but then drops the ball when it comes to actually do anything with them (i.e. dispatch/route them as expected, using regular expressions that actually match Unicode objects).

This was a real problem in my app, so I came up with a quick and dirty patch, which may or may not work for you and may or may not break other things. Basically I've tracked down the regex operations on URLs, and added Python's re.UNICODE flag to them, so that unicode characters will be matched as "\w" etc.

Feel free to tell me where I'm going wrong -- I'm not a web.py guru by all means -- but this little patch significantly improved my quality of life today, so to speak.

11 July 2013

Safari extension to show XML

A few months ago I started using Safari for most of my browsing, because I love trackpad gestures and I'm a sucker for smooth animations. However, if there's one thing that Safari gets spectacularly wrong, it's dealing with XML. As far as I know, in Safari 6.x there is no way to display raw XML, the damn browser will always try to launch an external feedreader, and even selecting which feedreader requires industrious hacking that I'd rather avoid. This is particularly annoying when some memory-hungry, battery-burning giant application hijacks this process: in my case, VmWare Fusion will always try to launch one of my images, which is just terrible.

To cut the story short, I wrote a small extension to prevent this horrible process. When I want to have a look at an XML file, I right-click on the link and select "Show me that feed". The result is a slightly-formatted view of the file, in a new tab.

You can download the ShowMeThatFeed Safari extension on BitBucket.

I haven't been a web-plumber for more than 10 years now, so I'm sure it can be dramatically improved -- the formatting in particular is implemented with regexes (argh). Please feel free to fork the BitBucket repository for ShowMeThatFeed, pull requests are very welcome.

UPDATE: Apologies, I've pushed quite a few updates (included some buggy ones!) in the last few hours, but now it should work fine.

07 June 2013

iTunes "File Sharing" is a ridiculous pain

There is no way to programmatically access the application-specific "File Sharing" directories on iPhone from OSX. You are forced to start iTunes and manually select the phone, select "Apps", select your app, drag&drop files.

In 2013.

With a unix-based OS talking to another unix-based OS.

This is ridiculous.

No, I will not jailbreak my phone. This is something that Apple should expose in an API, either via iTunes / Scripting Bridge or via direct Obj-C calls. iCloud simply doesn't cover all use-cases (and, reportedly, it's broken anyway).

This is the frustrating side of the Apple ecosystem: sometimes, you'll be prevented from doing something very simple and very obvious, for some obscure reason nobody cares about (except Apple, of course).

28 May 2013

Social Abstinence


On Saturday evening, I've officially stopped using Facebook, Twitter and G+.

The reason is that I was sucked into socialmedia-overload by certain political events back in my home town (i.e. a referendum). I unofficially took over a troll-cleaning role and started enjoying the keyboard-warrior role a bit too much. I recognised, halfway through, that my engagement had gone way beyond sane levels. I forced myself to promise that, once the situation was over, I'd stop living on the internet and reassess my life priorities. The night before the referendum was due to be hold, I posted a goodbye status on Facebook, and logged off. Then I went on twitter to say what I'd done, and thought I might as well go the extra mile and quit that as well as G+.

"We" won that referendum. I like to think that I helped, if just a little bit. Now it's time to re-establish some focus on my own priorities, look outside the window, be a better dad, exercise regularly, that sort of thing.

If you need me, for the next few months please use email or any other instrument developed in the XX Century. Thank you.

18 May 2013

Fully disable User Access Control (UAC) via Group Policy (GPO)

I'm sure Windows' User Access Control is a wonderful idea and dramatically improved security levels of this once-beleaugured operating system. Unfortunately, most COM/DCOM-based software was written before 2007 and simply doesn't like it (cough*Oracle EPM Financial Management*cough); 6 years later, we're still forced to disable it in many cases.

This is usually achieved through Active Directory policies. Most documents and guides will tell you that you just need to turn off three policies in Windows 2008, under Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Local Policies -> Security Options:


  • User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode (set to Elevate without prompting)
  • User Account Control: Detect application installations and prompt for elevation (set to Disabled)
  • User Account Control: Run all administrators in Admin Approval Mode (set to Disabled)

Unfortunately, this will bring that lovely UAC slider all the way down, but will still results in a weird behaviour where local administrators have most rights but not all of them. The typical test I perform is to open a regular Command Prompt and try to navigate to C:\Windows\SysWOW64\Config - if I get an Access Denied message, then UAC is still lurking in the shadows.

The extra kick we need is, from my tests, this:


  • User Account Control: Only elevate UIAccess applications that are installed in secure locations (set to Disabled)

As explained on the technet site, this policy refuses to elevate applications that don't live in "secure locations" (i.e. %windir% or Program Files). It makes sense that such a policy would affect third-party software dropping executables in their own home folders (cough*lots of Java stuff*cough), but why cmd.exe? No idea, but there you are. For all intents and purposes, UAC is completely turned off only when all these four policies are disabled; miss one of them, and things will get weird. 

I wish Microsoft had just given us a big button that said Behave like Windows 2003, but I guess it wouldn't have sold new manuals and certification lessons.