Nov
19
Synergy on OS X – the easy way
Filed Under Computers & Tech, System Administration on November 19, 2005 | 6 Comments
If you have multiple machines on your desk and you are fed up of having a mess of keyboards and mice all over the place then Synergy is just the thing you need. What makes Synergy even better is that it works cross-platform so you can share a single keyboard and mouse between Linux, OS X, any Unix and even crappy old Windows!
To find out more about installing synergy on non-OS X platforms or
about the practicalities of setting up a Synergy server checkout
Synergy’s home page: http://synergy2.sourceforge.net/
The synergy home page allows you to download binaries for OS X but that package literally gives you just the executable file for the server and client and nothing more. If you want Synergy to be easier to use and install on OS X don’t get it from the Synergy website, get Synergy KM instead.
SynergyKM gives you a nice Synergy icon on the Menu Bar to allow you to easily see and change Synergy’s state (see screen first shot below). SynergyKM also adds an extra panel to your System Preferences to allow you to configure Synergy both as a client and a server (see second screen shot).
You can get SynergyKM here: http://software.landryhetu.com/synergy/
Addendum – 24-11-05
For some reason when you are using Synergy to connect your Mac to another keyboard and mouse and you have a hot-corner set up to lock the screen it doesn’t work while Synergy is on. If you turn-off synergy it works fine. for the last week I’ve been turning off Synergy each time I wanted to lock my computer and that’s just not ideal at all so I did some Googling on the matter and found a good solution.
You can get a padlock icon to appear in your Menu Bar and when you click on that one of the options in the menu is "Lock Screen" (see first figure below). This will allow you to lock your screen even while using Synergy. Getting this padlock is a little counter intuative but here goes:
- Open the "Keychain Access" program in your Applications/Utilities folder
- Open the prefferences for this app (Keychain Access -> Preferences)
- I nthe "General" pane check the checkbox labled "Show Status in Menu Bar"
Simple as that!
Nov
3
Could this be a glimpse of a bright future?
Filed Under Computers & Tech on November 3, 2005 | Leave a Comment
I read an article in Yahoo News today from MacCentral that was about a MacMini clone (called the MiniPC) by the Taiwanese computer manufacturer AOpen. At first I thought it was just anther rip off of a good idea by Apple (which it is, the new machine is almost identical to the MacMini in both spec and appearance) but something else caught my eye, honest and transparent pricing!
There are two versions of this tiny PC which have identical hardware but a dramatic difference in price, a Linux version ($399) and a WinXP version ($499). This gives consumers and accurate idea of how much of the price of their PC goes to Microsoft (20% in this case).
In my experience, your average consumer just assumes that Windows ‘comes free’ with their computer because many manufacturers will not sell you a machine without Windows (I have personal experience of both Dell and Fujitsu-Siemens refusing to sell me a PC without Windows). With pricing like that of the new MiniPC that illusion will be shattered and when you combine that with Microsoft’s efforts to make life hard for those using pirated versions of Windows, I think there will be many more people pushed away from Windows.
Hopefully this is the start of a bright new future rather than just a blip on the radar. If other manufacturers start to follow suit ordinary people will, for the first time, start to genuinely consider Linux as a real alternative to Windows.
Oct
27
Nice web forms and not a table in sight!
Filed Under Computers & Tech, Software Development on October 27, 2005 | Leave a Comment
I am well aware that tables for layout are a BAD BAD idea and have stopped using them for such perverted things years ago with just one exception, forms. I started doing my forms in lists because IMO that makes sense but clients were always grumpy when web forms weren’t layed out in the traditional two column way and short of creating a mess of Divs I always ended up falling back to tables for forms. Not anymore! I’ve FINALLY found a nice way of doing forms so that the XHTML is simple, elegant and more importantly, semantically correct while still keeping to a nice two column layout.
Oct
22
Is a CS Degree actually WORTH anything?
Filed Under Computers & Tech on October 22, 2005 | 3 Comments
I got thinking about this after reading an entry on The Daily WTF which described a meeting in which a cocky young graduate was giving a solid old programmer the blame for something that was not his fault. The old programmer printed the raw data his code was receiving to show that the problem was "upstream" of him (with the young graduate's stuff). When the young graduate saw the data he insisted he knew what the problem was, letters were getting mixed in with the numbers by the old programmer. The old hand pointed out that this was called HEX and was a way of presenting binary data. The young graduate refused to believe that and insisted that was rubbish! The fact that someone could graduate from a CS degree without having heard about HEX is bad but what really got me thinking was a reply by a reader who insisted this post was a hoax because it was just not possible to graduate from any CS course anywhere without knowing about HEX. I thought about that for a second and came to the conclusion that I would have no problem believing that there are graduates from my college (NUI Maynooth) out there now who have no idea what HEX is! Read more
Oct
8
Is there any need for the Applet anymore?
Filed Under Computers & Tech, Software Development on October 8, 2005 | Leave a Comment
Now that the worst of the ‘browser wars’ finally seems to be behind us and now that JavaScript can easily communicate with servers to get data without page re-freshes via AJAX one has to wonder if there are any real uses left for applets. My conclusions would be that yes there are still some uses for applets on the web but they are few and far between. Anyone who uses an applet in this day and age should have a bloody good reason to do so because your browser should not have to load a JVM just to view a web page unless that JVM is providing something spectacular that actually adds something to your page and that cannot be done with the core web technologies (XHTML, CSS, JS, AJAX).
Oct
4
The CORRECT way to install Sun Java on Debian/Ubuntu
Filed Under Computers & Tech, System Administration on October 4, 2005 | Leave a Comment
This little guide is just a greatly padded out version of instructions I got from Misha but since we have quite a few Ubuntu users and quite a few Java programmers in MiNDS> this should come in quite useful.
Basically this is the Debian way of installing the Sun JSDK so that it can be managed with dpkg and hence easily upgraded or removed at a later date.
Firstly, since Ubuntu IS a distribution of Debian really I will just refer to Debian in these instructions but the instructions also apply to Ubuntu and in fact it was on Ubuntu that I tested this. Also, these instructions assume that you are logged in as a user who has access to root via sudo.
The way this will work is that we will use a Debian package called java-package to turn the binary Linux installer we get from Sun (or IBM and others too) into a proper Debian package (.deb) and then we will use Debian’s package manager (dpkg) to install that Debian package.
The first step in the process is to install the java-package program that will allow us to create the .deb file. To do this simply type:
sudo apt-get install java-package
If you are asked for a password it is for sudo and you should enter your own login password.
The next step is to go to java.sun.com and download the Linux binary installer for the JSDK that you want to install. DO NOT DOWNLOAD THE LINUX RPM FILE!
The next step is to use java-package to turn this binary file into a Debian package, to do this move into the folder where you downloaded the binary file from java.sun.com.
NOTE, if you are doing this in the college on your machine for your 4th year project you will have to copy the binary file to /tmp and work from there because local root does not have access to your NFS mounted home directory.
For this step you will need fakeroot, if you don’t have it installed install it with apt-get like so:
sudo apt-get install fakeroot
Once you have fakeroot installed and you are in the right directory start the packaging with the command (replacing file_from_sun.bin with the actual name of the file you got from Sun):
fakeroot make-jpkg file_from_sun.bin
This will now appear to run the Sun installer but rather than installing it into your system it is extracting it to a temporary fake root file system and then creating the .deb file from the files in that fake file system. During this stage you will be asked to agree to the Java license agreement.
When the above command completes (will take a few minutes) a .deb file will have been created in your current folder. This is the file that we will now install with dpkg as follows (replacing name_of_deb_file.deb with the actual name of the .deb file created):
sudo dpkg -i name_of_deb_file.deb
And hey presto you are finished, when ever you want to get rid of that JDK all you have to do is (replacing name_of_deb_file_without_The_extension with the name of the generated .deb file but with the .deb extension left out, e.g. sun-j2sdk1.5):
dpkg --purge name_of_deb_file_without_The_extension
You can then install a new JSDK in the same was as described above or just leave your system Java free (heaven knows why you’d do something mad like that!)
Oct
3
The easiest way to turn a Mac into a Mail Server
Filed Under Computers & Tech, System Administration on October 3, 2005 | Leave a Comment
So, you have a mac server running OS X and your boss tells you it needs to act as a mail server too. The HARD way to do things is to compile your own postfix and then manually configure it. If you are a Unix whiz then this will of course be the kind of stuff you do in your sleep but if you’re just a pleb like the rest of us then you will be interested in this neat bit of software.
Using Post Fix Enabler it took me a whopping 30 seconds to get my machine running properly as a mail server (note things were made quite a bit quicker by the fact that I had to use another server as a smarthost). Yes, it costs just under $10 but it is money well spent!
Oct
3
Beating Bugzilla into submission on OS X
Filed Under Computers & Tech, System Administration on | Leave a Comment
I had been warned that Bugzilla was a pain to install but when I read the instructions on their webpage I thought it all looked pretty simple, turns out it WAS a pain to install!
The trouble was caused by two things:
- CPAN modules refusing to build on OS X
- Bugzilla making ridiculous assumptions that just don’t stand up to reality, namely:
- You will always want to use /usr/bin/perl
- sendmail will always be in /usr/lib/sendmail
For details on how I resolved these issues read on.
Firstly, getting Perl to behave itself. The simplest solution to this problem is not to use Perl that comes with OS X but to use DarwinPorts or Fink to get Perl in order. I used DarwinPorts because I have had bad experiences with Fink and really like DarwinPorts. Anyway, it worked like a charm, all the modules I needed were available via DarwinPorts and installed with no issues at all. One thing to note is that this does not patch up the Perl in /usr/bin but rather installs a whole new Perl in /opt/local/bin. One slight annoyance was that to get DBI::MySQL I also had to install a copy of MySQL from DarwinPorts. This is fine because you don’t actually have to USE it, just have it there. As it happens the guys at MySQL have an excellent binary distribution of the MySQL server these days so there is no need to get it from DarwinPorts. I also already had other databases installed and running on my MySQL install so I was in no humor to have a second MySQL server running just for Bugzilla! The one complication here is that the default location for the MySQL socket in the DarwinPorts Perl is the location the DarwinPorts MySQL server uses and not the one the default MySQL server uses. Since I am not using this MySQL I had to tell Bugzilla not to use the default socket but the one I was actually using. You do this by editing localconfig. In my case I had to set the following:
$db_sock = '/private/tmp/mysql.sock';
Now, you can probably imagine how using DarwinPorts’ Perl caused the first of the assumptions made by the Bugzilla installer to break down. The Perl that comes with OS X is at /usr/bin/perl and is used by loads of stuff on the system (so I can’t replace it with a symlink to the right Perl), the Perl from DarwinPorts is at /opt/local/bin/perl. Although I explicitly ran the installer for Bugzilla with this Perl in the hope that it would be smart and realise that it should use that Perl for everything, it still set all the shebang lines to #!/usr/bin/perl and hence although Bugzilla passed the installer’s tests with flying colours, it crashed in a heap when you tried to use it because it went running off to the wrong Perl!
I figured that if the shebang lines were not generated by setting them to the Perl running the installer then there MUST be a configuration option to allow you to specify what Perl should be used. I tried looking really hard but with no joy. I looked on the online documentation, no joy, I tried their mailing list, not even a reply so I took the bull by the horns and wrote my own Perl script to change all the shebang lines for me:
#!/opt/local/bin/perl
use strict;
print "\n\n";
# get the files in the directory
opendir(THISDIR, ".");
my @files = readdir(THISDIR);
closedir(THISDIR);
#loop through the files
foreach my $file (@files){
# skip files that are not cgi files
next unless $file =~ m/\.cgi$/;
print "Processing file: $file\n";
# get the contents
open(CGIFILE, "$file");
my @contents = <CGIFILE>;
close(CGIFILE);
# write it back out but with the correct shebang line
open(CGIFILE, ">$file");
if($contents[0] =~ m/^\#\!/){
print CGIFILE "#!/opt/local/bin/perl\n";
}else{
print CGIFILE $contents[0];
}
for(my $i=1;$i < scalar(@contents); $i++){
print CGIFILE $contents[$i];
}
close(CGIFILE);
}
print "\n\n";
This got Bugzilla up and running and talking ot the DB but desepite the fact that I had sendmail up and running on the server Bugzilla now had a hissy-fit each time you tried to add a bug or do anything that caused it to try to send an email. This is where the second retarded assumption made by the Bugzilla peeps was the culprit. firstly, their error reporting sucks donkey dick and was of no use at all so into the code I dived. After some poking around inside the source tree I figured the problem must lie within Bugzilla/BugMail.pm and sure enough in the last function of that file (line 868 of 876) I found this:
open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i")
Yup, they had hard-coded in the location of sendmail! Again, there is no way to set the location of sendmail in any config file I could find so I had to manually edit this line to look like this:
open(SENDMAIL, "|/usr/sbin/sendmail $sendmailparam -t -i")
Once that was done all was fine and Bugzilla is now working but I really shouldn’t have had to jump through so many hoops to get it working!
Sep
2
String.replaceAll(String, String) wowes
Filed Under Software Development on September 2, 2005 | 9 Comments
When you are dealing with databases one of the most common things you have to do is to escape out all single quotes in text being entered into the DB to stop PostgreSQL/MySQL/*SQL having a cow and to prevent injection attacks.
In most languages this is trivial, take Perl for example
my $sqlText =~ s/'/\\'/g;
Could it be that easy in Java … not on your life!
Aug
18
Controling X11 Focus Follows Mouse – OS X
Filed Under Computers & Tech on August 18, 2005 | 6 Comments
GIMP on OSX comes with a little program to enable X11 Focus Follows Mouse on OSX. This means that all you have to do to focus an X11 Window is to move your mouse over it. Sounds great so I ran the program, turns out it isn’t so great and is in fact REALLY annoying. Does the GIMP ship with a program to turn X11 Focus Follows Mouse off again? Hell no, that would just be far too considerate of them!
However, fear not, some googling lead me to the answer, to turn it off just run the following from your command prompt:
defaults write com.apple.x11 wm_ffm -bool false
No prizes for guessing how to turn it back on or for how to set it for other apps!