Marcin Świerczyński's blog

Marcin Świerczyński

My name is Marcin Świerczyński. I'm a software developer especially interested in Java and Python languages, Java-based technologies and mobile applications development.

I'll be writing here about interesting issues I faced during my programming adventures. I hope you'll find the solutions useful.

Scaling Django

posted 25 Jan 2013

Just quick info: very interesting presentation by Mike Malone about scalability of Django-based web applications. Scaling Django View more presentations from Mike Malone

¬ read more

Django and Rails and Grails comparison

posted 25 Jan 2013

I've recently found a link to an interesting presentation at zenzire.com. Its author, Jaime Buelta, speaks about differences between Django, Rails and Grails frameworks. I know Django and Grails. Personally, I like both of them. I can't only disagree with one argument about Grails - it's rather poorly documented. But still, it deserves to give it a shot. Just take a look at it. Django and Rails and Grails, Oh my! (Jaime Buelta) from whykay...

¬ read more

Virtualenv + pip

posted 25 Jan 2013

In the Java world there was always a problem with dependencies. All the jars we had to mange by hand - quite awful. Thankfully there is a Maven project which helps us in requirements management. But what about Python? Is there any way to handle necessary libraries? Of course, there is! It is a tandem of virtualenv and pip. Virtualenv is a tool to create isolated Python environments. I'm sure you can imagine a situation...

¬ read more

Productivity tips for programmers

posted 25 Jan 2013

I've recently started reading The Productive Programmer book. In a few first chapters, I've found some interesting tips for programmers. Some of them can be useful for non-programmers too. Prefer typing than using mouse It is quite obvious that moving hands from keyboard to mouse consumes a lot of time. How to minimize this effort? Use launchers. That applications can be started by a simple keystroke. They display an input where you can enter a...

¬ read more

Python 3. Kompletne wprowadzenie do programowania - opinia

posted 25 Jan 2013

Pozycja Python 3. Kompletne wprowadzenie do programowania (oryg. Programming in Python 3: A Complete Introduction to the Python Language) ukazała się w Polsce nakładem wydawnictwa Helion. Niniejszy tekst stanowi próbę oceny tej książki. "Python 3. Kompletne wprowadzenie do programowania" można podzielić na dwie główne części. Pierwsza stanowi wprowadzenie do podstawowych elementów języka, bez znajomości których ciężko byłoby stworzyć sensowny program w Pythonie. Druga natomiast to omówienie bardziej zaawansowanych technik wykorzystania biblioteki standardowej w sytuacjach uznanych...

¬ read more

Generic relationships in Django

posted 25 Jan 2013

Last week I've completed an interesting task within our project: building internal link-shortening system based on persisted objects, not on constant URLs. The main requirement was to get as loosely-coupled design as possible. In the perfect world the "shortenable" classes should know absolutely nothing about link-shortening mechanism. How to get such a flexibility in Django? I've used the ContentTypes framework with generic relations and it works pretty well! First of all, we need to prepare...

¬ read more

Code coverage analysis in Django

posted 25 Jan 2013

Code coverage analysis could be very valuable if you want to do reliable testing. 100% coverage doesn't give you a guarantee that everything will be fine, but still - it's extremely useful tool. How can we use it in Django-based application? First of all, we'll need an awesome module called coverage.py and written by Ned Batchelder. I recommend to install it on a development machine instead of just attaching it to the project, because it...

¬ read more

How to add a text message to messages conversation in Android SDK

posted 25 Jan 2013

Today I've published new version of my Andriod application - AutoRespnder. The main feature in this release was quite simple: show auto-sent messages within standard messages conversation, just as if was send by hand. How to do this in Android SDK? Because it is a background operation not visible to user, I've decided to build a Service to accomplish this task. //imports public class SentSmsLogger extends Service { private static final String TELEPHON_NUMBER_FIELD_NAME = "address";...

¬ read more

Spring - kontener wstrzykiwania zależności

posted 25 Jan 2013

Czym jest Spring? Spring Framework jest to platforma, ktorej głownym celem jest uproszczenie procesu tworzenia oprogramowania klasy enterprise w technologii Java/J2EE. Rdzeniem Springa jest kontener wstrzykiwania zależności, ktory zarządza komponentami i ich zależnościami. Umożliwia on automatyczne wykrywanie tych zależności bez większego udziału programisty. Nie ma także problemu z własnoręczną konfiguracją - jeśli taki sposob pracy bardziej nam odpowiada. Cel jest jednak jeden - zmniejszenie stopnia związania klas. Artykuł ten ma za zadanie zaprezentować Springa właśnie...

¬ read more

Null Value on Save Issue in Grails

posted 25 Jan 2013

If you’ve used Grails, you’re probably familiar with a domain class and its “constraints” block. There you can define conditions which have to be met by class’s fields. For example, you can enforce that a field have to be not-empty using “blank: false” condition. It’d be intuitive not to define conditions for the field you don’t care of. Unfortunately, there is a small trap here. Let’s use an example to explain it. Let’s define an...

¬ read more