Friday, 30 May 2008

Using SVN on your Mac


Svn is pre-installed on leopard, and should already be on your path. The steps that follow setup a repository and test it using Netbeans.

We need to create our repository (local) first,

17864397:dist anujseth$ svnadmin create ~/Desktop/research/SVNRep
17864397:dist anujseth$ ls ~/Desktop/research/SVNRep/
README.txt conf dav db format hooks locks


The above creates our repository named SVNRep in the research folder on the users desktop. We then import our project(s) into this repository.

17864397:dist anujseth$ svn import /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS file:///Users/anujseth/Desktop/research/SVNRep/DFS -m "Initial Import"Adding         /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/ForwardBoundPeerFactory.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/BackwardBoundPeer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/PeerFactory.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/RandomBoundPeer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/ForwardBoundPeer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/OverlayGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/LookupSimulator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/BackwardBoundPeerFactory.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/Peer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/simulator/RandomBoundPeerFactory.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/FileLogger.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/Logger.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/CentralizedGatherer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/CentralizedGathererTest.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/StatisticsGatherer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/logging/LoggerException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/DataGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/Experiment.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/BenchmarkGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/proc
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/proc/VisitConsolidator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/proc/Consolidator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/SingleSetupExperiment.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/SkewedBenchmarkGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/CommandGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/ExperimentalShell.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/BenchmarkException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/benchmark/CommandParser.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/ByteRepresentable.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/HashUtilities.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/RoutingTable.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/Convert.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/netgen
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/netgen/NetworkGenerator.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/AbstractNetObject.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/FileTypeException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DummyDBClient.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DBPeerClientTest.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/LocalDB.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DBPeerTest.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DBPeer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Deletion.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/LinkedPage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DBException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/LayoutManager.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Lookup.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Insertion.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Catalog.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/.old
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/RelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Layout.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/PageAccessException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Command.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Record.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/FileType.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Scan.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/LocalDBServer.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Key.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/Payload.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DBTreePage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DBTreeCursor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DLogicalIDKey.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DExtHashSlottedPage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DBTree.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/OutOfRoomException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/NullCursor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DExtHashFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DBPlusTree.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/Page.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DArrayFileLayout.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DCursor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DArrayFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DHashSlottedPage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DHashFileRelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/OutOfBoundsException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DDynamicHashFileRelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/RequestDispatcher.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DCursorException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DFileException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/LinkedPage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DExtHashFileRelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DBPlusTreeRelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DLinearCursor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DSlottedPage.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DArrayFileRelationDescriptor.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DSlottedFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/NullPayload.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DHashFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/dio/DDynamicHashFile.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/DBNode.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/db/LayoutException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/InsufficientIDsException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/Node.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/LogicalID.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs/NetObjectCache.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs/CacheException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs/NetObjectManagerException.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs/NetObjectManager.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/fs/FileUtilities.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/PhysicalID.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/NOTest.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/framework/NetObject.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/util
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/util/ShutDownThread.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/util/Triplet.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/util/Pair.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/src/peer/util/Args.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/p2p/build.xml
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/toAsk.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/toDo.java
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/cleanup.sh
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/gensetups.sh
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/servers.txt
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/clsetup.sh
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/cleanupall.sh
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/killall.sh
Adding /Users/anujseth/Desktop/coursework/MScDiss/QueryDFS/scripts/go.sh

Committed revision 1.
17864397:dist anujseth$


The "Initial Import" string adds meta information to your action, and can be anything.

You can similarly use command line options to manage your code (checkout etc.) , we're just going to switch to Netbeans directly. All you need to do is go to Versioning -> Subversion, and add the path to your repository and follow the simple GUI instructions, ours in this case is file:///Users/anujseth/Desktop/research/SVNRep.

Infact if you want you can just do step one (create your repository) and directly import your projects from netbeans itself, simply right clicking your project and selecting import into subversion from the versioning menu.

Tuesday, 27 May 2008

Netbeans 6.0 and Mac OS X (part 2)


(This post was originally written circa Dec. 2007)

To fix the dock icon problem mentioned in the previous post and to run Netbeans directly by clicking the dock icon, with the Metal look and feel, you need to edit the netbeans.conf file.
17864397:etc anujseth$ pwd
/Applications/NetBeans/NetBeans 6.0.app/Contents/Resources/NetBeans/etc
17864397:etc anujseth$ ls -l
total 24
-rw-r--r--  1 root  admin   205 26 Nov 17:43 netbeans.clusters
-rw-r--r--  1 root  admin  1093 26 Dec 20:44 netbeans.conf
-rw-r--r--  1 root  admin  1047 26 Dec 20:44 netbeans.conf_orig_jdk_home
17864397:etc anujseth$ sudo vi netbeans.conf
Password:
17864397:etc anujseth$ 

This is what my file looks like after editing.
# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/6.0"
# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
#netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
#---------------------------------
#---------------------------------
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true --laf javax.swing.plaf.metal.MetalLookAndFeel --fontsize 11"
#---------------------------------
#---------------------------------
# (Note that a default -Xmx is selected for you automatically.)
# If you specify the heap size (-Xmx) explicitely, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/wiki/view/FaqGCPauses)
# Default location of JDK, can be overridden by using --jdkhome :
netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"

You basically need to add
--laf javax.swing.plaf.metal.MetalLookAndFeel --fontsize 11

, with whatever font size you want, to the
netbeans_default_options

value. You can similarly use the GTK or Windows look and feels etc.
--laf javax.swing.plaf.metal.MetalLookAndFeel
--laf com.sun.java.swing.plaf.motif.MotifLookAndFeel
--laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel
--laf com.sun.java.swing.plaf.windows.WindowsLookAndFeel
--laf javax.swing.plaf.metal.MetalLookAndFeel -J-Dswing.metalTheme=steel

The last one will give you the original (called Steel) look for the Metal Look and Feel, by default the cross platform Metal Look and Feel uses 'Ocean' (yes! it is mind-numbingly confusing). The windows LAF doesn't seem to work, I'm not sure to be honest but it looks a lot like the ocean one.

Monday, 26 May 2008

Netbeans 6.0 and Mac OS X


(This post was originally written circa Dec. 2007)

Netbeans 6.0 is out, it looks really good, some of the code editor improvements are brilliant (actually I really like the color scheme : ) ). Thats besides the point, there is a major problem that I have with using Netbeans 6.0 on Mac OS X 10.5. The problem is that the menu-bar is just endless and as a result covers most of my stat-counters etc. So, how does one fix it, simple switch to the metal LAF. Some of us, me actually, like the blueish Java metal LAF. So to do this just run netbeans with a few command line parameters, like so,
/Applications/NetBeans/NetBeans\ 6.0.app/Contents/MacOS/netbeans --laf
javax.swing.plaf.metal.MetalLookAndFeel --fontsize 12

This, launches Netbeans 6.0 (provided you have chosen the default installation location) with the metal look and feel, and a font size of 12 (the default is 11). As can be seen in the screenshot, a new dock icon is launched however and I haven't figured out how to link the Netbeans.app one and the one that launches from the using the binary file.

In general, to use the Metal look and feel with your Java applications on Mac OS X, simply launch them with the following command line parameter
-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel

for example,
java -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -jar
/Developer/Examples/Java/JFC/SwingSet2/SwingSet2.jar

launches the swing set example, with the metal look and feel. This of-course cannot be used with the /jdkhome/bin commands, jconsole for example. To change your default settings that is to have applications launch with the Metal LAF by default, you need to edit the swing.properties file.
17864397:~ anujseth$ cd /Library/Java/Home/lib
17864397:lib anujseth$ sudo vi swing.properties

The default is set to Apple's Aqua LAF and can be changed accordingly, for example,
#the java metal LAF
swing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
#apple default setting
#swing.defaultlaf=apple.laf.AquaLookAndFeel

this is what my swing.properties file looks like.

Thats about it, I wrote this because I could not really find any such document on the Metal LAF, ah well maybe I'm the only crazy one who prefers it to all native-ish LAF's. Dare I say, Happy Hacking!, :).