Supporting Arbitrary Modules Order In SCons

By Thursday, December 18, 2014 2 , , Permalink 0

This is the eighth post in my SCons series. In this post, I describe how to support arbitrary modules order.

In an earlier episode, I presented the multi-module C++ SCons project. In that episode, I explained that modules need to be specified at the order of dependence.

This restriction can be annoying, and painfully limiting, once your project “gets serious”.

I promised a better solution, and now I provide one πŸ™‚ . In a nutshell, the solution is based on a two-pass approach. In the first pass, all library-targets are processed and collected across all modules. In the second pass, all program-targets are processed, using the libraries already collected.

The rest of the post goes into further detail about the solution. The result, as usual, is available on my GitHub scons-series repository. It builds on top of the SCons shortcuts enhancement, in case you need to refresh your memory πŸ™‚ .

Continue Reading…

Manipulating Python os.walk Recursion

The os.walk function in Python is a powerful function. It generates the file names and sub-directory names in a directory tree by walking the tree. For each directory in the tree, it yields a 3-tuple (dirpath, dirnames, filenames).

It is not well-known that you can modify dirnames in the body of the os.walk() loop to manipulate the recursion!

I’ve seen programmers avoid using os.walk(), and hack their own version of it using recursive calls to os.listdir(), with various path manipulations in the process. It was rare that the programmer doing this was not familiar with os.walk(). More often than not, the reason was that the programmer wanted more control over the recursion. Unfortunately, if the programmer was aware that this can be done with os.walk(), she would probably use it and save time and sweat!

This specific feature is well documented in the Python os.walk docs. Seeing how under-used it is, I wanted to highlight it here, hoping it will serve someone out there πŸ™‚ .

Continue Reading…

Weekly Review, December 13

By Saturday, December 13, 2014 0 Permalink 1

Look! My Day Job startup launched a public website! You can now read some more about how we at Yowza are trying to make computers understand the world in 3D.

We believe 3D data will become ubiquitous, and revolutionize the world. Just like cameras in every pocket made images so important, the day that everyone will always carry a tiny high-resolution 3D scanner is not far. To take advantage of the imminent explosion of 3D data, we’re working today on giving technology the ability to make sense of the world around it in 3D.

Naturally, this is a huge undertaking. As a small startup (13 at the moment), we have to start with something and focus on it. For us, that first something is yowza-search. Our approach to search is shape-based, driven by the underlying geometry of indexed objects. This involves pretty high-level math, so we’re always on the lookout for bright people with strong background in math or physics. This also involves some serious compute-fu, scaling up the algorithmic shit to handle volumes of 3D data (did I say “cloud” and “big data”? πŸ˜‰ ).

If any of it sounds interesting to you, consider joining us! πŸ™‚

btw, the post image is a screenshot of a 3D model of myself (produced with a 3D scanner).

The Weekly Review is a recurring (so-far-)weekly summary, reviewing highlights from the last week.

Continue Reading…

Right-click Hashes and Pythons ASCII command-line

By Thursday, December 11, 2014 0 , Permalink 1

This post is a guest post by Gil Dollberg

A while ago I wrote a Python script that calculates MD5 and SHA1 hashes on a file with a right click. Here’s the script that calculates the MD5 and the script that writes the .reg file. What you probably want to download is just the reg file – double click, install, and you’re set. Note the pythonw.exe caveat below though…

Continue Reading…

Starting Terminal In the Current Directory In OS X Finder

I use the terminal on OS X a lot. I also use Finder to navigate the file system. Sometimes I want to start a terminal session in the current Finder location. To do it, I found the cd to… app.

Last year, when I was mainly on Windows, I showed how to use AutoHotkey to launch the command prompt from anywhere. Now that I’m mostly on OS X, the terminal is even more useful than the command prompt on Windows. It’s only natural that I want similar access to it.

The cd to… app does something similar. When executed, it opens a new terminal window, at the active Finder location. The app can live in the Finder toolbar for quick one-click access. I prefer staying at the keyboard as much as I can, so I rather invoke it with Spotlight, or using a keyboard shortcut assigned to launch it.

This is part of my Mac Power User Training series. Follow it to see how I try to go from Mac novice to a pro.

Continue Reading…

App Highlights: Pushbullet

Pushbullet is the missing link between your mobile devices and other computers. With its various mobile apps and browser extensions, it finally allows you to move between mobile and desktop with ease.

The features that make Pushbullet one of the first things I install include:

  • Notification sync: the mobile app sends notifications to the desktop, so I don’t need to pick up the phone while working on my laptop.
  • Push links (and files, and notes): push something from the desktop to the phone, instantly. no more emailing-to-self nonsense!
  • SMS from desktop: send and reply to SMS messages from the laptop, without picking up the phone!

App Highlights is a recurring series. From time to time, I highlight one Android app that I found useful. Feel free to suggest apps for me to highlight, but be advised that I focus on apps that I actually use.

Continue Reading…

Weekly Review, December 6

By Saturday, December 6, 2014 0 Permalink 1

Oogis dad will turn 60 next week. Her mom decided to surprise him with a family weekend retreat. We rented a beautiful Villa on the beach and spent our time eating and resting, just like god intended. All in all, everybody had a great time. The kids got to see some sea, and the only thing missing was hot water in the shower. That, and Noona.

I always had a hard time understanding the gap between the culture of (some) companies, and the harshness of (most) standard employment agreements. A company with an open culture, that may even encourage side projects and open source contribution, still has legalese about all inventions being the sole property of the company… Once again, Joel Gascoigne from Buffer stands behind their transparent culture, and tackles the issue of the employment agreement with a pledge to employees. To my understanding, the pledge Joel presents contradicts the employment agreement (at least in spirit), and the employment agreement takes precedence. Despite that, I think it’s good to convey the spirit of the employer-employee relation in plain language, as the employer sees it.

What do you think? As an employer? Employee?

The Weekly Review is a recurring (so-far-)weekly summary, reviewing highlights from the last week.

Continue Reading…

How To Assign Keyboard Shortcuts For OS X Apps

As much as the trackpad is powerful on Mac, I still prefer not to leave the keyboard if I can. For that reason, I want to assign keyboard shortcuts to the rare few apps that deserve it. Imagine my surprise when I realized it’s not a straight forward action in OS X!

In this post I describe how to assign arbitrary keyboard shortcuts to launch OS X apps, without any third-party software or AppleScript. The solution is based on creating an Automator Service workflow to launch the desired app, and assigning a keyboard shortcut to that service.

I imagine there are simpler solutions that take advantage of some third party automation software or AppleScript. Feel free to let me know about your preferred solution, even if it involves such demons.

I am aware that I can use Spotlight to launch any application by typing the first letters of its name. Indeed, this is how I launch 99% of apps. There are very few cases where it makes sense to bypass Spotlight with a shorter key-combo – and this post is for these cases.

This is part of my Mac Power User Training series. Follow it to see how I try to go from Mac novice to a pro.

Continue Reading…

Shell Foo: Getting a cpplint Breakdown Report On All Project Source Files

You’re working on a non-trivial project, with multiple source files, in multiple languages. You want to use cpplint to get a “style report” for all C/C++ files in the project.

You don’t want to get bogged down with hundreds of style warnings – you just want the final summary of warnings count per category.

In addition, you want to run only on C/C++ files, and avoid duplicates resulting from the build-directory.

How do you accomplish that?

Shell-Foo is a series of fun ways to take advantage of the powers of the shell. In the series, I highlight shell one-liners that I found useful or interesting. Most of the entries should work on bash on Linux, OS X and other UNIX-variants. Some probably work with other shells as well. Your mileage may vary.

Feel free to suggest your own Shell-Foo one-liners!

Continue Reading…

Python Logging Traps

The Pythons logging framework is powerful, but gives you plenty of ways to shoot yourself in the foot. To make matters worse, logging mistakes are subtle and slip through code review easily.

The post Python Logging Traps by Simon Weber originally appeared on www.simonmweber.com

In his time at Venmo, Simon had seen logging mistakes cause everything from unneeded debugging to application crashes. Here are the most common culprits.

Continue Reading…