server client programming

here is the deal about the server client programming which is port numbers and their limit its about 65 thousands. I know its not a really big number about if you are planing to serve counts more then 65 thousands.

here is the solutions about it. iocp and p2p networking. I am reading both of those big topics. I think if you are planing to do something big p2p will be the real solution. at least throwing bandwidth of the server to client its easy way to go with p2p. I read jxta and I can say that its absolute solution about java and server part. there are some problems about .net and c# part but. in developing games in this situation its acceptable to build a applet for it 🙂

pg_restore

I know its been a long time I have not write anything. because I have not learn or done any new things. I dont want to write regular meaningless blogs here. anyway today I tried to restore a pg_dump out file to another postgresql server.

that pg_restore looks nice but in first try it started print lines of the file that was strange. at the end I learned that if we give the name of the database it will restore data to there. otherwise it works like scanner for a dump file.

here is the command: pg_restore -d dbName backupFileName

after that it does not print anything to stdout just starts restoring the data. if anyone knows how to show which table is being restored in that time that would be nice. because now I am cleaning some useless data with pgadmin manually.

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.

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.

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 🙂

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…..

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();
}