Wednesday, April 27, 2005

Firefox 1.0.3 compilation time

While running flux,xscreensaver, abi-word, and openoffice Impress:
Linux rr800 2.6.11-gentoo-r4 #4 Mon Apr 4 22:43:46 MDT 2005 i686 Intel(R) Pentium(R) M processor 1700MHz GenuineIntel GNU/Linux
model name : Intel(R) Pentium(R) M processor 1700MHz
stepping : 5
cpu MHz : 1694.743
cache size : 1024 KB
real 37m27.053s

And this compares to:
http://anandtech.com/cpuchipsets/showdoc.aspx?i=2397&p=20

on Windows.

58 minutes on Intel Pentium D 840 3.2GHz!!

Saturday, April 23, 2005

volume keys on latitude dell d800

.xbindkeys entry:
"~/bin/audiomix.sh incr"
c:176
"~/bin/audiomix.sh decr"
c:174

Friday, April 22, 2005

change nice level to -1, and sudoers

Credit to Norm for this beauty. Here's the latest JEdit script to change the nice level to -1:

#!/bin/sh
# Java heap size, in megabytes
JAVA_HEAP_SIZE=256
DEFAULT_JAVA_HOME="/opt/sun-jdk-1.4.2.06/jre"
if [ "$JAVA_HOME" = "" ]; then
JAVA_HOME="$DEFAULT_JAVA_HOME"
fi
#exec "$JAVA_HOME/bin/java" -mx${JAVA_HEAP_SIZE}m ${JEDIT} -jar "/home/russ/jedit/4.3pre1/jedit.jar" $@
#exec "$JAVA_HOME/bin/java" -mx${JAVA_HEAP_SIZE}m ${JEDIT} -jar "/home/russ/jedit/4.3pre2/jedit.jar" $@
#exec "$JAVA_HOME/bin/java" -mx${JAVA_HEAP_SIZE}m ${JEDIT} -jar "/home/russ/jedit/4.2/jedit.jar" $@
#----speedup code----#
"$JAVA_HOME/bin/java" -mx${JAVA_HEAP_SIZE}m ${JEDIT} -jar "/home/russ/jedit/4.3pre2/jedit.jar" $@ > /dev/null 2>&1 &
jeditPid=$!
sleep 10
jeditPid2=`ps axl|grep $jeditPid|awk '{print $3}'`
for pid in $jeditPid2
do
jeditPid3=`ps axl|grep $pid|awk '{print $3}'`
for realPid in $jeditPid3
do
sudo /usr/bin/renice -1 $realPid > /dev/null 2>&1 &
done
done

New stuff is everything under "speedup code#". In order to enable this to work correctly, sudoers must be modified. Current sudoers is as follows:

russ ALL = NOPASSWD:/usr/bin/renice

Thursday, April 14, 2005

CVS update script

getting sick of verbose output. I once again realized why I love Ruby:
-----Begin code, cvsupdate.rb-----

#!/usr/bin/ruby
puts "Now updating imsteam...."
result=`cvs update -dP 2>&1`.split(/\n/)
colormodified="\e[0;36m"
colormerged="\e[0;34m"
colornon="\e[0;32m"
colorconflict="\e[0;31m"
colorupdated="\e[0;35m"
colorremoved="\e[0;34m"
endcolor="\e[0m"

puts "//-------------------//"
puts " Results "
puts "//-------------------//"
for element in result
#!/usr/bin/ruby
puts "Now updating imsteam...."
result=`cvs update -dP 2>&1`.split(/\n/)
colormodified="\e[36m"
colornon="\e[32m"
colorconflict="\e[31m"
colormerged="\e[34m"
colorupdated="\e[35m"
colorremoved="\e[34m"
endcolor="\e[m"

puts "//-------------------//"
puts " Results "
puts "//-------------------//"
for element in result
character=element[0,2]
filename=element[2,element.size]
state=""
case character
when "M ":
state="#{colormodified}MODIFIED: #{endcolor}"
when "C ":
state="#{colorconflict}CONFLICT: #{endcolor}"
when "P ":
state="#{colormerged}MERGED: #{endcolor}"
when "U ":
state= "#{colorupdated}UPDATED: #{endcolor}"
when "R ":
state= "#{colorremoved}REMOVED: #{endcolor}"
when "? ":
state= "#{colornon}(NONCVS) #{endcolor}"
end
if (state!="") then
puts "#{state} #{filename}"
end
end

-----End code-----

Wednesday, April 13, 2005

cvsview.py

needed another change to handle merges on line 134:

elif date=="dummy timestamp from new-entry" or date=="Result of merge":

Monday, April 11, 2005

TODO Meld update

create update script for CVS directory that yanks down all the changes
create "remote changes" capability:
find all changes in CVS dir, show changes in popup
OR add new column in layout, store changes in collection, update
view and column label
create module checkout
port code to Ruby

Friday, April 08, 2005

more elegent solution to cvsview.py

Minor refactoring and fixing:
try:
temp = re.compile(r'\s+')
weekday,month,day,ttime,year=temp.split(date)
hour,minute,second=ttime.split(":")
imonth = {'Jan' : 1, 'Feb' : 2, 'Mar' : 3, 'Apr' : 4, 'May' : 5, 'Jun' : 6, 'Jul' : 7, 'Aug' : 8, 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12 }[month]
sysmodtime = time.mktime(time.gmtime(os.stat(path).st_mtime))#now a float
cvsmodtime = time.mktime([int(year),imonth,int(day),int(hour),int(minute),int(second),0,0,0])#should also be float representation
except OSError:
state = tree.STATE_MISSING
else:
if cvsmodtime == sysmodtime:
state = tree.STATE_NORMAL
else:
state = tree.STATE_MODIFIED

cvsview.py

change to compare posix timestamp floats instead of strings (what were they thinking?!) I'll be posting this to bugzilla and hope for a patch. This was my first real whirl with python. It has some odd nuances (like enforced indentation), and lousy date/time handling (compared to Java objects). But overall, it's kinda slick. I still prefer Ruby.

-----------
try:
weekday,month,day,ttime,year=date.split(" ")
hour,minute,second=ttime.split(":")
#print year + " " + month + " " + day + " " + ttime +" " + hour + " " + minute+ " " + second
iyear = int(year)
#resolve month to int
imonth = {'Jan' : 1, 'Feb' : 2, 'Mar' : 3, 'Apr' : 4, 'May' : 5, 'Jun' : 6, 'Jul' : 7, 'Aug' : 8, 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12 }[month]
iday = int(day)
ihour = int(hour)
iminute = int(minute)
isecond = int(second)
cvsdate = datetime.datetime(iyear,imonth,iday,ihour,iminute,isecond,0)
sysmodtime = time.mktime(time.gmtime(os.stat(path).st_mtime))#now a float
sysstruct = time.gmtime(os.stat(path).st_mtime)
print "file " + name
print "sysstruct " + str(sysstruct)
print "modstruct " + str([cvsdate.year,cvsdate.month,cvsdate.day,cvsdate.hour,cvsdate.minute,cvsdate.second,0,0,0])
cvsmodtime = time.mktime([cvsdate.year,cvsdate.month,cvsdate.day,cvsdate.hour,cvsdate.minute,cvsdate.second,0,0,0])#should also be float representation
print "sys " + str(sysmodtime)
print "cvs " + str(cvsmodtime)
except OSError:
state = tree.STATE_MISSING
else:
if cvsmodtime == sysmodtime:
state = tree.STATE_NORMAL
else:
state = tree.STATE_MODIFIED



-----------

Thursday, April 07, 2005

JEdit javadoc comment macro

Quick and dirty, but it only works on one line functions. I'll get around to handling multiple lines another time:
//author RR, 7 Apr 2005
//create Javadoc comments for one-liner functions
//parses method signature
//for each param adds @param
//if returns value, prints @return


int funcLine=textArea.getCaretLine();
int cntr=0;
String function = textArea.getLineText(funcLine);
StringTokenizer st = new StringTokenizer(function," ");
String returnType =null;

textArea.goToStartOfLine(false);
textArea.insertEnterAndIndent();
textArea.setSelectedText("/**");
textArea.insertEnterAndIndent();
textArea.setSelectedText("*");
textArea.insertEnterAndIndent();
//parse for return type
while(st.hasMoreTokens()){
String element = st.nextToken();
if(!element.equals("void")&&cntr==1){
returnType = "* @return " +element;
break;
}
cntr++;
}
//parse for params
String params = function.substring(function.indexOf("(")+1,function.length()-1);
StringTokenizer stParams = new StringTokenizer(params," ");
int cntr2=0;
while(stParams.hasMoreTokens()){
String element = stParams.nextToken();
if(cntr2==0||(cntr2 %2==0)){
textArea.setSelectedText("* @param "+element);
textArea.insertEnterAndIndent();
}
cntr2++;
}

if(returnType!=null){
textArea.setSelectedText(returnType);
textArea.insertEnterAndIndent();
}

textArea.setSelectedText("*/");
textArea.insertEnterAndIndent();
textArea.shiftIndentRight();

Wednesday, April 06, 2005

Speed increase

Hosed with my maven script so that all maven procs are at a lower nice level. This way JEdit still maintains priority when I'm coding (or whatever) and there are no noticeble UI delays.
Replaced the last 9 lines in the /bin/maven file with the following:

/bin/nice -n 15 $JAVACMD $MAVEN_OPTS -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.Doc
umentBuilderFactoryImpl -Djava.endorsed.dirs=$MAVEN_ENDORSED -classpath $MAVEN_HOME/lib/forehead-$FOREHEAD_VERSION.jar -Dforehead.conf.file=$MAVEN_HOME/bin/forehead.conf -Dtools.jar=$TOOL
S_JAR -Dmaven.home=$MAVEN_HOME $MAIN_CLASS $@