Tuesday, October 22, 2013

Using 'email' instead of 'username' in Passport.js

Just spent ah hour debugging why Passport.js would not forward my login request to the LocalStrategy. After putting some logs inside the strategy itself I have realized that it expect to see a 'username' field in the form, while I was sending an 'email'. Better answer (not mine) with code example here.

Friday, February 8, 2013

Good examples of Open Government implementation

It is not easy to come by really good implementations of systems for Open Government. For those who speak Russian, here is a really good example. It seems to be frozen at the moment but the idea and the implementation are very nice.

http://veche.duma.gov.ru

Wednesday, March 21, 2012

PYTHON: Reimplement imported methods for testing purposes

Spent some time figuring this out, though I'd share. Who knows someone might save some time.

I was trying to write a Django unit test for a method that performs some logic and then sends out several emails by calling the "send_email()" method. For the testing purposes, I wanted to replace the original "send_email()" method with "mock_send_email()". This would have been straightforward, if not for the fact that "send_email()" was not implemented in the tested module itself but in another module imported by it.

Here is what finally worked.

emailutils.send_email = mock_send_email # replace the method 

reload(testedmodule) # reload the module 

from testedmodule import testedmethod # import again 

testedmethod() # run the method 

Hope this helps.

Tuesday, February 21, 2012

Good answer

Check out this great answer to why software development time estimates are, to say it mildly, imprecise. Enjoy

Friday, April 29, 2011

No Country For Old Mann

I have been enjoying the Back To Work podcast with Merlin Mann for some time now and following the 13th episode, which I hope will not be the last one, I want to express some thoughts on some of the issues raised and covered in it, to be specific I want to talk about four topics: Advice, Inspiration, Honesty and Productivity. I am mostly going to talk about Merlin Mann because I think he is the heart of the show, with no offense to Dan Benjamin being the great host

On Advice.

When I think of good advice I have ever received or about good advice in general, I think my biggest criteria would be its timeliness. When you are at G and you want to get to H, last thing you can use is advice on how to get from A to B (cause I already know that) or from M to N (cause I have no idea what you are talking about). Even though Merlin really tries to make the show useful for everyone, I think most of the advice is really for people who are currently trying to get something started, are stuck somewhere or on something or are beating themselves over the head with doubt on whether they are doing the right thing or making enough progress and all sort of similar neurotic thoughts you could and should really do without. I liked when on one of the shows Merlin mentioned his wife telling him that most of 'those' people really need a hug and some therapy rather then another index card management system. I totally agree with that.

The types of people who should not listen to the podcast include those who are not doing anything and are happy as it is and those who are already happily doing something and making great stuff on their own. These types do just fine with regular porn, they don't need productivity porn in their lives as well. For years I was in fallacy of nagging people who are just happy with the ways things are either doing something or doing nothing with all sorts of helpful advice and was extremely irritated when they told me to buzz the fuck off. I totally get it now.

In some way, all Merlin is saying is to stop listening to him because he does not have any real answers. This, in a way, is the highest level of mastery, if you get this kind of thing. To those who are doing nothing, he says, stop listening and go do something, only when you start doing anything you will get what I am talking about. To those who are really doing great he says stop listening to me and do what ever that is you do. And to those who are 'trying' to do things (as himself) he says, listen I don't know what you should do and the most I can do is either tell you what someone else did or what you could do. But never what you should do or what you will do, this is your job, pal, to figure out. Which brings us to the second topic.

On Inspiration

In a way Merlin has put it brilliantly in the episode on inspiration by saying that you can not really make something out of inspiration alone. At most, it can serve as an initial push, after which you will still have to do this clackity noise, regardless. And do you really need an inspiration at all, it might, after all, be highly overrated. I really like Seth Godin's book called The Dip in this regard, and the metaphor is provides. You see this tiny hump in the beginning, you are lucky if the inspiration get you there but all the rest of the way is still yours to cover. If you want to go to a distant place, inspiration might get you out of the door, but you still have to work out through the entire way. And do you really need inspiration at all, just get out with or without it and this is what I think Merlin is trying to tell you there.

On Honesty

It is clear the Merlin Mann has decided on being absolutely and brutally honest in everything he does and talks about whether it works for him or not. He is not trying to make himself a guru or claim originality in any way on things that do not belong him. One of the commenters on the latest show called him a hypocrite for preaching the stuff he does not practice and I think this is a wrong way to go, not because I want to defend Merlin in any way, but because life does not work this way ever and you really should not punish the person telling you the truth, disappointing as it may sound. I could have said that you do not ask your dentist to open your mouth before the visit or for your shrink to tell you about himself first, but I really don't want to go there. Rather, having read a shitload of self help books over the years, what Merlin Mann has to offer deep inside is much much much more valuable that any of that crap if you only listen carefully. If you really listen in to this, you will realize that this is probably the most honest thing you will ever hear on this subject from a guy you basically don't even know on the internet, so treasure it.

On Productivity

In the morning my wife, who is building this toy house model from Styrofoam for a theater production, told me that she just discovered that if you add some color to the otherwise transparent glue you can work much faster because you immediately see which area is already covered with glue and which is not. This allowed her to improve her productivity twofold at least, but since it was the first time she did this kind of job she only discovered it in the middle of her work. If I knew this earlier, she said, it would be done even faster.

That is true, of course, but how much earlier. Imagine someone walking up to you in a street when you are like twelve and saying listen kid, you better mix some color into your glue, that would be the moment that you run like hell and ask the nearest adult you trust to dial nine one one. To sum this up I will paraphrase an famous quote by saying: "Productivity favors the prepared".

MZ.

Saturday, April 23, 2011

Locked in Pandora's Box

It is coming up here and there, and I can totally relate, the idea that simplistic customization and adaptivity in information services can lead to you only seeing the same limited set of stuff you have been established to like. This topic is covered in the recent TED talk by Eli Pariser, who calls it 'personalization bubbles'.

One of the simple ways to demonstrate this is through Pandora, the best music radio site ever which I absolutely adore and which allows you to play music you like not by genre or artist but by its musical characteristics and does this extremely well. If you pick up some non mainstream music you can vote songs up and down until after a certain period of time you will be looping through a list of ten of ten songs or so.

This does have interesting implications in other areas as well, certainly when it goes into even more polarized domains such as, interestingly, politics.

Monday, March 28, 2011

Extraordinary as usual

Merlin Mann is being absolutely awesome.

If you feel down, unmotivated or just could use a boost of good spirit I would recommend this podcast, and this presentation (slides) from Webstock 2011.

Enjoy