Showing posts with label macosx. Show all posts
Showing posts with label macosx. Show all posts

Saturday, April 26, 2008

RXTX and the funky PortInUseException on Macosx

I am using the RXTX serial libs for getting data out of my gps. They always worked nice, but the first time I tried them on Macosx they didn't work, throwing this ugly:

gnu.io.PortInUseException: Unknown Application

Since the thing worked from commandline:
>>> cat /dev/tty.touchGPS-SSP-1
$GPGGA,172025.233,2500.0001,N,12159.9999,E,0,0,,80.9,M,16.1,M,,*7D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,172025.233,V,2500.0001,N,12159.9999,E,0.00,0.00,260408,,,N*77
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32... etc etc

I was pretty helpless. Then I found in some mailinglist archive the solution. To cite the guy that solved my problem: "As I've discovered the PortInUseException rarely has anything to do the port being in use. For reasons I don't understand RXTX is not using /var/spool/uucp for lock files. It's using /var/lock. A directory that didn't exist on my system. Once I created this directory I started getting different errors for the RXTX code. This directory requires read/write permissions for the user. I just used the blanket chmod 777."


Nothing to add, tried it and it worked.






UPDATE as of Saturday 4th of April 2009:


As a nice anonymous user comments, these are the steps to go:
  1. Open 'Terminal' from Applications->Utilities
  2. Enter the commands:
sudo mkdir /var/lock   (hit enter end type your password)
sudo chmod 777 /var/lock (hit enter again)

Thursday, April 24, 2008

What is going on with case sensitivity on *nix systems?

I think I'm going mad (due to my ignorance, since I guess this is known...)!!

On my macosx I made I typo in trying to enter a folder (note that USers doesn't exist):

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][1 ~]
>>> cd /USers/moovida//codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data/

But hey, I could enter:

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][2 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> pwd
/USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data

So to be sure I didn't do anything nasty in the past, as for example renaming my home folder (which is impossible) or relink it.. or ... or aliens came to take me:

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][3 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> ll /
total 41029
drwxrwxr-x+ 116 root admin 3.9K Apr 19 10:17 Applications
-rw-r--r--@ 1 root admin 1.0K Nov 18 22:58 Desktop DB
-rw-r--r--@ 1 root admin 2B Nov 15 20:04 Desktop DF
drwxrwxr-x@ 16 root admin 544B Nov 27 00:43 Developer
drwxrwxr-t+ 57 root admin 1.9K Jan 20 23:01 Library
drwxr-xr-x@ 2 root wheel 68B Sep 23 2007 Network
drwxr-xr-x 4 root wheel 136B Feb 13 17:30 System
drwxrwxrwx@ 3 root wheel 102B Dec 13 22:45 TheVolumeSettingsFolder
lrwxr-xr-x 1 root admin 60B Nov 15 15:56 User Guides And Information -> /Library/Documentation/User Guides and Information.localized
drwxr-xr-x 5 root admin 170B Nov 15 15:55 Users

Ha ha, Users is != USers...

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][4 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> cd /Users/moovida//codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data/

Works also... so is the filesystem case sensitive or not?

Sunday, January 20, 2008

How to check the operating system type and architecture

even if java is superportable (:]), more than often we need to execute operating dependent stuff. The rcp environment helps a lot in this:


if (Platform.getOS().equals(Platform.OS_WIN32)) {
// do windows specific stuff
}else if (Platform.getOS().equals(Platform.OS_LINUX)) {
// do linux specific stuff
}else if (Platform.getOS().equals(Platform.OS_MACOSX)) {
// do macosx specific stuff
}else{
// throw exceptions
}

Thursday, January 10, 2008

How to supply network to a linux box through a macosx through ethernet

This is for sure no GIS and no java, but it can be usefull to others, so here I go with it.

The problem: supply internet connection to a colleagues computer running linux from my macosx box. I have a broadband connection given me trough an USB-modem.

This was pretty easy, at some point I'll have to get that also throught airport connection, not sure about the security issues tho.

ON MY MAC:
1) the first thing to do is to activate leopard's (my current macosx operating system) internet connection sharing. This is easy. Go under preferences->sharing and just activate it. Select in the combobox the active internet connection and from the list below the way you want to share the connection with the linux box.

In my case I have an ethernet crossed cable for connections between two pcs, so I choose Ethernet.

2) check out the connection properties. In the network settings I see that my modem is connected with the IP address: 10.98.0.76


BTW I need to know the gateway of that all, i.e. the connection address to the outer world. This can be achieved through the supplied connection software of my modem, though I'm sure there are a lot of other ways. There are also google widgets to trace the connection.


As you can see the connection goes to 10.64.64.64. Now I have to set up properly the ethernet connection, since the connection will not supply dhcp and we need to be all on the same network.


So i simply set up the ethernet connection with a static address of one more than the modem ip address and the proper netmask. The router is the link to the outer world and that's all.

No wait, we need the DNS, which we can retrieve in the advanced settings of the modem connection, in my case:
62.13.171.4
62.13.171.5

Alright, now I'm ready to jump to my linux box:

ON MY LINUX BOX (KUBUNTU FEISTY):

1) Edit the network settings file: /etc/network/interfaces
and put the following into it:

auto lo
iface lo inet loopback

mapping hotplug
script grep

iface eth0 inet static
address 10.98.0.78
netmask 255.255.0.0
gateway 10.98.0.77


2) Edit the DNS file: /etc/resolv.conf

nameserver 62.13.171.4
nameserver 62.13.171.5


And start your network:
sudo ifup eth0


This should work at that point! Enjoy!




UPDATE: I right notice that the static IP thing could be misleading as I put it.

Instead of 10.98.0.78 on your linux box and 10.98.0.77 on your macosx system you could use more usual numbers for the internal networks, as for example 192.168.1.123 and 192.168.1.124.