Thursday, May 30, 2013

New York City for the first time: Part 1 - Expectations and Surprises

We decided to go to New York City. We arrived on the 1. of  May and we stayed for a week. It was our first time in NYC and first time in the USA at all. That's why I want to share my experience, thoughts and how it surprised me with parks in the middle of the city and its cultural richness.

I thought that NY is something like a big Paris but without  the nice architecture. I didn't like Paris so I thought that NY is even worse. Big dirty city full of stressed people who are hurrying somewhere all the time. But I said OK, let's go and check it out.

After our arrival I found out that I was quite wrong...When we traveled from airport to our accommodation trough the whole Brooklyn and Manhattan I elbowed Daniel and asked him, if he knew, that there are so many black people. I knew that there are many black people in America, but I really didn't know it's this many. Surprise No. 1.

Something about our accommodation. We booked a room at a "bed and breakfast" in Harlem, Manhattan.
This place has only 6 rooms and one small dining room, where you can experience a family atmosphere and eat great homemade cookies. I really liked the Victorian era style of the rooms. I recommend this place for  staying in NY. Here is their website http://sugarhillharleminn.com/

On the first day we planned to go to camera store to buy Daniel a new camera. And the surprise No. 2 was waiting for me there. It was a really big store and they were closed on Saturday but open on Sunday. Guess why. The employees were about 90% Jews. I don't know why, you don't see them in other shops, but here. It was quite funny.

About that cleanliness of this city. The city is not dirty at all. OK it isn't Zurich, but really, the subway and streets were quite clean. So that marks surprise No. 3. Although we heard, that during the summer it gets much worse.

Surprise No. 4: People. They didn't look so stressed, actually they looked relaxed and they were really friendly. We expected something what is normal in touristic destinations in Europe. People shouting at you buy this, you need to have this... and they talk to you only when they want to sell something. Of course you can find those people in NY too, but just a few. We were in many shops and we talked with people just about normal stuff and they kept talking to us regardless whether  we bought something or not. We were looking into the map on the street and people just stopped and asked if we needed help.
Another surprise about people was, that they are not that fat. Actually you can find so many restaurants or fast foods only with salads or low carb food and you can eat your lunch in one of many parks in the city. Funny is, that there are many squirrels in these parks and they are not timid at all.

This is the first part of our trip to NY. I will come back with the second part about our insights and with the third part about useful information and must visit places off the beaten path.

Tuesday, October 2, 2012

Re: Čo je pravda?

V tomto článku by som chcel stručne reagovať na túto esej, na ktorú som bol odkázaný ľudmi, ktorí prehlasujú že pojem "pravda" je absolútny a objektívny.

Sunday, September 30, 2012

Personal analytics with Selfspy and Google Spreadsheets

In the spirit of the Quantified Self movement, this article provides steps to:
  • use an activity tracking daemon SelfSpy to capture the usage habits for all your applications and
  • Google Drive spreadsheets to store and graph productivity stats/aggregates

Monday, September 17, 2012

Stanford HCI Class - Notes


Hi folks,
here is a dump of my notes based on the magnificent HCI class held at:
https://www.coursera.org/course/hci
These notes include a recommended reading list + the essential points of each lecture.

Wednesday, July 25, 2012

Weight tracking/exercise spreadsheet+

We started a protein diet with Mana a couple weeks ago and over the time I put together a spreadsheet to track your weight + fat/water/muscle percentages. The setup is simple, you just enter your height in cm. Then just enter a date of measurement together with the measured values and it gives you your current BMI. In addition to that for each of the measured values you get:

  • total difference between the first value (when you started tracking) and the current value - good for motivation ;-)
  • you can specify a target value for any of the measured variables and the spreadsheet calculates an estimated date when you reach your target (linearly considering the progress so far)
  • nice charts!
Here is a link to the spreadsheet with some sample values - just create your own copy and good luck!
https://docs.google.com/spreadsheet/ccc?key=0AnJ2BfrzQpQGdFRkcDB6XzVCLVU5RlpWZ2hoSEhvcGc

Tuesday, May 8, 2012

Berlin Tegel - hostile for the unprepared

This is a little story of how the Berlin Tegel airport is awesome. NOT!

Saturday, March 3, 2012

Gevent+Psycopg2 = execute cannot be used while an asynchronous query is underway

I am using a stack composed of, among others, Django + Gevent + Gunicorn + psycopg2 (greened with https://bitbucket.org/dvarrazzo/psycogreen/src).
Until recently, I was occasionally getting the following errors, if I rapidly reloaded our application that generates a couple of ajax calls on the startup:
ProgrammingError: execute cannot be used while an asynchronous query is underway
DatabaseError: execute cannot be used while an asynchronous query is underway
After getting the following versions:
Django 1.4 b1
Gunicorn 0.14
Gevent 0.13.6
psycopg2 2.4.4
And greening psycopg2 pre_fork like this (in the Gunicorn config):
worker_class = "gevent"
def def_pre_fork(server, worker):
    from psyco_gevent import make_psycopg_green
    make_psycopg_green()
    worker.log.info("Made Psycopg Green")
pre_fork = def_pre_fork
And using the gunicorn_django in a virtualenv to run the server from supervisor (instead of the manage.py shortcut):
[program:photobooks]
command=/path/bin/gunicorn_django -c /path/conf/photobooks_gunicorn.conf.py
directory=/path/src/photobooks
environment=PATH="/path/bin"
I was not able to reproduce the problem any more.

Thursday, March 1, 2012

Chord progress in Celery

On our company blog I described the new server stack we use to run 47posters.com. One part of this stack is a distributed task queue Celery. We use it for 2 reasons:

hard task throttling - we have certain more processing heavy tasks, that if spawned by all Gunicorn processes at the same time would overwhelm the RAM of the server. With celery we can start them synchronously and use the --concurrency flag to control the number of heavy tasks processed in parallel

asynchronous tasks - we have one task that can take time in the order of minutes. This task is actually a collection of tasks that can be all done in parallel and then one synchronization tasks that runs after all the partial tasks are finished.
This synchronization task is done with chord and the collection of parallel tasks is modeled with a TaskSet.

There is only one tricky part - chord returns an AsyncResult corresponding to the synchronization task. If you then query the task_id given by this result, you can check for the cord completion. What you can't do is to track progress of the taskset completion. To do this, we have to create a new chord like this:
from celery.utils import uuid
from celery.task.chords import Chord
class progress_chord(object):
    Chord = Chord

    def __init__(self, tasks, **options):
        self.tasks = tasks
        self.options = options

    def __call__(self, body, **options):
        tid = body.options.setdefault("task_id", uuid())
        r = self.Chord.apply_async((list(self.tasks), body),
                                   self.options,
                                   **options)
        return body.type.app.AsyncResult(tid), r

(I highlighted the difference against the default celery.task.chord).
Now if you call the chord like this:

result_chord, result_set =
    tasks.progress_chord(taskSet)(syncTask.subtask(params))

You will be able to get both the result_chord.task_id and result_set.task_id.

Then what remains is to create a view that polls for the task status:
def check_batch_result(request):
  chord_result = AsyncResult(request.GET.get("chord_task_id",""))
  task_set_result = AsyncResult(request.GET.get("set_task_id","")).result
  response = {}
  response["tasks_completed"] = task_set_result.completed_count()
  response["tasks_total"] = len(task_set_result.results) 
  
  if chord_result.state == celery.states.PENDING:    
    response["status"] = "pending"
    
  elif chord_result.state == celery.states.STARTED:
    response["status"] = "started"

  elif chord_result.state == celery.states.RETRY:
    response["status"] = "retry"

  elif chord_result.state == celery.states.RETRY:
    response["status"] = "failure"
    
  elif chord_result.state == celery.states.SUCCESS:
    response["status"] = "successful"
    response["result"] = chord_result.result

  return Structure2JsonResponse(response)

Friday, January 6, 2012

pdfx.sty date conversion

Hi everybody,

there has been a bazillion changes in my life (finishing the Google internship and working in my startup fulltime) and I want to sum that up in another post. This is just a quick tip for people who want to generate PDF/X files with LaTeX.

Sunday, September 11, 2011

opensubtitles.com pretending to be big

For one of my datamining projects, I decided to spend a weekend trying to find out how many subtitles you can actually get online for free. It took a bit of parallel python writing to scrape an entire website but I found a surprising discrepancy between the claimed database size and the actual number of subtitles they provide.

Wednesday, August 17, 2011

Looking for a job in Switzerland

My story

I came to Switzerland on the 15th of July and I already have a job, but I wouldn't say that it is easy to find a job here. It depends on your field, I'm structural engineer, so I'm writing from my point of view. I sent 22 emails and had 3 interviews until I got a job. I made a spreadsheet so I know where and when I sent an email, what they replied and more details (Danny's idea), very useful. I will write you some tips, which can help you to find a job.

Friday, July 15, 2011

Interning at Google - Week 2

The whirlpool is starting to spin and I am being pulled in. The infrastructure at our disposal is literally scary in both the scale and complexity of control and processes. Among the highlights of the second week, I had a lecture given by Bram Moolenaar the original author of our daily awesome Vim (shook his hand yay!) and the guy (can't remember the name:() who created the OO features in PHP proudly wearing this on his laptop.
Holding on :-)

Saturday, July 9, 2011

Fakulta Informatiky a Informačných technológií - FIIT

Pred pár týždňami som ukončil štúdium FIIT na STU v Bratislave, s titulom Ing. v obore Softvérové Inžinierstvo. Počas tých 5 rokov som stretlol nových ľudí, ktorí ma prekvapili aj v dobrom aj v zlom, starých známich som lepšie spoznal a čo-to nové som sa aj naučil. V tomto článku by som chcel zhrnúť moje pôsobenie na FIIT a zhruba načrtnúť stratégiu, ktorou som sa týchto 5 rokov riadil a na záver si dáme dolovanie v dátach zo sekcie Galéria študentov na webe fakulty ;-)

Tuesday, July 5, 2011

Software Engineering at Google

For 2011 I wanted to try something new again and when I was approached by Google after the Google Code Jam 2011 (I just placed in top 500, nothing too special, but I got a t-shirt :-P) I agreed to start the interview process. After 2 technical interviews, I was offered a Software Engineering Intern position at the Google Zurich office, which I joyfully accepted. This is the first post about the experience, since I started just yesterday, on the 4th of July.

I will not be able to disclose any details of course, and will have to be super careful, because of how sensitive some information can be and how strict Google is about this.

Great Minds at IBM Research

For the sumer 2010, I was chosen to join the Great Minds programme for research-oriented computer science students, organized by IBM Research Laboratory in Zurich, Switzerland. This article is a small summary of my observations.

Wednesday, April 20, 2011

First team to win N games

This is just a quick post for "my" TEAP students who couldn't solve one problem and I promised to show some code (I normally don't do that ;-).

Thursday, April 7, 2011

Conversational style

The problem of using conversational style while communicating or publishing on the Internet is that if written down and consumed without the context of the given moment in time and environment, body language and relation to the writer, it often comes through as illiteracy bordering with rudeness.

Monday, April 4, 2011

Dynamic programming checklist

There are many articles that talk about this programming technique, but I have never seen complete and generic step by step tutorial on how to deal with Dynamic programming problems. So here I present mine suited to my personal taste, but you may still find it useful.

Gridder - Humongous spatial data visualization

I designed the Gridder algorithm as a part of my diploma thesis and I've been playing with it for some time now. I am trying to find datasets and use-cases for it, so if you get any ideas just leave a comment ;-)

102,000 worlds biggest cities, plotted as dots. Applied mild edge glow filter for kicks.

Thursday, March 31, 2011

MySql job failed to start

I've got this message from MySQL, after importing some data and building indexes. The DB stopped responding and hitting the
/etc/init.d/mysql restart
gave me the aforementioned very non-descriptive error. My problem was that the DB didn't have enough disk space for some temp files, so increasing that solved the problem.