Raging Goblin

7 February 2011

Infolog version 2.1 released

Filed under: Egroupware,Java — Raging Goblin @ 21:55
Tags: , , ,

Recently I have been fooling around with the Google WindowBuilder Pro. This is the best GUI builder for Java I have used so far. My only complaint: it is quite unstable! For the rest, it is very easy to use, especially support for LayoutManagers is superb. I used it to create some configuration dialogs for the Infolog Desktop application and today I released Infolog version 2.1. Configuration of the look and feel and the synchronization is now much easier through these dialogs:

Configure look and feel

Configure Synchronization

Advertisements

4 January 2011

Python imap changes with python 3 (II)

Filed under: Linux — Raging Goblin @ 21:51
Tags: , , , ,

Due to a new update my conky.rc broke (again). The script that shows the status of my email box (imap.py) now failed with the following message:

Traceback (most recent call last):
  File "./imap.py", line 37, in <module>
    server.login(username,password)
  File "/usr/lib/python3.1/imaplib.py", line 517, in login
    typ, dat = self._simple_command('LOGIN', user, self._quote(password))
  File "/usr/lib/python3.1/imaplib.py", line 1067, in _quote
    arg = arg.replace('\\', '\\\\')

This guy explains how to solve it. As a quick fix I added a new line to /usr/lib/python3.1/imaplib.py on position 1067.

arg = arg.decode("utf-8")

Though this solution will only work until the next update, for now it will do.

21 December 2010

Systray not supported with OpenJDK and Compiz

Yesterday I stumbled upon a bug in the the OpenJDK. A system tray icon is not supported while using Compiz. I found out about this because I was playing around with the Google WindowBuilder. It kept freezing while using the Sun-JDK. With the OpenJDK it only freezes with opening a separate preview window. Then I noticed that my Infolog program wouldn’t start anymore. So when you are using the particular combination of Compiz and OpenJDK you won’t be able to use a system tray icon with Java. These options are open to you:

  1. Install Sun-JDK and don’t use the Google WindowBuilder.
  2. Install both JDK’s and use the Sun-JDK with programs that need a system tray icon, and the OpenJDK with Eclipse and the Google WindowBuilder.
  3. Install the OpenJDK en don’t bother with a system tray Icon.
  4. Stop using Compiz.
  5. Install Sun-JDK and use Windho$e in a virtual box.

The last one is not a real option of course, I only mentioned it to be complete ;-).

16 December 2010

Infolog version 2.0 released

Filed under: Egroupware,Java — Raging Goblin @ 20:58
Tags: , ,

Yesterday I released Infolog version 2.0. With version 2.0 I took a different approach how to communicate with the server. Instead of updating items on the server directly and communicating this to all connected clients, a client is now completely independent. A client is capable of synchronizing with the server on regular intervals. By making the client completely independent of the server it is now much easier to run it as a standalone application when someone does not want to use it in conjunction with Egroupware.

Further enhancements include:
– Better readable README with explanation about using the application over ssh.
– Small improvements such as nicer icons to be used on the taskbar.
– Several bugfixes, e.g. using non-standard ports for Java RMI did not work in version 1.0.

12 November 2010

Python imap changes with python 3

Filed under: Linux — Raging Goblin @ 09:43
Tags: , , , ,

Recently I upgraded my Arch linux box and python switched to version 3 causing my conky.rc to break. Conky shows the status of my email box through the usage of a python script imap.py that failed with the following message:

Traceback (most recent call last):
  File "imap.py", line 37, in 
    server.login(username,password)
  File "/usr/lib/python3.1/imaplib.py", line 512, in login
    typ, dat = self._simple_command('LOGIN', user, self._quote(password))
  File "/usr/lib/python3.1/imaplib.py", line 1072, in _quote
    arg = arg.replace(b'\\', b'\\\\')
TypeError: Can't convert 'bytes' object to str implicitly

Found this issue about it. Changing the script with the diff suggested solved the problem. I added the following line right before logging in:

password = bytes(password, "ASCII")

22 May 2010

My .conkyrc

Filed under: Linux — Raging Goblin @ 19:41
Tags: , , ,

Here is my conkyrc. The output looks like this:
Conky
It is a modified version of conky-colors. As you can see, I cheat here and there a little by printing a couple of parameters of which I know they don’t change. E.g. my internal ip is static (I set my router up that way).

# Use Xft?
use_xft yes
xftfont Terminus:size=11
xftalpha 0.8
text_buffer_size 2048

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type override
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 250
maximum_width 250

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color white
#default_shade_color black
#default_outline_color black
own_window_colour black

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 35
gap_y 50

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none

TEXT
SYSTEM ${hr 2}
${voffset 2}${font OpenLogos:size=16}B${font}   Kernel:  ${alignr}${kernel}
${font StyleBats:size=16}q${font}   Uptime: ${alignr}${uptime}

DATE ${hr 2}
${alignc 40}${font Arial Black:size=22}${time %H:%M:%S}${font}
${alignc}${time %d - %m - %Y}

CPU ${hr 2}
${font StyleBats:size=16}A${font}   CPU: ${cpu cpu1}% ${alignr}${cpubar cpu1 8,60}
${font weather:size=16}y${font}   CPU Temp:${alignr} ${hwmon 0 temp 1}.0 oC
${font StyleBats:size=16}O${font}   CPU Fan:${alignr}${hwmon 0 fan 1} ${font}RPM

GPU ${hr 2}
${font StyleBats:size=16}E${font}${font}    nVidia Geforce${alignr}7300GT
${font weather:size=16}y${font}    GPU Temp:${alignr}${execi 30 ~/.scripts/gputemp.sh}.0${font} °C

MEM ${hr 2}
${font StyleBats:size=16}g${font}   RAM: $memperc% ${alignr}${membar 8,60}
${font StyleBats:size=16}j${font}   SWAP: $swapperc% ${alignr}${swapbar 8,60}

HD ${hr 2}
${voffset 4}${font Pie charts for maps:size=14}7${font}   ${voffset -5}Root:
${voffset 4}${fs_free /}/${fs_size /} ${alignr}${fs_bar 8,60 /}
${voffset 4}${font Pie charts for maps:size=14}7${font}   ${voffset -5}/var:
${voffset 4}${fs_free /var}/${fs_size /var} ${alignr}${fs_bar 8,60 /var}
${font Pie charts for maps:size=14}7${font}   ${voffset -5}Documents:
${voffset 4}${fs_free /home/rijk/Documents}/${fs_size /home//Documents} ${alignr}${fs_bar 8,60 /home//Documents}
${font Pie charts for maps:size=14}7${font}   ${voffset -5}Backup:
${voffset 4}${fs_free /home/rijk/Backup}/${fs_size /home//Backup} ${alignr}${fs_bar 8,60 /home//Backup}
${font Pie charts for maps:size=14}7${font}   ${voffset -5}Films:
${voffset 4}${fs_free /media/Films}/${fs_size /media/Films} ${alignr}${fs_bar 8,60 /media/Films}

NETWORK ${hr 2}

#${if_existing /proc/net/route wlan0}
#${voffset -6}${font PizzaDude Bullets:size=14}O${font}   Up: ${upspeed wlan0} kb/s ${alignr}${upspeedgraph wlan0 8,60 F57900 FCAF3E}
#${voffset 4}${font PizzaDude Bullets:size=14}U${font}   Down: ${downspeed wlan0} kb/s ${alignr}${downspeedgraph wlan0 8,60 F57900 FCAF3E}
#${voffset 4}${font PizzaDude Bullets:size=14}N${font}   Upload: ${alignr}${totalup wlan0}
#${voffset 4}${font PizzaDude Bullets:size=14}T${font}   Download: ${alignr}${totaldown wlan0}
#${voffset 4}${font PizzaDude Bullets:size=14}Z${font}   Signal: ${wireless_link_qual wlan0}% ${alignr}${wireless_link_bar 8,60 wlan0}
#${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Local Ip: ${alignr}${addr wlan0}
#${voffset 4}${font PizzaDude Bullets:size=14}b${font}   Public Ip: ${alignr}${execi 1 ~/.scripts/ip.sh}
#${else}
#${if_existing /proc/net/route eth0}
${voffset -6}${font PizzaDude Bullets:size=14}O${font}   Up: ${upspeed eth0} kb/s ${alignr}${upspeedgraph eth0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDude Bullets:size=14}U${font}   Down: ${downspeed eth0} kb/s ${alignr}${downspeedgraph eth0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDude Bullets:size=14}N${font}   Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDude Bullets:size=14}T${font}   Download: ${alignr}${totaldown eth0}
#${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Local Ip: ${alignr}${addr eth0}
${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Local Ip: ${alignr}192.168.2.24
${voffset 4}${font PizzaDude Bullets:size=14}b${font}   Public Ip: ${alignr}${execi 3600 ~/.scripts/ip.sh}
#${endif}
#{else}
#${font PizzaDude Bullets:size=14}4${font}   Network Unavailable
#${endif}

TOP - CPU ${hr 2}
${font StyleBats:size=16}A${font} ${top name 1}${alignr}${top cpu 1}  ${top mem_res 1}
${font StyleBats:size=16}A${font} ${top name 2}${alignr}${top cpu 2}  ${top mem_res 2}
${font StyleBats:size=16}A${font} ${top name 3}${alignr}${top cpu 3}  ${top mem_res 3}

TOP - RAM ${hr 2}
${font StyleBats:size=16}g${font} ${top_mem name 1}${alignr}${top_mem cpu 1}  ${top_mem mem_res 1}
${font StyleBats:size=16}g${font} ${top_mem name 2}${alignr}${top_mem cpu 2}  ${top_mem mem_res 2}
${font StyleBats:size=16}g${font} ${top_mem name 3}${alignr}${top_mem cpu 3}  ${top_mem mem_res 3}

MAIL ${hr 2}
${font Wingdings:size=16}-${font} ${execi 10 echo `grep total ~/.scripts/mail`}
${font Martin Vogel's Symbols:size=16}B${font}  ${execi 10 echo `grep unseen ./.scripts/mail`}

I use a couple of scripts and fonts. The fonts you get when you first install conky colors. These reside in ~/.fonts/conky_colors. Two other fonts I use are Wingdings, to get the mail box and Martin Vogel’s Symbols to get the envelope. All my scripts are in a hidden directory in ~/.scripts. The scripts I use are:

gputemp.sh

#!/bin/bash
tempString=`nvclock -T|grep "GPU temperature"`
echo "${tempString:19:3}"

This one echoes the temp of nvclock.

ip.sh

#!/bin/bash
curl-s myip.dk |grep '"Box"' | egrep -o '[0-9.]+'echo 

This one echoes my ip

The mail is checked by a script I found somewhere on the internet. Through a cron job this script writes the output to a file, which is read by my conkyrc. This seems to be little devious, but I do not know how to print these special fonts with an envelope and a mailbox in python. If anyone knows, please let me know.

imap.py

#!/usr/bin/python
# Author: Bhavik Shah
# Created: 3/5/09
# Description: Simple script that uses the python imap library
# to retrieve number of messages and unread messages from your 
# imap email account. 

# Script is free. Credit to bhaviksblog.com is appreciated =)

import imaplib

# Username should be your username with '@gmail.com' added
# I think the @gmail.com is required.
# If you're trying it with something other than gmail
# you should make the username the full email address
# example@domain.com
username = 
password =  # your pw
mailbox = 'INBOX' # inbox is default
output = '/home//.scripts/mail'

# only tested with gmail and my university email
# it should work with any imap server
# change mail server and port to match your server's info
mailserver = 
port = 993 #ssl

# connect to gmail's server (uses SSL, port 993)
server = imaplib.IMAP4_SSL(mailserver,port)

# gmail uses ssl...if your imap mail server doesn't comment the above
# line and uncomment this one.
# server = imaplib.IMAP4(mailserver,port)

# login with the variables provided up top
server.login(username,password)

# select your mailbox
server.select(mailbox)

# pull info for that mailbox
data = str(server.status(mailbox, '(MESSAGES UNSEEN)'))

# print it all out to a file
tokens = data.split()
total = int(tokens[3])
unseen = int(tokens[5].replace(')\'])',''))
outputFile = open(output, 'w')
outputFile.write('unseen: ' + str(unseen) + '\n')
outputFile.write('total: ' + str(total) + '\n')
outputFile.close()

# clean up output with str_replace()
#print tokens[2].replace('(',''),tokens[3] 
#print tokens[4],tokens[5].replace(')\'])','')

# close the mailbox
server.close()

# logout of the server
server.logout()

30 April 2010

Conky fan number changed again

Filed under: Linux — Raging Goblin @ 12:27
Tags: , , ,

Today my fan number switched back to 0. So I changed my conkyrc back to:

${font StyleBats:size=16}O${font}   CPU Fan:${alignr}${hwmon 0 fan 1} ${font}RPM

This starts to annoy me :(.

28 April 2010

Conky fan number changed after upgrade of Arch

Filed under: Linux — Raging Goblin @ 18:15
Tags: , , ,

I am using Arch linux for my system. This distro has a rolling release schedule. So every now and then you have to upgrade your complete system with ‘pacman -Syu’. This is always a little risky, but the advantage of running bleeding edge software, the minimalistic approach of Arch and the fact that you really install such a system only once made this one the distrohopperstopper for me. Yesterday I upgraded the system and I noticed conky wouldn’t run anymore. Running conky from the command line revealed the problem:

Conky: can't open '/sys/class/hwmon/hwmon0/fan1_input': No such file or directory

Looking in /sys/class/hwmon/hwmon1 revealed that all my sensors where there and not in hwmon0. No idea why, but changing the line in my conkyrc to:

${font StyleBats:size=16}O${font}   CPU Fan:${alignr}${hwmon 1 fan 1} ${font}RPM

made me a happy conky user again:

Conky

Anyone knows why this happened?

20 April 2010

Eartwallpaper revisited

Filed under: Linux — Raging Goblin @ 19:49
Tags: , , , ,

Recently I found a script written by Claudio Novais to show a nice wallpaper which displays a picture of the Earth, in real time. On my system this looks like this:

Original wallpaper

Now, I recently got this huge monitor so this didn’t look so well and I decided to change it a little. On http://www.fourmilab.ch/earthview/ you can find an earth and moon viewer. You can alter the image to your liking. So I created an image of 800px x 800px with a view from 35785 km above, 53°23’N and 6°E (roughly Amsterdam, The Netherlands). With ctrl-u (firefox) I looked at the source from the website and found a line like this:

/Earth?di=09523FEE4A66A46BC0364BAA5DD73780BB5E4B6C16283003C802B34399E
7DBBBBEDD58341A5839B680DEB05E0FB23713949A6000B79A9E35A8BC41D5379746

This was clearly the image I was looking at. So my wget line in the original script now looked like this:

wget http://www.fourmilab.ch/cgi-bin/Earth?di=09523FEE4A66A46BC0364BAA5DD73780BB5E4B6C16283003C802B34399E
7DBBBBEDD58341A5839B680DEB05E0FB23713949A6000B79A9E35A8BC41D5379746 
-O world.jpg

The result was quite satisfactory:

Second attempt

But with all this space left I was wondering if I could do a little better. E.g. put a view of the moon on the left side. Using the same procedure as before I found that a picture from the moon, viewed from my place (change E to W and N to S) gave me the following id:

69325F8E2A06C40BA0562BCA3DB757E0DB3421067C425A69A268D908D8A888C8CAF7
784C6E3C34F0AAD9F61851DFC7E463FA324CEA77476FF2E406A776E182D6639D0D6F

The moon is not changing every minute, so downloading it at startup would satisfy my needs. I put the following line in /etc/rc.local (I am on Arch Linux):

wget http://www.fourmilab.ch/cgi-bin/Earth?di=69325F8E2A06C40BA0562BCA3DB757E0DB3421067C425A69A268D908D
8A888C8CAF7784C6E3C34F0AAD9F61851DFC7E463FA324CEA77476FF2E406A776
E182D6639D0D6F -O /home/-username-/.gnome2/moon.jpg

And a black picture with resolution 1820*956 as background.jpg. Find the needed resolution by subtracting the border (2*50px) from your full screen. Then altered the script to use ImageMagick and blend these pictures together:

cd ~/.gnome2/
while [  1 ]; do
 COUNTER=0
 while [  $COUNTER -lt 60 ]; do
 wget http://www.fourmilab.ch/cgi-bin/Earth?di=752E4392361AD817BC4A37D621AB4BFCC72237106A544C7FB47ECF3FE5
9BA7C7C2A12448662479F4DE80EE6C08AB9EBD383FFC80379D9932AEB952C01182D
88636F85BB29877916B -O world.jpg
 composite -bordercolor black -border 50x50 moon.jpg background.jpg backgroundWithMoon.jpg
 composite -gravity center world.jpg backgroundWithMoon.jpg completeWallpaper.jpg
 temp=$(stat -c%s world.jpg)
 if [[ $temp > 1000 ]]
 then rm world_sunlight_Wallpaper.jpg
 mv completeWallpaper.jpg world_sunlight_Wallpaper.jpg
 break
 fi
 sleep 5</span>
<span style="color:#0000ff;"> let COUNTER=COUNTER+1
 done
 sleep 900
done

The result :):

Earth an moon together

Create a free website or blog at WordPress.com.