Reduce SQL Injection Risk in Python and psycopg2

It will be surprising that a slight different in your line of code can have a great impact in preventing SQL injection. Try to spot the difference between these 2 lines below. It probably looks obviously different, but for a second it looks like it shouldn’t give much different result. But sadly it does. The […]

The adventure of the Old Mac line breaker in the Python world

There are many representations of a new line, End Of Line indicator, or a line breaker. You probably heard of the terms Line Feed (LF) and Carriage Return (CR). They are technically characters like the letter “A” and small letter “a”. But instead of printing the letter, they tell the system that it’s the end […]

Speeding up your query with Temp Tables

If you have a query that: have a lot of subqueries join many different tables or subqueries going to return a huge amount of data take forever to run (more than 1 minutes) you have a busy database server You can run your query in a hundred times faster speed by storing some groups of […]

Better way to execute sql files in PostgreSQL

My previous post  is kind of dumb. It’s simple, but dumb. First of all, the /o command will only write the output of a particular query into file. It won’t write any error or any other information that pop out during the execution. The last time I ran that, it failed and I don’t know […]

The theory of Object Oriented Programming vs its application.

Speaking of Object Orientated Programming (OOP), I remember how absurd it was to learn for the first time. In the university, they first teach you a bunch of concepts, ideas and terminologies. After that, you are on your own. Being a totally newbie in the programming at the time, and a very horrible English speaker in a […]

The Ruby, C++, PHP and C++

I’m taking the Stanford Online Course called the Design and Analysis of Algorithm 1. So far so good, and then the Programming Exercise 4 hit me hard. First of all, we are allowed to use any programming language. They only want the final result, regardless of how you process them. So, at week 4, we are supposed […]

PHP Unit Testing : Installing PHPUnit in Windows 7

After playing with Ruby on Rails (RoR) for a while, I’m now back to PHP again. Since PHP is the language that I am using in my job, I have to come back anyway. I’m gonna miss RoR nevertheless. But who cares, I don’t need her right now. And she’s got a little too complicated […]