It Was Only A Matter Of Time

Internet filtering plan may extend to peer-to-peer traffic, says Stephen Conroy.

THE Federal Government’s controversial internet censorship scheme may extend to filter more online traffic than was first thought, Broadband Minister Stephen Conroy revealed today.

In a post on his department’s blog, Senator Conroy today said technology that could filter data sent directly between computers would be tested as part of the upcoming live filtering trial.

Update 24/12/08Internet filter ‘technically impossible’… lets hope so :-)

Getting SharePoint Users In InfoPath 2003

Recently I have been doing some work with SharePoint and InfoPath 2003 and one of my tasks was to get a list of SharePoint users into a drop-down list box in an InfoPath form – sound simple right? Wrong! What should be an easy task is made more complicated due to that fact that the SharePoint web services which return user information do not provide complete definitions of their return types, so InfoPath does not know what it can do with the result.

User / Group information can be retrieved from SharePoint via the UserGroup web service located at http://yourserver/_vti_bin/UserGroup.asmx – the web method I am going to be using is GetUserCollectionFromSite, but of course you can use whichever method you require.

In order to be able to get the information and use it in InfoPath 2003 we are going to need to create a new InfoPath Form Template in Visual Studio 2005. Before we can do this we need to install the Office InfoPath 2003 Toolkit For Visual Studio 2005, which can be found in your MSDN subscription – or alternatively you can download the InfoPath 2003 Toolkit For Visual Studio .NET (2003) although I have not tested this. Once you have installed the toolkit and created a new project you will be presented with a wizard which will guide you through the processes of setting up the project and you can either base the project an existing InfoPath form or create a new one, either is OK.

The first thing to do now is to set up our reference to the SharePoint web service; In InfoPath go to Tools -> Data Connections and click Add. Select Receive data, on the next page select Web Service, and on the following page enter in the URI to your UserGroup web service (E.G. http://yourserver/_vti_bin/UserGroup.asmx). On the next page you should be able to select your desired web methods, in this case we want GetUserCollectionFromSite. You can now enter a name for the data connection, I am just going leave it as the default name “GetUserCollectionFromSite“. Underneath the textbox where you can enter in the name there is a checkbox option “Automatically retrieve data when form is opened“, ensure this is ticked (if you do not tick this you can retrieve the manually retrieve the data later by calling the Query() method on the data connection).

Now that we have a connection the SharePoint we need to create a data connection which we can easily use in SharePoint, which will allow us to bind default values or in this example populate a drop-down list box. To do this we are going to create an XML file containing the same format as the return type of the SharePoint web service. In notepad, or your preferred text editor, enter the following:

Save the file as SiteUsersAndGroups.xml. Back in InfoPath create a new receiving data connection, but this time instead selecting Web service select XML document. On the next page click Resource Files… and click Add… -> select theSiteUsersAndGroups.xml file we just saved earlier and click OK twice. On the next page, once again we are going to leave the data connection name as the default “SiteUsersAndGroups“.

To populate the drop-down list box all we have to do now is double-click on the drop-down list box we want to populate and under List box entreis select the option “Look up values in a data connection to a database, Web service, file or SharePoint library or list“. In the Data Connection drop-down select SiteUsersAndGroups. Next to the Entries textbox click the Select XPath button and select the User node. You can now select the attributes we want to display in the Value and Display name fields (the Display name attribute will be the text presented to the user – typically this should be @Name to display the users name). After saving the form we now need to switch back to Visual Studio in order to transfer the data from the web service data connection to the xml data connection.

In Visual Studio open FormCode.cs – by default there should be two methods and two properties: _Startup(…)_Shutdown()thisXDocument and thisApplication. Although we will not need to use the startup or shutdown methods we will need to use the thisXDocument property.

The first thing we need to do is capture the load event of the InfoPath form. In order to handle InfoPath events methods need to have the InfoPathEventHandler attribute specified. For example our OnLoad event handler is going to look like the following:

To test if the method is being executed a dialog prompt can be triggered by calling thisXDocument.UI.Alert(”Hello World”);. When the InfoPath form loads a standard dialog box should be displayed saying “Hello World“.

Now that we have an entry point for our code we need to read the data returned from the SharePoint web service, stored in the GetUserCollectionFromSite data connection, and copy it into our SiteUsersAndGroups data connection which we are binding to the drop-down list. As all of the data is returned in XML format, as is the case with all InfoPath data sources, we are going to need to use XPath to retrieve the data. The first step is to get an XPathNavigator we can use to perform out XPath query, in order to do this we first need to take the DataObject from thisXDocument and place it into an XmlDocument and from the XmlDocument create a navigator.

If you look back at the xml file we created earlier you will notice that the Users node is under the namespace. Along with this namespace InfoPath data connections are placed under the namespace. In order to access these namespaces in our XPath query we need to create an XmlNamespaceManager.

Our actual XPath query, to get the nodes we are interested in, is going to look similar to the follow:

Now that we have the all of the users (and groups) returned from the SharePoint web service we simply need to load the xml in to the SiteUsersAndGroups data connection as follows:

That’s it! When the form is opened the drop-down list should not be populated with the users and groups from SharePoint. The final class should look similar to the following:

Note: Instead of writing managed code behind the InfoPath form you could write a proxy web service which contains a complete return type in the WSDL, which InfoPath can then use directly; However, note that the SharePoint web services require windows authentication so you will either need to set up a service account to access the web services, or more preferably set up Kerberos to allow authentication to be delegated to your proxy web service.

Incrementing The Project Version Number Using NAnt

The following code depends on getVersion.

The script works simply by getting the current version number and then replacing it with the build number incremented (it assumes you use all four version number sections). It will also replace any other references to the version number in the file, keeping them consistent.

The script could be enhanced using regex trickery to target a specific instance of the version number (e.g. those between AssemblyVersion(”...”) etc), allow for use of only the first few number sections, or be self dependent if desired.

Committing the changes to subversion:

The ${subversion.exe} property should reference your tortoise subversion.exe file. Note: the user account calling the script will be the user account used to submit the file to the subversion repository – this means if you have a build server automating this process the service account must have access to commit changes.

Getting The Project Version Number Using NAnt

Specifying the file containing the global assembly information:

Retrieving the version information:

Usage: ${project.version}

Prior to using the project.version property the getVersion target must be called or the target using the property must be directly or indirectly dependent of the getVersion target.

Note: The previous code applies to C# assembly version information only. A simple alteration of the Regex value will allow the code to work with vb assembly version information.

Adding Custom Toolbar Buttons To VS2008

So you’re a smart cookie and you’ve written yourself some scripts to build your DAL or perhaps to deploy or package for a different environment; However, when you want to run said scripts you have to open up a command window, navigate to working folder and run the scripts. Not only is this a pain and waste of valuable time, it also inevitably results in a taskbar full of command prompt windows! Well there is a quick and easy way to add custom buttons to your Visual Studio 2008 toolbar which will fire off your scripts and display the results in the output window.

The first step is to ensure you have a consistent approach to how your projects are set up in order to run your scripts. After all, you don’t want to have to create a unique toolbar button for every single application you’re developing. One simple approach to this is to create a batch file of the same name (e.g. GenerateDAL.bat) for each application which can then call of to project specific actions. Once you have a consistent pattern to your projects your custom toolbar buttons will become much more useful and save you lots of time.

Steps for creating a custom toolbar button:

  1. In Visual Studio 2008 go to Tools -> External Tools…
  2. Click Add -> (Complete the form)
    Title: (Name of the script e.g. Generate)
    Command: (Location of script e.g. $(SolutionDir)CodeSmithCode.Generate.cmd if your script is in the folder ‘CodeSmith’ of all your project)
    Arguments: (Leave this one empty if you wish)
    Initial directory: (Location of script or the folder level from which you would usually call your script e.g. $(SolutionDir)CodeSmith)
    (Check Use output window to display results in the output window)
  3. Click Ok.
  4. Right-Click on the toolbar -> Click Customize…
  5. Select the Toolbars tab -> Click New -> (Enter a suitable name e.g. Scripts)
  6. Select the Commands tab.
  7. Under Categories scroll down and select Tools -> Under Commands scroll down to External Command 3 (this assumes you only have to default 2 commands in Visual Studio — if you have more than the external command number will match the order of your external commands list)
  8. Drag-and-Drop “External Command 3″ and/or any other external commands you created previously.
  9. Click Close (At this point the button should automatically be renamed to the title of the external command they are linked to).
  10. Drag the new toolbar group to where you want it on the toolbar and enjoy :-)

Must Do: Discover The Natural Beauty At Springbrook

Springbrook is about an hours drive South-West of Surfers Paradise (approximately 2 hours from Brisbane — see map after break for directions) and is lined with luscious green fields and mountains and is renowned for its waterfalls and natural beauty.

From the moment you leave the M1 and pass through the outer suburbs of Advancetown you are presented with a completely different, more relaxed and peaceful, surrounding. Billboard and tall buildings replaced with tall trees and mountains. Houses after house replaced with long fields of green grass, with the occasional house erected amongst the fields.

During my visit it had been a fairly overcast and dismal day (as South East Queensland seems to be often lately), however I was fortunate enough to have had a break in the weather. With the clouds sparingly parting I pushed on with great reward as the sunlight shines through gaps in the cloud, selectively lighting the surround hills, providing spectacular views on a peaceful drive. Unfortunately I did not take the chance to capture this moment on digital film so I’m hoping that will not be the last time such events occur!

Not only is Springbrook good for visiting, it’s also great for passing through. With long windy roads pathing the way, it’s sure to be a joyful drive for any keen travelers or riders. A point of caution: Some of the roads are hilly with sharp corners and as a result are known blackspots.

With plenty to discover in Springbrook and surrounding areas of Binna Burra, Lamington National Park and Natural Bridge this must do will take many full day visits to truly take in all it has to offer. I for one will certainly be revisiting the area on a number of future occasions.

See additional photos from Natural Bridge.

Must Do: Pumicestone Passage, Bribie Island

Pumicestone Passage is a narrow channel of shallow sand banks and islands which separate Bribie Island and the mainland. Bribie Island is located approximately an hour and a half’s drive north of Brisbane, Between Redcliffe and the Sunshine Coast (see map after break for directions).

This must do is not particularly one of my favourites; however, Bribie island is home to numerous parks and surf beaches which would make a great day out for those wishing to bring along the family or simply have a seaside picnic and possibly a swim. There are also a few recreational activities readily available throughout the island. The 150 must do campaign website also suggests taking a tour of Pumicestone Passage aboard the Bribie Island Ferry or exploring the passage on a small hire boat.

The few times that I have been to Bribie Island it appears to be a windy area, with an offshore breeze certain to come in and stir things up of an afternoon. Along with the winds, although the actual parks are luscious and green, some of the surrounding rivers are not the most healthy looking or smelling. However, after all is said and done, if you are looking to take the family for a BBQ picnic Bribie Island certainly is a place to investigate.

See additional photos from Pumicestone Passage.

Must Do: Shopping At The Queen Street Mall

Queen Street Mall is Brisbane CBD’s main shopping strip. Boasting over 700 retailers, five major shopping centres, two department stores and four shopping arcades, Queen Street Mall is host to a large array of retail outlets, restaurants, cafes, bars, cinemas, salons, hotels, and the Conrad Treasury Casino. The mall is located in the heart of the city on Queen Street (see map after break) which ensures it is constantly filled with shoppers and diners alike.

Constantly undergoing upgrades, as with the rest of Brisbane, the mall is ever changing. One reason achievement is the refurbishment of the intersecting Albert Street and the underground busway, giving greater access and more modern feel to the mall. The upgrades have also seen the introduction of regular artists playing both ends of the mall on weekends, along with the more traditional buskers performing shows during the week and on weekend at various times.

Working in the city means regular visits to the mall so this must do is not particularly a big feat for me, but for tourists and visitors of Brisbane shopping at Queen Street Mall is a great way to explore what Brisbane has to offer. With plenty to explore on the mall and with the rest of the CBD within walking distance it is a great way to start or end a day exploring Brisbane CBD.

Must Do: Australia Zoo, Beerwah

Australia Zoo is a wildlife conservation located approximately an hour and a half north of Brisbane, in Beerwah on the Sunshine Coast (see map after the break for directions). It is was the home of the Australian Crocodile Hunter, Steve Irwin, and is now run by Terri Irwin. One of the first things that you will notice about the zoo is it’s size. Currently situated on over sixty acres of land, you will have plenty of places to explore throughout the entire day.

Entry fee is $53 per adult and $31 per child or alternatively a family of four (two adults and two children) pass can be purchased for $157, saving you $11 on entry fees. In my case I was lucky enough to obtain free entry due to failing EFTPOS machines :-)

One thing to note about is the car park. There are two car parks; a small one at the front and larger one at the rear. Due to the fact that only the small car park is visible from the main road, and is always full, it may deter some people from visiting. However rest assure there is a much larger car park just beyond the front car park, with lots of parking and still only a very short walk from the main entrance.

Along with all the traditional zoo displays there are three main Exhibitions at Australia Zoo: Tiger Temple, Elephantasia and The Crocoseum. The Crocoseum is the main stage, capable of seating 5,000, and is used for live animal shows and special performances such as Bindi and The Crocmen.

Continue reading “Must Do: Australia Zoo, Beerwah”