java hashCode inconsistent ?

While trying to make some kind of header check to see if someone modified the header of my property files I observed something I don’t understand.
I found out that the standard java Method ‘.hashCode’ that every Object provides behave some kind of stange.

Here is my Code

1. StringBuilder sb = new StringBuilder();
   try {
       int i = 0;
2.     for (String s : file2Text.getFileText("./test.txt", "UTF-8")\
                      .split(System.getProperty("line.separator"))) {
3.       if (i++ < 10) {
4.          sb.append(s);
         } else {
} catch (FileNotAccessibleException ex) {
5. System.out.println(String.valueOf(sb.hashCode()));

So I create a StringBuilder (1) and append (4) the first 10 lines (3) from
file ‘./test.txt’ (2). After that if simply print out the hash Code of the
String Builder (5). Note that the file I read in will stay the same.
I run it and it prints out

fine, so far.

Now I transfer my program to a Linux (2.6.18-6-amd64 #1 SMP  2008 x86_64 GNU/Linux) box.
Copy the  file test.txt and rerun my program.

Hmm, well thats not what I expected cause

Maybe something related to the system architecture because locally I’m working with Darwin
(9.6.0 Darwin Kernel Version 9.6.0: root:xnu-1228.9.59~1/RELEASE_I386 i386).

So I already thought that it wouldn’t be possible to make this kind of property header check.
While playing around I then rerun the my code with the same text file on the amd machine.
And suddenly my hash code changes to:


Ok again

1408212765, and again, 1408212765 and again 7281581206 and again 1408212765.


Why does my hash code changes? I read from the same file on the same system changing nothing between the runs.
Shouldn’t a hash value stay the same ?


because of too less time at the moment I’m going to investigate some time whenever there is time to have a closer look at this

bash screen auto reattach

automatically search for an attached screen session at login and reattach

cb0@home:~/$cat >> ~/.bashrc << EOF
if [ \$SSH_TTY ] && [ ! \$WINDOW ]; then #comment out for local usage
  SCREENLIST=\`screen -ls | grep 'Att'\`
  if (( ! \$? )); then
    echo -e "Screen running and attached:\n \${SCREENLIST}"
    screen -U -R
fi #comment out for local usage


The script above only works when you connect through ssh. If you login from a real terminal $SSH_TTY and $WINDOW won’t be set.
Comment out lines marked for local usage if like screen as much as i do.

backspace problem with screen in remote debian with os x

Every time I use terminal in combination with an ssh connection to a remote host and the execute screen I’m not able to use the backspace key.
Found a soultion in the comment section of atomized

just put the following line into your ~/.bash_login script

export TERM=xterm


BibTeX and LaTeX in TeXShop OS X

  1. create a file (e.g. cites.bib) that will contain the cites
  2. create a cite in cites.bib (you may use as the simple solution)

      AUTHOR = {cb0},
      TITLE = {BibTeX and LaTeX in TeXShop OS X},
      PUBLISHER = {cb0},
      ADDRESS = {Leipzig},
      YEAR = {2009},
    URL = {},
    note = {This is an electronic document.
               Date retrieved: Feburay 22, 2009. Date last modified: Feburay 22, 2009},
    url = {},
  3. Insert the following 2 lines at the desired place of your bibliography

    cite is the reference to the created cites.bib

  4. cite it somewhere
    \cite[see cb0's Blog]{bibAndTex}
  5. Save all changes
  6. set Latex
  7. set BibTeX
    output should start with sth. like this
  8. 2 times step 6 for correct numbering of all cites
  9. look at the results
    the cite in the text

    the cite in the bibliography
  10. enjoy