Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Subscribe: RSS JSON

2019 November

  • What to do in a production crisis

    Despite our best efforts as software developers, it can still happen: production goes down. Or some sort of bug introduces catastrophic data error. Hopefully you have a support/DevOps team to handle the response. If not, the dev team themselves have to step in. This usual means a mad rush to figure out what happened and how to fix it, sometimes during off hours and maybe even into the early morning, all while facing pressure from clients and higher-ups. I was advising another developer in such a situation a while back, and it was his first stint as technical lead so

    read more (441 words)

  • DevNotes: Python's yield

    I've been using Python for well over 10 years, and I still don't have an intuitive mastery of one of its keywords: yield. Everytime I see it in someone's code I need to stop and mentally remind myself what it does. I figured I'd write a devnote to help improve my recall. Typically, yield is used in a function with a loop, like so: def some_func(lim): for i in range(0, lim): yield i yield means the function returns a "generator" that can be used as an iterable in a loop: for val in some_func(5): print(val) You can also straight up

    read more (172 words)

  • The Perils of Handover Documentation

    A while back I found myself having to figure out how to compile/build/run a mobile application. The developers previously assigned to the project were no longer available to consult with, but they did leave behind some documentation. However, their documentation quality left a lot to be desired. The instructions they left basically amounted to: npm install ionic serve ionic codrova run android/ios Okay, first sign of trouble is that their instructions were basically commands that anyone who knew the app used Ionic would be able to Google. But ok, I gave this a shot, even though I had not used

    read more (725 words)

    Posted by under blog at #software-development

    Also on: twitter / 725 words

2019 August

  • Python: Markov Chains

    Back when I was still learning Python in 2008, one of the first "fun" scripts I wrote was a text generator using Markov chains. I'd run it against all the chat logs I had with people at work and serve the results from a webserver on my computer. THe results were often amusing and sometimes hilarious. Since I've been going through my old scripts lately, I thought I'd update that script to Python 3 (read: add parentheses around print params and use pathlib) and run it against all the posts on this here site. I added the script to my

    read more (162 words)

    Posted by under blog at #software-development #python

    Also on: twitter / 162 words

  • Devnotes: Python Pathlib

    Ever since I started learning Python back in 2008ish, I've been using it as my primary scripting language for various tasks such as processing log files, organizing my own file system, processing stuff on this blog, and so on. A lot of it is basically moving files around. In the days of Python 2, that involved a lot of imports of different libraries like os, shutil and glob. It can become a bit messy with so many imports, and I often can't remember which import I need for a particular case and end up having to search for the documentation

    read more (316 words)

  • Devnotes: Migrating Mercurial to Git

    Big news in online repositories this week is that Bitbucket is sunsetting support for Mercurial! This might be the death knell for Mercurial, although Git was already the super popular choice before. Back when I started using online source control for my personal coding projects I started out with Bitbucket over Github because they offered unlimited private repos and Mercurial (which I had already tried out before at work, so at first I preferred it over git). Now that Gitlab and Github both offer unlimited private repos, there's no reason to stick with Bitbucket either. I had already migrated most

    read more (279 words)

  • I recently found myself doing a really small project as sort of a proof of concept/demo for a potential client. It often seems that it might be a waste of time to do something like this since you don't know if the project will actually push through or maybe the client will want something else. To kind of hedge my bets a bit, I decided to take the opportunity to try out some new technologies so that no matter what I at least learned something from all of this. (What is life if not learning?) Django Rest Framework. I've been

    read more (750 words)

  • I decided to start doing small "devnotes" on developer stuff I'm doing so I can refer to them later (and also because I feel like I could use more technical content on this blog) Today is about PostgreSQL. I haven't used it much beyond standard ANSI sql stuff. You won't always have a graphical interface to access your database, sometimes you need to ssh to prod and query the database from the shell. The command line for PostgreSQL is psql. You can do: psql [database-user-name] -d [database-name] and it should prompt you for your password. But when I tried this

    read more (317 words)

    Posted by under blog at #devnotes #software-development

    Also on: twitter / 317 words

2019 July

  • Upgrading a React Native Project

    I have a small mobile app that I wrote using React Native (henceforth RN) back in 2017, currently deployed on the Google Play Store and Apple App Store. Shortly before my US trip, I got an email from Google telling me about a required action: By August 1, 2019, all apps that use native code must provide a 64-bit version in addition to the 32-bit version in order to publish an update. This past January, we reiterated that this is required in order to make way for innovation and in anticipation of future Android devices that only support 64-bit code.

    read more (1080 words)

  • 10X Programmers

    The topic of the mythical "10x programmer" has been the topic of discussion recently on tech twitter, due to a thread listing out the supposed signs of being such a mythical beast. 10x engineersFounders if you ever come across this rare breed of engineers, grab them. If you have a 10x engineer as part of your first few engineers, you increase the odds of your startup success significantly.OK, here is a tough question.How do you spot a 10x engineer?β€” Shekhar Kirani (@skirani) July 11, 2019 The thread received a lot of negative responses, mainly because several of these items can

    read more (1943 words)

    Posted by under blog at #software-development

    Also on: twitter / 1943 words

2019 April

2019 March

  • A Quick Twitter App I Wrote

    I wish I had a more concise way to describe it, but I really don't. Some time ago this guy I follow on Twitter, visakanv wanted to know how to do a certain search: he wanted to know who a given famous person follows on Twitter, and among those, finds the one who follow him (visakanv), so he could network through them. I might not be explaining the concept too well, here's the thread. Anyway, in a fit of "I'm a bit bored, anything interesting I could do?" I figured I could set up a quick webapp to do that.

    read more (373 words)

    Posted by under blog at #software-development

    Also on: twitter / 373 words

  • Lies and marketing

  • Don't stay in the same place too long

    If I could give some advice to someone starting out in their software development career, it would be this: Don't stay in the same place too long. The first company I worked at, I stayed with them for thirteen years, which I now feel was way too long. I have to admit, the work was hard and challenging, but I was young and had a lot of energy and was willing to work the long hours. I was good at the work and the enjoyed the company of the people I worked with so in a certain sense I got

    read more (480 words)

    Posted by under blog at #software-development

    Also on: twitter / 480 words

  • Another repost from my Quora answers, this time some info for anyone looking to move into programming. What are the pros and cons of making your career in programming? Pros: It is a very rewarding career financially. Software development often ranks in the top 10 highest-earning careers in most countries There is a lot of scope - you could be developing web applications, mobile applications, embedded applications, client-side, server-side, data analysis, artificial intelligence, games, etc It is very difficult to be bored. You can always automate away the boring stuff. Different projects always present different challenges. The field is evolving

    read more (459 words)

  • Studying a large project codebase

    Given my recent misgivings about Quora, I thought it might be a good idea to cross-post some of my answers from there into this blog, with some edits even. So here's the first one! (stuff in italics were added during the cross-post) How can you read and study a large software project source code? Attacking a large, existing codebase that you are unfamiliar with can be a daunting endeavor. Don't expect that you will be able to easily navigate the codebase quickly after just a few days of studying it. Familiarity will come with experience. Some things that can help:

    read more (393 words)

    Posted by under blog at #quora #software-development

    Also on: twitter / 393 words

2019 February

  • Reddit PH: Software Dev Q&A

    I had some free time the other day so I randomly decided to post in the PH subreddit's regular afternoon random discussion thread, asking for questions about software development. I ended up typing some longish answers, I thought I'd copy them over to the blog in case anyone was interested. TBH I meant more like StackOverflow type questions with specific technical problems, but I ended up answering mostly career-related questions, which is fine, but disclaimer: I don't claim to be an expert, these are just my opinions on things. capybara_c0de: project/s junior devs should include in his/her portfolio? I've technical

    read more (1124 words)

  • Hacktoberfest

    Last October I participated in #Hacktoberfest, sponsored by DigitalOcean and Github. It's a "celebration" to promote open source activity, and basically you just need to submit 5 pull requests to any github repository, and they give away swag to anyone who completes the activity. Microsoft held a [counterpart celebration] where they only require you to submit 1 pull request to any Microsoft repository. I've always wanted to start participating in Open Source, but it's a bit difficult to find a good place to contribute (other than logging issues of course). So when I heard about this activity, I thought "Why

    read more (305 words)

  • TriviaStorm: Text and Answer parsing

    A while back I started a Twitter trivia bot as a weekend project. That bot is still up and running on Twitter, you can check it out there! But today, I thought I'd write about the answer-checking mechanism used by the bot. It was a bit interesting to me because it was the first nontrivial use I had for Django's unit testing framework. I'm not too keen on unit testing web functionality (something I still have to learn), but this seemed an appropriate first use of a unit test framework for several reasons: the bot had to be able to

    read more (579 words)