Get Safe Paths From Arbitrary Strings In Python

Sometimes, all you want to do with an arbitrary string, is to use it to create a file or a directory. Really, that’s all. Nothing too special about it, right?

Alas! This is the root of all evil!

Arbitrary strings are dangerous, and should be handled with the utmost care, as if they were explosives, or Frank Underwood’s new liver! (sorry)

Wait, but, how exactly are they to be handled? And why should you reimplement this apparently basic, but practically risky, functionality every time you need it?

This is exactly what my ostrich.utils.text.get_safe_path() OstrichLib function set out to solve once and for all 🙂

It’s already available in Ostrich Lib in release v0.0. It’s also released to PyPI, meaning you can get it now with pip install ostrichlib. It’s tested (using Travis CI) against Python 2 & 3, and requires only the future library as an external dependency (which makes everyone happier with Python 2 / Python 3 compatibility). Detailed library documentation are available via Read the Docs. Hurray!

I would love to get some review from others for my solution, given the risky nature of the problem.

Continue Reading…

Migrating Kambatz Meteor App to Galaxy

A few months back, MDG announced Meteor Galaxy, their “cloud platform for operating and managing Meteor applications”. It was only for development teams and enterprise at the time. Earlier this month they released One Galaxy for Everyone, including a basic “pay-as-you-go” plan for $0.035/container-hour.

Now, I can’t say I was unhappy with the free hosting on meteor.com, but along with this Galaxy release they also decided to shutdown the free hosting on meteor.com. So I had no choice, but to migrate my Kambatz app.

I am aware that there are multiple Meteor hosting options out there. I am going with Galaxy, for now, because:

  1. It looks like the path of least effort 🙂
  2. I did not see other viable free options, and this seems to be affordable.
  3. When Galaxy was launched on October 2015, I watched a talk by MDG’s Matt DeBergalis on AWS re:Invent about the Galaxy architecture. It’s built on top of AWS Elastic Container Service (ECS), and it was fascinating. If I can have a chance to experience it from some perspective (e.g., an end-user), maybe I can learn more about it. In any case, the alternative I had in mind is to set up my own Meteor-in-Docker on AWS-ECS, to minimize costs, so this seems pretty close to that. Maybe if I later transition, it will be smoother 🙂 .
  4. Supposedly, since I migrated before March 25, I should get a $25 credit on my Galaxy account 🙂 . Haven’t seen it yet though.

One thing to keep in mind is that Galaxy does not include MongoDB hosting. You’ll need to find another place to host your MongoDB, like mLab.

Continue Reading…

Intro to Meteor Coursera Course: Final Thoughts

I completed the Introduction to Meteor.js Development course two weeks ago, after submitting the final assignment – my social website aggregator. I waited with this “final thoughts” post, because the course officially ended just now.

I also joined the follow-up course, Web Application Development with JavaScript and MongoDB, as it seems to keep digging into more advanced Meteor subjects. It just started this week.

Continue Reading…

Kambatz App: First Iteration

I finally started building Kambatz – my bills management app.

It’s a refreshing change, after weeks of just learning, by taking an online course, or going through an official tutorial. I finished the course, in case you’re curious. I plan to write my thoughts about the course once it formally ends.

The course served me well. I was able to use my submission for the final assignment as a reasonable starting point for my Kambatz app. I changed most of it, but it was useful nonetheless!

This iteration of the app doesn’t really do anything. It’s just some plumbing and layout to get me started. Read on for more about what it contains, and the new things I learned while working on it.

You can see the latest prototype at kambatz.meteor.com, and follow the code on the GitHub repository 🙂 .

A snapshot of this iteration is available at 20151213.kambatz.meteor.com, and the code for this iteration is tagged in the GitHub repository.

Continue Reading…

Official Meteor Tutorial: TODO App With React

I installed Meteor, and joined a Coursera introduction course, but I still want to go through one of the official Meteor tutorials.

The Meteor site has a tutorial around building a “ToDo App”, in one of three flavors – Blaze, Angular, and React.

I’m not quite sure what it means to choose one of these flavors (see more in the feedback section). It looks like Blaze is some sort of a default, or the recommended one, based on some links pointing directly to it, and the fact that it is the first in the list. I’m already using Blaze in the Meteor intro Coursera course, so to spice things up, I randomly decided to go with React for this tutorial.

Do read on for the an exciting and detailed accounting of my step-by-step experience with the tutorial! 🙂 For your convenience, I have shared my tutorial implementation in a GitHub repository. It shouldn’t be very different from the official Meteor tutorial repository, but I took the liberty to add some tweaks of my own.

tl;dr: The tutorial was excellent. It is well structured. Things worked as expected. It is clear and concise. I feel I learned a lot in a short time. I do have some feedback to share, about the lack of clarity about Blaze vs. Angular vs. React, the mobile section, and the insecure defaults that are built-in.

Continue Reading…

I Joined the Intro to Meteor Coursera Course

After installing Meteor, I thought I will continue with the tutorial, in my learning process. But then I found out that Coursera is offering a free Introduction to Meteor.js Development course that just started last week. Since the course was approaching the end of week 1, I decided I’d go ahead and join the it!

Continue Reading…

Installing Meteor – First Step In Meteor Training

The first obvious step in learning the Meteor JavaScript platform is to install it on my laptop.

So I did it. The verdict – very easy and friendly. Running one console command I copied & pasted from the Installing Meteor page.

I did that on OS X and on Ubuntu Linux (14.04). On both platforms it worked smoothly. Haven’t tried Windows, since I don’t do development on Windows these days.

At the time of writing, the current Meteor version was 1.2.1.

Continue Reading…

Kambatz: The App I’m Building To Learn Meteor

So I said I want to build a utility app for myself. And do that using the Meteor JavaScript platform. While learning it. And blogging about learning it.

OK, but what’s this utility app I’m talking about? This is the topic of this post.

I’m fanatic about my digital paperwork organization system, especially when it comes to monthly bills. I have several self-imposed requirements from my bills processing workflow (beyond “pay on time” 🙂 ) that I’d like to automate as much as possible. The purpose of the app is to enable this bills processing workflow automation.

I know, this isn’t the sexiest app out there. It is, though, a real and concrete need that I have. Solving this will save me significant time. This means I’m motivated enough to build it 🙂 .

Keep reading for more details about my plans for this bills management app.

Continue Reading…

I’m Going to Teach Myself the Meteor JavaScript Platform – While Blogging the Process

I want to build a utility app for myself. It doesn’t matter what’s this app is about – I’ll get to that later. What matters is that I get a chance to start something from scratch, which is always fun 🙂 .

For this project, I decided to use Meteor – a JavaScript app platform.

The interesting thing about this project, is that I have zero experience with Meteor. Or any other JavaScript framework for that matter. I have some knowledge of JavaScript & HTML basics, but that’s pretty much it.

I see this as an opportunity to capture and document the newbie experience as I go through the learning process! As I learn the Meteor platform and build my project, I will blog about my experience as a newcomer to the Meteor platform.

This should be interesting 🙂 . Read on for more about my motivation and plans.

Continue Reading…

Shell Foo: Comparing the Output of Two Commands – Without Temp Files!

You probably know to use the diff file1 file2 command to compare file1 and file2 line by line.

Sometimes you don’t want to compare files, but output of commands. For example, compare sort file1 and sort file2. Or maybe compare grep foo file1 and grep foo file2.

Of course, there’s the obvious way – run the commands, redirect their output to temp files, and compare the temp files:

$ sort file1 >tmpf1
$ sort file2 >tmpf2
$ diff tmpf1 tmpf2
...
$ rm tmpf*

But, really..? 3 extra commands just for the one command you really wanted?

There must be a better way! This post is about the better way 🙂 .

Even better, the solution is more general than diff. It allows using the STDOUT of any command as a “file” input for other commands!

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…