Saint Petersburg – The City of Bones

In response to this question on Quora: Which city has the bloodiest history through out the recorded history of humankind?

Saint-Petersburg, Russia
(aka Leningrad, USSR) – in it’s short 300 year history it can claim the dubious honor as the swamp that claimed the most lives. From founding to 3 revolutions to World War II to the criminal wars of the 90’s Russia’s second capital built on swamp land kept sucking people’s lives in. As best as I can estimate roughly around 4 million people lost their lives in a premature or violent way in it’s brief 300 year history.

Currently a city of about 5–6 million people it was built on a river Neva on the shore of Baltic Sea, in very inhospitable land surrounded by marches, swamps, rivers, lagoons and lakes (add northern Russian winter on top). It is poetically known as the Venice of the North because of many canals. As can be seen in this picture – there is water all around.

Bloody Founding

Saint-Petersburg had a bloody history from the beginning as it was built on bones. When Peter the great decided to “cut the window in Europe” he started by trying to get territory in the Baltic by wrestling it from the Swedish crown. The little conflict known as Great Northern war of Denmark-Norway & Russia vs Swedish Empire. More people jumped in once the ball got rolling – Prussia, Saxony, Poland, Ottoman Empire, the Dutch and Great Britain (yeah on both sides of the conflict), and a score of smaller principalities and duchies. It’s hard to estimate how many people were actually involved in the capturing of territory of Saint-Petersburg, but the conflict around it took the lives of around 20,000 to 30,000 soldiers. Nobody really kept track of civilians back then.

Once the territory was captured, thousands of Russian peasants and governments serfs lost their lives building Saint-Petersburg – drying marches, building defenses, bringing wood by land, etc. The town was built on bones. Again since they were serfs ( essentially slaves) nobody really kept track of how many people died.

Historians believe the remains of some 100,000 18th-century serfs are buried beneath its wide Parisian-style avenues and grand Italianate palaces. Source: St Petersburg: Paris of the North or City of Bones?

This is a map Map of St. Petersburg in the 1720s by Johann Homann. Notice the Big green rectangle on the large island – the Summer garden. One of the first things built.

Later on various other Empresses and Emperors built more impressive palaces and gardens that cost thousands of lives as well.

Peterhof Palace


City of Three Revolutions

Also Saint Petersburg is often referred to as the City of Three Revolutions in Russian literature, as 3 revolutions started there.

The Decembrist Revolt (while not one of the 3 revolutions, referred to by the poetic name – is worth mentioning) was surprisingly not that blood, mostly because it was an uprising of the aristocracy not of the masses. Several hundred aristocrats were executed and the rest were sent to Siberia. While it was profound in Russian Society as a general, it was routed so fast that it was mostly an event for spectators.

Revolution of 1905 started here and briefly spread into provinces. The effect was mostly seen in the provinces but the number of executions is reported in thousands.

Revolution of 1917 or the Red Revolution or October Revolution (some people don’t realize there was actually another revolution in February of the same year) – is the bloodiest revolution and civil war of the 20th century that led to millions of deaths in Russian Empire. That whole year was very unstable and saw several thousands of casualties in several unrests, demonstrations and uprisings.

Bolsheviks storm the Winter Palace

World War II – The Siege

In the recent history it is known as a place with roughly 5 million casualties, 2.5 million of them lost their lives during the siege that lasted 2.5 years during WWII from 1941 to 1944 , another 2.5 million – sick, wounded, maimed.

The exact figures are hard to come by, there was not a lot of record keeping during the siege itself, but the best we have are these:

  • 1,042,000 – civilians including kids and women (642,000 during the siege, 400,000 during evacuation over a frozen lake)
  • 3,436,066 – Soviet soldiers lost in the North Front – in and around Leningrad. 1,017,881 killed & MIA. 2,418,185 – wounded and sick from disease, cold and malnutrition
  • 579,985 – German soldiers – MIA & KIA. No figures on sick and wounded.

There are many horrible pictures of people starving, fighting and surviving from that time, but I would like to illustrate this with a picture that gives hope surrounded by horror.

Survivors credited the symphony for giving the city hope in the worst of times. Though thousands died that winter and into the next, the orchestra’s performance (which was blared through loudspeakers all throughout the city) was a turning point for Leningrad.

Source: The Symphony That Saved a City

Poster reads: Shostakovich, 7th Symphony

This is not the only example of heroism of city’s defenders, but one that struck me the most somehow – that people found strength to inspire other people through the most difficult of times ( and I’m not even a fan of classic music) .

Wild 90’s

The most recent episode in Saint Petersburg bloody history occurred in the 90’s – known as the Wild 90’s in Russia. Petersburg became the criminal capital of Russia. The city became known for contract killers, mafia “razborki” – bloody sit downs, corruption. It’s estimated that Wild 90’s took about 2 million people in Russia, a significant portion of them in St Petersburg, but there is no hard statistic that I could find. This is anecdotal evidence but 1 of the 2 most popular criminal series about 90’s was set there – Bandits’ Petersburg ( the other being Brigade was set in Moscow).


I love Saint-Petersburg, and it is a beautiful and very cultural city ( let’s just mention that – Hermitage – one of the top 5 museums of the world is there ) , but we should always know and remember the history. The plaza where the Decembrists were routed is about 2 blocks away from Hermitage.

Also posted by me on Quora

How to read & write to a dbf database file from ruby

A little history. The company I work for has an old system that was written in-house for a period of almost 20 years and it’s done in dBase. Once cool and almighty, it’s not longer, dare we say, a system that is at the forefront of computer technology. It has a numerous problems, i.e. multiple users locking tables, AD based security for each individual file/table, slow, etc. Anyways long story short, we decided to convert our system to a web based one, with a Debian/Apache/Passenger/MySQL/Ruby backend – and whatever at the front end.

obviously we had a problem of converting old data to mysql format, with ruby only supporting reading of dbf file via ruby dbf gem – which is great if you only need to read files. unfortunately – we couldn’t just abandon our system – since too much depended on it – we need to have a slow transition – where some stuff being phased out as it’s being replaced by web based app. :. , we needed to be able to write back to dbf files. Let me save you some time – I search long and hard, and there is no way to do it. Or so I and most of the commenters on the Internet thought at the time of this writing (Jan, 09). Until I had an epiphany – ODBC!!! I was actually reading an article about PHP, and thought about one of my first experinces – when I had to pull data from MS Access (back in ’99) into MySQL using ODBC.

So below is the solution and explanation of the process. Let me tell you right now – I don’t know if this will work on Linux. My dev box is WinXP and apps that will be deployed will be deployed on Win2k3 for vairous other reasons. Please leave a comment if you got it working on Linux.

Setup a DSN for your connection.

  1. Go to Control Panel > administrative Tools > ODBC
  2. Select System DSN  tab and add a new connection
  3. Select Driver do Microsoft dBase (*.dbf) – if you are missing that – you might need to install db2k running time, that you should have if you working with dBase files.
  4. Select Version 5
  5. Give it a name – i.e. rubydbf – something unique and descriptive – this analogous to your db name in your MySQL connections
  6. Select the directory where your dbf files sit – in my case – C:Projectsdbf
  7. Select appropriate indexes for your dbf files – either *.ndx or *.mdx files.

Fire up shell – we are going to test our connection.

  1. We need to make sure we have all the gems:

  2. Let’s test if it worked:

    If you didn’t get any error messages – that means that you are fine. You can try to run

    for a list of tables available to you through this connection.

  3. Let’s try to run a couple of select statements. Let me warn you right away – and I think it’s a dBase driver issue ( there are a couple of other driver’s I haven’t tried, that might be better) – some of the standard DBI ODBC commands just don’t work. I’ll give the list of the ones I found working and most useful at the end of the post.

    That throws back all the data sitting in the product table, rs being your reqular ruby array. So you can do all the nice things such as rs.size or rs[3], etc. Obviously you are limited by your RAM and pc – but most modern pc’s should handle your older dbf files. The reason I’m saying this is that I found most sql statement unexecutable – for example select * from product limit 2 – won’t work. Of course you can use things like select_many() – but I think it’s just easier to do all of your magic in ruby, simply cause ruby is going to be faster and easier in this case, thou I do not advocate that in general – DBs are good at manipulating data – leave it to them.

    Also another way to do it is to use DBI’s prepare and execute statements:

    This approach lets you use band variables – which might be useful – if you are not just converting data, but need to pull dynamic result sets – i.e. dated reports or something.

  4. Now that we can read data, let try to insert data – which is the main point of this exercise:

    If you run a select now you should see a new record in your table. As – I said unfortunately you can’t do limits and so on, so you can dump all you data in an array rs = conn.select_all('select * from product') and then do rs.last to see your new and shiny row

That is it. Should be enough to get you started, let me know if you run into problems – someone else might think of something or sometimes – I have an epiphany – just like this one time 🙂
Have fun! or what amounts to it in dBase world 🙂


Digital Ocean VPS hosting

“Selecting your first VPS company is like buying your car – you can get a workhorse that looks like a piece of junk that will serve till you graduate from college, or you can get an eye candy that will stall in a week.”

Nick Gorbikoff

Since this topic came up in a recent conversation with my friend, here is my take on VPS (virtual private hosting)
When I was looking for hosting for my personal stuff including this blog I looked at at least 20-25 companies. Here is the list of requirements that I had.

  • either direct tier 1 host or at least a tier 2 host
  • cheap – I’m not running twitter here
  • knowledgeable SUPPORT – I cannot stress that enough
  • be able to support either debian or ubuntu
  • have fast reliable data center with a backup
  • SSD drives
  • located in North America

I will not list all of the companies I looked at, just the ones that I made it to my final list:

If you are in the business of looking for a new VPS host – I would suggest looking at all of these, but the 3 that impressed me the most from the get go are: Digital Ocean, Rimu Hosting and Linode

After some consideration I went with Digital Ocean. I could get into further detail – but just take my word for DO is the answer. Linode and Rimu were close second. If you are in New Zealand or looking for Java hosting go with Rimu – they know their stuff, but a bit more expensive than DO. Linode is a great alternative to DO and if you need slightly different pricing or plans – they are worth checking out.

Price & Specs:

We had DO so far for about 2 years – their basic VPS plan at $5.00 – it’s not much but is sufficient for now, since you get 1 ip addresses, full control, 20 gigs of SSD space, 512 mb RAM, 1TB  a month worth of bandwith . So unless I get reddited every day – I should be perfectly-totally fine.


I tested support just to see how they can solve a common case scenario – and support is exceptional and is based in NYC. Most of the replies were within 1 hour or less during business hours. They also went beyond the call of duty and helped  to setup nginx, which they didn’t have to – since I could have done it myself, but it’s nice to know that they can figure out basic problems quickly. They also a have a very nice custom-built control panel and a great API.


If you actually decide that you like DO please sign up using my link that will give me service credit to help pay for the hosting, as they don’t really pay money for referrals. If for some reason you morally object to supporting my site can user a direct link.


Damn I sound so happy with DO  – it’s revolting.

Top Whatever List of the 90’s games or the Good Old Days

I was just talking yesterday to my old friend nostinker about how gaming is an addiction and then we started remembering good old days – when when we were kids and played games, which were limited to one computer and game creators actually had to create some interesting plot and content in order to captivate users, unlike the current crop of modern MMORPGs and such.  So anyways for anyone interested in this topic here is a VERY subjective list of the best games of the early 90’s, that had breathtaking graphics  and  good plot. In no particular order, except I’ll mention my favorite as the last game in this list of the top Whatever of the 90’s games. This intended mostly as a reminder for those of you who played and as a guide for those of you who don’t know where to start.



Do I have to say more? Well actually I do for all of you who haven’t heard of it. Anyways this was THE SHOOTER. Half-Life? Halo? Counter-Strike? All misguided attempts to recapture the glory of Doom and Doom II. This was the only shooter I actually had the patience to go through with no Cheat Codes at the highest difficulty. None of the other ones compared to it later on. By comparison – modern graphics is way above that, but you know what – that was in 1994. And there were no cooler kid on the block.

“You’ve done it. The invasion is over. Earth is saved. Hell is a wreck. You wonder where bad folks will go when they die, now. Wiping the sweat from your forehead you begin the long trek back home. Rebuilding Earth ought to be a lot more fun than ruining it was.”


  • Civ
  • Settlers
  • Transport
  • Tycoon
  • Centurion
  • SimCity



90’s were the golden age of quests ( and Lucas Arts Games 🙂 ).

The Monkey Islands Series

One the of the geekiest quest franchises, combined witty puzzles, funny dialogues and superb graphics. Probably the most quoted games in history.

Guybrush: At least I’ve learnt something from all of this.

Elaine: What’s that?

Guybrush: Never pay more than 20 bucks for a game.


  • Grim Fandango
  • Indiana Jones series
  • Myst
  • Full Throttle
  • Fable


Someone mentioned to me that this list doesn’t include great games such as Sabateur or Prince of Persia on ZX Spectrum. Well as I mentioned this is a HIGHLY SUBJECTIVE list, and I never really liked ZX Spectrums 🙂

How to find file or directory in folder that was most recently modified.


I seem to be running into this problem all the time: I need to find file or directory in another folder that was most recently modified.

For instance, I need to display most recent report from a client that they upload on an FTP server. Every time I keep reinventing the wheel, so I looked around for a solution and there seem to be no proper consensus on how to do it best. Most of the approaches are either slow or too cumbersome. So here is my 2 cents – extending (monkey patching ) FileUtils gem . One gotcha – it used ends_with? from ActiveSupport, but I used my module only in my Rails projects, can be easily swapped for some regex (and should be!).

It can also filter extensions – let’s say you are only interested in .xls files in the folder…

This will find and show the most recently modified file that ends in “ls”

Anyways here it is:


If you plan on using this in your Rails 3 project – put this in your lib folder, then require it in an initializer – I have require_libs.rb in my initializers folder for things like that.

Hope that helps.

Sane Ruby console on Windows or how to patch IRB to behave like *nix.

This is a post for those poor souls who are like me stuck for whatever reasons developing in Ruby on a Windows system. I don’t know about other people, but I spend a big chunk of my development time in console, particularly in irb or rails console: trying things out & debugging. Do you want your console to look like this? I’m not referring to the bright clown-like colors – this is for illustration purposes: but you can have colored irb console, transparency, auto completion, history and bunch of other goodies.


I’ve been trying these and combination of other tools for a while, but it finally came together when I found a pure ruby implementation of readline, called rb-readline developed by Luis Lavena . While it is not as fast readline library – the advatange is that is actually works on windows. For those who haven’t encountered there are some nasty bugs in readline lib on ruby 1.8.6 that prevent it from working properly in command line in conjunction with other libs. I.E. – text gets scrambled all over the screen, if the line is a little too long then you get problems with not being able to edit the line, the cursor keeps jumping, etc.

I’ve been getting by with default ruby config for a while, until I came across a gem called RawLine, which is intended to replace readline and gives you a bunch of other tools. For the life of me I can’t get it to work on my windows machine – it get’s my command line even worse. It looks like a lot of people thou have it working ok on their systems, so I’m guessing it has to do with me messing around with my system – I have too much different software and gems installed – so I would attribute it to problems on my machine. I just wanted to mention RawLine – as an alternative to my setup that works for some people. Without further ado here is my setup:

  1. Optional: If you haven’t done so download Windows powershell. This is not required for this setup per se, but is an improvement on cmd.exe . Note that this will not replace default windows shell but will actually install this as a separate program. ( You already get it on Windows 2008 by default I believe) . It does things like *nix style pipelines for one and better file transfer.
  2. Recommended: Get Console2! This is a nice wrapper for windows shell. It’s not a replacement for shell, all it does it lets you specify which shell you want to use and gives you a bunch of customization options: TABBED windows, transparency, you can pin windows to a top z-level on your screen or to a desktop, etc. You can point it to use either powershell or cmd, i.e. in the screenshot bellow I setup 3 most commonly used environments – 1st one is default Desktop – which opens up powershell in “c:\documents and settings\ngorbikoff\Desktop”Then you can just setup a regular windows shortcut (or 2 or 3) pointing to your console2 installation and specifying tab that you want to open, like so;

    I have a bunch of shortcuts in my QuickLaunch bar that point to my current projects.
  3. Highly Recommended: In order to get this to work I had to replace default readline lib with the rb-readline as I mentioned above. You may try the following setup without doing this step if default C readline lib works fine on your machine – but I otherwise I would recommend installing rb-readline. It’s on rubyforge yet – which means you need to get it from github. Just download it. Unzip on desktop and run setup.rb . It will setup a separate rb-readline gem and replace default readline.bat .
  4. Required: Installed these 2 gems or make sure they are installed
  5. Required: Define “HOME” envirnoment. Go to System Properties > Advanced > Environment Variables. Click on new, enter HOME for the name and point it to the folder you want to be considered your home folder such as C:\Documents and Settings\ngorbikoff\ or whatever else you want. This is analogousto “~\” on *nix systems. Doesn’t matter where you point it as long as you know where. You can set it up as a system variable if you want to but not recommended. This step is needed so that shell can store your irb history or irb will keep failing.
  6. Required:you need to tell irb to load all the libs required for the magic. I saw people recommending to put your settings into .irbrc file in your home folder (if you want this make sure that you create this file from some text editor as by default Windows will not allow you to create a file with a . as the first character in the filename. ). You can also combine this steop with step #5 and create ENV VAR call IRBRC and point it to the irbrc file somewhere. Unfortunately these approcahes interfere with MSYS – if you don’t use it don’t worry, but I gave you a fair warning. So what I did I just modified irb.bat in my ruby folder ( c:\ruby\bin\):

  7. Now you have autocompletion, colors, history and bunch of other goodies that will ease up life for you. As an added bonus this will work in your rails console. Also I’ve seen some pople define their color scheme using ANSI colors – you can if you want to but wirble does the job for me.
  8. ABSOLUTELY REQUIRED: Enjoy! Enjoy I tell you!! muhahaha

How to speed up Axigen Mail Server by optimizing storage

Axigen is a mail server from Hungary. There are some drawbacks to it and if I was to choose one now I wouldn’t go with it (particularly I have issue with response time from their support, and their support for Outlook connector). However if you are dealt lemons, try to make lemonade.

One thing that will definitely help you improve the responsiveness of your mail server – is optimizing storage from time to time . I recommend doing it at least once a month, or if possible even more often. This process is very easy but is very time consuming, depending on  the size of all your mail data and how often you do this. The first time I did it, it took  almost 1.5 days ( running over weekend) – and at this point I have about 600 GB worth of data on my mail server. Basically think of this as a very slow defraging process.

Anyways here is what you need to do ( of course after a proper back up!!).

  1. SSH into your mail server ( you can telnet into it on port 7000, if you open it up through web admin, but I wouldn’t recommend it)
  2. Once you are in telnet to localhost on port 7000.
    telnet 7000
  3. You’ll be asked for a login:
    user admin
  4. Then type in you password
  5. Connect to your domain:
    update domain
  6. Compact everything:
    compact all
  7. Go home – this will take a while! Your mail server is still operational, but not as fast – so I would HIGHLY recommend doing this on the weekend.



How to fix c000026c on Windows

WARNING: I make no promises that this will work for you. Do it at your own risk. You and you alone assume all responsibility.

Just came across this error yesterday: when one of our Win2K systems was booting up it kept giving us Blue Screen of Death and the error read: ” c000026c . Can’t read file in  SystemRootSystem32swapk.sys ”

The only thing that could go wrong – was the virus removal we did 3 days earlier. It was that pesky “antivirus 2009” spyware/virus that keeps pretending to be legitimate software. Anyways we got rid of it with AntiVira . Avg wouldn’t load properly on that machine as it requires Service Pack 4 for Win2k to run. Anyways long story short – apparently it cleaned out the everything except for that one problem.

After much searching, the only references I could find – were made to DirectX 8.1 causing this problem or bad memory. Couldn’t be the case in my problem – nothing else change, no new modules or software installed. The problem thou was that I couldn’t load into the system to take a look – it would just freeze – no matter what (safe boot or no). I didn’t have a floppy or disk on hand with DOS – just to get in and take a look. Seemed to be stuck. I even tried the Windows Installation / Repair option – when you load Windows installation CD and select – R for Repair system.

Finally I hooked it up to another XP machine I have (make sure you change the jumper to either slave or cable select) and was able to read it as a new drive (E: in my case) . Anyways I went to c:\WINNT\System32 and renamed swapk.sys (which turned out to be an empty file) to swapk.bad .  Reconnected the drive to the original machine – and lo and behold – it loaded. After some more investigation – I believe that was the file and Antivira cleaned up but never deleted – windows kept trying to load a file that had nothing in it.  Renaming it – bypassed it altogether.

Hope that helps someone else.

If programming languages were cars

While moving from one hosting to another and upgrading WordPress – encoding got damaged. I fixed most of it, but need to find time to fix little errors manually.

ниже – мой литературный перевод заметки на сайте Майкла Ваниера, с небольшими добавлениями и немного отсебятины. Переведено и напечатано с разрешения автора.

Below is my literary translation ( with some small changes and additions ) of a post on Mike Vanier’s website – If programming languages were cars. Translated and posted with author’s permission.

Ada – это аццкий танк. Большой и толстый, времён 2-ой мировой, чем-то напоминает руский T-34 или американский Шерман М-4. Люди смеются над тобой когда ты им говоришь, что ты в танке. эо ты, блин, ещё посмеёшся над ними, когда наступит война, и они будут ездить на своих спортивных машинах по полю битвы. Хорошо смеётся тот, кто смеётся последний. Особенно если у него есть план, и он в танке.

Assembly – чисто двигатель. Машину надо построить самому, вручную подвести нефть из трубы, нефть переработать на месте, и всё это не выключая двигателя. Зато если ты аккуратен – попрёт, что твой запорожец, из анекдота,э с авиационным двигателем.

ASP.NET -э машина класса ехтра-люкс, которая хочет попасть в гараж каждого автолюбителя, как это удалось сделать главному её конкуренту. Правда ездит она только по дорогам построенным специально для неё, в случае поломки вам надо выписывать специального механика из дорогой мастерской и запасные части, а также спойЛера, диски, и турбо, стоят сумасшедших денег.

Basic – простая машинка, для поездок в ближайший овощной магазин. Однажды популярнаэ среди начинающих машин, была переделана крупным ПО производителем. эоваэ машина пригодна для поездок на более дальние расстоэниэ, лишь издалека напоминая предыдущую модель. э-ля Toyota Corolla – 1984 и 2000.

C – спортивнаэ машина, котораэ может ехать очень быстро, но ломается каждые 100 км.

Cobol – поговаривают что была такаэ машина, но ни один уважающий себэ водитель не признается, что ездил на такой. Прэчется в подвалах очень крупных гаражей. Типа инвалидки с зиловским двигателем.

C# – конкурентнаэ модель симейных седанов. Однажды проехавшись на таком, вы уже не сможете пересесть на другую машину. Ваш седан просто не разрешит вам.

C++ – затюнингованаэ Си, обладает кучей всяких крутых новых кнопочек и фишечек, может проехать 500км, прежде чем поломается, но когда уж поломоается, никто не знает почему. И без-политра тут не обойдёшся.

dBase – это Deloarean эзыков програмированиэ. Одно времэ – это была самаэ моднаэ тачка на районе. Так должны были виглэдеть машины будушего. Когда вы садитесь за руль этой машины, вы чувствуете себэ немного как тот сумашедший професяор из “эазад В Будущее”.

Eiffel – машина, в которую встроен инструктор по-вождению, разговаривающий с сильным французским акцентом. Он поможет вам быстро понэть и исправить ваши ошибки, но не смейте прирекаться – или вас обматерэт и выкинут из машины.

Erlang – это автопарк машин, которые едут вместе, чтобы доставить вас по месту назначениэ. Требуется опыт, чтобы научится управлэть этим табуном, но уже если научитесь, то не не захотите учиться ездить по-другому. К тому же не важно если одна из лошадей выпадет из табуна – упрэжка всё равно дотэнет вас до места назначениэ.

Forth – машина которую вы собираете сами из конструктора. Она не выглэдет как машина и даже не ведёт себэ как ни одна другаэ. Зато очень эксклюзивно – ведь машина марки Forth – ездит только задом наперёд.

Fortran – достаточно примитивнаэ машина, котораэ может ездить, только по очень прэмым дорогам. Владельцы – этой машины будут до посининениэ доказывать вам, что это не правда, и просто у всех остальнх слишком неправильный прэмой взглэд на дороги.

Java – это семейный вагон. Им относительно легко управлэть, он не слишком быстр, но иэ в меру безопасен.

Haskell – не совсем машина. эа самом деле вовсе не машина – а абстракциэ машина, которой вы должны описать как бы вы себэ вели если бы были машиной.э После чего, вам нужно будет абстракцию воплатить в реалном мире. При этом как работает прототип вы знать не имеете права. Вы так же можете сделать множество копий вашей абстрактной машины, после чего вы сможете сделать много одинкаовых поездок на этих копиэх.

Lisp – похож на машину, но если у вас есть смекалка и лобзик, вы можете из него сделать и самолёт и атомную подводную лодки. Вы лишь ограничены своей фантазией и лобзиком. К сожелению никто вам не верит – все думают, что это всего лишь старый советский анекдот.

Mathematica – продукт попыток сделать из Лиспа – навигационый спутник. Может расчитать оиптимальный маршрут до места назначениэ, но и стоит эта машина как спутник.

Matlab – дешовый вариант Математики, на подобе, распечатаных карт. Очень удобна длэ передвижениэ по знакомой местности, но стоит вам попаст в чащёбу, и вы быстрее выберетесь пешком.

Ocaml – европейские автопроизводители постарались над её сексуальным дезайном. Она не такаэ быстраэ как Си, но почти никогда не ломается, в отличии от своих амерканских скоростных аналогов. Правда из-за того, что делали её во Франции, приборнаэ доска, комьютерный чип и руль находэтся в совершенно неожиданных местах.

Perl – говорэт, что это очень класянаэ точила, но книга по эксплуатации, написана по-олбански, а логика управлениэ – отчасти напоминает женскую. Оданко если вы научитесь управлэть этой машиной, вам уже не захочется пересаживаться на другю.

PHP – это как э­карус. В него набито куча народу, в него иногда не заедешь легко в маленкий дворик, но всем хочется такой поводить и желательно оранжего цвета.

Prolog – делает за вас всё автоматически, после того как вы дадите эй инструкции – но усилий которые вам на это потребуются, с лихвой хватило бы чтобы уже сбегать туда и обратно два раза.

Python – это замечательнаэ машина длэ начинающих. Если вы никогда не поедете на болото, не заберётесь на вершину вулкана или не полетите в космос, другое средство передвижениэ вам и не потрбуется.

Ruby – машина, которэ пострил один эпонский автостроитель в подсобке, из останков того что осталось после аварии между Пёрлом, Питоном и Смолтоком. Правда некоторые водители жалуются: ” эа хера в машине три рулэ?”, но не задумиваются они над тем, что первый руль может отказать, а второй просто не захочет с вами разговаривать. Правда поговоривают , что её скоро перестроют с одним рулём, но с 6-ю колёсами длэ увеличениэ проходимости и скорости.

Smalltalk – очень маленкаэ машина, придуманаэ длэ начинаюших водителей и конструкторов. Она не быстра, но зато вы можете сделать из неё трех-колёсный мопед или веложабу. Единстевенное маааааленкое отличие: вы ей не управлэете, вы посилаете смс-ки что бы она сделала, то что вы хотите.

Visual Basic – машина котораэ ездит на вас!

How to determine month end in MySQL

I had a to do a report for a client today that would get all the orders placed in the previous month and that report needs to run on the 5-th of the following month. For example, if today was 5th of March it would have to show all the orders for the month of February. The problem is that each month is different 28, 29, 30, or 31 days and since I couldn’t find a quick reference by googling here is my query (stripped of all specifics) for anyone who needs to run a similar query. The trick is to use

function in MySQL.

P.S.: My order_date is a date field in the format 2009-01-01, check DATE_FORMAT() function in MySQL spec to match your date field format.