Bookmark this site!

2006-03-23

ant java Shark: XrunShark

You want to use Shark to profile your java code - and you want an ant target that runs your jar file under Shark. You have to call the jvm with the option -XrunShark

Create a new target in your build.xml file

<target name="profile" depends="jar"
        description="Run jar file (no args) with Shark profiler">
     <java jar="${jarfile}" fork="yes" failonerror="true">
         <jvmarg value="-XrunShark"/>
     </java>
</target>

Start Shark, then run
ant profile

Shark is a profiling tool included in the CHUD package. CHUD is an optional install which comes with XCode Tools. The CHUD installer is in the Packages folder, and installs Shark in /Developer/Applications/Performance Tools

2006-03-22

Unison

Unison, courtesy of Benjamin Pierce is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

I have Unison installed using FinkCommander (see my blogitem on Intel port of Fink) - as a by-product this also gives you an installation of ocaml. Unison is an "unstable" packackage installed from source, so to install it you first need to install Apples's XCode and X11 SDK (from the Tiger installation disks) to provide the compilers, headers etc neded to build the application. Then in Fink Commander Preferences select "Use unstable packages" (Fink tab). From the menus run Source>SelfUpdate then Source>UpdateAll. Finally, select the unison package then install from source (click the .h icon).

To use unison to synchronise your mac with your DICE files, run unison from the command-line in an X terminal window using the staff.ssh.inf.ed.ac.uk server. The DICE unison installation may not be the latest, so use 'unison-[version]' to run a matching version on the Mac. (eg unison-2.10.2). Current DICE version is 2.12.0 - this is not included in the Fink package.

Shuly Wintner provides a variety of binary versions with native Mac UI. Get the 2.12.0 version, to match the unison server on DICE - it appears to run fine under rosetta.

2006-03-16

Real Player for OSX Intel

Real Player Universal Binary is now available - build 412.

Note that this version is not mirrored on all download sites (the London UK site hosted by demon still has build 352, PPC only). I used one of the Seattle sites to get 412. You can check which build you have downloaded using get Info (command-I).

Once you've downloaded the correct build and put the put it into your applications folder, quit all web browsers; open the RealPlayer application, go through the setup process, which will install the plugin needed to access RealPlayer content on the web, such as BBC Radio Player.

You can then change Safari to run native — unless you want to view Shockwave content!

In the finder use get Info (command-I) then click "Open using Rosetta".

Since the RealPlayer plugin is compiled to PPC code you have to ensure Safar is run under Rosetta - an application running native Intel code cannot use a PPC plugin.

BBC Radio Player uses RealPlayer, so you need the same trick to run BBC Radio player on an Intel Mac.

2006-03-15

DivX for OSX 10.4 Intel

Since the DivX plugin is compiled to PPC code you have to ensure Quicktime or Safari run under Rosetta - in the finder use get Info (command-I) then click "Open using Rosetta". Update 2006:04:12 The plugin provided by the official release of DivX Player for Macintosh is a Universal binary. You can run it native. Curiosly, the DivX Converter and DivX Player are still PPC. Download the DivX 6 for Mac Installer.pkg
Double-click the installer to install the codec. Restart, and use Quicktime Player or Safari, to watch the latest day's work on the building (around 1.5Mb). You can also see the day at a slower pace (around 170Mb) or a directory of other views.

2005-12-26

ant javac Xlint:unchecked

You are porting your code to Java 5.0 (aka 1.5); building your project under Xcode gives the following notes from javac:

[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
This raises the following question:
Q: How do I pass -Xlint:unchecked to an ant javac task?
A: Edit the relevant target in your build.xml file to add an embedded compilerarg entry, to the javac task:
<compilerarg value="-Xlint:unchecked"/>
or
<compilerarg value="-Xlint"/>
so it reads something like this:
<target name="compile" description="Compile code">
       <mkdir dir="${bin}"/>
       <mkdir dir="${lib}"/>
       <javac srcdir="${src}" destdir="${bin}" 
              includeAntRuntime="no" 
              classpathref="lib.path" 
              debug="${compile.debug}">
           <compilerarg value="-Xlint"/>
       </javac>
</target>
Using "-Xlint" enables all recommended Xlint options, including :unchecked. See the Sun javac documentation (scroll down to Xlint) for details of other options, giving finer control if you need it.

2005-12-09

Installing the University Certificate

The EUCS site gives complex instructions for installing the University Certificate on MacOSX for use with Safari.

Now Apple have made this simple:

  1. Download the Edinburgh CA Certificate.
  2. Open (double-click) the certificate in the finder. This should launch Keychain Access and take you through a dialog to install the certificate.
  3. Install the Certificate in your X509 Anchors keychain.

2004-11-19

Broadcasting using iSight and Quicktime Broadcaster

NB this still seems flakey (ie it works sometimes but not reliably). Use at your own risk...

Preliminaries

These instructions assume you have an iSight camera, and have downloaded and installed Apple's QuickTime Broadcaster. Register to get an account on the University Darwin Streaming Server. You will be given FTP access to pilton.ucs.ed.ac.uk—the reflector which will braodcast your video stream.

Setting up a live broadcast

Plug in the iSight; quit from iChat; launch QuickTime Broadcaster.

Check the IP address for pilton.ucs.ed.ac.uk
(type host pilton.ucs.ed.ac.uk on the unix command line).

In the quicktime broadcaster window, select multicast transmission, and enter the reflector (i.e. pilton) IP 129.215.16.20 for both audio and video address. Don't change the port entries.

Under Audio, enable the audio stream and select the source (probably iSight) and set parameters; under Video enable the video stream, select source (iSight) and parameters. (Note that the University reflector is throttled at 350kbits/sec total for both streams, so 300kbits/sec is about the most you can use for video.)

Now choose File>>Export>>SDP... from the file menu. This produces an sdp file. Save it somewhere convenient (eg. as test.sdp) and then transfer it to the reflector (pilton.ucs.ed.ac.uk) by ftp.

You can save the Broadcast Settings at this point, quit QuickTime Broadcaster, and come back later to give your performance.

Launch Quicktime Broadcaster; Click the broadcast button to go on air, and tell your audience to watch the stream with QuickTime Player (File>>Open URL in New Player...) using a URL like rtsp://pilton.ucs.ed.ac.uk:554/hcs/test.sdp (see your email from ucs which gives details of the URL to your space on pilton). Unfortunately, both Safari and Firefox try and open this URL using Real Player - which doesn't cope with the format.

2004-05-04

sshLogin ssh-agent ssh-add

ssh-agent and ssh-add don't do what you want if run from terminal or xterm.

The excellent application sshLogin carries a GPL licence. This provides ssh-agent ssh-add functionality integrated with Apple's X11. You can even, in effect, install your ssh identity in your Apple keychain.

To install sshLogin:

You have to set up a keychain pair using ssh-keygen before using sshLogin.

2004-04-21

Setting environment variables

There is a special environment file which loginwindow reads each time a user logs in. The environment file is: ~/.MacOSX/environment.plist

Dot files aren't, by default, visible in the finder, so type cd; open .MacOSX in a terminal. If the environment.plist file is there you can open it in the Property List editor with a doubleClick. Otherwise, you will have to create the .MacOSX directory yourself.

To create the directory and file
$ cd
$ mkdir .MacOSX
$ echo "" > .MacOSX/environment.plist
$ open .MacOSX/environment.plist

This should open your new, empty environment.plist file in the Property List Editor. Select Root and Add a Child: the Key should be the name of the variable you want to set; Type should be String; Value should be the value you want to set for this variable. Next time you log in the variables should be set.

Environment variables set in environment.plist also appear in the standard bash environment. You can see all your environment variables using the shell command env from a Terminal window.

REFERENCE: http://developer.apple.com/qa/qa2001/qa1067.html

WARNING: do not set the DISPLAY variable—see my post re. X11 on Leopard.

2004-04-12

No xauth data

The common
Warning: No xauth data; using fake authentication data for X11 forwarding.
appears to be harmless. However, it is annoying. It arises when you have no xauth data!

The command
xauth list
displays all your xauth data. If there is no entry for your local display — which looks something like
localhost/unix:0 MIT-MAGIC-COOKIE-1 026666083d4e480d3e77544949281b49
you can generate one using the command
xauth generate :0 .

This creates an authorization using the MIT-MAGIC-COOKIE-1 protocol. Clients that connect with this authorization will be untrusted.
The period "." is part of the command; "untrusted" is probably what you want.
However, for some operations you need to connect as a trusted client. In case of problems, try using the command
xauth generate :0 . trusted
see man xauth or the X11 Security Extension Specification.

2004-04-01

Printing to DICE printers

You have to be connected inside the DICE firewall (eg. by physical connection, informatics wireless, or ssh) to use the printers ...

On a DICE machine, use the Unix command printers -s to list the available printers, + information on models, printservers, and location. (See man printers for other options.)

Use the Printer Setup Utility (in /Applications/Utilities/ on the Mac) to add a new printer:

IP Printing
Printer type: LPD/LPR
Printer Address: printbp.inf.ed.ac.uk
Queue Name: lwa
Printer Model HP LaserJet 4050 Series

Printer Type
is LPD/LPR
Printer Address
is the address of the server
Queue Name
is the name of the printer
Printer Model
can be left as Generic. However, if you get it right you can access printer-specific options from the OSX print dialogs.

2004-02-02

EUCS VPN and wireless

To use the central 802.11 wireless network (available in,: Raeburn Room, Old College; Hodgson Room, Science & Engineering College Office; Concourse, Appleton Tower, inter alia) and the University VPN, register online with the University Computing Service (EUCS) .

You do not need to download the Cisco VPN client. Once registered, you can connect to the University VPN server, vpngate.net.ed.ac.uk using PPTP with the built-in VPN client (accessible via Internet Connect on MacOSX v10.3 (Panther)).

Once connected via the VPN you can use the staffmail SMTP server: staffmail.inf.ed.ac.uk

2003-01-01

feedback

Please give feedback on this blog by leaving a comment below.

Was the tip you found unclear?
Were you looking for something else?

Let me know!

Thank You

This is a post to say, "thank you" to you, the reader, for your interest, feedback, comments and tips.

If you found this blog helpful, please just click the link at the foot of the post.

For constructive feedback or criticism, add a comment on the relevant post (or for general feedback, on this post).

To submit a tip, mail it to mpfourman-mactip@blogspot.com.