Tag: django

  • Puck Mouse

    Introduction

    This post is a guide for building your own version of Apache’s mod_python as a Universal Binary in order to support a custom Django install containing the Twitter libraries. As you can probably gather, this information is likely only useful to advanced Mac users who are comfortable in Terminal with compiling and installing software from source. If you’re still interested, gird your loins, crack your knuckles, grab some Mountain Dew, and read on.

    Mac OS X 10.5 “Leopard” is yet another step forward into the world of 64-bit. At the same time, Apple has to support both PowerPC and Intel architectures. This is no mean feat, and this is where “fat” or Universal binaries come in.  Apple also has an explanation of Universal binaries, although it’s heavy on PR. This is all well and good, but there is one problem: once you make this leap, all of your library dependencies must contain the architecture you’re running as. Much software is still built as 32-bit only; while it may be a “fat” binary, containing both Intel and PowerPC machine code, it only has the 32-bit versions thereof. For reference, the names of the various architecture flags:

      32-bit 64-bit
    Intel i386 x86_64
    PowerPC ppc7400 ppc64

    Huzzah naming conventions! There’s a lot of history in those names. I’ve linked to the relevant Wikipedia articles if you’re curious; these flags will be coming up again later when configuring various builds. The main thing to note is that most build configurations default to i386 on Intel Macs (even though Core 2 and Xeon processors are natively 64-bit), probably because most software is developed for 32-bit versions of Windows and Linux. As you’ll see, we’ll be overriding that default in several places to get this whole mess working.

    Unfortunately, Universality is a cancer, which in my case starts with the Apple-shipped version of the Apache web server in 10.5, a universal binary. Everything it touches needs to be Universal as well, so that Apache can run as a 64-bit process by default. I wanted to add Django support on my web server via mod_python, specifically to play with the Twitter API, which meant I also needed to build python-twitter and its dependencies, as well as a MySQL python module to allow Django to talk to my database. None of these are included in the default Leopard version of Python 2.5.1.

    After getting all of this set up, and trying to start my test Django app, mod_python was giving me errors about architecture. As it turns out, the included version of Python is only a “fat” 32-bit binary, not a Universal binary… which means all of the new Python modules I just compiled to support Twitter and Django were only 32-bit, which in turn means that the included Universal version of Apache and mod_python couldn’t use them. Yay.

    Below the cut you’ll find my complete instructions for compiling all of the relevant components and their dependencies. I also took the opportunity to update to the latest release version of Python 2.6 and MySQL 5.1, and as a side effect my database server is now running as a 64-bit process. Progress has been made here. Feel free to comment or contact me if you have questions.

    (more…)

  • Seattle After Dark

    Seattle skyline at night with Space Needle in center, with Christmas lights on top

    We were wandering the neighborhood to see light displays and ended up at Kerry Park’s iconic view.

  • The Potato Wanter

    Small Yorkshire Terrier stands on kitchen floor begging.

    Pike has learned to beg for chopped broccoli and kale so now any use of the cutting board summons him.

  • Cube

    Hand holds a Rubik's cube at angle so the white face with logo, blue face, and orange face are visible.

    Nerd achievement unlocked. Kiddo asked me to solve his Rubik’s Cube. I merely followed the algorithm.

  • New Glasses

    Selfie of Nick in a grey shirt with new small brown professorial glasses, standing in front of a grey wall with a black metal bird sculpture on it

    After almost three years without a vision checkup, found my nearsightedness increased slightly in one eye. Picked out some new frames in a different style, courtesy Queen Anne Eye Clinic.

  • Work Where You Want

    For those of us in the “knowledge economy” we have the privilege of our work largely being decoupled from objects and places. Whether it’s coding, designing, writing, or any number of other activities that involve manipulating information, little more is required than ourselves, a computer, and an internet connection. This feature has been of particular value during the ongoing global pandemic as it has offered workers the opportunity to shape their lives as best as they can while dealing with extreme external stressors.

    For those of you not immersed in the Apple blog-podcast-Twitter discourse, recently John Gruber doubled down on his take on remote work prompted by an internal Apple employee letter. I think John’s take is bad, and has prompted multiple rounds of valid criticism from a variety of sources. At points in both posts he refers to the leaked Apple employee statement as “self indulgent” or “passive-aggressive”, and I think in general fails to understand how much the last almost year and a half of remote work has obviously changed the way many Apple employees relate to work and home life. This is especially ironic coming from someone who has been a work-from-home member of the commentariat for well over a decade!

    At this point I should do two things: disclaim that my opinions are my own and do not reflect those of my employer; and establish my own remote work bonafides. In addition to the current pandemic-induced work from home period, I worked remotely for the last two years in my previous job. In the former case my entire team is forced to work from home (with perhaps occasional brief periods in the office as needed); in the latter I was the odd one out but remained a part of a team with whom I had already established in-person relationships. I want to talk a little bit about the advantages of supporting people working where they want, when they want, as the nature of their work allows.

    First and foremost for myself, both that previous remote stint and the crisis-induced work-from-home period have allowed me to spend more time with my family at critical periods of their day. Somewhat flexible hours and working from home have allowed me to be more present for everything from meals to bedtime to walking to school. Secondly, the elimination of a daily commute (at least one that exceeds walking down the hall!), even when trying to live in locations that minimize distance to an office, saves time that I can now dedicate to other pursuits, including cohosting a video game podcast with my friend Chris. Thirdly, with modern communication tools like chat apps and video calls, you don’t have to fight to book a conference room and there are whole categories of meetings that can be handled more easily with an asynchronous conversation or more quickly with a short call than gathering everyone in one big (and likely poorly ventilated) room. Finally, most large companies already have teams distributed all over the world, so they were already making use of tools that support remote work just to complete their regular in-office work. And these points don’t even consider the accessibility factors in how remote work allows fuller participation from disabled folks! (This is an area where Gruber seems particularly obtuse in his complaint that anyone disagreeing with the original letter must be against inclusivity; including disability means accommodations like remote work.)

    Fully remote work is not entirely without its disadvantages; however I think most of these problems have mitigations, if a team works to establish those mechanisms. In the last year-plus of remote work I have run into only three major issues: onboarding new hires into the team culture; some team members overworking; and certain kinds of technical discussion. All of these are more of a problem in an organization that is not natively remote, where habits around this kind of work are lacking. For the first, I think it’s a combination of some natural human tendencies to want to get to know people face-to-face as well as how you structure impromptu encounters between experienced team members and new hires. These don’t require an office, but unless you structure your team thoughtfully, it can be challenging to bring new folks into the fold. For the second, when work is reachable from everywhere, it’s all too easy to never stop working. I try to make clear to people on my team that they should establish clear boundaries and use tools at hand (such as calendar blockers and notification settings) to separate work time from other time. (This is something that is easier said than done; Slack on my phone is dangerous!) For the third, as a technical lead on my team, the thing I miss the most is being able to overhear (and jump into!) some informal technical discussions. Right now some of those might be happening in direct messages or other chat channels I’m not in, in which case I might miss out on giving some critical feedback until a later review when it’s a bit too late.

    All of these problems are solvable with a fully remote or hybrid team. You can establish a mentorship system with onboarding guides to welcome new members to the team; you can schedule regular virtual team events that help build those critical trust relationships; you can agree upon team standards for core hours; you can configure your devices to not inject work into your non-work times; you you can have conversations in the right channels where stakeholders have an opportunity to comment and arrest a problematic solution before it goes too far; you can share your musings in documents and channels where team members of all levels can comment on them.

    To get back to my criticism of John’s thoughts specifically: he puts a lot of emphasis on gathering everyone together in Apple Park, which is no doubt an architectural wonder. As a would-be urbanist (who happens to normally work in a downtown office) I think Apple has made a mistake in creating this suburban monument and expecting so many of their employees to physically commute there. While a beautiful space, that kind of daily routine sacrifices time that be can better used for other activities with limited advantages on any given typical day in the office. “Onsite” or “office centric” culture misunderstands what most modern knowledge workers value, and Gruber demonstrates his worst impulses in in repeatedly stating that employees just need to get in line with a executive-driven return to normal that fails to value their unique and diverse lives.

    In short, a company or a team that wants to hire the best people to solve their complex problems must support a wide variety of work arrangements, including fully remote work. Let your employees work where and how they want to.