Category: Life

Every other post.

  • Pride 2012 and Janice Kennedy

    Pride 2012 and Janice Kennedy

    On Friday, the Ottawa Citizen published a piece titled What does tacky sex have to do with gay pride? by Janice Kennedy. In it, she blasts Pride week and the parade in particular, calling it “classless”, “vulgar”, and undignified:

    Not to mention the big parade Sunday afternoon, which will feature drag queens, leather kings, sailor-capped guys in leopard skin bikinis and the usual display of rampant horniness on floats dedicated to sexuality made adolescent, trivial and — what’s the word? — tacky? vulgar? classless? all of the above?

    How does iconizing the pageantry of monumental bad taste — even when it’s dressed up in adjectives like “fun” and “colourful” — serve as a vehicle for dignity? How does a public sexfest honour a struggle for equality and human rights? Assuming a desire to end the alienating forces of segregation, how does any of this function as a bridge?

    She’s certainly not alone in voicing a disdain for the events. This conversation repeats itself every time Pride rolls around.

    I wonder if she’s ever actually been to one of these parades. Her view that it is no more than a hedonistic orgy on wheels doesn’t at all reflect how the march actually is. It is far more mundane, involving dozens of groups walking down to show their support for various causes.

    The title for her piece, in which she calls it gay pride, goes some way into explaining why she doesn’t get it. It is not a gay pride parade. It’s been called that, and it certainly has its fair share of gay people in attendance, but it isn’t a gay pride parade. It is a nexus for all those who want to show solidarity with issues surrounding the body, of which sexual orientation is only one small part.

    That’s why you’ll also find in the parade groups dealing with such things as gender expression and identity, HIV stigmatization, non-monogamy, BDSM and leather. It is an environment where people can celebrate among others and not be judged for it.

    To ask such things is not to be joyless or puritanical. It is to be publicly aware and socially respectful. Yes, the world should know who you are, why you’re flying the flag or wearing the triangle, why (against family expectations) you have a boyfriend, girlfriend or same-sex spouse. But the world really does not need to know explicitly what turns you on.

    With the exception of sexual orientation, Janice is uncomfortable with any notion of body and sex that deviates from her perceived norms. To the point where she argues that people shouldn’t be open about it at all, not even at its own parade. She sees it as taboo.

    I don’t believe that anyone should be ashamed about their body. I think that shame inhibits communication and so fosters ignorance, which in turn opens a world of pain for a lot of people.

    This is a parade about liberation. Unlike Janice, I believe this is very much the place for people to be open and free of the shame for who they love, how they dress, their gender, their kinks, etc. To her it’s an undesirable expression that is entirely unrelated to the struggle for acceptance. To me, it couldn’t be more about it.

    I’d also like to throw a shout out to Jeremy & Tina for having joined us at the parade. I had a great time, thanks guys!

  • 27 Programming Tips

    27 Programming Tips

    The following are what I’ve learned after having programmed for a little while. It is by no means a complete list, and you may disagree with some of it.

    You’ll Never be Great

    And that’s a good thing. The moment you think you’re great is the moment you’ve given up thinking that there’s significant room for improvement. There’s always room to learn, and you’ll be better for it.

    Learn, Learn, Learn

    I read Hacker News and Proggit daily. By virtue of this I also invariably end up on StackOverflow each day. What I’m looking for on these sites are articles on programming in general. I want to expand my horizons, and become exposed to new paradigms and ideas about how to go about the field. I also learn by Googling up whenever I encounter terms that I’m not familiar with.

    I’ve learned so much from doing this. From functional programming concepts to how big web companies maintain responsive services in the face of gargantuan demands. It would be a mistake to dismiss this exposure on the basis of appearing unrelated to what you do. If you’re developing, it’s all related. It all matters. Those ideas shape how you think about problems, and provide you with more options with which to address them.

    Don’t Over-Engineer

    I define over-engineering as the act of programming in solutions to problems without having first established whether it’s warranted. I have been quite guilty of this with past projects.

    The problem with over-engineering is that it increases the complexity of the code, and in doing so, reduces your flexibility to deal with the issues that do materialize. The kind of problems that have ramifications that extend beyond refactoring a few methods. Increasing the size of the code base also elevates the statistical likelihood of bugs, and if it’s not obvious, makes finding the bug that much more time consuming.

    Kill Dead Code

    If I don’t use it, I don’t comment it out. I delete it. If I want to go back to it in the future, I look through the history as managed by the code revision software.

    Having a bunch of commented out code obfuscates the remaining logic. Leaving dead code in there, meanwhile, increases the likelihood of errors in the long run.

    Only Ever Define Once

    If you define something more than once, whether it’s a constant or program logic, you introduce the possibility that the program may do two different things for what is supposed to be a single behaviour. This introduces the possibility of error. Not to mention it increases the size of your code.

    I have yet to encounter a situation where something that was defined twice or more couldn’t have been condensed into just the one. Also see my point on clarity over efficiency.

    Don’t Program Blindly

    By this I mean resist the temptation to start tackling the problem by jumping in and coding straight-away. It’s okay for small projects, where the whole thing is going to be done in a matter of minutes or hours.

    When you’re dealing with larger projects, you’re going to want to work out how the program is to behave ahead of time. In my case, I’ll find flaws with the initial approach I had in mind, refine it, and then code it. The amount of time I save by removing these logical flaws at the conceptualization rather than execution stage is immeasurable.

    Comment Everything

    It’s not for the sake of others. It’s for yourself. Unless you’re actively working on a project, or have Rain Man-like memory, you’ll never really remember how your application works. When someone a year or two down the line asks for a new feature, you’ll have to go through the code base, and if you didn’t comment it properly, you’re likely in for a number of frustrating hours.

    As important as commenting your code is maintaining those comments. You can’t just change your code and leave your comments be – that defeats the purpose of their existence. My rules are to keep it brief, and to explain the why more than the how. The code can handle the how.

    Clarity over Efficiency or Cleverness

    I will always gladly sacrifice a few potential cycles of CPU time if it means my code is more clear. In all my years of programming, never once has that trade-off ever resulted in my having to refactor code.

    Debuggers & Profilers: Learn them

    When you start out, it’s tempting to use print statements everywhere to figure out what’s wrong. Learn a debugger. It’ll save you so much time when it comes to finding the source of an issue, especially when it’s not where you expected it to be.

    Profilers meanwhile help you figure out what part of your code is taking the most time to execute. It may not be what you anticipated. Instead of being that loop that does this big computation, it might actually be this side function that does a little record-keeping.

    Use Useful Variable and Function Names

    I’ve inherited code bases where the authors used such descriptive variable names as “AAA” and “AAAA”. Nearly as useless are when variables with redundant names like “data” are used.

    Variable and function names aren’t for the compiler or interpreter’s benefit. They’re for the person who wrote the code. Like comments, putting a little effort in coming up with descriptive names will save you much head scratching when you’re working on that same code down the line.

    Indent Properly

    Indentation is another of those things that in most languages isn’t for the benefit of the program interpreting your code, so much as the authors of that code. And even then.

    Proper indentation makes your code more legible, which in turn saves you time. And bugs. I didn’t think this needed to be said until I inherited this spaghetti code of an web-based management system, where each page of VBScript was a minimum of 3000 lines, none of which were indented in any logical manner.

    Limit the Number of Characters per Line

    In all of my IDEs, I make use of the option to draw a line that delineates the 80 character mark. I make sure that my lines of code never pass this threshold.

    You should never have to scroll horizontally to see a line of code. A line represents a statement, a single idea. Always scrolling left and right to capture them will hinder your progress at absorbing the logic behind the code.

    Blame Yourself

    When something goes wrong, and it doesn’t seem to make sense, it becomes tempting to blame whatever you’re using. My code is behaving as it’s supposed to – it’s this graphical toolkit that has a bug in it.

    No, it’s your code. Especially when you’re writing basic stuff using mature libraries and compiler/interpreter. It’s not impossible that there’s a bug in what you’re using; it’s just so much more likely that the issue you’re facing is of your own doing.

    Don’t Redesign the Wheel

    You’ll often encounter situations whereby you can either write your own implementation of something, or use one provided by a library. Unless you want to do this as a learning exercise, always pick the library.

    There’s a few reasons for this. For one, it reduces the amount of code you have to write. This saves you time, and reduces the potential for error. It also takes into account the fact that the people who wrote the library spent their time writing that specific functionality – and they likely did a much better job than you could. Especially when you go into such tasks as signal processing or visualization.

    Use Code Revision

    Even if I’m working alone, I always use code revisioning software. For one, I find the historical aspect very helpful. To go back in time, and see how I did things differently. Or to figure out what changes I did when the symptoms of a bug started presenting themselves.

    I name my software builds according to the revision of that build. This means that when a user says they saw an issue with build 266, I can go and load up the code for that very build, and have the same software they run. All at the press of a few buttons. The code revision software is also the authoritative changelog.

    Don’t Get Attached

    When I code, I code with myself in mind. How would I want this to be? Then I do it. But the way I envision things and the way users envision things don’t always align with each other.

    In those times, it’s important to be able to let go of what you thought was the best solution, and cater to the user. Because this program ultimately isn’t for you, it’s for them.

    Keep Functions/Methods Small

    Most of my functions are only ever about thirty lines of code. That doesn’t inhibit me from creating complex applications at all. What it does do is keep the logic legible and clear, which is a great time-saver when revisiting code.

    It also keeps my code more flexible. It’s much easier to alter how things work when you only have to edit a few small functions rather than mega-functions here and there.

    Keep source Files Small Too

    Smaller files take less time to parse mentally. Give these files useful names, and store them in directories with equally informative names. This will cut down the time you spend hunting for specific logic.

    Beware the Waterfall

    The waterfall approach to software development is the most intuitive on the outset, but it has a great number of short comings. This is why some teams use alternative models such as Agile. For the uninitiated, the waterfall model consists of coming up with requirements for the software, then creating the product, then testing it, and then maintaining it all.

    The problem is that verification stage. You may have spent a really long time in development, and then in testing, the user realizes that how you went about something isn’t what they had in mind. Changing that one thing, meanwhile, becomes a big undertaking because it means changing a whole slew of other things along the way. You did the application with a given logic in mind, wrote it with that logic in mind, and this user’s requests pulls the rug from under all of that.

    It’s easy to blame this on getting the requirements stage wrong, but you never really had any chance to begin with. The problem meanwhile with doing things differently, such as getting users more involved to get feedback early on, is that managers may not want to allocate time. They might not see the value of spending more time up front to save it down the road. I have no advice there, just be aware of the issues.

    Don’t Adopt too Early

    It can be tempting to adopt cool new technologies as they come out. While I love toying with new programming frameworks, I won’t use them in production applications I intend to support down the line.

    The reason being that I prefer stability over features. The extra time I spend up front will be recuperated in maintenance done down the line. This does go with my environment, where I create it and leave it so that I can work on the next project. If I was in a situation where the software was a living breathing entity, I’d likely be more open to using less proven technologies.

    Ignore the Fanboys

    I have yet to encounter a programming language, coding style, or paradigm that was perfect. Yet there appears to be no shortage of people who snub others based on this “one article” they read.

    I believe that especially as it comes to languages, it’s about picking the right tool for the right job. C is great for low-level work, but not my first pick for setting up elaborate GUIs, and so forth.

    Most fanboys tend to be good at repeating, but short on understanding. When you hear one blast you for your decision, ask them why such-and-such is better. If they can provide a suitable answer, awesome – listen to what they have to say. But if it’s ignorant tripe like “Python is slow at multithreading because it doesn’t do out-of-order execution”, run. Fast.

    Never Say “This Will be Easy”

    Never say “this will be easy” unless you’ve already done it. Oh sure, it should be easy. But then you do it, and you run into obstacles you didn’t even know were there. Like your company’s network policy that blocks your HTTP requests. Or permission issues on the user’s computer.

    Be especially weary of people express that belief of ease for you. That’s a red flag that they don’t know what they’re talking about.

    Admit When You Don’t Know

    University teaches you to come up with bullshit if you don’t know the answer to something. That doesn’t cut it in a professional workplace. When you don’t know the subject under discussion, don’t fool yourself. Admit that you don’t know.

    Especially in a team setting, it’s an opportunity for others to play to your strengths, and help you on the rest.

    Take Ownership for Mistakes

    This is hard. As soon as you recognize something wonky, tell someone. The worst you can do is let it be and hope it gets better. Luck is the least reliable ally in getting you out of a bind.

    A healthy work environment will take that information, work towards resolution, work out how to prevent it in the future, and move on.

    Don’t Work Weekends

    If you need to work through weekends in addition to weekdays, then start applying for another job. Your health and mental well-being are being sacrificed for a quarterly report.

    If you’re volunteering that time, then you’re making a mistake. It can be very easy to open up the laptop and just work. I’ve done it. But there’s value in that time apart. If you spend all your time on a given problem, then your mind will narrow onto a particular solution. You will inhibit yourself from conceptualizing anything else.

    Meanwhile, if you just stop focusing on it, you might spuriously come by a novel and entirely superior alternative approach. The mind works in funny ways, one being that creativity works best when there’s plenty of time not spent trying to innovate.

    Treat the Cause, not the Symptoms

    Bugs have causes and symptoms. A tendency with new programmers is to blindly change things around until the symptoms disappear, without ever grasping the underlying issue.

    When you’re confronted with a bug whose causes aren’t immediately obvious, stop for a moment. Think about the problem. Understand why it is happening. Then think out how you’re going to address it.

    Leave Optimizations to the Compiler

    Don’t try to optimize for the sake of optimizing. Leave that to the compiler. For one, what you’re changing might not actually be the part of your code that’s taking up the most resources. For another, most optimizations obfuscate the program logic to developers, introducing new avenues for errors. They also often reduce code portability.

    Only optimize when there’s a demonstrable need to do so.

  • Mini Lava Cakes

    Mini Lava Cakes

    I found a simple recipe to make mini lava cakes last week, and got around to trying it tonight.

    It turned out well, though not all cupcakes had gooey interiors. I think I had baked them a few minutes too many.

  • Vegan Poutine

    Vegan Poutine

    I didn’t follow a recipe for this one, just improvised.

    It was a sweet potato. The gravy was a mixture of water, flour, soy sauce, garlic and pepper. The dairy-free cheese was of the Daiya brand.

    The consistency was right, but the gravy was bland. Most recipes I saw for vegan gravy called for lots of oil, which I didn’t want to do. I think next time I’ll experiment with adding more herbs and spices to the gravy. I might also skip out on the cheese, and use something else in its place.

     

  • Trying Out Desktop Environments for Linux

    Trying Out Desktop Environments for Linux

    The hard drive on my laptop was dying, so I replaced it over the last weekend with a 500GB Seagate Momentous XT. This meant I would also reinstall Linux.

    I had settled on Ubuntu as my distro of choice, but I was open to trying a new desktop environment. So I put a few to the test, seeing whether there was something better for me out there. I had been using GNOME 3 before the drive started to falter.

    KDE 4: KDE was my standard desktop environment before GNOME 3. I was excited when KDE 4 was first introduced, though stability issues dissuaded me from adopting it until a few iterations later.

    Like GNOME, KDE is a solid, mature, desktop environment with an eye that has come to value simplifying the default interface for users. Unlike GNOME, this simplicity has not come at the price of omitting advanced features for power users.

    Despite design decisions that have prioritized a simpler look and feel, I do feel that overall KDE is a bit more “cluttered” than other desktop environments, and GNOME in particular. Your desktop always has an “activities” button in view, the default desktop comes with a great big “folder view” widget, the file manager window has more real estate devoted to buttons and metadata than actual files. I feel like the first thing I do when I get KDE up and running is just hide, hide, and hide more things.

    Oxygen, it’s default theme, looks great. The visual effects are nice. The application launcher works well. It’s future is promising with the rise of QML. I wouldn’t be unhappy if this was the DE I had to deal with, though I settled for something else.

    Cinnamon: Cinnamon didn’t like the fglrx drivers for my laptop’s older Radeon 4xxx graphics chip. The framebuffer would become a corrupt mess whenever there was a complex graphical operation like the application launcher fading in. Had there not been these issues, I would have picked this as my DE. Design-wise, it has all the things I like about gnome-shell and none of the baggage.

    GNOME 2: I use it on my RHEL-based systems because it’s rock-solid, but it really shows its age in its lack of modern features. It’s not something that I’d want on my laptop, for which I favour the new and fresh. I didn’t give MATE a try, though perhaps I should have.

    XFCE: It’s relatively lightweight and reliable.  It used to be that it lacked some of the features of more established DEs, but I’d say it’s now on-par with the last generation of desktop environments (KDE 3, GNOME 2). That said, it does lack some of the graphical niceties of this generation’s worth of desktop environments, which is why I ultimately didn’t favour it for my laptop. A solid contender overall, however, and I use it on embedded systems.

    LXDE: Very lightweight, but also light on features – too much so for a primary machine. I’ve used it in embedded systems in the past, and it’s on my Raspberry Pi now. Where possible, I’ll favour XFCE over LXDE however.

    GNOME 3: This DE has received lots of flack lately, which I think is unfortunate. The GNOME team have had a clear vision of making an environment that’s as suited for traditional input devices as it is for touch. They did this well before Microsoft with Windows 8 or Apple with its iOS/OSX convergence. They’ve also taken a clear stance on making things simple, which I think is a big boon for Linux.

    I love the workspace/application switcher in gnome-shell. I however really don’t care for the application launcher. Presenting everything at once in a grid, a la Android or iOS, makes the launcher cluttered  to the point of being useless. It’s not much better than a grandparent whose Windows 98 desktop is completely filled with icons. This is where I wish the GNOME team would have taken a page from Canonical, which I think found a very nice solution to this problem with Unity’s lenses. Everything is neatly categorized and searchable, yet there’s still the large icons necessary for touch input.

    The gnome-shell should have also made window decorations dissapear when the applications are full screen. Or at least make that ability optional. The most common screen resolution these days is 1366×768. With the default gnome-shell activities bar and the Adwaita window decorations, far too much of the screen becomes occupied by unusable space. Again, Unity handles this aspect better.

    I think that the negative attitudes to GNOME 3 are undeserved. I have some minor niggles with gnome-shell, but they are just that: minor. This is a very mature desktop environment with lots of great ideas implemented. I applaud its designers for their vision, and sticking to their guns in the face of such overwhelming reaction. I didn’t mind using it before, especially with some adjustments, but ultimately I decided I would have a better experience with Unity.

    Unity: This has become much more usable since Ubuntu 11.10, and is the DE I have settled with for now. If the team at GNOME had a design goal of making things easy, Unity’s was to reclaim as much of the desktop for the content that mattered. The minimalist scrollbars, the window decorations that dissapear when maximized, the integration of the application menu into the top bar. These ideas took some getting used to, but I’ve come to appreciate them.

    I dislike Unity’s default application switcher. Here, I think the GNOME people do a much better job. I ended up installing CompizConfig to have alt-tab use the “scale” application switcher and have a window edge trigger the workspace switcher like in Cinnamon.

    I also find the visuals rather ugly – I replaced the default GTK+ theme and window decorations for Zukwito and the icons for eOS Dark. As I recall I used gnome-tweak-tool to make that happen.

    Making up for Unity’s deficiencies are the lenses, which let me search for applications and files with a simple press of the super button. Another great plus is its stability. Whereas gnome-shell used to crash on me occasionally, this has yet to do the same. I also like it’s integration with Google calendar via evolution, a feature also found in GNOME 3’s gnome-shell. Overall it works, and it works well.