The Stochastic Game

Ramblings of General Geekery

Posts with tag 'gotcha'

    Microsoft password fail

    Almost 4 years ago, I wrote a short article on dumb websites who have a maxiumum password length. Now, in 2012, there are still websites with such stupid policies. One of the most famous is none other than Microsoft’s Live Account service, which serves as the authentication hub for all things Microsoft. Basically, your Live ID, or whatever it’s called, can’t have a password longer than 16 characters. Microsoft is, rightly so, getting a lot of criticism about that because the recently released Windows 8 lets you link your Windows user to a Live ID, for use with the whole Windows App Store thing and more.
    Read more...

    When Windows "just works": part 2 (the work around)

    Back in the first part of this 2-part post we looked in some detail at how MacOS mounts network shares, and how badly designed this feature is compared to its Windows counterpart. We’ll now look at the solution I’m using to fix the problem, which is to mount network shares in a consistent way for a multi-user machine. The work around Thanks to the power of UNIX, you can get around the problem by spending hours reading boring documentation, searching useless forums, editing obscure configuration files and generally speaking wasting your time for something Windows gets right in 2 clicks.
    Read more...

    When Windows "just works": part 1 (the problem)

    If you asked me a year ago what was the most awesome feature that Windows has and that MacOS doesn’t, I would have probably scratched my head for a bit, mentally sorting through all the obscure advanced things you can do with the Windows SDK and a few lines of code, or all the little things that make organizing files so much easier than with the horrible Mac Finder. But if you ask me now, I’ll reply straight away this: mapped network drives.
    Read more...

    Simple workaround for the iPad's smart cover's design flaws

    I recently got an iPad (more on this later), and with it I got the much hyped smart cover. I loved the simplicity of it, and how quickly you can take it off and put it back on again… However, I quickly realized that I probably had more dust on the screen while using that thing than if I didn’t have any cover at all. Among the problems I had the infamous “dust lines” – those three lines you get on the screen at exactly the same spot as the cover’s folds.
    Read more...

    PHP is fucked up

    You may be shocked by what I’m about to say but here it is: PHP is fucked up. Oh, no. Wait. No you’re not shocked. You already knew it. Today’s topic: namespaces. PHP’s namespace implementation is fucked up. There’s really no way to say it nicely, and you will realize it 5 minutes after starting to use them, when most of your code breaks and you need to litter the beginning of your files with use statements and you really wonder what you gained in the process.
    Read more...

    Don't brick your ReadyNAS

    I have a ReadyNAS NV+ at home to store most of my data and I’ve been pretty happy with it so far… except for one thing: although it’s running a flavor of Linux that you can access as root user (if you installed the EnableRootSSH add-on), you can’t do everything you would normally do with a Linux box. First, like most pre-2010 consumer grade NASes, the NV+ runs on a sparc CPU, so there’s a lot of packages you don’t have access to unless you recompile them yourself.
    Read more...

    Working with Disqus

    Since I’ve migrated this blog to PieCrust and all its comments to Disqus I’ve run into a few problems that took me some time to figure out (although I got help from the nice Disqus guys). Those problems come down to the following information which was not quite clear to me even after reading their documentation several times: The disqus_identifier value gives a unique name to a thread. The disqus_location value indicates the URL(s) at which a given thread can be found.
    Read more...

    Facebook’s privacy issues

    Everybody knows, or at least says without really knowing, that Facebook has a few privacy issues, but there’s one thing I never quite realized until recently… It all started with my friend Bertrand opening his new personal blog. He wanted a dedicated place to post personal stuff, which he previously posted alternatively on his professional blog or on Facebook. I’m pretty sure he also wanted an excuse to play around with his new cool baby, Orchard… Anyway.
    Read more...

    Xaml serialization quirks and gotchas

    I recently had to build a little tool that would read its configuration from a XAML file (because XAML serialization is, most of the time, better and more customizable than standard XML serialization). The trick was that this tool had to be built on top of .NET 3.0 – not 3.5 or 4.0. And I discovered that there are a few little gotchas in .NET 3.0’s XAML serializer that I, somehow, never ran into before.
    Read more...

    About unit testing Maya and MStatus macros

    Programmers in the video games and movies industry rarely write unit tests for all kinds of reasons and excuses, but every now and then, it happens. And it can get a bit complicated when you want to test a plug-in hosted by a 3rd party application like Autodesk’s Maya. Setting up the unit test project The good thing is, unlike most other 3d modeling packages, Maya comes with built in “batch” and “library” modes.
    Read more...

    Writing a custom Main() method for WPF applications

    Creating a new WPF project in Visual Studio gives you the following pretty simple application markup and code: <Application x:Class="WpfApplication2.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml"> </Application> namespace WpfApplication2 { public partial class App : Application { } } Understanding how it really works, and how to supply your own custom Main() method, is just a search query away. You basically need to change the application’s build action from “Application Definition” to “Page”, create a constructor that calls “InitializeComponent”, and write your Main() by eventually calling one of the application’s “Run” method overloads.
    Read more...

    Exposing global variables in IronPython

    Lately I’ve been playing around a bit with IronPython and how to embed it inside an application to add scripting features. I’m still figuring things out, but I had a hard time exposing global variables to the Python environment.

    The idea was to expose a couple of .NET objects (mainly a few important managers/singletons from the app’s API) as global variables so that scripts could access and act on the important parts of the app (query the database, batch run actions, etc.).

    At first, I exposed some objects as variables of my ScriptScope:

    public void SetupScope(ScriptScope scope)
    {
        scope.SetVariable("test_string", "This is a test string");
        scope.SetVariable("test_callback_method", new Action(TestCallbackMethod));
        scope.SetVariable("test_callback_function", new Func<string, string>(TestCallbackFunction));
    }

    The problem was that only interactive scripting would get access to those variables (I had a simple UI for typing commands to be executed on that ScriptScope). Using “test_string” in a function loaded from a module would result in a “name ‘test_string’ is not defined” error. Using either “import” or “global” would not fix it.

    Read more...

    Conditional operator fun

    A good friend of mine sent me this little “gotcha” a few days ago, so I thought I’d share: #include <iostream> #include <string> void main() { int a = 0; int* ptrA = &a; const int b = 1 ; <span style="color: blue">const int</span>&amp; refA1 = (ptrA ? *ptrA : 1); <span style="color: blue">const int</span>&amp; refA2 = (ptrA ? *ptrA : b); std::cout &lt;&lt; refA1 &lt;&lt; std::endl; std::cout &lt;&lt; refA2 &lt;&lt; std::endl; a = 42; std::cout &lt;&lt; refA1 &lt;&lt; std::endl; std::cout &lt;&lt; refA2 &lt;&lt; std::endl; }
    Read more...

    Pass-phrases, and the problem with dumb websites

    I’m a huge fan on pass-phrases. Since Jeff already evangelised them over passwords, giving arguments and advice, there’s no need to add anything… Except, well, some good old complaining. It pisses me off that some websites have a limited length for passwords, thus preventing users from using pass-phrases. It’s not a pass-phrase if it can only have a maximum of 12 characters, is it? But the worst is how most of those websites won’t even warn you that your password is too long… they will just truncate it and tell you everything’s okay!
    Read more...

    Disable windows from resuming when opening your laptop’s lid

    One of my laptops is getting old and the lid is not as sturdy as it used to be. It now has the unwanted tendency of triggering a “laptop lid open” event when you barely touch it because the lid moves up a bit and back down. This is problematic because it wakes up the operating system, which doesn’t always detect that the lid was closed immediately. When you run an internet search about laptop lids and putting Windows on stand by or hibernate, you find a lot of stuff, but nothing useful about disabling resume.
    Read more...

    Got burned by Vista

    These, days, I'm back doing PHP stuff at home, and therefore had to install Apache. Of course, I could do PHP under IIS7, which would be easier, what with the nice administration interface and all, but I need to recreate the same environment as my hosting solution, complete with .htaccess and all that stuff. One of the first thing you need to do in this situation is to add an alias to your websites because they probably aren't located in the default documents root.
    Read more...