Thursday, May 26, 2011

Laptop disassembling

   Yesterday I spilt milk on keyboard and touchpad of my laptop (Sony Vaio F series). Windows hanged up and I turned off laptop quickly. After dry front part of laptop I tried to boot again and got nothig. I was very frustraited, but decided to wait a while - give it time to dry out.
    So today at morning I tried to boot again. I inserted battery, that I take out right after splilling, and pressed power on button. Couple secs nothing happends, and I my thoughts was crazy, than it started to boot... I thought that's it - now all ok. But bum! on a middle of Windows booting process display went down and green light near "power on" button started to blink. It always blinks only when not enought power on a battery... But I pluged in to power supply - so it couldn't be true reason. I was in my dark place, and started to think, how and what I can do to recovery information and etc.
    I hadn't time at morning to play with laptop more, so I returned to it later and evening. First I tried boot it again - it showed me only black screen and blinking green button. So I decided to unassemble laptop and to look inside. I had experience with this process with my previous laptop (HP), and it wasn't so hard - they had excellent instruction how to unassemble everything, including display. So I downloaded instruction, and was surprised when found only how install new memory stick. It was very strange, for me, that Sony doesn't add normal instruction how to deal with other hardware problem. Internet search got me to nothing - instructions for old models.
    And I decided to work on my own risk. So I got screwdriver and unscrew every screw from back panel of laptop. Than I took my time to take off that panel.

I stared in mother board, but it wasn't so clear for me, how remove it and get closer to keyboard. Plus I wasn't sure, that I didn't crashed anything, so I desided to test, if laptop still works.
And imagine my surprise when it started and booted to Win without any problems. So I shut it down, assemble back again, and now writing from this laptop - and it works pretty fine for me.

Ideas of this topic:
  - Backup your data
  - Don't drink near computer
  - Hope will recovery your laptop :)

Thursday, May 12, 2011

Dive into Java

Today I decided to solve one task on Java. Task - DMC2011, and result of second must be Java-class.
So I can't write for example on Scala (which I read is pretty cool language). So first I started is googled "java suck" and found couple interesting texts, most interesting: Just real facts why java suck vs C# rocks - read it.
Next I wrote code, that go thought large (140mb) csv file and represent information in internal HashMap structure and then serialize it to file. When I run it I got to swap, so I stopped execution.
So now it's only 1/5 of file (~30mb) and I wrote Python code just to compare:
Lines of code7638
IMHO code looksuglynot so bad
Memory usage23.3%31.4%
Execution time (cpu)48 sec77 sec
Output file140mb150mb

In result, I can also note, that Java reads and makes structure very fast but take a long time to serialize and write to file. And Python contrary.

Still work on this stuff. Wish me good luck :)

Sunday, May 8, 2011


And hi there again,

There are django-misc application, that I want to talk about.
First, I developed it with my friend - Vlad Frolov. We started to working on it couple years ago.
It was like a part of every project, we've done since than. We always used misc/ app as place, where all "strange", "not know were to put" code were placed.
And recently I published it on GitHub, and to PyPi (it was my first experience - and it turned out pretty easy).
So if you want latest version:
pip install git+git://
and stable version:
pip install django-misc

If you want to use bbcodes - install postmarkup, and if you want html clearer (remove javascript, iframes, etc - make html safe) - install BeautifulSoup.

After installation, you can add it to INSTALLED_APPS if you want template tags and management commands:

From this I'll got:

  •  template tags misc_tags, bbcode_tags, html_tags, share_buttons
  • command - create_app - that will create application in apps/ folder
  • post_sync event that will create Site object from settings.SITE_NAME and SITE.DOMAIN
  • Middlewares: SpacelessMiddleware that removes spaces from response html; StripCookieMiddleware - remove google analytics cookies (to enable django cache for full page).
Plus I'll have (even without adding to INSTALLED_APPS):
  • : json_encode, json_response and json_template functions
  • : server_error, redirect_by_name
  • to_template (render_to), receiver (standard on django 1.3)
  • HttpResponseReload,  custom_spaceless, render_bbcode, strip_bbcode, str_to_class, get_alphabets (russian and english)
  • html clearer: html.clear.clear_html_code

This application still under development, so we'll add more functionality later. But it already have plenty a lot of cool stuff, so I add this application on all projects I create.
On full documentation I'll work later.


Hi there,

Today's topic - django-manager. This app were created because recently I needed to create couple django projects from scratch, and that wasn't fun.
So decision was - to create some app, that will have just simple "create project" script, and it will done all stuff, that I need to do, before and after standard " startapp".

Plus, one time I faced problem, that I haven't root access, so I can't install any application (like django) at all. So django-admin doesn't need to install at all/
So, lets start from start :)
1) Install django-manager from
git clone git+

2) Go to django-manager folder and run
cd django-manager/
./ your_project_name [path/to/project]

This will create:
- Virtual environment for your project
- Create project folder for new django project
- Create new project with some stuff already made:
- apps/ folder - for your django applications
- apps/auth_ext - contains code for profiling, and you can change it whatever you want
- deploy/ - folder for your deploy scripts, requirements.txt, etc
- developer/ - place for scripts (for start & update.bat scripts)
In requirements.txt you'll find: django, mysql-python, south, django-misc, django-uni-form and some other useful python libraries.
Configured urls and settings for work with admin and auth_ext.
- Create git repository in project directory, and commits changes.

Plus, when I'll issue update of django-manager (and I'll), you can update you project by using
./update_project path/to/your_project

This will apply patches, that I'll create if I'll make any changes.

Personally, I'm not recommend Windows users to use virtual environments. That is why I'll shortly add keywords for create_project to disable virtual environment and git work.

PS Use Linux for your python\django development - it rulezzz ;)