Perhaps you've read some of the much tweeted [PHP hate] (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html) from recent years. I used to write PHP and it is true that it works, you can get things done. The same goes for MySQL - it works and you can definitely use it to build and run successful applications. Facebook uses it. But the ["fractal of bad design"] (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) assessment of PHP could equally be applied to MySQL. Just take a look at [this screencast] (http://www.youtube.com/watch?v=1PoFIohBSM4) for a whole bunch of concrete examples. Don't get me wrong, over the years MySQL and I have had our fair share of late nights partying together till dawn, our intimate mornings nestled amongst the features of the INFORMATION_SCHEMA, timeless moments on that shitty official MySQL forum site (yes you know the one) but I'm afraid the time has come to truncate my losses and move on. You could say I've **mys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias vboxip="nmap -sP 192.168.0.1-254 && arp -n|grep ether|sed s/://g|grep `VBoxManage showvminfo pupone| egrep '^NIC 1'|awk '{print tolower($4)}'|sed s/,//`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maybe you've read some of the [PHP hate] (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) that's out there. I used to write PHP and you know, it works, you can get things done. The same goes for MySQL. I kind of feel like in this day and age MySQL is the relational database analogue of the [lingering legacy of the PHP singularity] (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html). | |
Basically, MySQL works and you can definitely use it to build and run successful applications. Facebook uses it. But the important point to consider is that Postgres ..... is better. It's more or less a fact. How and why? Well there are numerous articles out there for you to google up but [here's a screencast] (http://www.youtube.com/watch?v=1PoFIohBSM4) that gives you a reasonable breakdown, by example. | |
So just like I left PHP behind, now I've left MySQL behind. You could say I've **mysqldumped** it forever. Now, [WHO'S COMIN WITH ME?!] (http://www.youtube.com/watch?v=r7ObPFtGijw) | |
If you're |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select gender, suburb, avg(salary) | |
from demographics | |
group by gender, suburb | |
# so MySQL will allow ?: | |
select gender, suburb, avg(salary) | |
from demographics | |
group by suburb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydict = {'mykey': 'foo', } | |
class MyObj(object): | |
thing = 'whatever' | |
myobj = MyObj() | |
val = getattr(myobj, 'thing', mydict['nonexistent']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydict = {'mykey': 'foo', } | |
class MyObj(object): | |
thing = 'whatever' | |
myobj = MyObj() | |
val = None | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydict = {'mykey': 'foo', } | |
class MyObj(object): | |
thing = 'whatever' | |
myobj = MyObj() | |
val = None | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydict = {'mykey': 'foo', } | |
class MyObj(object): | |
thing = 'whatever' | |
myobj = MyObj() | |
val = None | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
things = ('one',) | |
otherthings = ('one') | |
print 'things:' | |
for t in things: | |
print t | |
print 'otherthings:' | |
for ot in otherthings: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def scale_size(size, scale=None): | |
''' | |
This function receives size form choices. i.e. 'XXS' or 10 or A or whatever, | |
and an optional scale. If not scale is passed, returns the value of size in any of the default scales. | |
If scale is passed, then it returns the value of size in such scale. | |
''' | |
#default scales for certain type of products. | |
default_sizes = {'XXXXXS':-6, 'XXXXS':-5, 'XXXS':-4, 'XXS':-3, 'XS':-2, 'S':-1, 'M':0, 'L':1, 'XL':2, 'XXL':3, 'XXXL':4, 'XXXXL':5, 'XXXXXS':6} | |
baby_sizes = {"NEWBORN":0, "0-3M":1, "3-6M":2, "6-12M":3, "6-18M":4, "6-12M":5, "6-18M":6, "12-18M":7, "18-24M":8, "18-36M":9 } |
OlderNewer