Django through the Firewall

Once upon a time, in a galaxy far far away… Yeah you probably heard that one before too…  Still developing a Django App behind a Firewall that has to interact with Amazon RDS and Amazon Elasticache might encounter a problem or two unless you read this post.

See also: SSH Tunnel Magic

The Problem

Developing behind a Firewall.

Cannot reach services like mailgun which can be used to send emails.

The Solution

Make Django Server communicate through a Proxy that happens to be attached to a Putty SSH Tunnel.

See also: PySocks

Adjust your Django App Startup as follows:

3-1-2013 1-58-45 PM

Your actual mileage may vary… some assembly required…  Obviously I tend to make modifications where few dare to tread but then I also get the results I want.

The Test

Ran the Django App and clicked the link to send an email via mailgun and bingo !!!  It Worked !!!




How can you tell when a software algorithm can be parallelized ?!?

Parallelization is a pet project of mine and has been for many years…

Recently while interviewing at Paypal, who by the way does NOT hire talent and especially NOT talent who has a conscience… more on Paypal later…


Algorithms that seek to collect data can be more easily parallelized than the other kind.

This means Analytics Application are ripe for parallelization because Analytics is all about collecting aggregations from raw data.

How to…

All you need is a bit of experience with TCP/IP in the form of connecting a Process running on one computer to a Process running on another computer – repeat this as often as possible and you too can create a network of Processing Nodes each of which is connected to the rest – the real magic lies in how you achieve this goal in an efficient manner.

Next, you need to find a way to ask each Processing Node to perform part of the Aggregation Process using one chunk of data each.

Then find a way to get each Processing Node to make the request for its chunk of data at the same time, or as close to the same time as possible.

Then find a way to collect the results from each Processing Node in a parallel manner – again this is where you will find some magic.

HINT: TCP/IP is useful because it allows many requests to be made at the same time while allowing many results to be collected very quickly.

Before you know it you have the framework for parallelization but again there is ample room for doing some magic within the framework.

HINT: Python is easier because Stackless Python combined with multi-threading combined with TCP/IP combined with Parallel Python and Cython and Psycho… can’t get this much bang for the buck from Ruby but you can surely try if you must.

HINT: If you are me then you are more able to use your experience to make your typical non-aggregating algorithm into one that does perform some kind of aggregation… 😉

Paypal’s Interviewing Practices and the lack of ethics

Once upon a time I interviewed with a guy at Paypal who asked me to code a datetime object using an unspecified language who also did not stop to consider his goal had already been accomplished in just about every computer language he or I might wish to use… I mentioned this during the interview and he failed to respond with anything other than his lack of desire to continue… My question was driven by my desire to be ethical since I consider it unethical to write code where an existing solution has already been accomplished and I wanted to know “why” I was being asked to violate my own sense of ethics – not that I am opposed to violating my own sense of ethics so long as I can respond to the questions I might be asked to give later during the deposition in case the request results in legal action as most ethical breaches will eventually.  I have to wonder about professionals who have not spent any of their time thinking about what may or may not be ethical behavior.

Why “ethics” ?

Because I am a professional software engineer who, from time to time, write code by the hour and if I were to spend billable time (as would be the case for Paypal in this instance) working on code I knew had already been written I would feel as-though I was taking money under false pretenses and this would be a breach of ethics for me – not that this guy at Paypal would feel the same because he apparently had no ethical problems with asking me to work on code I would not otherwise have to build.  Maybe if those who ask contractors to work would also stand behind their requests someone like me would not need to develop a sense of ethics… think about it because I have.

Realistic Interviews !?!

 I think professional interviews should be 100% reflective of real life which means if I were actually asked by some manager to work on some kind of datetime object and I actually did so rather than using one that already exists I would hope I would be considered to be less than honest because aren’t I supposed to know what software objects already exist versus the ones that don’t ?!?
Consider the other side of this coin… what if I approached my manager at Paypal and asked him or her for permission to work on something and the something I asked to work-on already exists as some kind of open source thing I could have much more easily used ?!?   Would I have to not be completely dishonest if I were being paid by the hour to spend billable time working on something that already exists ?!?  I would think so but then I have a sense of ethics and a desire to not waste my professional time.
Interviews should be as realistic as possible in terms of professional expectations and professional ethics.
Nonetheless… I will remain as ethical as I can be even when it takes money out of my pocket because this is the right thing to do !!!
And those who lack ethics are generally punished by the legal system sooner or later…

So you want to build a slick Video Chat Service of your own based on Python, RTMP and Flash

Here’s the Research you might want to focus on:

So I got all twisted 4 long years ago…

This is how twisted I was 4 long years ago…  it never occurred to me anyone might have thought the twisted framework was anything but super easy to use 😉

Enjoy the download…  twisted-11-19-2007 (believe it or not… this code comes right out of 11-19-2007… Disclaimer: Some of this code may be from Open Source sources… nothing like stating the obvious…)

See also:

What is the Twisted Framework ?!?

What is the Twisted Framework ?!?

Every so often I am asked to describe certain frameworks like the Twisted Framework and this is my response for that one.

The Twisted Framework (Disclaimer: Some of the code in this document was written by Ray C Horn but the rest was not since it may be from some Open Source sources… nothing like stating the obvious…)

%d bloggers like this: