With a little side of applesauce...

Thursday, March 27, 2008

Ubuntu Gutsy - PPtTP configuration

What a pain?! Apparently, network-manager-pptp doesn't work in gutsy, and I even had issues with pptpconfig... I ended up writing shell scripts to start and stop my vpn, and everything is happy now...

Here are some links which helped me to figure out the configuration for work:
http://www.section6.net/wiki/index.php/Configuring_PPTP_in_Linux
http://pptpclient.sourceforge.net/howto-ubuntu.phtml

I paid attention to the configuring-by-hand sections, as none of the others worked for me. Plus, the amazing staff at St. Olaf College IIT!

Wednesday, March 26, 2008

Java - short-hand for iterating through arrays

This took me a bit to find:

class EnhancedForDemo {
public static void main(String[] args){
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
for (int item : numbers) {
System.out.println("Count is: " + item);
}
}
}

GNU/Linux - LDAP Administrator client

I found LDAP Browser to be a good desktop client for LDAP administration:
http://www-unix.mcs.anl.gov/~gawor/ldap/

Especially for connecting to multiple servers...

Thursday, March 20, 2008

Finally - nice formatting for source code in my Blogger posts

http://formatmysourcecode.blogspot.com/

The previous java code sample was posted using this nice tool. Thanks!

Java/gdata - List Calendars

As a total Java wimp, I was pretty excited when this example worked:
import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.acl.*;
import com.google.gdata.data.calendar.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.URL;
import java.io.IOException;
import javax.xml.*;


public final class GCalendar {
public static void main(final String[] args) {
// need to set service argument to [comp-id]-[app-name]-[version-number]
// this is how google monitors who is sending traffic, (and probably how they throttle).
CalendarService myService = new CalendarService("myaccount-test-1.0");
try {
myService.setUserCredentials("myaccount@gmail.com", "password");
} catch (AuthenticationException e) {
System.out.println("\tUnable to authenticate: " + e);
}

try {
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
System.out.println(feedUrl);
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

System.out.println("Your calendars:");
System.out.println();

for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}
} catch (java.net.MalformedURLException e) {
System.out.println("\tWe have a bad URL: " + e);
} catch (IOException e) {
System.out.println("\tWe were not able to get the feed: " + e);
} catch (ServiceException e) {
System.out.println("\tService Not Available: " + e);
}
}
}


It is the example from Google's "Getting Started with the Java Client Library", *but* with the error handling. I hope this helps others are just starting out.

Wednesday, March 19, 2008

debian/mailman - delete archive and rebuild

To delete a mailman archive on Debian:

cd /var/lib/mailman/archives/private
rm listname.mbox/listname.mbox
mv listname{,.bak}
cd ../..
./bin/arch listname

Wednesday, March 12, 2008

Regex fun

Here are some reminders for for loops, deleting various types of file patterns:

files which contain ".":
for f in $(ls | grep "^.*\..*$"); do sudo rm -Rf $f ; done

files which start with a number:
for f in $(ls | grep "^[0-9].*$") ; do sudo rm -Rf $f ; done

files which contain a number:
for f in $(ls | grep "^.*[0-9].*$") ; do sudo rm -Rf $f ; done

files which contain "{":
for f in $(ls | grep {); do sudo rm -rf $f ; done

files which contain "-"
for f in $(ls | grep -) ; do sudo rm -rf $f ; done

files which start with "u":
for f in $(ls | grep ^u.* | grep -v ushers); do sudo rm -rf $f ; done

for f in $(ls | grep _) ; do sudo rm -rf $f ; done


Most of these were generated by spam addresses. (mail)

Ubuntu Gutsy - jde fails to install

jde was failing to install on Gutsy:

Selecting previously deselected package jde.
(Reading database ... 120077 files and directories currently installed.)
Unpacking jde (from .../archives/jde_2.3.5.1-2_all.deb) ...
Setting up jde (2.3.5.1-2) ...
Error in `/usr/share/doc-base/jde', line 1: the first line does not contain valid `Document' field
dpkg: error processing jde (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
jde
E: Sub-process /usr/bin/dpkg returned an error code (1)


This bug was filed:
http://www.mail-archive.com/debian-bugs-rc@lists.debian.org/msg122466.html

This temporary fix is:

sudo dpkg --purge jde
sudo apt-get install cogre cedet-contrib
sudo apt-get source jde
sudo sed -i '1,2d' ./jde-2.3.5.1/debian/jde.doc-base
sudo sed -i '1i\Document: jde\nSection: Apps\/Programming;' ./jde-2.3.5.1/debian/jde.doc-base
cd jde-2.3.5.1/
sudo debian/rules binary
cd ..
sudo dpkg -i jde_2.3.5.1-2_all.deb


The patch for jde-2.3.5.1 is:

--- /tmp/jde.doc-base.orig 2008-03-12 12:23:44.000000000 -0500
+++ debian/jde.doc-base 2008-03-12 12:16:08.000000000 -0500
@@ -1,5 +1,5 @@
-Section: Apps/Programming
Document: jde
+Section: Apps/Programming;
Title: JDEE JDE User's Guide
Author: Paul Kinnucan
Abstract: This guide explains how to use the JDE to develop Java applications


This is fixed in Hardy:

hardy (devel): JDEE, Java Development Environment for Emacs(en) [multiverse]
2.3.5.1-4: all

According to the diff.gz:
http://archive.ubuntu.com/ubuntu/pool/multiverse/j/jde/jde_2.3.5.1-4.diff.gz


--- jde-2.3.5.1.orig/debian/jde.doc-base
+++ jde-2.3.5.1/debian/jde.doc-base
@@ -0,0 +1,14 @@
+Document: jde
+Section: Apps/Programming
+Title: JDEE JDE User's Guide
+Author: Paul Kinnucan
+Abstract: This guide explains how to use the JDE to develop Java applications
+ and applets. The Java Development Environment (JDE) is an Emacs Lisp
+ package that interfaces Emacs to third-party Java application development
+ tools, such as those provided by JavaSoft's Java Development Kit (JDK). The
+ result is an integrated development environment (IDE) comparable in power to
+ many commercial Java IDEs.
+
+Format: HTML
+Index: /usr/share/doc/jde/html/jde-ug/jde-ug.html
+Files: /usr/share/doc/jde/html/jde-ug/*.html

checkgmail debian package

I'm just copying my bug entry for checkgmail on Ubuntu Gutsy:



I would think that checkgmail should be pulled from the stable repos. It is not ready for primetime. On Gutsy, (so far), I have had to install dh-make-perl, (plus its dependencies), libextutils-depends-perl,
, and now I am getting more dependency issues from:
sudo dh-make-perl --build --cpan Gtk2::Sexy

Found: Gtk2-Sexy 0.02 (libgtk2-sexy-perl arch=any)
======================================================================
Could not find the dependencies for the requested module
Module::Depends::Intrusive reports: Can't locate ExtUtils/PkgConfig.pm in @INC (@INC contains: /home/speeves/Gtk2-Sexy-0.02 /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at /home/speeves/Gtk2-Sexy-0.02/Makefile.PL line 10.
BEGIN failed--compilation aborted at /home/speeves/Gtk2-Sexy-0.02/Makefile.PL line 10.
Compilation failed in require at /usr/share/perl5/Module/Depends/Intrusive.pm line 76.

Generated error: Error: Can't locate ExtUtils/PkgConfig.pm in @INC (@INC contains: /home/speeves/Gtk2-Sexy-0.02 /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at /home/speeves/Gtk2-Sexy-0.02/Makefile.PL line 10.
BEGIN failed--compilation aborted at /home/speeves/Gtk2-Sexy-0.02/Makefile.PL line 10.
Compilation failed in require at /usr/share/perl5/Module/Depends/Intrusive.pm line 76.

Please check if your module depends on Module::Install
for its build process - Automatically finding its
dependencies is unsupported, please specify them manually
using the 'depends' option.
======================================================================

If anything, the dependencies need to be updated in the package files, and the workaround in:
http://ubuntuforums.org/showpost.php?p=4053269&postcount=10

needs to be implemented in the postinst of checkgmail, (since we don't seem to have a deb package associated with Gtk2::Sexy). Any volunteers?


The bug associated with checkgmail is:
https://bugs.launchpad.net/ubuntu/+source/checkgmail/+bug/151226

Tuesday, March 11, 2008

jBPM notes for Ubuntu Gutsy

1. The jBPM starter kit is found under the jPDL downloads.
http://labs.jboss.com/jbossjbpm/jpdl_downloads/

2. To fix the ^M newline characters, and make the start/stop files executable:

cd /path/to/jbpm-starts-kit-3.x.x/jbpm-server/ ; chmod 755 *.sh ; chmod 755 bin/*.sh ; dos2unix *.sh


3. I created shell scripts to start and stop the server without having to cd to the ends of the earth:
~/bin/jbpm-server-start.sh

#!/bin/sh

cd /home/speeves/tools/jbpm-starters-kit-3.1.4/jbpm-server/ ; ./start.sh &

~/bin/jbpm-server-stop.sh

#!/bin/sh

cd /home/speeves/tools/jbpm-starters-kit-3.1.4/jbpm-server/ ; ./stop.sh &


4. The jBPM runtime location is:

/home/speeves/tools/jbpm-starters-kit-3.1.4/jbpm


5. The Deployment Server Settings: Server Deployer value for jBPM 3.1.4 is:

/jbpm/upload

Friday, March 7, 2008

Thursday, March 6, 2008

XP command line refs

Here are some helpful links:
http://www.ss64.com/nt/index.html
http://www.ss64.com/ntsyntax/

That helped me to write this:

for /f "delims=|" %G in ('dir /S /B ^"prefs.js^"') do sed "s/user_pref(\"browser.startup.homepage\", \"http.*\")\;/user_pref(\"browser.startup.homepage\", \"http:\/\/www.stolaf.edu\")/;" "%G"


to modify the home page value for firefox. (Esp. useful when there are multiple profiles on a box).

The sed.exe is taken from:
http://sourceforge.net/projects/unxutils

and placed in the directory in which you execute the command, (so that is in the PATH).

Gutsy - backlight manipulation (the easy way)

I see many posts about downgrading BIOS versions... But, this is much easier:

speeves@mylaptop:~$ cat bin/fullbright.sh
#!/bin/sh

sudo bash -c 'echo -n 100 > /proc/acpi/video/VGA/LCD/brightness'


I then create an alias in my .bashrc:

alias fullbright='sudo bash -c "/home/speeves/bin/fullbright.sh"'

Wednesday, March 5, 2008

Gutsy - Dual Monitors - On and Off

Following the following post:
http://ubuntuforums.org/showpost.php?p=1141790&postcount=7

I created an on/off scripts for using dual monitors, and tied them to Control-F7 and Control-F8. Here are the scripts:

speeves@mylaptop:~$ cat bin/dual_monitor_off.sh
#!/bin/sh

xrandr --output VGA --off
speeves@mylaptop:~$ cat bin/dual_monitor_work.sh
#!/bin/sh

xrandr --output LVDS --auto --output VGA --auto --right-of LVDS
gconftool --type int --set /apps/panel/toplevels/top_panel_screen0/monitor 1

Gutsy - Dual Monitors

Don't use the displayconfig-gtk tool under Administration, if you have a:

00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)

Instead, read this page:
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

And, read the following section to get your virtual screen size:
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2#Using_xrandr_to_do_useful_things

The following explains the virtual screen concept:
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2#the_Virtual_screen

The previous link broke the concept free in my mind. I then ran:


xrandr --output LVDS --auto --output VGA --auto --right-of LVDS


Noted that my max screen size was 3120x1050, and add the following line to the Display section of /etc/X11/xorg.conf:

Virtual 3120 1050


Pulled the laptop out of the docking station, and restarted X, (ctrl-alt-backspace). I then logged back in, docked the laptop, and ran the following:

xrandr --output LVDS --auto --output VGA --auto --right-of LVDS
gconftool --type int --set /apps/panel/toplevels/top_panel_screen0/monitor 1


The first line works with my laptop on the left, and the external monitor on the right. The second line puts the gnome-panel back on the laptop display.

Sunday, March 2, 2008

VirtualBox - Ubuntu Hardy resolution and mouse integration

While working on the Ubuntu Christian Edition conversion scripts, I was having problems getting my Ubuntu Hardy guest to a screen resolution greater than 800x600. It appears that it needs to be done manually, per the following trouble tickets:

Mouse Integration:
http://www.virtualbox.org/ticket/1165

Screen Resolution:
http://www.virtualbox.org/ticket/1214

I now have a resolution of 1024x768 :)