Old Posts

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.

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

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.

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).

P.S.:

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.

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.

Go to Control Panel > administrative Tools > ODBC

Select System DSN tab and add a new connection

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.

Select Version 5

Give it a name – i.e. rubydbf – something unique and descriptive – this analogous to your db name in your MySQL connections

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

Ruby

1

conn.tables

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

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.

Ruby

1

rs=conn.select_all('select * from product')

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:

Ruby

1

2

3

q=conn.prepare('select * from product where partid = 14')

q.execute()

rs=q.fetch_all()

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.

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 🙂

“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.

Support:

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 https://m.do.co/c/ef9c07812f33 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.

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.

Shooters

DOOM & DOOM II

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.”

Strategies

Civ

Settlers

Transport

Tycoon

Centurion

SimCity

Quests

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

P.S.:

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 🙂

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”

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:

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.

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;

Ruby

1

C:\Console2\Console.exe-t"Desktop"

I have a bunch of shortcuts in my QuickLaunch bar that point to my current projects.

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 .

Required: Installed these 2 gems or make sure they are installed

Ruby

1

geminstallwirblewin32console

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.

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\):

Ruby

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

#!/usr/bin/env ruby

#

# irb.rb - intaractive ruby

#Â $Release Version: 0.9.5 $

#Â $Revision: 11708 $

#Â $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $

#Â by Keiju ISHITSUKA(keiju@ruby-lang.org)

#

require"irb"

require"win32console"

require'wirble'

colors=Wirble::Colorize.colors.merge({

:commÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â =&gt;:white,

:refersÂ Â Â Â Â Â Â Â Â Â Â Â Â Â =&gt;:yellow,

:classÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =&gt;:dark_gray,

:symbolÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â =&gt;:light_red,

:symbol_prefixÂ Â Â Â Â Â Â Â Â =&gt;:light_blue,

})

#you can configure this according to your taste - this is just to show you how easy it is.

# start wirble (with color)

# set the colors used by Wirble

Wirble::Colorize.colors=colors

Wirble.init

Wirble.colorize

#I picked this up on stackoverflow.com - by user: webmat

classObject

# Return only the methods not present on basic objects

definteresting_methods

(self.methods-Object.new.methods).sort

end

end

##make sure any pre you add goes before this line.

if__FILE__==$0

IRB.start(__FILE__)

else

# check -e option

if/^-e$/=~$0

IRB.start(__FILE__)

else

IRB.setup(__FILE__)

end

end

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.

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!!).

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)

Once you are in telnet to localhost on port 7000.telnet 127.0.0.1 7000

You’ll be asked for a login:user admin

Then type in you password

Connect to your domain:update domain example.com

Compact everything:compact all

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.

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.

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