Weekly Review, March 14

By Saturday, March 14, 2015 0 Permalink 0

Today was Pi day, and this year was “super Pi day”. I already mentioned it this morning. I also mentioned Pi day is celebrated as “Aba day” in my family, thanks to my perfect wife. She’s not into the geekiness, but she’s into making it an awesome day! Today included lemon meringue pie for breakfast, Pi-decor and balloons with a bunch of Pi digits floating around the house, pizza-pie for lunch, and some Pi-centric fashion statements :-)

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

Happy Best Pi Day of Our Lifetime!

By Saturday, March 14, 2015 0 Permalink 0

This “Happy Pi Day” post was published on 3.14.15@9:26:53.589 (at my local time, UTC+0200)!

Pi day is also known as “Aba Day” (or Daddy Day) in my family. You’ll see why in a later post… ;-)

If I lived in the 16th century, I might have witnessed an ever cooler Pi day, on 3.14.1592@6:53:58.979. But back then I guess it was harder to geek out about it…

An even cooler Pi day will take place on 3.14.15926@5:35:8.979 (yes, I’m loose with the zeros). Only 13,910 years, 364 days, 20 hours, 8 minutes, 15 seconds, and 390 milliseconds to go!

Happy Pi Day!

Using Python’s print With No Newline

Maybe I’m the only one who didn’t know that, but yesterday I learned how to make Python’s print function not write \n.

If you’re using Python’s print function to write stuff to standard output, you’re probably used to its default behavior of ending lines with \n:

> for i in xrange(5): print i
0
1
2
3
4

Sometimes you don’t want it to add the trailing newline. I used to think that in such cases, I need to switch to sys.stdout:

> import sys
> %paste
for i in xrange(5):
    sys.stdout.write('%d ' % (i))
else:
    sys.stdout.write('\n')  # for the trailing newline after the last iteration

## -- End pasted text --
0 1 2 3 4

Turns out that the print function supports the same behavior with a trailing comma!

> for i in xrange(5): print i,

0 1 2 3 4

Of course, this is covered in the documentation.

Every day I learn something new…

Weekly Review, March 7

By Sunday, March 8, 2015 0 Permalink 0

Earlier this week, I finished listening to the audio book version of “A More Beautiful Question: The Power of Inquiry to Spark Breakthrough Ideas”, by Warren Berger.

In this book, Warren Berger explores the power of questions and the questioning mindset, and how it is used to ignite change in business and in our daily lives. Warren finds that although children start out asking hundreds of questions a day, questioning decreases dramatically as children enter school. He discusses the effect of the education and business culture that rewards answers, and barely tolerates questions. Warren analyzes numerous examples of successful startups (e.g. Google, Airbnb, Netflix, and more), and reveals how questioning is key in their culture, and the driver for innovation. Throughout the book, the author outlines a practical Why-What If-How framework of inquiry to facilitate the process of innovation.

I enjoyed the book very much, and recommend it whole heartedly! It resonated with my own lingering thoughts and concerns about the western education system, that keep growing as my own kids approach entering this broken and outdated system. When the day arrives, I hope I will be able to enroll my kids to a school that embraces and encourages the questioning mindset, instead of demanding canned answers and emphasizing compliance – a culture that served the industrial age, but is harmful at the information age. Are you familiar with such school? In Israel? Around the world? Please let me know!

I also completed today the Cloud Compute Concepts (1) Coursera course. This course was a 5-week MOOC from University of Illinois at Urbana-Champaign, covering some basic technical concepts in cloud computing. The syllabus includes MapReduce, grids, peer-to-peer systems, failure detection and membership protocols, key/value stores (e.g. Cassandra), multicast, time ordering in distributed systems, snapshots, the consensus problem and the Paxos protocol.

I’m not seeking any “formal” qualifications on this subject. When I started my current job at Yowza](http://www.yowza3d.com/), it was the first time I worked with cloud technology at depth. I picked up lots and lots of practical stuff, but I felt I’m missing the background and underlying theory. To compensate for this, I decided to take a series of Coursera courses, whose syllabi looked comprehensive enough. This course was the first in the series, and I think I already produced value from it. For instance, we’re considering using Cassandra, and thanks to the course, I now know more about Cassandra then I knew before.

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

Shell Foo: Simple Distributed grep on a GCE Cluster

You just finished running a distributed multi-phase pipeline on a cluster of 200 GCE VM’s. Good for you! But something doesn’t look right, and you’d like to investigate by grepping the local log files across all nodes and do something with the results. How would you do that?

Let’s say that if you had 1-2 machines, you would ssh into each, and run this command:

$ grep ERROR /tmp/*.log.* >errors

This post describes a simple one-liner that scales the local grep to cluster-scale.

Shell-Foo credit for this one: Eyal Fink.

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!

App Highlights: Twilight

According to research, exposure to blue light near bedtime is bad.

Twilight is a simple app that makes your device screen adapt to the time of the day. Using the app is like applying a red filter to the screen, filtering emitted blue light from reaching your eyes. The app uses your location, to adjust the filter intensity to the sun cycle, based on local sunset and sunrise times.

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.

Supporting External Libraries In My SCons Shortcuts

By Thursday, February 26, 2015 0 , , Permalink 0

This is the fifteenth post in my SCons series. This post introduces a small enhancement to my SCons shortcuts system – nicer support for external libraries via the with_libs keyword argument.

In recent episodes, I needed to link with the protobuf library to use the Protocol-Buffers-based AddressBook library. I did this by adding the LIBS=['protobuf'] argument to the Program target, which works just fine.

If this works “just fine”, why mess with it? Well, I already mentioned my OCD, haven’t I? I already have a nicer way to refer to libraries I use, so why can’t I write with_libs=['AddressBook::addressbook', 'protobuf']? It looks a bit cleaner.

The reason this would not work as is, is because I lookup the with_libs entries in a shared dictionary of project-specific libraries (more no that in the post that introduced the shortcuts system), and “protobuf” is not a project library.

This post extends the shortcuts system to support also external libraries. In addition to improved aesthetics, I add a couple of useful features:

  • Support configuration-based list of “supported external libraries”. This allows for centralized control of external libraries used across the project, which can be very useful in projects that want to enforce policies about library-usage (e.g. licensing requirements etc.).
  • Simpler support for libraries that are not installed system-wide, taking care of icky details, like CPPPATH and LIBPATH crap.
  • Protection against potentially difficult troubleshooting due to library name typo’s.
  • External library aliases and groups.

This episode picks up where the previous episode left off. Read on for the full details, or check out the final result on my GitHub scons-series repository.

Weekly Review, February 21

By Saturday, February 21, 2015 0 Permalink 0

In case you missed it, Lenovo preinstalled an adware called Superfish on Windows laptops. Not only that this adware obnoxiously injects ads to your search results, turns out that the Superfish adware implements man-in-the-middle to do its thing!

If you think that’s bad enough, the certificate they use to do this was easy to crack… This means that anyone can use this to implement man-in-the-middle attacks against machines with the Superfish certificate installed… :-( In case you’re curious, the password is “komodia”.

Scared? Rightly so! Go ahead and check yourself, and clean it up if you’ve got it!

Interesting to see claims that the adware poses no risk… O_o

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

Adding SCons Proto Builder Shortcut

This is the fourteenth post in my SCons series. The topic of this post is adding a shortcut for the custom SCons Protoc builder from the previous episodes.

The shortcut is in line with the SConscript simplification approach described in an earlier episode. In this installment, I add a new Proto shortcut to the collection, so the address book SConscript can look like this:

"""AddressBook proto-based library SConscript script"""

Import('*')

AbProtos = ['person.proto', 'addressbook.proto']

Proto(AbProtos)
Lib('addressbook', protos=AbProtos)

The final result is available on my GitHub scons-series repository.