Csl /Daily

Edit this page (without having to scroll to the bottom). :)

On this page... (hide)

2012

February

Print to a Ricoh from a Mac

PPD file

You should create and include the PPD file as per below. The difference is in the installation process.

Installation on Leopard

I was able to make it work using the "Before March 26, 2008" example just a few days ago (8/6/2010), but the other instructions remain for posterity...perhaps an update fixed this?

After March 26, 2008

Stupid Apple put out a security update that breaks printing. I sometimes wish I had my PC back. "Just works" is not a phrase I have EVER used with my mac. If I wasn't a poweruser on Linux, I'd be lost.

To install, you need to add your printer using "advanced" options. As originally posted on http://discussions.apple.com/thread.jspa?messageID=6873260&tstart=0

  1. sys prefs
  2. print & fax
  3. click add (+) button
  4. right (ctrl) click toolbar and choose Customize
  5. add Advanced icon to toolbar
  6. continue instructions below

Now, create your new printer using the advanced option. When you create the smb printer, you have to (e.g.):

 smb://username:password@falcon:139/copy320ps

This is a major security risk, since your password is sent over clear text. THIS IS A WORKAROUND UNTIL IT IS FIXED BY APPLE.

Before March 26, 2008

Installing windows printers is MUCH easier now.

Now, you need to do some hacking. Easy hacking, but hacking nonetheless. Namely, you should find the portion of the Ricoh printer's PPD file and modify some terms to match your copy code. DO THIS BEFORE INSTALLING THE PRINTER, so that if you accidentally uninstall the printer, that you can get it back for "free"

First (as always) make a copy of what you're changing

 dhcp-39: sprinkle$ pwd
 /Library/Printers/PPDs/Contents/Resources/en.lproj
 dhcp-39: sprinkle$ sudo cp Ricoh-Aficio_1022-pxlmono.ppd.gz Ricoh-Aficio_1022-pxlmono-usercodes.ppd.gz

Then, look note that the old file has this area:

Ricoh-Aficio_1022-pxlmono.ppd.gz
*OpenUI *UserCode/User Code (up to 8 digits): PickOne
*FoomaticRIPOption UserCode: string JCL A
*FoomaticRIPOptionMaxLength UserCode:8
*FoomaticRIPOptionAllowedChars UserCode: "0-9"
*OrderDependency: 255 AnySetup *UserCode
*FoomaticRIPOptionPrototype UserCode: "SET USERCODE="%s""
*DefaultUserCode: None
*UserCode None/None: ""
*UserCode 1001/1001: "%% FoomaticRIPOptionSetting: UserCode=1001"
*FoomaticRIPOptionSetting UserCode=1001: "SET USERCODE="1001""
*UserCode 1002/1002: "%% FoomaticRIPOptionSetting: UserCode=1002"
*FoomaticRIPOptionSetting UserCode=1002: "SET USERCODE="1002""
*UserCode 1003/1003: "%% FoomaticRIPOptionSetting: UserCode=1003"
*FoomaticRIPOptionSetting UserCode=1003: "SET USERCODE="1003""
*CloseUI: *UserCode

You want to change some of these settings, specifically to be YOUR user code

Ricoh-Aficio_1022-pxlmono-usercodes.ppd.gz
*OpenUI *UserCode/User Code (up to 8 digits): PickOne
*FoomaticRIPOption UserCode: string JCL A
*FoomaticRIPOptionMaxLength UserCode:8
*FoomaticRIPOptionAllowedChars UserCode: "0-9"
*OrderDependency: 255 AnySetup *UserCode
*FoomaticRIPOptionPrototype UserCode: "SET USERCODE="%s""
*DefaultUserCode: MYCODE
*UserCode None/None: ""
*UserCode MYCODE/MYCODE: "%% FoomaticRIPOptionSetting: UserCode=MYCODE"
*FoomaticRIPOptionSetting UserCode=MYCODE: "SET USERCODE="MYCODE""
*UserCode 1002/1002: "%% FoomaticRIPOptionSetting: UserCode=1002"
*FoomaticRIPOptionSetting UserCode=1002: "SET USERCODE="1002""
*UserCode 1003/1003: "%% FoomaticRIPOptionSetting: UserCode=1003"
*FoomaticRIPOptionSetting UserCode=1003: "SET USERCODE="1003""
*CloseUI: *UserCode

I also changed the first section to give the printer a better (more descriptive) name to show this one used usercodes that I specify:

Ricoh-Aficio_1022-pxlmono-usercodes.ppd.gz
*ShortNickName: "Ricoh Aficio 1022 PXL (Usercodes)"
*NickName: "Ricoh Aficio 1022 PXL (Usercodes)"

IT'S VERY IMPORTANT to change the DefaultUserCode to match the UserCode which is yours. E.g., in the above if your copy code was 50672, you would substitute that phrase for everywhere you see MYCODE.

A very easy way to do this (if you are using vim or vi) is to execute a search and replace

 :%s/MYCODE/50672/g

Which will do a global search/replace.

Note that there are lots of other codes in this file, like the LockedPrintPassword, but this one is the only one that will help you print.

To get a copy of this driver for the Ricoh Aficio 1022, you can download it here. After you download it (and you have installed the above programs) from here, copy it to the PPDs source directory:

 cp ~/Desktop/Ricoh-Aficio_1022-pxlmono-usercodes.ppd.gz /Library/Printers/PPDs/Contents/Resources/en.lproj

And now, when you install the printer (I used LPR/LPD protocol) you should find this one under Ricoh

 Ricoh Aficio 1022 PXL (Usercodes)

Installation of printer

I used the following options when installing the print queue

 Ricoh Aficio 1022 PXL (Usercodes)

By the way, I got lots of help from these websites:

2011

February

Mac shows up dark on a VGA projector

Turns out that Macs seem to always show up dark on VGA projectors. Information that would have been useful years ago. Taken from: http://ets.berkeley.edu/help/what-if-my-macintosh-laptop-displaying-too-dark Short story:

2010

October

Finding out what your preprocessor knows

Ever get frustrated because you are trying to figure out what preprocessor directives to use, that would be defined by the system you're on? Try this:

 echo | gcc -E -dM -

This will run the gcc preprocessor, and show the available defines for this machine. I found this accessing this page.

August

Problems with your ACM SIG Proceedings Copyright Box??

In case you forgot, the ACM SIG Proceedings Templates are nice looking, but have quite a few quirks. First is this error that you might get:

 Package caption Error: No float type 'copyrightbox' defined.

I'm not sure, but I think this is from using the subfig package. In order to "fix" this error while simultaneously getting rid of your copyright box, try

 \makeatletter
 \let\@copyrightspace\relax
 \makeatother

Before the \begin{document}. I found this info from the ACM SIG Proceedings FAQ, item 21.

May

plot3 with dotted/dashed lines looks terrible?

You need to override the buffering used by MATLAB with the following command:

 set(gcf,'renderer','zbuffer')

This now uses a bitmapped (rather than vector graphic) renderer.

You might have noticed that zooming in showed you dotted/dashed lines before. Now you will see those easily when viewing in 3d, but it is still necessary that when printing the figure for a paper, that you set a high DPI (600 or so) to ensure that it does not look pixelated when printed.

March

Capturing a view in MATLAB

You can easily rotate a figure in 3D, but in order to recover that view for a future plot (or to put it in a script), the below is useful (found on http://www.mathworks.com/matlabcentral/newsreader/view_thread/252952)

  goodView = view

Then you can paste the values you got from good view into a variable and set it; viz:

  goodView = [0.8572   -0.5151         0   -0.1710; ...
              0.1071    0.1782    0.9782   -0.6317; ...
              0.5038    0.8384   -0.2079    8.0931; ...
                   0         0         0    1.0000 ];
  view(goodView);

Site pointers on PmWiki

I always forget how to do this. If you want to have a quick reference to an external page or location, but don't want to have to type that URL in, you can create an InterMap page for the wiki site. You do this as below.

 SHORTCUT: URL

Converting generic GPS strings to Google Earth

My GPSStix board produces generic NMEA strings (see this page). That gives me a file that looks a bit like this:

generic_gps.txt
GPSD,R=1
$GPTXT,01,01,01,PSRF inv format*2B
$GPTXT,01,01,01,PGRM inv format*34
$GPTXT,01,01,01,PFEC inv format*2C
$GPRMC,221950.00,A,3214.19463,N,11056.87070,W,0.008,,120310,,,A*60
$GPVTG,,T,,M,0.008,N,0.014,K,A*2E
$GPGGA,221950.00,3214.19463,N,11056.87070,W,1,08,0.97,748.9,M,-27.6,M,,*6F
$GPGSA,A,3,20,32,11,31,14,30,19,22,,,,,1.69,0.97,1.38*07
$GPGSV,3,1,10,12,02,044,,20,07,306,37,32,37,316,47,11,31,292,48*7A
$GPGSV,3,2,10,31,73,144,50,14,41,040,44,30,15,072,44,19,07,231,42*74
$GPGSV,3,3,10,48,46,217,50,22,32,105,50*77
$GPGLL,3214.19463,N,11056.87070,W,221950.00,A,A*70
$GPZDA,221950.00,12,03,2010,00,00*68
$GPRMC,221951.00,A,3214.19464,N,11056.87077,W,0.001,,120310,,,A*68
$GPVTG,,T,,M,0.001,N,0.002,K,A*20
$GPGGA,221951.00,3214.19464,N,11056.87077,W,1,08,0.97,748.9,M,-27.6,M,,*6E
$GPGSA,A,3,20,32,11,31,14,30,19,22,,,,,1.69,0.97,1.38*07
$GPGSV,3,1,10,12,02,044,,20,07,306,37,32,37,316,47,11,31,292,48*7A
$GPGSV,3,2,10,31,73,144,50,14,41,040,44,30,15,072,44,19,07,231,42*74
$GPGSV,3,3,10,48,46,217,50,22,32,105,49*7F
$GPGLL,3214.19464,N,11056.87077,W,221951.00,A,A*71
$GPZDA,221951.00,12,03,2010,00,00*69
$GPRMC,221952.00,A,3214.19464,N,11056.87080,W,0.007,,120310,,,A*65
$GPVTG,,T,,M,0.007,N,0.012,K,A*27
$GPGGA,221952.00,3214.19464,N,11056.87080,W,1,08,0.97,748.9,M,-27.6,M,,*65
$GPGSA,A,3,20,32,11,31,14,30,19,22,,,,,1.69,0.97,1.38*07
$GPGSV,3,1,10,12,02,044,,20,07,306,36,32,37,316,47,11,31,292,48*7B
$GPGSV,3,2,10,31,73,144,50,14,41,040,44,30,15,072,44,19,07,231,42*74
$GPGSV,3,3,10,48,46,217,50,22,32,105,49*7F
$GPGLL,3214.19464,N,11056.87080,W,221952.00,A,A*7A
 

If all you want to do is see GGA strings (which gives Global Positioning System Fix Data), then you could naively (and successfully) do this:

 cat genericgps.txt | grep GPGGA

However, this still leaves a LOT of work to see the waypoints in Google Earth, if you want to compare several recorded trajectories, for example. In order to address this, the following script does a pretty good job.

The important thing that needs to be done in this script---besides removing all the useless columns, is that the lat/long needs to be modified to be in the right GE format. That is, a number like

 3214.87,N

needs to be converted to

 32 14.87N

As GE wants the degrees to be separted from the minutes (and decimal minutes) with a space. Note also that the NS or EW comma delimiter is removed.

nmea2ge.sh
#!/bin/bash
# Jonathan Sprinkle
# University of Arizona
# Use at your own risk

function usage()
{
        echo "$0 INPUT_FILE"
        echo "$0: transform an NMEA stringset into Google Earth format."
        echo " Outputs a file named ge_INPUT_FILE, which can be imported using Google Earth Pro."
        echo " The name of the input file will be the name of each waypoint that is imported, in"
        echo " order to compare multiple waypoint paths."
        echo " Note: only working with Northern & Western Hemisphere series"
        echo ""
}

if [ $# -eq 0 ]; then
        usage
        exit
fi

echo "Running $0. Processing file $1, to produce file ge_$1..."
echo "Name,Latitude,Longitude,FixType,Number of Satellites,Horizontal Dilution of Precision" > ge_$1
LOCNAME=`echo $1 | sed 's/\.[a-zA-Z0-9]*//'`
# selects only sentences from the NMEA that are GCA types
# see http://gpsd.berlios.de/NMEA.txt
# the pattern first deletes the GPGGA and time fields
# then, the next command inserts a space after the minutes and removes the comma before NS and EW
# HACK: the 3 numbers for Longitude are hacked, but someone who knows more sed could fix (giggle) this
# then, the next command preserves the lat/lon (with E/W,N/S) and removes the remainder of the line
cat $1 | grep "GPGGA" | sed -e '
        s/\$GPGGA,[0-9.]*,//
        s/\([0-9.]*,[NS],[0-9.]*,[EW],[0-8],[0-9]*,[0-9.]*\).*/'
${LOCNAME}',\1/
        s/\([0-9][0-9]\)\([0-9.]*,[NS]\),\([0-9][0-9][0-9]\)\([0-9.]*,[EW]\)/\1 \2,\3 \4/
        s/,\([NSEW]\)/\1/g'
>> ge_$1
echo "" >> ge_$1
unix2dos ge_$1
echo "Processing complete; See output file ge_$1"
 

January

SVN Options (403) fail, when using .htaccess file

I got this message the other day, when trying to check out files from a repository:

 Server sent unexpected return value (403 Forbidden) in response to OPTIONS request for (http...)

It turns out that I was using the .htaccess style of read/write protections, and there was a typo in my file:

 # generated Tue Feb 9 16:05:43 MST 2010 by the createsvnrepos.sh script -- modify carefully
 [groups]
 owner = sprinkle
 jmsgroup = sprinkle, alhelal, diyangc, mblhudson, jgulotta

 # default access for users is owner-only
 [/]
 sprinkle = rw
 @jmsgroup = rw

 [/trunk/some/directory]
 @groupdoesnotexist = rw

 # everyone can read, but only owner can write, to public dir
 [/trunk/public]
 @owner = rw

Because the groupdoesnotexist group...does not exist, then 403 errors get thrown by SVN. Make sure that group names match, and are all listed in the groups section.

MATLAB epic fail when using pdfExpress

IEEE conferences now use PDF Express to upload files that are camera ready, and you only get three tries. If you have MATLAB plots with Helvetica, or other, fonts that are not embedded, try using the below toolchain after exporting your MATLAB figure to be .EPS format.

  ps2pdf14 -dPDFSETTINGS=/prepress (filename.eps) (filename.pdf)
  pdfcrop (filename.pdf) (filename.pdf)

2009

November

Escaping .ps and .pdf hell in LaTeX

I had a bunch of GME screenshots which were "Print to File" in GME as .PS docs. However, these needed to be cropped and rotated to be used by LaTeX. Since some journals do not accept .PDF as input sources for graphics, it was time to use the original .PS files instead. Note also that using pdf2ps did not preserve the vector graphic nature of many of these figures, and in one case turned a 125k figure into a 62MB figure!

I used the following toolchain to git 'r done.

 macphee-2:figures sprinkle$ ps2eps -R + CreateBufferPorts.ps
 Input files: CreateBufferPorts.ps
 Processing: CreateBufferPorts.ps
 Windows generated Postscript file detected, fixing
 Rendering with existing BoundingBox: 18 8 593 784
 Calculating Bounding Box...ready. BoundingBox: 19 8 235 777
 Creating output file CreateBufferPorts.eps...ready.
 macphee-2:figures sprinkle$ 

Now, note that there is a new bounding box, which has cropped the bottom of the figure. There is still some GME headers at the top, so using the trusty tool vi, I changed the bounding box to instead be 19 8 205 777. Now, it displays appropriately. By cropping the .PDF version of this file the same way, it means that I can interchangeably use pdflatex or latex.

May

Are you trapped in X11?

In Mac there is a way to toggle the full screen mode of X11. If you accidentally do this, it can be your doom, as command-tab no longer works! I got some details from http://developer.apple.com/opensource/tools/runningX11.html to figure out that Command-Option-A toggles full screen mode. This might be why I got here, cuz it is close to a keystroke combo I was using in MATLAB. Whee!

Debugging an ECAN527 board with default drivers/examples

OK, after installing the module on startup, the thing still doesn't seem to work. We are now using the default examples provided by the manufacturer, and here is the debug trail.

Examples setup

We installed everything in

 /usr/local/src/Ecan_Linux_V02.02.01/

Our module installation (below) was undone, by

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01$ lsmod  | grep rtd
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01$ 

Then, we installed using the basic make in the driver directory

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ make MODEL=527
 make -C /lib/modules/2.6.17-10-generic/build SUBDIRS=/usr/local/src/Ecan_Linux_V02.02.01/driver modules
 make[1]: Entering directory `/usr/src/linux-headers-2.6.17-10-generic'
   Building modules, stage 2.
   MODPOST
 WARNING: /usr/local/src/Ecan_Linux_V02.02.01/driver/rtd-ecan527.o - Section mismatch: reference to .init.text: from .smp_locks after '' (at offset 0x28)
 make[1]: Leaving directory `/usr/src/linux-headers-2.6.17-10-generic'
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ make insmod527 && make devices527
 insmod ./rtd-ecan527.ko io=0xD0000,0xD0100
 insmod: error inserting './rtd-ecan527.ko': -1 Operation not permitted
 make: *** [insmod527] Error 1
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ sudo make insmod527 && sudo make devices527
 insmod ./rtd-ecan527.ko io=0xD0000,0xD0100
 Removing old device files ...
    /dev/rtd-ecan527-0
    /dev/rtd-ecan527-1
    /dev/rtd-ecan527-2
    /dev/rtd-ecan527-3
    /dev/rtd-ecan527-4
    /dev/rtd-ecan527-5
    /dev/rtd-ecan527-6
    /dev/rtd-ecan527-7
    /dev/rtd-ecan527-8
    /dev/rtd-ecan527-9  

 Obtaining device major number ... [: 28: ==: unexpected operator
 253

 Creating device files ...
    /dev/rtd-ecan527-0
    /dev/rtd-ecan527-1
    /dev/rtd-ecan527-2
    /dev/rtd-ecan527-3
    /dev/rtd-ecan527-4
    /dev/rtd-ecan527-5
    /dev/rtd-ecan527-6
    /dev/rtd-ecan527-7
    /dev/rtd-ecan527-8
    /dev/rtd-ecan527-9
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$

Not sure whether this is why we are failing? The == unexpected operator seems tempting, but it boils down to this line in the Makefile:

 if [ "$${major}" == "" ]; Which can be replaced with
 if [ "$${major}" -eq "" ]; 

Then, we don't get any errors at all:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ sudo make devices527
 Password:
 Removing old device files ...
    /dev/rtd-ecan527-0
    /dev/rtd-ecan527-1
    /dev/rtd-ecan527-2
    /dev/rtd-ecan527-3
    /dev/rtd-ecan527-4
    /dev/rtd-ecan527-5
    /dev/rtd-ecan527-6
    /dev/rtd-ecan527-7
    /dev/rtd-ecan527-8
    /dev/rtd-ecan527-9

 Obtaining device major number ... 253

 Creating device files ...
    /dev/rtd-ecan527-0
    /dev/rtd-ecan527-1
    /dev/rtd-ecan527-2
    /dev/rtd-ecan527-3
    /dev/rtd-ecan527-4
    /dev/rtd-ecan527-5
    /dev/rtd-ecan527-6
    /dev/rtd-ecan527-7
    /dev/rtd-ecan527-8
    /dev/rtd-ecan527-9
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$

Clearly, we're ready for the next problem, if it surfaces. However, we DO have a module and devices now:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ lsmod | grep rtd
 rtd_ecan527            38604  0
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$ ls /dev/rtd*
 /dev/rtd-ecan527-0  /dev/rtd-ecan527-2  /dev/rtd-ecan527-4  /dev/rtd-ecan527-6  /dev/rtd-ecan527-8
 /dev/rtd-ecan527-1  /dev/rtd-ecan527-3  /dev/rtd-ecan527-5  /dev/rtd-ecan527-7  /dev/rtd-ecan527-9
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/driver$

Running the examples

They are run in this order

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-test-board --board 0 --type 527
 Creating handle for board 0 ...
     OK
 Test passed
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-digital-io

         ECAN527 Digital I/O Example Program

 Opening board 0 ...
 Opening board 1 ...
 Setting port 0 to output ...
 Setting port 1 to input ...
 Port 0: 0,   Port 1: 0
 Port 0: 1,   Port 1: 0
 Port 0: 2,   Port 1: 0
 Port 0: 3,   Port 1: 0
 Port 0: 4,   Port 1: 0
 Port 0: 5,   Port 1: 0
 Port 0: 6,   Port 1: 0
 ...
 Port 0: fa,   Port 1: 0
 Port 0: fb,   Port 1: 0
 Port 0: fc,   Port 1: 0
 Port 0: fd,   Port 1: 0
 Port 0: fe,   Port 1: 0
 Port 0: ff,   Port 1: 0
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

OK, next example

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-test-hardware verbose

        ECAN527 Hardware Non-Interrupt Test Program

 ** Begin file descriptor 3 interface setup
 OUT Interface 3: offset 0, data 41
 OUT Interface 3: offset 2, data 1
 ...
 OUT Interface 3: offset f1, data 59
 OUT Interface 3: offset 1, data 0
 OUT Interface 3: offset 0, data 0
 ** End file descriptor 3 interface setup
 ** Begin file descriptor 4 interface setup
 OUT Interface 4: offset 0, data 41
 OUT Interface 4: offset 2, data 1
 OUT Interface 4: offset 6, data ff
 ...
 OUT Interface 4: offset f1, data 59
 OUT Interface 4: offset 1, data 0
 OUT Interface 4: offset 0, data 0
 ** End file descriptor 4 interface setup
 ** Begin file descriptor 4 interface object 1 RX setup
 OUT Interface 4: offset 10, data 55
 OUT Interface 4: offset 11, data 55
 OUT Interface 4: offset 12, data 42
 OUT Interface 4: offset 13, data 60
 OUT Interface 4: offset 16, data 80
 OUT Interface 4: offset 10, data bf
 ** End file descriptor 4 interface object 1 RX setup
 ** Begin file descriptor 3 interface object 1 TX setup
 OUT Interface 3: offset 10, data d5
 OUT Interface 3: offset 11, data 5b
 OUT Interface 3: offset 12, data 42
 ...
 OUT Interface 3: offset 1e, data 7
 OUT Interface 3: offset 10, data bf
 OUT Interface 3: offset 11, data e7
 ** End file descriptor 3 interface object 1 TX setup
 ** Begin file descriptor 3 interface object 1 TX test
 IN Interface 3: offset 11, data 65
 ERROR: Transmit Request bit still set!
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

This is odd...OK, next example

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-test-hardware-int verbose

        ECAN527 Hardware Receive Interrupt Test Program

 ** Begin file descriptor 3 interface setup
 OUT file descriptor 3 interface: offset 0, data 41
 OUT file descriptor 3 interface: offset 2, data 1
 OUT file descriptor 3 interface: offset 6, data ff

 ...
 OUT file descriptor 3 interface: offset f1, data 55
 OUT file descriptor 3 interface: offset 1, data 0
 OUT file descriptor 3 interface: offset 0, data 2
 ** End file descriptor 3 interface setup
 ** Begin file descriptor 4 interface setup
 OUT file descriptor 4 interface: offset 0, data 41
 OUT file descriptor 4 interface: offset 2, data 1
 OUT file descriptor 4 interface: offset 6, data ff

 ...
 OUT file descriptor 4 interface: offset f1, data 55
 OUT file descriptor 4 interface: offset 1, data 0
 OUT file descriptor 4 interface: offset 0, data 2
 ** End file descriptor 4 interface setup
 ** Begin file descriptor 4 interface object 1 RX setup
 OUT file descriptor 4 interface: offset 10, data 55
 OUT file descriptor 4 interface: offset 11, data 55
 OUT file descriptor 4 interface: offset 12, data 42
 OUT file descriptor 4 interface: offset 13, data 60
 OUT file descriptor 4 interface: offset 16, data 80
 OUT file descriptor 4 interface: offset 10, data bb
 ** End file descriptor 4 interface object 1 RX setup
 ** Begin file descriptor 3 interface object 1 TX setup
 OUT file descriptor 3 interface: offset 10, data d5
 OUT file descriptor 3 interface: offset 11, data 5b
 OUT file descriptor 3 interface: offset 12, data 42
 ...
 OUT file descriptor 3 interface: offset 10, data bf
 OUT file descriptor 3 interface: offset 11, data e7
 ** End file descriptor 3 interface object 1 TX setup
 ** Begin file descriptor 3 interface object 1 TX test
 IN file descriptor 3 interface: offset 11, data 65
 ERROR: Transmit Request bit still set!
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

Again with the Transmit Request bit still set error...next test

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-test-leds --board 0
 Creating handle for board 0 ...
     OK
 Turning off LEDs ...
 Turning on red LED ...
 Turning on green LED ...
 Turning on both LEDs ...
 Turning off LEDs ...
 Test passed
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

We don't have the rtd-ecan-cmd example. After running the rtd-ecan-clear-accounts we have this when we run print accounts:

rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-print-accounts /dev/rtd-ecan527-0

                       in               out              lost
                ---------------   ---------------   ---------------
 port  I/O    :               0 :               0
 board I/O    :               0 :               0

 messages     :               0 :               0 :               0
          RTR :               0 :               0
  data octets :               0 :               0

 queue size   :               0 :               0
   slots used :               0 :               0 

 hard reset   :               0 | accounting time :      80,041,673 use c
 soft reset   :               0 |                 :    0 00:01:20.041673 

 Interrupts                     | process/interrupt board access locks
 -------------------------------|----------------------------------------
 all          :               0 | proc     lock         :               0
   immediate  :               0 | proc   unlock         :               0
   deferred   :               0 |
     taken    :               0 | intr try_lock_success :               0
     serviced :               0 | intr try_lock_fail    :               0
 serviced     :               0 | intr try_lock_unlock  :               0

OK, so what happens if we run the test function and check this again?

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-test-hardware quiet
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan527-test-hardware-int quiet

Now, we see:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-print-accounts /dev/rtd-ecan527-0
                       in               out              lost
                ---------------   ---------------   ---------------
 port  I/O    :              36 :             256
 board I/O    :              36 :             256

 messages     :               0 :               0 :               0
          RTR :               0 :               0
  data octets :               0 :               0

 queue size   :               0 :               0
   slots used :               0 :               0

 hard reset   :               0 | accounting time :     224,601,416 usec
 soft reset   :               6 |                 :    0 00:03:44.601416

 Interrupts                     | process/interrupt board access locks
 -------------------------------|----------------------------------------
 all          :               0 | proc     lock         :             118
   immediate  :               0 | proc   unlock         :             118
   deferred   :               0 |
     taken    :               0 | intr try_lock_success :               0
     serviced :               0 | intr try_lock_fail    :               0
 serviced     :               0 | intr try_lock_unlock  :               0

OK, so things are happening, but no clear 'errors' are popping up. What if we try to run the read/write combo? First, we'll try writing:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-write 527 0 ./transmission/test_transmission

         ECAN Message Write Example Program

 Input file size: 21
 Transmitting file ...
 Checking status.ErrorCode: 0x0, (Success), continuing...
 Board returned status of 0x3, (No such process), retrying ...
 Press ENTER to retry transmit.

 FAILED: Interrupted by user ... exiting.
     Messages transmitted: 0
        Bytes transmitted: 0

Now, there are a few more error msgs that print out (and I also called strerror on status.ErrorCode, so that I could see what it was). What happens if we print the statistics now?

rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-print-accounts /dev/rtd-ecan527-0

                       in               out              lost
                ---------------   ---------------   ---------------
 port  I/O    :              56 :             418
 board I/O    :              56 :             418

 messages     :               0 :               1 :               0
          RTR :               0 :               0
  data octets :               0 :               8

 queue size   :               0 :               0
   slots used :               0 :               0

 hard reset   :               0 | accounting time :     430,756,914 usec
 soft reset   :              12 |                 :    0 00:07:10.756914

 Interrupts                     | process/interrupt board access locks
 -------------------------------|----------------------------------------
 all          :               0 | proc     lock         :             125
   immediate  :               0 | proc   unlock         :             125
   deferred   :               0 |
     taken    :               0 | intr try_lock_success :               0
     serviced :               0 | intr try_lock_fail    :               0
 serviced     :               0 | intr try_lock_unlock  :               0

Maybe we need to have the read example running too...let's forget about this, and just use a simpler example:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-test-bit-rates 527 0

         ECAN Bit Rate Test Program

 Testing message send ...
 Set receiver bit rate to 50000 bps.
 Hit ENTER when ready to send message.


 ERROR: Board returned status of 0x3

So, maybe I'm doing something wrong. Should I have a cable setup to go to some receiver in order to do this right? Is the only way to test the CAN card to have it plugged in to something? In any case, the board thinks it sent a message:

rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ ./rtd-ecan-print-accounts /dev/rtd-ecan527-0

                       in               out              lost
                ---------------   ---------------   ---------------
 port  I/O    :              76 :             653
 board I/O    :              76 :             653

 messages     :               0 :               2 :               0
          RTR :               0 :               0
  data octets :               0 :               8

 queue size   :               0 :               0
   slots used :               0 :               0

 hard reset   :               0 | accounting time :     809,982,410 usec
 soft reset   :              20 |                 :    0 00:13:29.982410

 Interrupts                     | process/interrupt board access locks
 -------------------------------|----------------------------------------
 all          :               0 | proc     lock         :             132
   immediate  :               0 | proc   unlock         :             132
   deferred   :               0 |
     taken    :               0 | intr try_lock_success :               0
     serviced :               0 | intr try_lock_fail    :               0
 serviced     :               0 | intr try_lock_unlock  :               0

Compiling and installing RTD ECAN527 Drivers and Libraries

The RTD ECAN527 card is for interactions with the CAN bus. In order to access the CAN bus in a nice way, they provide a library with several function calls to receive, and send, certain messages.

Here is how to install the library for use by other programs. After downloading and extracting the RTD ECAN 527 driver/software, go to that directory. I extracted in /usr/local/src

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/lib$ ls
 ecanlib.cc  Makefile
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/lib$ make
 g++ -O3 -I../include -Wall -c ecanlib.cc
 ar cr librtd-ecan.a ecanlib.o
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/lib$

Now, the librtd-ecan.a is around, we need to put it somewhere where it will be located by programs who need it:

 sudo cp librtd-ecan.a /usr/lib

So, we can now use this library for linking against objects that require the ECAN headers. To build the examples that come with the ECAN card, we can just:

 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/lib$ cd /usr/local/src/Ecan_Linux_V02.02.01/examples/
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$ make
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan1000-send-command                  rtd-ecan1000-send-command.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan527-digital-io                  rtd-ecan527-digital-io.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan527-test-hardware                  rtd-ecan527-test-hardware.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan527-test-hardware-int                  rtd-ecan527-test-hardware-int.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan527-test-leds rtd-ecan527-test-leds.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-read rtd-ecan-read.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-bit-rates rtd-ecan-test-bit-rates.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-board rtd-ecan-test-board.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-filter rtd-ecan-test-filter.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-id-read rtd-ecan-test-id-read.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-id-write rtd-ecan-test-id-write.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-test-tx-error-code                  rtd-ecan-test-tx-error-code.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-throughput rtd-ecan-throughput.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-write rtd-ecan-write.cc -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-clear-accounts rtd-ecan-clear-accounts.cc                  -lrtd-ecan
 g++ -g -I../include -L../lib -Wall -DDEBUG -D_GNU_SOURCE -o rtd-ecan-print-accounts rtd-ecan-print-accounts.cc                  -lrtd-ecan
 rtd1@rtd1:/usr/local/src/Ecan_Linux_V02.02.01/examples$

NOTE this does NOT use the version that we just placed in /usr/lib, but rather the one we made. If we want to write our own examples outside the build directories for this embedded hardware, we have to make sure that we use

 -L/usr/lib

and that

 -lrtd-ecan

is included in the linking lists. This can easily be done in CMake in

 TARGET_LINK_LIBRARIES( ${execname} rtd-ecan )

which will link librtd-ecan.a against the executable named ${execname}.

April

Getting an ad hoc kernel driver to startup, and create devices at boot time

We're using a CAN card from RTD to interface with our vehicle. Under Kubuntu (6.10) we need to compile the driver, load the module, and install device directories under /dev. However, while this is easily doable under the driver's instructions, upon reboot the kernel module is no longer loaded, and devices are unavailable.

Hardware information

OS information

 Linux rtd1 2.6.17-10-generic #2 SMP Fri Oct 13 18:45:35 UTC 2006 i686 GNU/Linux

OK, we follow the instructions in the driver:

 cd /usr/local/src/Ecan_Linux_V02.02.01/driver
 make MODEL=527 && make insmod527 && make devices527

As we discussed earlier, you can now view that the kernel module is installed, and that the devices are there.

 rtd1@rtd1:~$ lsmod | grep rtd
 rtd_ecan527            38604  0 
 rtd1@rtd1:~$ ls /dev/rtd*
 /dev/rtd-ecan527-0  /dev/rtd-ecan527-2  /dev/rtd-ecan527-4  /dev/rtd-ecan527-6  /dev/rtd-ecan527-8
 /dev/rtd-ecan527-1  /dev/rtd-ecan527-3  /dev/rtd-ecan527-5  /dev/rtd-ecan527-7  /dev/rtd-ecan527-9
 rtd1@rtd1:~$ 

However, if you reboot the machine now, you lose all this. In order to guarantee continued use upon reboots:

 cd /usr/local/src/Ecan_Linux_V02.02.01/driver
 sudo cp rtd-ecan527.ko /lib/modules/2.6.17-10-generic/initrd/
 cd /lib/modules/2.6.17-10-generic/initrd/
 sudo depmod -Ae rtd-ecan527.ko

Now, some magic has been worked behind the scenes, so that the init.d scripts will be able to load this module. Next we need to load the module into the kernel on startup

 cd /etc && sudo vi modules
/etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp
rtd-ecan527 io=0xD0000,0xD0100

Note that we provide the io parameters for our machine. Your mileage may vary. With this in place, the kernel module will be loaded on startup (you could verify this with dmesg, but the devices will not be. Thus, we need to create a script that will create these devices on startup. Luckily, the logic is already in the Makefile, so...

 cd /etc/init.d

GeSHi Error: GeSHi could not find the language sh (using path /home/sprinkjm/public_html/pmwiki/cookbook/geshi/geshi/) (code 2)

With this script in place, you still have to put it in line with the various runlevels. This is done (in kubuntu) as

 cd /etc/init.d
 sudo update-rc.d rtd-ecan527.sh defaults
 sudo reboot

Now, upon reboot, you can check everything out:

 rtd1@rtd1:/etc$ dmesg | grep rtd
 [   43.456049] rtd_ecan527: module license 'unspecified' taints kernel.
 [   43.460830] rtd-ecan527> Initializing module (version 02.02.01).
 [   43.460848] rtd-ecan527> CAN bus interface board driver
 [   43.460855] rtd-ecan527> Copyright 2004 RTD Embedded Technologies, Inc.  All Rights Reserved.
 [   43.460875] rtd-ecan527[0]: probe device at 0xD0000 address ...
 [   43.460891] rtd-ecan527[0]:     IRQ line
 [   43.606314] rtd-ecan527[1]: probe device at 0xD0100 address ...
 [   43.606335] rtd-ecan527[1]:     IRQ line
 [   43.752742] rtd-ecan527: 2 cards detected
 [   43.752761] rtd-ecan527: registered with major 253

 rtd1@rtd1:/etc$ ls -la /dev/rtd*
 crw-rw-rw- 1 root root 253, 0 2009-04-30 11:19 /dev/rtd-ecan527-0
 crw-rw-rw- 1 root root 253, 1 2009-04-30 11:19 /dev/rtd-ecan527-1
 crw-rw-rw- 1 root root 253, 2 2009-04-30 11:19 /dev/rtd-ecan527-2
 crw-rw-rw- 1 root root 253, 3 2009-04-30 11:19 /dev/rtd-ecan527-3
 crw-rw-rw- 1 root root 253, 4 2009-04-30 11:19 /dev/rtd-ecan527-4
 crw-rw-rw- 1 root root 253, 5 2009-04-30 11:19 /dev/rtd-ecan527-5
 crw-rw-rw- 1 root root 253, 6 2009-04-30 11:19 /dev/rtd-ecan527-6
 crw-rw-rw- 1 root root 253, 7 2009-04-30 11:19 /dev/rtd-ecan527-7
 crw-rw-rw- 1 root root 253, 8 2009-04-30 11:19 /dev/rtd-ecan527-8
 crw-rw-rw- 1 root root 253, 9 2009-04-30 11:19 /dev/rtd-ecan527-9
 rtd1@rtd1:/etc$ 

Capturing video from Kubuntu using xvidcap

Download and install xvidcap. I had to install from source.

We got this error:

 checking for perl... /usr/bin/perl
 checking for XML::Parser... configure: error: XML::Parser perl module is required for intltool 

We had to install libxml-parser-perl. This was after determining that the term

 /usr/bin/perl -e "require XML::Parser" 

Was looking for XML/Parser.pm, which we didn't have.

We also installed ffmpeg, and mencoder

 sudo apt-get install ffmpeg mencoder

OK, now with xvidcap installed, we can run it, and we get a bunch of xwd files. THere may be a way to change that, but what we did was

 convert test-*.xwd test-%04d.png

Now, with png files, we can:

 mencoder "mf://*.png" -mf fps=10 -ovc lavc -o ./video.mp4

A concise script for transforming an entire directory is

 convert test-*.xwd test-%04d.png && mencoder "mf://*.png" -mf fps=10 -ovc lavc -o ./video.mp4

March

Tethering a Blackberry to a Mac (via Bluetooth)

http://hubpages.com/hub/Tethering-A-Blackberry-To-A-Mac-With-Bluetooth

PHP Upgrades at ECE

After upgrading the PHP server, some of my bibtexref package commands no longer work. It seems this was due to the calls being no longer supported by PHP.

The error I saw was:

 Publications/HomePage
 Invalid BibTex Entry: [, ]!

The fix is below.

bibtexref3.php
global $_GET, $PageStartFmt, $PageEndFmt, $PageHeaderFmt, $ScriptUrl, $bibentry, $bibfile, $bibref;
  $bibfile = $_GET['bibfile'];
  $bibref = $_GET['bibref'];
  SDV($ScriptUrl, FmtPageName('$PageUrl', $pagename));

 // REMOVED for newer PHP installation, JMS 03/05/09
 // see http://www.pmwiki.org/wiki/Cookbook/BibtexRef
 //  global $HTTP_GET_VARS, $PageStartFmt, $PageEndFmt, $PageHeaderFmt, $ScriptUrl, $bibentry, $bibfile, $bibref;
 //  $bibfile = $HTTP_GET_VARS['bibfile'];
 //  $bibref = $HTTP_GET_VARS['bibref'];

January

Making a WOL (Wake on LAN) packet

See http://wiki.tcl.tk/15423

2008

October

boost doesn't build on mac ports

As found in http://trac.macports.org/ticket/13714

 sudo port install boost

 ......
 --->  Building boost with target all
 Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build
  /_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_boost/work/boost_1_34_1" && gmake all " 
 returned error 2
 Command output: Makefile:2: *** missing separator.  Stop.


 sudo port clean --work boost
 sudo port install boost

Change the default clipboard format in your Mac

As found at http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X

 defaults write com.apple.screencapture type image_format

Where image_format is one of pg, tiff, pdf, png, bmp or pict (among others). To make the change take effect, try:

 killall SystemUIServer

Making a movie out of a series of png (or similar) images

Download imagemagick to get the convert program. You also need some kind of mpeg2encode. In (k)ubuntu, this install is:

 sudo apt-get install imagemagick

IF you are downloading imagemagick to edgy-eft, you need to put this in your apt-sources.list:

 deb http://old-releases.ubuntu.com/ubuntu/ edgy-updates main restricted
 deb-src http://old-releases.ubuntu.com/ubuntu/ edgy-updates main restricted

Then, you need to download the mpeg2encode program, and install it (boring!)

 cd /usr/local/src
 wget ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/mpeg2vidcodec_v12.tar.gz
 tar xzf mpeg2vidcodec_v12.tar.gz
 cd mpeg2 && make && sudo cp src/mpeg2enc/mpeg2encode /usr/local/bin/mpeg2encode

Seriously, who the heck distributes software without make install target !?

Now, a command similar to this will do the trick:

 convert *.png output.mpg

Changing a4 pdfs to be letter pdfs

Note that this solution, since it uses PS as a transformation space, necessarily pixelates the fonts to be postscript, rather than vector, fonts. You can accomplish vector font transformations if you are willing to do it by hand using a PDF printer.

To do this automatically, Unix scripts to the rescue:

a4topaper.sh
#!/bin/bash

if [ $# -ne 1 ]; then
        echo "Provide an input filename"
        exit 1;
fi

# change into a PS file
$PSNAME=$1.ps

pdf2ps $1 $PSNAME
psresize -PA4 -pletter $PSNAME $PSNAME-letter.ps
ps2pdf $PSNAME-letter.ps
 

September

MS Terminal Server stops accepting connections

My MSTS is not accepting connections on our external connection to the world. The internal (lab) connection is ok. To fix it, I can ssh to a linux machine in the lab, rdesktop to the MSTS from that machine, and then repair the internet connection.

Note that the outside world connection still responds to ping.

Possible solutions (not yet tried):

June

Et al. in Latex/bibtex

Ever wonder how to get et al. to show up in your bibliography entry? Turns out you just make the list something like:

 @ARTICLE{ j:ref-info-2008,
   author={Sprinkle and others},
   ...
 }

and BibTeX sorts out the rest.

March

"The disk is full or too many files are open" Error Message in Microsoft Word

See http://www.dessci.com/en/support/mathtype/tsn/TSN64.htm

Using Ice in/out of a firewall run by iptables

I was having trouble using Ice on my machine, bracton.ece, since bracton has two network cards, and (evidently) only machines inside the lab were able to use Ice.

I tested for connectivity using the Orca utility, iceping

 dimble@dimble:~$ iceping -r
 Ice version: 3.2.0
 assumed config file: --Ice.Config=/home/dimble/.orcarc
 03/04/08 13:43:06.216 warning: unknown property: Ice.Timeout

 Ping failed.
 Network.cpp:622: Ice::ConnectTimeoutException:
 timeout while establishing a connection

This machine, dimble.ece, has a live internet address (150.135.217.180). However, running iceping on a machine with an internal lab address is successful.

 maggs@maggs:~$ iceping -r
 Ice version: 3.2.0
 assumed config file: --Ice.Config=/home/maggs/.orcarc
 03/04/08 13:48:08.983 warning: unknown property: Ice.Timeout

 Ping successful.
 Proxy		[ IceGrid/Query -t ]
 Connection	[ local address = 192.168.1.6:45136
 remote address = 150.135.217.192:12000 ]
 RTT (3) 	[ 1500 us ]
 Ice ID 		[ ::IceGrid::Query ]

Note that it believes that bracton's ip is the internet (not subnet) version. I also tested on bracton:

 sprinkjm@bracton:/etc/sysconfig$ /opt/orca-dgc/bin/iceping -r
 Ice version: 3.2.1
 assumed config file: --Ice.Config=/home/sprinkjm/.orcarc
 03/04/08 13:42:20.103 warning: unknown property: Ice.Timeout

 Ping successful.
 Proxy		[ IceGrid/Query -t ]
 Connection	[ local address = 150.135.217.192:49557
 remote address = 150.135.217.192:12000 ]
 RTT (3) 	[ 3229 us ]
 Ice ID 		[ ::IceGrid::Query ]

OK, so clearly the problem is that there is a firewall issue. The only question was: is this blocked by the department routers, or is it bracton's firewall holding us back? Since I only had access to the firewall on bracton, I changed it to see. ;)

/etc/sysconfig/iptables
...
# entries for Orca/Ice
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 12000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 12000 -j ACCEPT

#-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-P INPUT DROP
COMMIT

After adding these entries, I restarted iptables

 sudo /etc/init.d/iptables stop
 sudo /etc/init.d/iptables stop
 sudo /etc/init.d/iptables start

I run stop twice, rather than restart, since some of the modules take more time to come down than iptables actually likes. Now that iptables is back up, we test using dimble (the machine with the 'live' IP)

 dimble@dimble:~$ iceping -r
 Ice version: 3.2.0
 assumed config file: --Ice.Config=/home/dimble/.orcarc
 03/04/08 13:49:23.506 warning: unknown property: Ice.Timeout

 Ping successful.
 Proxy		[ IceGrid/Query -t ]
 Connection	[ local address = 150.135.217.180:38917
 remote address = 150.135.217.192:12000 ]
 RTT (3) 	[ 16112 us ]
 Ice ID 		[ ::IceGrid::Query ]

Success! I thought....If I VPN into campus, I can (theoretically) get access to the icegridregistry running on bracton. However, this didn't actually pan out.

Running simple components, such as laser2d fail to connect and stream data. That is, a connection ocurrs, but the data doesn't keep coming. I think this is related to the use of Proxies, so I will see what else I can do. I hope that I don't have to create a separate NAT entry for each machine to forward proxy ports...that would not be cool.

February

Using Slice files with Doxygen

I am using Orca, which has a built-in doxygen script for satellite projects. However, the existing Sourceforge documentation is generated using a patched version of the Doxygen executable.

After poking around, I discovered this entry in a ZeroC forum. To implement this for an Orcasatellite project, the following needs to be created. Create slice.sed in the doc/ directory of the Orca satellite project.

slice.sed
# Skip C-style commenting
/\/\*/ , /\*\//b
/\/\/\(.*\)/b

s/module/namespace/
s/local//
s/idempotent//
s/dictionary/map/
s/sequence/vector/

#parse local interface
/interface/ , /{/    {
    /interface/ {
        #change interface to class
        s/interface\(.*\)/class \1/
    }
#change extends
    s/extends/: public/
#add public before every keyword, but not {
    /{/!s/,\(.*\)/, public \1/g
    s/{/{public:/
}

s/nonmutating\(.*)\)/\1 const/

/throws/,/;/ {
    s/throws/throw(/
    s/;/);/
}
slice2doxy
#!/bin/sh
sed -f slice.sed $1

Mark this slice2doxy file as user executable (make sure you do this before committing it to SVN/CVS). :)

 chmod u+x slice2doxy

With these files in play, edit the Doxyfile to have the following values:

project.Doxyfile
FILTER_PATTERNS = *.ice=./slice2doxy

Note that without the ./ before slice2doxy that the script may not work (it didn't work on my Kubuntu machine since the current director is not in the path...).

This solution is slightly more elegant than the one on ZeroC's site (though I heavily acknowledge the sed script from there!!!) since we now only pass through *.ice files, and not every file we parse.

Allowing SSH into Mac OS X

You only need to enable "remote login" using the System Preferences box.

 System Preferences->Sharing->Remote Login

I also added my machine to the dnsmasq.conf entry, so I would always get the same IP address.

Running IceGridRegistry on Fedora Core 8 as a daemon

Here's a howto for running icegridregistry as a daemon on FC8. I got a lot of this information from the DGC3 wiki, leftover from when I figured this out last time... :(

 cd /usr/local/sbin
 sudo mkdir -p icereg
 sudo cp /usr/local/src/[orca2]/scripts/ice/icegridregistry.cfg icereg/
 cd icereg/
 sudo mkdir db

Now, we create a few files

/etc/default/icegridregistry
# Customize the variables in /etc/default/icegridregistry rather than here
# uncomment based on whichever you prefer
#ICECHDIR=
ICECHDIR="--chdir /usr/local/sbin/icereg"

ICECONFIG="--Ice.Config=/usr/local/sbin/icereg/icegridregistry.cfg"

The existing file I had for icegridregistry was for ubuntu:

/etc/init.d/icegridregistry-ubuntu
#!/bin/sh
#
# /etc/init.d/icegridregistry   Start icegridregistry daemon.
#
#

# Customize the variables in /etc/default/icegridregistry rather than here

set -e

. /lib/lsb/init-functions


BINNAME=icegridregistry
CONFIGNAME=$BINNAME
ICECONFIG=""
ICECHDIR=""

[ -f /etc/default/$CONFIGNAME ] && . /etc/default/$CONFIGNAME

NET="$ICE_HOME/bin"
test -f ${NET}/${BINNAME} | exit 0

# Method to start up the daemon
do_start ()
{
        log_begin_msg "Starting ${CONFIGNAME}:"
        start-stop-daemon --start --quiet \
                ${ICECHDIR} \
                --exec ${NET}/${BINNAME} -- $ICECONFIG --daemon --nochdir
        log_end_msg 0
}

do_stop () {
        log_begin_msg "Stopping ${CONFIGNAME}:"
        start-stop-daemon --stop --quiet --oknodo --exec ${NET}/${BINNAME}
#       DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
#       KILLCOUNT=1
#       while [ $KILLCOUNT -le 5 ]; do
#               if stillrunning; then
#                       kill $DAEMONPID
#               else
#                       break
#               fi
#               sleep 1
#               KILLCOUNT=$(( $KILLCOUNT + 1 ))
#       done
#       if stillrunning; then
#               echo -n " not responding to TERM signal (pid $DAEMONPID)"
#       fi
        log_end_msg 0
}

# Set 'manual' to indicate if we were started by hand.
case "$0" in
        */S[0-9][0-9]*|*/K[0-9][0-9]*)
                manual=
                ;;
        *)
                manual=1
                ;;
esac

case "$1" in
  start)
        do_start
        ;;
  stop)
        do_stop
        ;;
  restart)
        do_stop
        sleep 2
        do_start
        ;;
  *)
        log_success_msg "Usage: /etc/init.d/${BINNAME} {start|stop|restart}"
        exit 1
esac

exit 0

 

I made a copy of the httpd start/stop, and hacked it for icegridregistry

/etc/init.d/icegridregistry
#!/bin/bash
# Author: Jonathan Sprinkle
#
# icegridregistry       Startup script for the Ice grid registry
#
# chkconfig: - 85 15
# description: The icegridregistry maintains a list of platforms with
#              available middleware services/interfaces provided.
# processname: icegridregistry
# config: /etc/default/icegridregistry
# pidfile: /var/run/icegridregistry.pid
#
### BEGIN INIT INFO
# Provides: icegridregistry
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start:
# Short-Description: start and stop IceGridRegistry daemon
# Description: The icegridregistry maintains a list of platforms with
#  available middleware services/interfaces provided.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/default/icegridregistry ]; then
        . /etc/default/icegridregistry
fi

# Path to the apachectl script, server binary, and short-form for messages.
#apachectl=/usr/sbin/apachectl
#httpd=${HTTPD-/usr/sbin/httpd}
icegridregistry=/usr/bin/icegridregistry
prog=icegridregistry
pidfile=${PIDFILE-/var/run/icegridregistry.pid}
lockfile=${LOCKFILE-/var/lock/subsys/icegridregistry}
RETVAL=0

# So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        $icegridregistry --pidfile ${pidfile} $ICECONFIG --daemon --nochdir
        #$icegridregistry --pidfile ${pidfile} --$ICECONFIG --daemon --nochdir
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

# When stopping icegridregistry, we give a delay of >10 second before SIGKILLing the
# icegridregistry parent; this gives enough time for the parent to SIGKILL any
# errant children.
# (maybe over the top, but we have plenty of time...)
stop() {
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile} -d 10 $icegridregistry
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $httpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f ${pidfile} ] ; then
                stop
                start
        fi
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|condrestart|status}"
        RETVAL=3
esac

exit $RETVAL
 

To start:

 sudo /etc/init.d/icegridregistry start

Things *should* run fine. To check that it is running:

 /bin/ps aux | grep icegrid

Now things look good. One last thing to do is add icegridregistry to the default runlevel for each of the 3,4,5 runlevels. I'm working on this...in the meantime, I have to ensure every time bracton restarts (once a semester?) I remember to restart the registry.

To ping something on ice, just to be super sure, you can use the iceping utiltity, which is an Orca product:

 sprinkjm@bracton:/usr/local/sbin/icereg$ /opt/orca-dgc/bin/iceping -r
 Ice version: 3.2.1
 assumed config file: --Ice.Config=/home/sprinkjm/.orcarc
 02/20/08 12:49:44.705 warning: unknown property: Ice.Timeout 

 Ping successful.
 Proxy		[ IceGrid/Query -t ]
 Connection	[ local address = 150.135.217.192:58282
 remote address = 150.135.217.192:12000 ]
 RTT (3) 	[ 9036 us ]
 Ice ID 		[ ::IceGrid::Query ]

Note that this assumes you have a ~/.orcarc file, since Orca 'houses' iceping. Here is a good one to use:

~/.orcarc
# Ice configuration

# Uncomment for being connected to bracton/UA campus
Ice.Default.Locator=IceGrid/Locator:default -h bracton.ece.arizona.edu -p 12000# IceStorm.TopicManager.Proxy=IceStorm/TopicManager:default -h bracton.ece.arizona.edu -p 10000

# Uncomment for using localhost
# Ice.Default.Locator=IceGrid/Locator:default -p 12000
# IceStorm.TopicManager.Proxy=IceStorm/TopicManager:default -p 10000

 Ice.Override.ConnectTimeout=1000
 Ice.Timeout=200

# Orca config
Orca.PrintProperties=0
Orca.PrintComponentStarted=0
Orca.RequireRegisty=1

# Orca Tracer config
Orca.Tracer.RequireIceStorm=0
Orca.Tracer.Filename=orca_component_trace.txt
Orca.Tracer.InfoToDisplay=1
Orca.Tracer.InfoToNetwork=0
Orca.Tracer.InfoToLog=0
Orca.Tracer.InfoToFile=0
Orca.Tracer.WarningToDisplay=1
Orca.Tracer.WarningToNetwork=0
Orca.Tracer.WarningToLog=0
Orca.Tracer.WarningToFile=0
Orca.Tracer.ErrorToDisplay=10
Orca.Tracer.ErrorToNetwork=0
Orca.Tracer.ErrorToLog=0
Orca.Tracer.ErrorToFile=0
Orca.Tracer.DebugToDisplay=0
Orca.Tracer.DebugToNetwork=0
Orca.Tracer.DebugToLog=0
Orca.Tracer.DebugToFile=0
Orca.Tracer.IgnoreRepeatedWarnings=1
Orca.Tracer.IgnoreRepeatedErrors=1
Orca.Tracer.Timestamp=1
 

Installing Orca on Fedora Core 8

I began at http://orca-robotics.sourceforge.net/orca/orca_doc_installfedora.html

 sprinkjm@bracton:~$ sudo yum install db4
 Setting up Install Process
 Parsing package install arguments
 Package db4 - 4.6.21-1.fc8.i386 is already installed.
 Nothing to do
 sprinkjm@bracton:~$ sudo yum install expat
 Setting up Install Process
 Parsing package install arguments
 Package expat - 2.0.1-2.i386 is already installed.
 Nothing to do
 sprinkjm@bracton:~$ sudo yum install openssl
 Setting up Install Process
 Parsing package install arguments
 Package openssl - 0.9.8b-17.fc8.i686 is already installed.
 Nothing to do

Hm, it seems like most of my packages were already installed by Marti (yay, Marti!) in his FC8 image. I'll check the rest en masse:

 sprinkjm@bracton:~$ sudo yum install bzip2-libs readline ncurses libgcc libstdc++ openssl-devel db4-utils doxygen
 Setting up Install Process
 Parsing package install arguments
 Package bzip2-libs - 1.0.4-12.fc8.i386 is already installed.
 Package readline - 5.2-7.fc8.i386 is already installed.
 Package ncurses - 5.6-12.20070812.fc8.i386 is already installed.
 Package libgcc - 4.1.2-33.i386 is already installed.
 Package libstdc++ - 4.1.2-33.i386 is already installed.
 Package openssl-devel - 0.9.8b-17.fc8.i386 is already installed.
 Package doxygen - 1:1.5.4-1.fc8.i386 is already installed.

After this, db4-utils (4.6.21-1) and readline (5.2-10) were installed. Next to install was CMake, but I had already installed it (v.2.4.7).

I was hoping that ICE would exist as a Fedora package...

 sudo yum search libzeroc-ice
 No Matches Found

Shucks. However, I looked on the ZeroC site, and they do have a binary version, but you have to edit the yum sources.

 cd /etc/yum.repos.d/
 wget http://www.zeroc.com/download/Ice/3.2/rhel4/zeroc-ice.repo

Now, I can check for it again with yum:

 sudo yum update

You should see at the top that it gets the new ice repositories.

 zeroc-ice                 100% |=========================|  951 B    00:00     
 primary.xml.gz            100% |=========================| 5.8 kB    00:00     
 zeroc-ice : ################################################## 32/32
 Setting up Update Process
 Resolving Dependencies

I said "N" at the end when it asked me to update packages (I find upgrading never goes as planned on an enterprise machine...). So, to install, I checked what ice was in the repository

 sudo yum search zeroc

And found that ice and ice-devel both existed, along with lots of other stuff. So, I installed ice-devel, figuring that ice will be installed too.

 sprinkjm@bracton:~$ sudo yum install ice-devel
 Setting up Install Process
 Parsing package install arguments
 Resolving Dependencies
 --> Running transaction check
 ---> Package ice-devel.i386 0:3.2.1-13.fc8 set to be updated
 --> Processing Dependency: libIceGrid.so.32 for package: ice-devel
 --> Processing Dependency: ice = 3.2.1-13.fc8 for package: ice-devel
 --> Processing Dependency: libIcePatch2.so.32 for package: ice-devel
 --> Processing Dependency: libIceSSL.so.32 for package: ice-devel
 --> Processing Dependency: libIce.so.32 for package: ice-devel
 --> Processing Dependency: libFreeze.so.32 for package: ice-devel
 --> Processing Dependency: libGlacier2.so.32 for package: ice-devel
 --> Processing Dependency: libIceStormService.so.32 for package: ice-devel
 --> Processing Dependency: libSlice.so.32 for package: ice-devel
 --> Processing Dependency: libIceUtil.so.32 for package: ice-devel
 --> Processing Dependency: libIceStorm.so.32 for package: ice-devel
 --> Processing Dependency: libIceBox.so.32 for package: ice-devel
 --> Running transaction check
 ---> Package ice.i386 0:3.2.1-13.fc8 set to be updated
 --> Finished Dependency Resolution

Golden. Now, Ice is installed, let's move on to the other dependencies of Orca.

 sudo yum install qt4-x11

Next...it's time to install orca. Before I set the paths and everything, I wanted to see whether it was possible to build Orca without hacking the /etc/profile:

 cd /usr/local/src/
 wget http://www.ece.arizona.edu/~sprinkjm/teaching/ece473/uploads/Main/orca2-ece473-573.tgz 
 tar xzf orca2-ece473-573.tgz && cd orca2-ece473-573 && mkdir build && cd build
 cmake .. && make -j2 && sudo make install

It found everything ok, without setting special paths:

 --Setting ICE_HOME to /usr
 -- This is a Debian Ice installation. Slice files are in /usr/share
 -- Looking for Ice - found in /usr
 -- Looking for C++ include Ice/Ice.h
 -- Looking for C++ include Ice/Ice.h - found
 -- Checking Ice version - 3.2.1 - ok

However, the build failed because it couldn't find the .ice files

 [  3%] -- Generating header file from  /usr/local/src/orca2-ece473-573/src/interfaces/slice/orca/home.ice
 /usr/local/src/orca2-ece473-573/src/interfaces/slice/orca/home.ice:15:   Ice/BuiltinSequences.ice: No such file or directory
 make[2]: *** [src/interfaces/cpp/orca/home.h] Error 1
 make[1]: *** [src/interfaces/cpp/orca/CMakeFiles/OrcaInterfaces.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs....

But, that file is in /usr/share/Ice-3.2.1/slice/Ice. So, ccmake to the rescue! I set the Orca Slice Files location to /usr/share/Ice-3.2.1, and the build took off!!

Installing usb networking on Mac OS X for gumstix

I basically did what Dave Hylands did on the gumstix webpage:

http://docwiki.gumstix.org/Setting_up_USBnet

It turns out that using this can wreak havoc on vmware. I had to remove the en2 ethernet to boot to my VMWare images, even after a few reboots. More updates to come, if I solve it...

Orca installation on fresh install of Gutsy Gibbon

I know that chasing the head of the development tree can make for rocky stability, so I decided I'd go with the latest release rather than the trunk for both orca and hydro. Since I love creating scripts to do installs on multiple machines, I investigated using svn as the checkout method, to avoid having to sit in front of the machine and wait for sourceforge to produce a mirror for me to download from.

I noticed that there's no tag for Orca for release 2.9.0. A release exists (as I saw on the orca-robotics website).

So, I just checked out the same revision number as hydro reported on the RELEASE_2_9_0 tag (in the hopes that they are in the same svn repository). I edited my .bashrc to include the HYRDRO_* env variables, opened up a new shell, built orca, and received the following error after having built and installed hydro:

 CMake Error: Loading Hydro manifest - failed. Please reinstall Hydro, **
 delete CMakeCache.txt **, then re-run CMake.

After digging around, I see that the new trunk of hydro creates a manifest entry called HYDRO_MANIFEST_LOADED, which the 2.9.0 version does not provide. So, I downloaded the 2.9.0 release from sourceforge (rather than the svn tag). When doing this, I noticed that the .tgz file extracts to the directory hydro, rather than hydro-2.9.0.

 sprinkle@macauslan-gutsy:/usr/local/src/hydro$ diff -r .

/home/sprinkle/svn/hydro-2.9.0/ | grep -v .svn

 6,9d5
 < INCLUDE( ${HYDRO_CMAKE_DIR}/FindIceUtil.cmake )
 < REQUIRE_VAR( BUILD LIB ${LIB_NAME} ICEUTIL_FOUND "libIceUtil not found" )
 <
 <
 26a27,29
 >
 > # pretend CRaP distribution
 > ADD_SUBDIRECTORY ( crapurglaser )
 8,10d7
 < INCLUDE( ${HYDRO_CMAKE_DIR}/FindIceUtil.cmake )
 < REQUIRE_VAR( BUILD LIB ${LIB_NAME} ICEUTIL_FOUND "libIceUtil not found" )
 <
 sprinkle@macauslan-gutsy:/usr/local/src/hydro$

While it's a little troubling that the svn tag doesn't match the release, this clearly isn't indicative that hydro is causing the problem. When I diff the orca-2.9.0 release (file) versus the revision 4116, it's clear that this is the problem. So, I removed /opt/hydro-2.9.0 and rebuild and reinstalled hydro from the release .tar.gz, and edited my .bashrc file to produce the right environment variables, and resourced ~/.bashrc.

So, I started to build the orca-2.9.0 release (as downloaded from the sourceforge mirror), and it flat didn't work. In looking through why this didn't work, I noticed a file in the orca-2.9.0 release that contains an svn-commit.tmp~ file to include that structure as a tag, but it never got committed. Whoops.

Anyway, it turns out that the reason my orca-2.9.0 would not build was because I put my variable declarations in .bashrc after the default source for bash_completion. This is a recorded bug:

https://bugs.launchpad.net/ubuntu/+source/bash/+bug/160405 A duplicate of: https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/149527

While this is really annoying, I guess the next OS fixes it. Since I don't want to upgrade to an unstable OS, I comment out the source from my .bashrc for bash_completion, since (by god) it get sourced from /etc/bash.bashrc. Stupid ubuntu. :) This didn't bite me before, since I had opened a new shell.

So, now, cmake is happy, but the build fails when I run with `make -j2`.

 [ 56%] Building CXX object

src/components/localnav/vfhdriver/CMakeFiles/OrcaLocalNavVfh.dir/vfhdriver.o

 Linking CXX shared library libOrcaLocalNavTestSim.so
 /usr/bin/ld: cannot find -lOrcaPathPlan
 collect2: ld returned 1 exit status
 make[2]: *** [src/components/localnav/testsim/libOrcaLocalNavTestSim.so]

Error 1

 make[1]: ***
 [src/components/localnav/testsim/CMakeFiles/OrcaLocalNavTestSim.dir/all]

Error 2

 make[1]: *** Waiting for unfinished jobs....

I can only presume that there is a problem in cmake's dependencies here, and the dual compilation is crashing. So (without cleaning) I run make -j1.

 [ 85%] Built target lasermon
 Linking CXX shared library libOrcaLocalNavTestSim.so
 /usr/bin/ld: cannot find -lOrcaPathPlan
 collect2: ld returned 1 exit status
 make[2]: *** [src/components/localnav/testsim/libOrcaLocalNavTestSim.so]

Error 1

 make[1]: *** 

[src/components/localnav/testsim/CMakeFiles/OrcaLocalNavTestSim.dir/all] Error 2

 make: *** [all] Error 2

Now, I don't need this component, but why does it try to build if it doesn't work by default? In case it's a remainder problem from the beginning, I clean (read: remove build dir and start over) and do it again.

 [ 86%] Building CXX object

src/components/localnav/testsim/CMakeFiles/OrcaLocalNavTestSim.dir/testsim.o Linking CXX shared library libOrcaLocalNavTestSim.so

 /usr/bin/ld: cannot find -lOrcaPathPlan
 collect2: ld returned 1 exit status
 make[2]: *** [src/components/localnav/testsim/libOrcaLocalNavTestSim.so]

Error 1

 make[1]: *** 

[src/components/localnav/testsim/CMakeFiles/OrcaLocalNavTestSim.dir/all] Error 2

 make: *** [all] Error 2

Now it's been 3 hours since a clean install of (k)ubuntu gutsy (7.10), and I still don't have a working copy of orca. After remembering from somewhere that having Qt installed can screw up everything, I checked out the Cmake output again:

-- Not planning to Build Library : OrcaPathPlan because libHydroPathPlan not installed

So, for some reason Orca still plans to build the test for localnav, despite the fact that localnav is not being built. Maybe this is fixed in a future release, or in the current trunk. In any case, it's not working in 2.9.0. I checked the hydro output:

-- Planning to Build Library : HydroPathPlan -- Looking for Qt4 >= 4.2 - not found -- Not planning to Build Library : HydroPathPlan because Qt4 not found

OK, so qt is messing all of this up, and not installing qt may have cost me a few hours. I wonder why building qt by default is not suggested? Maybe after building ice this would be reasonable? I install qt (though not player/stage) and after a few major downloads, orca and hydro are both happy.