Category Archives: software

Installing Subversion on Windows (Client and Server)

Ok this was painful, so in order to save you some time (and pain) here’s a fairly straight forward step by step guide to get subversion up and running.  It’s only a basic install and doesn’t go into massive detail but should be just enought to get you started.

Just to give you an idea of envionments here and software used:

  • 2 PCs on the same domain, a dev PC and another PC acting as a server (used this just for testing but would be much the same process on Windows Server X).
  • Both PCs running Windows XP SP3.
  • Eclipse 3.3.2 (Europa).
  • Client side subversion Subclipse from Tigris.org and at the time of writing v1.6.17.  This is compatible with old and new versions of Eclipse (except Helios I think).  It will work with Europa, Callisto, Ganymede and Galileo.
  • Server side (also includes a client too but don’t worry about this) is from CollabNet – Subversion Server and Client v1.6.16 – click the download button – you may have to create an account with them, but it’s all free.

 

Client Install

1. In Eclipse go to Find and Install

2. Edit remote site like so:

You need to paste in the link URL:    http://subclipse.tigris.org/update_1.6.x

3. Select Subclipse as sites to update from and click Finish.

4.  If you are using Europa version of Eclipse you may also have to install Mylyn 3.0 before you can install Subclipse.

Server Install

This is just a PC with an IP address of 10.9.65.154.

1.  Download the Collabnet software as described above and double click the exe file to install.  You will see a screen like below – press Next.

2.  Skip past the View Latest Readme screen and Choose Components like below and press Next:

3. For svnserve Configuration I tend to change the Repository Path to something shorter like C:\svn, press Next:

4. For Apache Configuration, again change the Repository path to the shorter C:\svn, press Next.

5. At the Choose Install Location for the Subversion Server, install at the default location, press Next:

6.  The next screen is for Automatic Updates Configuration where you can choose to Enable update notifications for this Collabnet product and enter details if you are behind a proxy server:

 

7. The install will complete and finish with the following screen.  Click finish on the last screen:

8. Start the CollabNet Subversion svnserve service in Services:

9.  Then configure Collabnet Subversion Apache to run as Administrator to the local machine by right clicking, selecting Properties on the service.  Choose the radio button This account and edit the dialog like below, press OK, the start the service:

Create your first repository

1.  Open a command window and create your first repository by typing 

svnadmin create "C:\svn\repository"

2.  Navigate to that newly created directory and edit file svnserve.conf in conf folder.  Remove hash sign (#) with no leading spaces to the following:

anon-access = read
auth-access = write
password-db = passwd

Save the file and close.

3.  Open and edit file passwd.  Again, delete hash sign and add some users of your own if you like (<username> = <password>):

harry = harryssecret
sally = sallyssecret
simonearnshaw = wibble

4.  You can get really fancy and elaborate with users, groups and security.  I’ll leave that up to you, this configuration will just get you started.

5.  As subversion server operates on TCP port 3690 – you need to add this as an exception to the firewall.

Checking in your first project to Subversion from Eclipse

1. Go back to your dev PC, essentially the client.  Open Eclipse and make sure you are in SVN Repository Perspective.

2.  Now add a new SVN Repository to the view.  This relates to the command we issued on the server to create our first repository.  The protocol is svn://, and is followed by the servname or IP address.

3.  Go to your Java EE or Java persepective and right click one of your projects.  Select Team -> Share Project -> SVN -> Next.

4.  The next screen is Share Project with SVN Repository.  As we have already made a repository then we can select Use existing repository location:

5.   Leave the default, Use project name a folder name:

6.  At this point you should add comments – the comment “Initial import” is inserted as default, this is OK for our purpose so just press Finish.

7.  At this point you will be asked for your security credentials that you set up earlier in the Server section.

And that’s it you’re finished.  I hope you found this informative and useful. 

Advertisements

Issues with persisting changes to the scale in PageLayout (LayoutView) using ArcObjects

Scenario

Now and again you may find yourself developing an application outside of ArcMap i.e. essentially an ArcEngine app.

I was developing an application that accessed an mxd via the IMapDocument interface and tried to persist a change in the map scale in the Layout View.  Every time I changed the scale and saved the mxd – however the original scale would not change and the programmatic new scale was ignored!

This was very frustrating indeed, I was sure that there must be a way to persist this change as it’s not exactly NASA missile launch code – I’m just trying to change a scale damn it!

ArcMap Scale

Highlight of the scale control in the layoutview of ArcMap

Solution

Anyway, it so happens that there is a fix, but it’s kind of unusual and not exactly intuitive or obvious to the developer coming at this problem cold.

Firstly we have to make use of some win32 API calls and most importantly to call IActiveView.Activate and pass our call to GetDesktopWindow().  This does the trick and is absolutely essential if you want to get this kind of change persisted.  Take a look at the code below to see how it’s done:

  
[DllImport("User32.dll")]
public static extern int GetDesktopWindow();

private void ChangeMyScale()
{
    IMapDocument MapDoc;
    mapDoc = new MapDocumentClass();
    mapDoc.Open(@"C:\Foo\Bar.mxd",null);
    IPageLayout pageLayout = mapDoc.PageLayout;
    IActiveView activeView = (IActiveView)pageLayout;
    activeView = (IActiveView) mapDoc.PageLayout;
    activeView.Activate(GetDesktopWindow()); //Key line!!
    mapDoc.ActiveView.FocusMap.MapScale = 10000; //Now we can change the scale!!
    activeView.Refresh();

    MessageBox.Show(@"We have an mxd called:" + mapDoc.DocumentFilename +
    "\nExtent: 1 to " + mapDoc.ActiveView.FocusMap.MapScale);

    mapDoc.Save(true, false)
    mapDoc.Close();
}

Other things to bear in mind, code such as:

MapDoc.SetActiveView((IActiveView)pageLayout)

only sets the view for the application as PageLayout, in order to get control of the specified window you have to use the Activate method:

<pre>activeView.Activate(GetDesktopWindow())

When working with the IActiveView interface on a MapDocument object, you should always first call IActiveView::Activate() in order to properly initialize the display of the PageLayout or Map object.

The MxDocument, MapServer objects, MapControl and PageLayoutControl all initialise display objects automatically after opening an MXD, but MapDocument DOES NOT DO THIS, so you should call Activate() before working with any other members of IActiveView.

So to summarise, if your application has a user interface, you should call Activate() with the hWnd of the application’s client area.  If your application runs in the background and has no windows, you retrieve a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.

Conclusion

I am hopeful that ESRI will change this so that you don’t have to, what I view totally unnecessary calls to the Windows API etc.  Maybe it will be fixed properly in version 10 or some other update to that, but I wouldn’t hold your breath!

Anyway I hope it’s useful to you and stops you burning lots of valuable dev time!

Yawho??

Why does anyone use Yahoo anymore other than for webmail and catching some news. Why are Microsoft even bothering trying to buy them out, I don’t get it, there are so many better alternatives to Yahoo!, that are both more of “today”, giving you a more Web 2.0 experience e.g. iGoogle (surprise surprise!). The only thing I can see happening is that Microsoft buy out Yahoo and make it almost the same as how iGoogle operates, because we all know that MS is a bit of magpie of the IT world and nicks other people’s good ideas etc.

Google have basically swatted Yahoo! into relative obscurity in search engine usage, even if Microsoft bought them out and combined their search engines, they would still be lagging behind Google. Don’t get me wrong I’m not really a Google fanboy or anything, but why would you bother using something that’s not all that good when there is better stuff out there. Yahoo is not total rubbish, it’s just a bit passe, and doesn’t really push the envelope or offer anything new.

Google has 59% of US searches, versus about ~20% from Yahoo! (according to searchengine.com). That’s a massive share. Yahoo aren’t helping themselves by charging for POP3 email access, who want’s to pay for web mail when it’s been free from the start – MailPlus from Yahoo woooooooh!, how exciting, yes please take my £12 a year for allowing me to access my email on Outlook and er…. better anti spam technology, allegedly – hmmmm my mouths watering. I know it’s only a pound a month, but I just can’t even be arsed paying them and going through all the payment details. So basically I dumped Yahoo not so long ago (and it would have been sooner if I wasn’t that precious about my email address) – I have a gmail account, it’s free too from 3rd party client software, and all round is much much better. It’s survival of the fittest, and Yahoo is looking a bit haggard!

Ripping DVDs is a consumers right

On the topic of encoding DVDs there is so much ambiguity about what you can legally do, but basically if you live in the UK or US, it’s illegal – nice! But people still rip DVDs and CDs regardless, you can’t throw us all in jail! The way I see it, I bought it, I own it, it’s for my own use, as long as I don’t file share it, what’s the problem? What possible threat am I doing to the poor, strapped for cash, beleaguered film industry? It physically doesn’t affect them in any monetary way, there is no financial hit to them, and that’s what it all boils down to anyway – money. I think the law should be officially changed to stop all this ambiguity as to whether it’s legal or not to encode your own DVDs for private use, especially concerning UK and US residents.

The Tide is Turning!

It’s inevitable, it will only be a matter of time and the laws will be changed to allow you to legally ‘format-shift’ your DVDs to hard disk or whatever format you like. What has started the ball rolling is a landmark case in 2007 – where the DVD Copy Control Association (a body you must get a license from if you intend to decode DVDs and play them in your technology, say if you were a manufacturer of DVD players) lost its breach-of-contract case from Kaleidoscope Systems, a maker of media servers.

Of course, it seems you can’t have a court case ruling without an appeal, and so DVD CCA are trying to overturn the ruling, BUT if they fail it will have huge ramifications – basically, it will mean that consumers will be able to format-shift DVDs – hooray!! Well thats for those in the US, but I expect that will influence legislation in other countries, especially the UK, who seem to follow closely in the steps of US. However format-shifting is happening in countries like Sweden, Germany and New Zealand despite the US stance and in Spain its legal to distribute your own media as well as pirated media, it only gets illegal if you try and do it for profit. Anyway I just hope, from a British standpoint, we don’t have to wait eons before format-shifting is legal here in the UK.

As an aside – why am I so keen on ripping DVDs….

Ripping DVDs is becoming more common because technology has advanced – its dictating how we, the consumer want our media. For the first time we have the power and technology and most importantly the storage capacity to rip DVDs. A couple of years ago this simply wasn’t the case, hard drives were too small and computers were too slow. Today you can have all your films streamed to Windows Media Centre or a PS3 etc, via your home network, and enjoy any of the movies you own, at the click of the button. This takes out the hassle of finding storage for a sizable collection, trying to locate a particular DVD, avoiding damage to the original discs, and lastly an overwhelming smug/warm feeling inside that you have all your film collection neatly stored on disk to access on a moments whim!

Software recommendations for format-shifting

  • DVD Shrink – encodes your DVD to VOB format.
  • Handbrake – converts VOB files to MP4 and loads of other stuff too.
  • PS3 Video 9 – more emphasis on PS3 but can be used for other devices

Also look at Lifehacker blog for some good info on DVD ripping software.