Sunday, March 30, 2008

Kubuntu Java And Eclipse

I have 3gb ram and p4 2.6 cpu and 8400gs nvidia video card but I was still having gui freezing eclipse problems. in this morning I started digging talk with my friends and read forums about the performance problem. now I am freely telling you if you have eclipse which works really really slow. you need to install sun java. not gij or blacksmart or anything. sun works well and eclipse gui does not freeze anymore.

Eclipse and word wrap

I know its legendary issue in eclipse world. while I was trying to read a simple README file in eclipse editor. I thought maybe someone would implemented till now because I have not check this issue since 2 or more months. anyway I found this and now I know. there wont be any word wrapping at least 1 year its just sad.

Wednesday, March 26, 2008

Amarok and Last.FM

I dont know what is the deal between them but I love this ability of Amarok. you give your last.fm user name and password to amarok and choose one channel and it starts playing songs one by one and I can say I like this or ban this. lovely kde and beautiful amarok.

there is only one problem about this. sometime quality of the stream changes and sound volume changes too. not a big bug but annoying.

anyway its been a long time I have not used linux for desktop this is good.

Friday, March 14, 2008

for loop problem in IE

I was coding some small javascript which should change the tab and modify some color and stuff and load some rss from somewhere its no big deal. somehow code worked in firefox but not in ie7. first I tought I manage to broke variables and naming. look at the code:

function ChangeTab(id,title){
for(k=1;k<4;k++){
if(k==id){
// section 1
}
else
{
// change like it did not choosed
}
}
}

its the simplest code ever. but somehow in ie it did not throw any debug dialog or any error at all. it was breaking the for loop "section 1" if it goes in there. here is the solution:
function ChangeTab(id,title){
for(var k=1;k<4;k++){
if(k==id){
// section 1
}
else
{
// change like it did not choosed
}
}
}

looks like no difference isnt it :) look closer. ie's javascript engine wants that k has to be declared there strange very strange. because normally ie can handle this small things. anyway what is the lesson from here. never trust ie :)

Monday, March 10, 2008

alexa

I don't know what is going on but there is strange things happening about Alexa these days. I have been buying some text links for seo for Google but some how my site loosing its score from Alexa its simply impossible because traffic going up. but when I see that Google ranked as 4. in Alexa top list I understand that there must be some thing going on Alexa. I dunno what its yet. it may be changing its algorithm or something. but it effects even Google. think about it.....

Friday, March 07, 2008

Flv Player

One of my friend göker developed the smallest flv player in as3(action script 3). if you are developing any kind of a video service you will probably need a player which can handle flv files.

check this out: Flv Player

Saturday, March 01, 2008

sendRedirect and SEO in java

simply response.sendRedirect takes user to another page. mostly its enough for forwarding browser to somewhere else from user perspective but what about google bot and other search engines. PR is not a easy thing to earn. and not affordable thing to loose.

anyway back to the topic. let say we are redirecting clients for subdomains to the other folders. like this:

faq.domain.com -->> faq.domain.com/faq/

in this situation we should use sendRedirect but that function uses HTTP 302 for the response status it means moved temporarily. as a result if you got any link from pr5 to faq.domain.com you will loose it. because google bot will say that this is a temporarily issue then I should not give this pr to that page.

how can we gain back that pr. you shoul use these lines for redirect:
response.setStatus(301);
response.setHeader("Location",newUrl);

if anyone who wonder about the real implementation of sendRedirect here:

public void sendRedirect(String url)
throws IOException
{
if (url == null)
throw new NullPointerException();

if (_originalResponseStream.isCommitted())
throw new IllegalStateException(L.l("Can't sendRedirect() after data has committed to the client."));

_responseStream.clearBuffer();
_originalResponseStream.clearBuffer();

_responseStream = _originalResponseStream;
resetBuffer();

setStatus(SC_MOVED_TEMPORARILY);
String path = getAbsolutePath(url);

CharBuffer cb = new CharBuffer();

for (int i = 0; i < path.length(); i++) {
char ch = path.charAt(i);

if (ch == '<')
cb.append("%3c");
else
cb.append(ch);
}

path = cb.toString();

setHeader("Location", path);

// The data is required for some WAP devices that can't handle an
// empty response.
ServletOutputStream out = getOutputStream();
out.println("The URL has moved <a href=\"" + path + "\">here</a>");
// closeConnection();

if (_request instanceof AbstractHttpRequest) {
AbstractHttpRequest request = (AbstractHttpRequest) _request;

request.saveSession(); // #503
}

close();
}

odd string diff

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