Skip to content →

Tag: mac

my first scraper

As
far as I know (but I am fairly ignorant) the arXiv does not
provide RSS feeds for a particular section, say mathRA. Still it would be a good idea for anyone
having a news aggregator to follows some weblogs and
news-channels having RSS syndication. So I decided to write one as my
first Perl-exercise and to my own surprise I have after a few hours work
a prototype-scraper for math.RA. It is not yet perfect, I still
have to convert the local URLs to global URLs so that they can be
clicked and at the moment I have only collected the titles, authors and
abstract-links whereas it would make more sense to include the full
abstract in the RSS feed, but give me a few more days…
The
basic idea is fairly simple (and based on an O\’Reilly hack).
One uses the Template::Extract module to
extract the goodies from the arXiv\’s template HTML. Maybe I am still
not used to Perl-documentation but it was hard for me to work out how to
do this in detail either from the hack or the online
module-documentation. Fortunately there is a good Perl Advent
Calendar
page giving me the details that I needed. Once one has this
info one can turn it into a proper RSS-page using the XML::RSS-module.
In fact, I spend far
more time trying to get XML::RSS installed under OS X than
writing the code. The usual method, that is via

iMacLieven:~
lieven$ sudo /usr/bin/perl -MCPAN -e shell Terminal does not support
AddHistory. cpan shell -- CPAN exploration and modules installation
(v1.76) ReadLine support available (try \'install
Bundle::CPAN\') cpan> install XML::RSS 

failed and even a
manual install for which the drill is : download the package from CPAN, go to the
extracted directory and give the commands

sudo /usr/bin/perl
Makefile.pl sudo make sudo make test sudo make
install

failed. Also a Google didn\’t give immediate results until
I did find this ADC page which set me on the right track.
It seems that the problem is in installing the XML::Parser for which one first need expat
to be installed. Now, the generic sourceforge page contains a
version for Linux but fortunately it is also part of the Fink
project
so I did a

sudo fink install expat

which worked
without problems but afterwards I still was not able to install
XML::Parser because Fink installs everything in the /sw
tree. But after

sudo perl Makefile.pl EXPATLIBPATH=/sw/lib
EXPATINCPATH=/sw/include

I finally got the manual installation
going. I will try to tidy up the script over the weekend…

One Comment

chicken of the VNC

If I
ever get our home automation system configured I’ll use my (partly
broken) old iBook as my Indigo-server (or my MisterHouse-server when I brush up my
Perl-knowledge). It should then run quietly put away somewhere and I
don’t want to take it out every time I want to add another routine to
the program.
Fortunately there is a way to do this by turning
the iBook into a VNC-server, where VNC stands for
Virtual Network Computer. Here is how RealVNC describes
it

VNC (Virtual Network Computing) software makes it
possible to view and fully-interact with one computer from any other
computer or mobile device anywhere on the Internet. VNC software is
cross-platform, allowing remote control between different types of
computer. For ultimate simplicity, there is even a Java viewer, so that
any desktop can be controlled remotely from within a browser without
having to install software.

But can all this be done under
Mac OS X without too much hassle? The first step is to download
OSXvnc and install it on the iBook. Some of the
sourceforge-sites do not seem to have this package, but fortunately some
still do. Installation is no problem and when you fire OSXvnc up
you have to fill in a password which you need later to connect to your
OSXvnc-server (the iBook). Most other options one can leave at their
default values but in the Startup-pane it is useful to click on
the Configure Startup Item button. When all this is done, press
the Start button to launch the VNC-server.
Next step is
to go to the computer you want to use to control the VNC-server (an iMac
in my case). On it one needs to install the Chicken of the VNC software which makes the iMac
into a VNC-client. Fire it up and fill out the Host (the name of
your OSXvnc-server, iBookLieven.local in my case) and the
Password (the one of the OSXvnc-server program), press the
Connect button and the screen of your VNC-server will appear
which you can control with your mouse as if you were actually working on
the thing. Very handy as I managed to break the touch-control on my
iBook when installing a new hard-drive and I need the only USB-port to
connect to the X10-network…

Leave a Comment

playtime

I
bought a couple of X10-building blocks : a tranceiver, an appliance- and
a lamp-module, a computer-interface and a motion detector and started
playing using the Indigo help-page. All modules worked immediately
and getting them under Indigo‘s control was also no problem.
Clearly it is fun to control a living room lamp and the coffee maker
from your computer but it gets even better when you program actions.
With Indigo you can let your home automation system react to
incoming emails. For example, if it is a rainy workday and I want to
have a cup of coffee when I bicycle home I can just send an email with
subject “Make coffee”. Indigo checks at home my email every
two-minutes and when it scans this subject-title it will send a signal
to the coffee maker to turn on (assuming I filled it with water and
coffee beforehand, otherwise it may result in a fire…). One can also
program it the other direction. For example, with Indigo I can
program things so that when the motion detector detects movement from
opening the front door, I can ask to send an email to work (or to a
mobile but as I am not using these things this is no option) with
message “Someone just walked in…”.
Getting the
motion-detector (MS13 for the experts) working was so far the second
hardest thing to do. I couldnt work out how to give it a home&unit
code
but I found a readable manual page which made everything work. I have to
remember to change the other default options of the detector.
The hardest thing to solve was to get the Indigo Web Interface working. Following the
instructions on this page to the letter I thought that I could control
my X10-stuff from any other computer (assuming Indigo is running
on my iBook) by accessing the
URL

http://iBookLieven.local/cgi-bin/Indigo.acgi

but all I got
was a ‘Server Error’. I figured out that the mistake was caused by the
acgi
dispatcher
program. The first time this is run, it asks for your
admin password to write some extra lines to the httpd.conf
Apache configuration file, but for some strange reason it didn’t want
to accept my password… Changing permissions on httpd.conf and
even creating a genuine root-account didn’t help so I was stuck
for a while. But then I found the Mac OS X
hack #91
which not only explains the use of the dispatcher tool but
also explains what it adds to the httpd.conf-file. So, I just
copied the following lines manually at the end of
httpd.conf

#BEGIN acgi dispatcher Include
/Library/WebServer/CGI-Executables/dispatcher.app/Contents/acgi.conf\r\
nEND acgi dispatcher

did restart the Apache webserved by a

sudo apachectl graceful

after which the acgi dispatcher
tool started up without problems and I got a working Indigo Web
Interface
. I must remember to put both Indigo and the
dispatcher into my StartUp items.
The Web Interface is
very basic compared to other house automation programs such as MisterHouse
which makes up for its sexist name by being open source! It is entirely
written in Perl
but as I am only halfway through the Learning Perl book at the moment, this will have
to wait a bit longer…

Leave a Comment

home automation, the next project??

I\’ve barely managed to implement the six
great tips for homemade dot mac servers
by Alan
Graham
or he is already off on a new project : Home Automation
with Mac OS X
. I thought that home automation only could be
installed in new, highly wired, houses but I was wrong. In part
1
Alan Graham gives an overview why you might consider home
automation, gives the set-up in his house and outlines the hardware
necessary to do it. Clearly, most of his hardware is American but even
in Belgium it is not difficult to find vendors, for example intellihome.be. One can either control the
X10-machinery by remote control or via computer. For Macintosh Alan
Graham suggests to use the indigo program, of which one can download a fully
functional version for a 30 day tryout. The only piece I could not find
(yet) in Belgium was the PowerLink USB device but there is a serial-port
alternative available which seems to work just fine using a USB to
Serial cable (which are fairly expensive). In part 2 Alan Graham explains the basics of X10 technology and how you can
install all the hardware. In part 3 and later he promises to explain the
software part of things (if he hasnt started a new project by
then…).

Leave a Comment

once more : synchronizing


Carbon Copy Cloner is a tool to make a full backup
of your hard-disk on an external firewire disk or iPod. Here’s
how it sells itself

Have you ever wanted a simple, complete,
bootable backup of your hard drive? Have you ever wanted to upgrade to
a larger hard drive with minimal hassle and without reinstalling your
OS and all of your applications? Have you ever wanted to move your
entire Mac OS X installation to a new computer? Then CCC is the tool
for you! CCC makes these tasks simple by harnessing the Unix power
built into Mac OS X. In addition to the features that CCC has provided
in the past, version 2 offers synchronization of the source and target
as well as scheduled backup tasks.

I didn’t try it out yet
but was interested in the final sentence and scrolling down the page I
discovered that the synchronisation is done using Dan Kogai’s psync program, which does not seem to work under
10.3 but has on the page a patch to this. Rather than using the
psync-page to install it, one can use the unoffical psync for Panther dmg-file from the
Carbon Copy Cloner-page. It installs without a problem and to
learn how to use it, there is a manual page. Here is what I do when I want to
synchronize my Documents-folder on iMacLieven to the
backup-machine tweedledee over the Airport-network

psync
/Network/iMacLieven/lieven/Documents /Users/lieven/docsLieven

Watching the packet-flow on the Activity Monitor it seems to be
slightly quicker than the rsync tool. But most of all : it seems
to do a much better job. When I compared the end-result of the
synchronising session with rsync to that of psync I was
surprised to find a 20 Mb difference (on an original .5 Gb Folder) in
psync‘s favour! But even psync seems to have dropped 0.6
Mb in the process…

Leave a Comment

tweedledee and tweedledum


Tweedledum is a first-generation iMac (233 MHz
slot-loading, 192Mb RAM, No Airport) whereas Tweedledee is
2nd-generation (350 MHz front-loading, 192Mb RAM, Airport card). A
couple of weeks ago I replaced their original hard-discs (4 Gb resp. 6
Gb) by fat 120 Gb discs and from this weekend they serve as our
backup-facility. Tweedledee is connected via Airport to our network and
is a fully functional 10.3 computer, everyone has a login on it and is
encouraged to dump important files onto it as a secondary copy.
Tweedledum. on the other hand, is invisible to the network but forms a
one-wire network with Tweedledee (they are connected by a crossed
ethernet cable which results in having a self-assigned IP address in the
169.254 range and hence they can see each other; moreover using the
Sharing-pane in the System Preferences I allowed
Tweedledee to share its internet connection to other computers,
connected to it via Ethernet, so Tweedledum can go online to get
system-updates when necessary).
A house-computer rule is that
all important files (which means those you don’t like to loose in a
crash) are kept in the Documents folder of your
Home-folder on your own computer. At regular intervals I make
sure that these folders are synchronized with backup-copies on both
Tweedledee & Tweedledum, so at any given time there are at least 3
computers containing the essential files (usually more as everyone has a
login at each of the 4 ‘work’-computers and can drop extra copies
around, but must clean-up when asked).
To synchronise I use
the shareware program ExecutiveSync. It is no longer possible to
obtain this from its original homepage as they seem to have been taken
over and invite you to buy You Sinc instead which costs more than
twice what ExecutiveSync costs (19.95$). Fortunately, for now you can
still download it from the Apple site. I have
ExecutiveSync running on Tweedledee (you are only allowed to run it on
one computer, you can install it on every computer but then the
synchronizing process is sometimes not possible which is why I came to
the following work-around). In ExecutiveSync you make several
Projects which involve choosing a Local folder and a
Remote folder somewhere on your network which you want to keep in
Sync. In my Home folder on Tweedledee I made several (originally
empty) folders such as docsGitte. Then my ExecutiveSync-project
syncGitte takes docsGitte as the local folder and the
/Users/gitte/Documents-folder on iBookGitte as the remote
folder. The first time you synchronise takes a lot of time (especially
over the wireless network, it may be better to do the first sync via
ethernet) but afterwards it works pleasantly.
Once I
synchronised all the local Documents-folders with the corresponding
folders in my home-folder on Tweedledee, I have another
ExecutiveSync-project BACKUP which takes as the Local-folder my
Home-folder and as the remote folder a folder BACKUP I did create
on Tweedledum. Fortunately, here the synchronising is done over Ethernet
or it would take forever.

Leave a Comment

iHome phase 2 ended

More
than a month ago I started a long term project trying to make the best
of our little home network. The first couple of weeks I managed to get
iTunes, iPhoto and iMovie-files flowing from any computer to the living
room (the TV-set for photo and mpeg-files and squeezebox for audio files). The last couple of weeks I
have been making my hands dirty with some hard-ware upgrades. The key
problem being that some of our Macs have a too small hard disk for
present day needs. For example, PD2 could no longer play The Sims (and
their never ending extensions) on her 6 Gb iMac, so one day she simply
decided to get rid off most things in het Applications-folder, a
desperate cry for attention. Together with Jan I took our two 6 Gb
slot-loading iMacs apart and replaced them by a 120 Gb resp. 80 Gb hard
disk, giving the Sims ample virtual space to expand (I hope). Beginning
of this week I finished the slightly more daunting task of upgrading an
original 4 Gb front-loading iMac to a performing 120 Gb potential
Server. But I knew that the worst part was still to come : my old
(colored) iBook was making so much noise that I didn’t use it anymore
for anything demanding some kind of concentration (like writing papers).
So I wanted to replace the old 6 Gb noisy disk with a silent Hitachi
2.5 HDD 20GB 5400RPM ATA100 8Mb Cache
-hard disk. However I did read
the instructions and was a bit put off by this.
Luckily, I had to wait because I didn’t have the appropriate material.
Whereas any super-market sells Torx- 10 and 15 screwdrivers, I needed an
8 or 9. Eventually I found one in a good shop (they even have torx 6 and
7, it seems you need those to take your mobile apart), so no more
excuses. Tuesday afternoon I had a first try but already between stage 2
and 3 of the instructions I cut an essential connection (for the
trackpad)… and quickly assembled everything again (I could still use
my iBook with a USB-mouse…). This morning, when the rest of my family
left at 8 o’clock, I had another go (btw. never try to do this unless
you can afford to loose your iBook). The whole process is pretty scary :
you have to take out your keyboard, modem, CD-player, display and a few
minor ingredients before you get at the hard-disk. At the time you do,
the whole table is filled with parts and several cups containing some
screws which you will hopefully remember to put back in the correct
place. Still, in less than two hours I managed to replace the harddisk
and put everything back together (I lost some tome because at the end
one needs to remove some bolts and I didnt have a good tool available so
I had to improvise). I didn’t expect anything when I powered up the
iBook but somehow it reacted ok, I could start up from a System9 CD and
initialize the harddisk and even put System9 on it, but there was
something strange : all message-windows appeared at the lower right hand
side of the display… When I did restart from the HD, it became
apparent that I lost about 30% of my screen, including the part where
one normally sees the HD, CDs etc., so I had a small problem. But, after
my success of conquering my hard-ware phobia, I was not alarmed, I
cycled to the university and had a chat with Jan about it. He suggested
zapping the PRAM which I did in the afternoon, without any effect
on my partial display. So, perhaps it was a hard-ware thing after all
and I had to take my iBook apart again until I got at the connections
for the display (which is step 6 out of 8 of the instructions). Then,
the problem became clear : in reassembling the display-connectors I had
used a bit too much force so that some of the spikes were bend. But,
after repairing this and closing up the iBook again, the problem was
solved. So I have now a 20 Gb iBook with a nice quiet harddisk and I
“only” lost my trackpad and sound in the process… a good deal I
would say.

Leave a Comment

now I see you, now I don’t

For
someone as clumsy as me, it is no real surprise to loose one in three
hard disks, but what happened yesterday was a bit puzzling at first. I
tried to replace the original 4 Gb hard disk of an original iMac (a tray
loading iMac) following the instructions of the MacWorld : how to upgrade an iMac-page I used last
time together with Jan to replace two hard disks in slot-loading iMacs.
The whole process is a bit scary : unplug 4 connections, remove the
motherboard, remove the CD-driver in order to get at the hard disk, but
to my own surprise I managed to do all this fairly quickly and replaced
the hard disk by a 120 Gb Seagate Barracuda hard disk. I
put the iMac back together and started up from the OS 9 CD (last time I
forgot this and it is becoming fairly impossible to get a working
System9 defacto on 10.3). I opened DiskUtility and to my surprise the
utility found the new disk, so I managed to install everything properly.
I could even initialize and partition the disk (to run OS X on a first
generation iMac one needs to install it on a partition which is no
larger than 8 Gb) in two partitions (one 8Gb, the other the rest) and
installed System9 on the first partition. So far, so good but when I
restarted the iMac, a blinking question-mark appeared on the screen
indicating that it could not find the installed System9! Then I tried to
start-up from the 10.3-installation disk, started up the DiskUtility and
this time it found no hard disk at all. So I started up again from the
System9 CD and the two partitions appeared on my Desktop, seemingly in
perfect order. What was going on? There was an hard disk, I put System9
on one of its partitions but somehow it refused to find it, and starting
from the 10.3 CD it looked as if there was no hard disk whatsoever. If
you are knowledgeable, you know already where the problem was situated
but as I am more a software than a hardware guy I looked for similar
problems on the net and found an entry in which the solution was
obtained by installing System9 on the larger partition. So I tried this,
but again met the same problems.

So it must be a
hardware problem and I downloaded the product manual and began browsing through it until
I found one of these marvelous computer-terms : the master-slave
jumper settings
. Who invents this kind of terminology? The
master-slave jumper… Anyway, here are the possibilities for a
Barracuda
I
admit I didn’t look at the jumper-setting when I inserted the hard
disk. The previous two times it was not necessary and I assumed that the
default position would be the master-setting but wasn’t certain. Hence,
there was only one way to find out and that was redoing the whole
replacement-process… So, this morning I did this and found out that
the jumper-settings were set at Cable select which according to
Geert is the best setting for Windows-computers as
they then automatically decide whether to use the disk as master or
slave, so perhaps for Seagate there is some marketing logic in choosing
this as their default setting. Hence, I changed the setting to
master, quickly put back the iMac and in the end discovered that
I was left with two screws… As they must have been the screws
connecting the hard-disk cage to the motherboard I had little choice but
to redo the whole process a third time. Surprisingly, I began to like
the whole procedure, one should be forced as a computer-user to take
your computer apart a couple of time before working on it. Finally, I
tried to install OS X again, the DiskUtility recognized the two
partitions without any problem and the installation went smoothly.
Probably System9 can find a Cable-select connected hard disk, whereas OS
X cannot…

Leave a Comment

Singular via GAP on OSX

The
GAP-package is very good in working with finite
fields or Abelian extensions of the Rational numbers, but sooner or
later we will need to use the coordinate ring or function field of an
affine variety for which it is hopeless. On the other hand, there is an
excellent free package to do these calculations : Singular.
So, the ideal situation for us would be to be able to access Singular
from within GAP. Fortunately, Marco Costantini and Willem de
Graaf have written such an interface. Here is how to get in working
under OS X : One has to download two files from the Singular Mac OS X download page :
Singular-2-0-4-ppcMac-darwin.tar.gz
and
Singular-2-0-4-share.tar.gz. Once they are on your desktop you
can follow the instructions on the INSTALL.html file in the 2-0-4
Folder of the expanded Singular-2-0-4-ppcMac-darwin. Keep the
tarred version and open the INSTALL-file in your browser (to be
able to copy and paste) and open up the Terminal. Do the analog
thing to

cd /usr/local sudo tar -pxf
/Users/lieven/Desktop/Singular-2-0-4-ppcMac-darwin.tar sudo tar -pxf
/Users/lieven/Desktop/Singular-2-0-4-share.tar

Then
follow the instructions making the symbolic links and you have Singular
working. The next step is to go to the GAP Packages page and go to the
package Singular for full documentation.
To use Singular in a GAP-session, here is an example

gap>
LoadPackage("singular"); 
The GAP interface to Singular 
true 
gap> StartSingular();
I  Started Singular (version 2004) 
gap> SetInfoLevel( InfoSingular, 2 ); 
gap> G:= SymmetricGroup( 3 );; 
gap> R:= PolynomialRing( GF(2), 3 );; 
gap> GeneratorsOfInvariantRing( R, G ); 
[ x_1 x_2 x_3, x_1*x_2 x_1*x_3 x_2*x_3, x_1*x_2*x_3 ] 
gap> I:= Ideal( R, last );; 
gap>GroebnerBasis( I );
I  running GroebnerBasis... I  done
GroebnerBasis. [ x_1 x_2 x_3, x_2^2 x_2*x_3 x_3^2, x_3^3 ] 
gap>
 
Leave a Comment

GAP on OS X


GAP the Groups, Algorithms, and Programming-tool
(developed by two groups, one in St. Andrews, the other in Aachen) is
the package if you want to work with (finite or finitely
presented) groups, but it has also some routines for algebras, fields,
division algebras, Lie algebras and the like. For years now it is
available on MacClassic but since the last clean install of my
computer I removed it as I was waiting for a Mac OS X-port to be
distributed soon. From time to time I checked the webpage at gap-system.org
but it seems that no one cared for OS X. For my “The book of
points”
-project I need a system to make lots of examples so perhaps
one could just as well install the UNIX-version. Fortunately, I did a
last desperate Google on GAP OS X which brought me to the
Aachen-pages of the GAP-group where one seems to be more Macintosh
minded. The relevant page is the further notes for OS X on the
GAP-installation for UNIX-page. Here is what I did to get GAP running
under OS X. First go to the download page (btw. this page has
version 4.4 whereas St-Andrews is still distributing 4.3) and download
the
files

gap4r4.tar.gz,packages-2004_01_27-11_37_UTC.tar.gz,xtom1r1.tar
.gz

This will give you three tar-files on your Desktop. Fire
up the Terminal and make a new directory /usr/local/lib if
it doesn’t exist yet. Then, go to your Desktop folder and do

sudo
cp gap4r4.tar /usr/local/lib sudo cp xtom1r1.tar /usr/local/lib cd
/usr/local/lib sudo tar xvf gap4r4.tar sudo tar xvf
xtom1r1.tar

Then return to your Desktop Folder and copy the
remaining tar-file in the /usr/local/lib/gap4r4/pkg-folder which
is created by untarring the former two files and untar it as above.
Then, it is time to compile everything (assuming you have installed the
Developer’s tools) and there is one magic OS X-command which will
speedup GAP by 20%. Here is what to do

cd
/usr/local/lib/gap4r4 sudo ./configure sudo make COPTS="-fast
-mcpu=7450"

and everything will compile nicely. If you
are so lucky as to have a G5-system, you should replace the last command
by sudo make COPTS=”-03″. Finally, get everything in the right
place

cd /usr/local/lib/gap4r4/bin sudo cp gap.sh
/usr/local/bin/gap

and if /usr/local/bin is in
your $PATH then typing gap at the command line will give
you the opening GAP-banner :

Leave a Comment