Coding, Python

Se7en Deadly Sins to Do in Python code

Update

As i am migrating my blog to my personal site, updated version of this post can be found here: http://blog.kmonsoor.com/seven-deadly-sins-in-python-code/

[ some of my friends expressed their confusion regarding the word used “Deadly“. To make things clear a bit, i have used the word NOT to express that this coding bad-practices harm human or any other life-form. Rather, i used the word to express the power of these to diminish the productivity of a Python programmer or his fellow teammate(s) who will work on the same code ]

There are a lot of ways someone can make his (or her) Python code extremely difficult for himself and his fellow developers to work with. But, the below ones are in my top-list.

Please take all these with quite a bit of salt, due to my limited expertise & very limited experience with different types of projects based on Python.

7 is just a catchy number. Of course, this top list is subject to change along with my experience. You are also most welcome to suggest your own-finding to make into this list.

Continue reading

Coding, database, java, PostgreSQL, software

[Step-by-step][How to] Generate ER diagram from a PostgreSQL (or any) database

Update

As i am migrating my blog to my personal site, updated version of this post can be found here: http://blog.kmonsoor.com/generate-er-diagram-from-sql-database/

……………………………………………………………………………………………..

When you are “study”-ing (for whatever reason) someone else’s database, and the database has more than 10 tables, you are in trouble to understand what goes where.

Now, imagine a database with 300+ tables. It’s like spaghetti, but not enjoyable. Rather, horrific.

I faced a similar challenge recently with a database of 250+ tables. Yes, i felt like in a deep sh*t. And, started looking for tools which can describe the tables in at least decent ER-diagram. If anything more, better. And, obviously free as my company is not paying.

Then, I found SchemaSpy, originally authored by John Currier. It generate a complete in-depth HTML-based description (of course, including clickable ER-diagram) of the database, which you can then browse with your browser. My this post is on it’s basic usage. Continue reading

configuration

How to become a programmer, or the art of Googling well

an epic revelation …

okepi

*Note: Please read all italicized technical words as if they were in a foreign language.

The fall semester of my senior year, I was having some serious self-confidence issues. I had slowly come to realize that I did not, in fact, want to become a researcher. Statistics pained me, and the seemingly endless and fruitless nature of research bored me. I was someone who was driven by results – tangible products with deadlines that, upon completion, had a binary state: success, or failure. Going into my senior year, this revelation was followed by another. All of my skills thus far had been cultivated for research. If I wasn’t going into research, I had… nothing.

At a liberal arts college, being a computer science major does not mean you are a “hacker”. It can mean something as simple as, you were shopping around different departments, saw a command line for the…

View original post 1,398 more words

Coding, configuration, Internet, Linux, Python, software, web

pep8_tonizer on for Notepad++ : Make your Python code PEP8-compliant on editor

[ Please take note that this is still in beta phase. In other words, it still has issues.]

This script can be used to make python code, that is being edited on Notepad++,  to comply with infamous PEP8 coding style  [http://bit.ly/pep8]
By default, autopep8 only makes whitespace changes. So does this script.

However, this script depends on following:

Continue reading

experience, personal

একজন টিপিকাল বাবা

আমি জানি ফেসবুকে এইরকম “নিউজ”/শোক-স্ট্যাটাস প্রায়ই আসে। আমরাও গা-সওয়া হয়ে গেছে।

তোমার ওমুকে মারা গেছে, আমি কি করতে পারি? ফাস্ট লাইফ, ফাস্ট স্ক্রলিং-ডাউন …

তবে আমার একটু বাড়তি কথা বলার আছে …

Continue reading

Coding, Python

Python fun #4: Create sorted list of all possible numbers using same digits (of a number)

Let’s say the number is 123.

Then the statement:

[int(''.join(x)) for x in permutations(list(str(123)))]

will create a sorted list of all possible numbers using ‘1’,’2′ and ‘3’.
which is, [123, 132, 213, 231, 312, 321]

What it is doing

The part, permutations(list(str(‘123’ is creating a permutated tuple list of splitted string ‘123’.
And the int(”.join(x)) is converting each tuple to back to Integer.

However, you need to

import permutations from itertools

so, the generalized version would be:

import permutations from itertools
[int(''.join(x)) for x in list(permutations(list(str(n))))]