Log in



Archive for April, 2007

Adding copyright statement recursively

April 24th, 2007 by Peter

I needed to add an LGPL copyright statement to all of our 462 Java source code files, in a deep directory tree. You could think about a shell script with same awt magic, but 12 lines of Python also do the job:

[source:python]
import os

copytext=”"”/*
* Copyright (C) 2007
* Author
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

“”"

for dirpath, dirnames, filenames in os.walk(‘.’):
for name in filenames:
if name.endswith(“.java”):
f=open(dirpath+”\\”+name,”r”)
data=f.read()
f.close()
if data.find(“Copyright”) == -1:
print “Changing ” + name
data=copytext+data
f=open(dirpath+”\\”+name,”w”)
f.write(data)
f.close()
[/source]

SOA Video

April 12th, 2007 by Peter

Here is a nice explanation of the current SOA hype in industry, don’t take it serious …

Solving OutOfMemory and PermGen space problems in Java

April 2nd, 2007 by Peter

Our ASG web application usually leads to OutOfMemory exceptions after 10-20 runs on a 3GB machine. Since we are using multiple software layers which utilize at least 50 different libraries, it is quite hard to profile for the right problem source. We found an excellent page, which summarizes the major problems with Java memory configuration:

http://confluence.atlassian.com/display/JIRA/Causes+of+OutOfMemoryErrors

Before doing anything else (e.g. extensive profiling), go through this page and follow the instructions. It was written for the Jira system, but is useful in any servlet or EJB – based application. For our case, we simply had too much classes loaded.

  • You are currently browsing the troeger.eu blog archives for April, 2007.