Infopath 2003 – how to regen your sampledata and template files

BronwenWeeGo.jpgIf you’ve modified your form.xsd file and want to get those nodes into your template and sample data files in Infopath 2003…best way i’ve found is:

1. Only works on mandatory items (so you can always make sure the item is mandatory (usage min 1) first and change it back afterwards)

 2. Open your form

3. Choose any control that’s already bound that has a default value e.g. a text box

 4. Choose Properties

5. Alter the default value, and change it back.

The files should be regenerated.  Stops you getting the unbound control errors and having to manually re-create the nodes.

Finding Version of SQL Server

BronwenWeeGo.jpgAlways forget what number is what version of SQL Server so here’s list of the ones I commonly run into

SELECT SERVERPROPERTY(‘ProductLevel’)
GO

or
 
SELECT @@VERSION
GO

SQL 2005

Release 9.00.1399.06
SP1 9.00.2047
Hotfix918222 9.00.2153
SP2 9.00.3042

SQL 2000

release 8.00.194
sp1 8.00.384
sp2 8.00.534
sp3/3a 8.0.760
sp4 8.00.2039

 

Tech.Ed – Some pics

BronwenWeeGo.jpgI didn’t take my 350D to Tech.Ed with me cause I didn’t feel like lugging my camera equipment around with me, so we took the old 2 MP Canon IXUS.  Unfortunatly i couldn’t find the charger before we left, so only got to take 1 photo with it.  We got our pici taken with my M/soft buddy Frank.

Techedus.jpg

After a long search we finally found our names on the wall, so then i believed that it was really made up of participant names.  Before that, there were a lot of tech.john, tech.david etc that coulda just been made up.  The likelyhood of Tech.John, Tech.Bronwen and Tech.Rod appearing in that order randomly is pretty slight.  Unfortunatly, we found it so late and by the time we found a camera to take a pic with, the security guy wouldn’t let us back in to take a quick photo, so no proof to show

To prove we were actually there, we’ve got our personalised Tech.Ed shirts with our names embroidered on it

techedus_small.jpg

So now that I’m home I had a chance to lay out all the freebies I got.  I have: 1 tec.ed backpack, dev garten shirt, dev garten bracelet, tec.ed shirt, 7 pens, 4 fling things, forefront shirt, forefront cap, travel mug, mini footy, calico bag, mouse pad, headphones with retractable chord, radio, some sock type thing, squishy pill, squishy lightbulb, squishy lego blocks (very cool), squishy throwing thing, intel blowup thing

techedhaul_small.jpg

I entered every competition possible (and signed up for a lifetime of spam), but as with my luck, didn’t win a thing.

Tech.Ed day 1 – the downside of being in the minority…

BronwenWeeGo.jpgWe got up bright and early and headed off to the exhibition centre.  Picked up our Tech.Ed bag, and our ticket for our free shirt.  Love the bag, and love the touch of having your name on the shirt.

Opening keynote was really cool.  Cultural anthropologist talking about her experience with using beta’s on REAL people.  She was awesome, and learnt some new words..Digital Immigrant and Digital Native.

Ran into a few people I know, so hello to Phillip, Pagey, Joe, Smiffy, Daniel, Joel, Geoff, Rod, Zac, Frank, Chuck and anyone else i forgot.  It’s quite a sight to see 2000 of the exact same backpack wandering around.

Mental note for the future…if you’re a girl and you forget your in the 4% of the populatation at a conference, it’s MUCH harder to double dip on the free stuff…ppl seem to remember me…no fair.

Day 1 was pretty good.  We’d planned to do some exercise and play tennis at the hotel, we brought our rackets, tennis balls and even had 4 players, but who woulda guessed that you have to book the stupid court, and that you can book it for 2 hrs!  So that planned failed, we wandered back to Tech.Ed and played on the xboxes and ran into a few other people.

Tech.Ed – the arrival

BronwenWeeGo.jpgWe musta picked a good time to fly outta Brisbane (or maybe it was just cause it was a Tuesday)  but we made great time to the airport, plane wasn’t too crowded and got a cab pretty quick.  Got to the hotel, and realised we were in a different class of hotel straight away, when they take your bags outta the cab for you and take them up to your room.

All was fine till we discover that we’re in a double instead of a queen so we made the sacrifice and moved to the harbour view room to get a queen, but had to handle the smoking room.  So off we went to woolies to get stuff we forgot and some serious room deodoriser.   Hotel was very full of people with Tech.Ed bags so we knew we were in the right spot.

Off to Tech Ed

BronwenWeeGo.jpg We’re off to Tech Ed in Sydney tomorrow afternoon, for 3 jam-packed days of information overload.  So probably no news from us till next week.  Hope to catch up with quite a few people in the next fews days.  Looking forward to it.  See a few of you there.

List T.Find

BronwenWeeGo.jpgWhen i started using the finder in the new generic lists I couldn’t find a good e.g of how to write the find function.  So here’s a cut down version of one that i ended up writing.

First I needed a class that could work out if a supplied item was equal to something in my list e.g.


using System;
using System.Collections.Generic;
using System.Text
namespace SoulSolutions.Test
{
    /// 
    /// Provides generic functionality to find an object in collection.
    /// 
    public class FindObject
    {
        private int id;
        
        /// 
        /// Constructor
        /// 
        /// The unique identifier for the object.
        public FindObject(int id)
        {
            this.id = id;
        }
        
        /// 
        /// Predicate to use to find a item in a list based on the 
        /// id
        /// 
        /// The object to compare to
        /// true if found/false otherwise
        public bool FindByIdPredicate(PersonObject objectData)
        {
            return objectData.ItemId == id;
        }
    }
}

Then to use it:

Need to create my FindObject class giving it the value i’m looking for.  Then using the list that i want to search, call the find giving it the findobject class with the function that i want to use to find.


List items;
FindObject objectToFind = new FindObject(2);
PersonObject person = items.Find(new Predicate(objectToFind.FindByIdPredicate));

Top 5 “features” of Infopath 2003 that annoy me

BronwenWeeGo.jpg So I’ve been using InfoPath as a development tool for a couple of months now.  So here’s the top 5 things that annoy me about infopath 2003, or that i haven’t found an easy answer for.

1. Regeneration of template/sampledata.xml – If you add new nodes into your form xsd file there’s no easy way to get them added to your template.xml or your sampledata.xml.  The only sure way to ensure they’re there is to add them manually which of course if very tedioius.

2. No common rule definiton -if you use the same rule on more than 1 control on the infopath form, you have to create it from scratch (unless you know how to hack the manifest file).

3. No Common Controls – If you use the same combination of controls (e.g. Suburb ddl, state ddl and postcode text box) in a lot of places, no easy way just to make it a common control.

4. No section footers –   As it’s very Word like, you’d expect it to behave like Word.  There’s no way to have a page header/footer on a section, only for the whole of the document.

5. No batch publishing – Doesn’t seem to be an easy way to publish a bunch of forms to  a web server in a batch (or using a batch file to publish)

Infopath error that always sends me on a wild goose-chase

BronwenWeeGo.jpg Every now and then I get an error when running an infopath form talking about trying to load duplicate assemblies.  This one always gets me…i clean up my manifest, look at my form xsd, template and sample data to see what i’ve changed.  Eventually I find it…the Microsoft.Office.Interop.Infopath.SemiTrust.dll reference must be set to Copy Local = false.

If this is set to true, it will sometimes give you a build error (with no error message of course), rather than the runtime error.

Clustering a million points on Virtual Earth using AJAX and .Net

johnWeeGo.jpgSo you have a million houses, festivals or gnomes you want to display on VE, but when you display them all at once it is messy and slow. Why not try clustering them?

Without clusters

With clusters

Basically the issue is when you have large number of pins to put on the VE map two problems occur.

1. If you go and add them all it is going to slow down to a crawl or timeout.

2. If you have pins at a close proximity at certain zoom levels they are going to sit on top of each other and be completely unusable.

Read the article

Running ASP1.1 and 2.0 on the same server

BronwenWeeGo.jpgIn our rush to deploy our new site we hit the problem of how to run ASP 1.1 and ASP 2.0 sites on the same web server.  Of course, at first we got a “Server Is Unavailable” error and quickly discovered in the event log that it didn’t like running both in the same app pool.  So just had to add a new app pool and assign our new website to run in there.  Quite logical really, but thought i’d better write it down, cause i’m bound to forget that in the future and do the whole “I fixed this the other week…what was it again” thing.

Disappointed with the Census questions

BronwenWeeGo.jpg I must say I was disappointed in the variety of questions asked in the census.  Wasn’t feeling like the census wasn’t really aimed at me. 

There was one question about transport and that only related to how you get to work and maybe could count the question about the number of vehicles at the house.  There was one question about internet access, and they lumped all the “broadband” options into one category.  Was hoping for some more questions around internet speed, VOIP, wireless etc.   However I was asked many questions related to housework, and whether i needed assistance dressing, talking etc and whether i helped anyone else.

Fun with eCensus

BronwenWeeGo.jpgAfter discovering I could complete my census form online, I was happy for both me (I hate filling out forms) and the people who have to read my scrawl.  So I log in and fill out the form and get to about the 2nd last question (think it was the number of bedrooms question) and i mistyped so I used the backspace key  in an attempt to correct it.  Of course this did a page back navigation and effectively locked me out for 1/2 hour.   Luck I’m not supposed to fill it out till tonight or I might have given up and just filled out the paper one!  Wonder how many people will make the same mistake as me?

Rounding fun – Banker’s rounding gets me again

BronwenWeeGo.jpgA little suprise you may run into with .NET (particularly if your dealing with monetary amounts) is that the .NET rounding uses roundng-to-nearest (bankers rounding). This rounds off to the nearest even number. For example:

5.15 -> 5.2
5.25 -> 5.2
5.35 -> 5.4
5.45 -> 5.4

Normal arithmetic rounding would result in:

5.15 -> 5.2
5.25 -> 5.3
5.35 -> 5.4
5.45 -> 5.5

Although the .NET bankers rounding is more accurate overall (arithmetic can introduce a slight bias), most people expect arithmetic rounding. The following code performs arithmetic rouding in C#:

Code:

      /// <summary>
      /// Arithmetic rounding routine for decimals.
      /// </summary>
      /// <remarks>
      /// The normal .NET rounding uses ‘bankers rounding’. When this
      /// encounters a tipping point, it rounds to the nearest even number.
      /// This rountine implements the more conventional rounding, rounding
      /// up on 5 or above, or down otherwise.
      /// </remarks>
      /// <param name=”d”>The number to round.</param>
      /// <param name=”decimals”>Number of decimal places to round to.</param>
      /// <returns>The rounded number.</returns>
      public static decimal ArithmeticRound (decimal d, int decimals)
      {
         decimal power = (decimal)Math.Pow(10, decimals);
         // Note: converting to positive number before calculating
         // rounding, so that we don’t need separate logic for negative
         // number handling
         decimal result = decimal.Floor((Math.Abs(d) * power) + 0.5m) / power;
         return result * Math.Sign(d);
      }
 

For additional information, see:

http://bloggingabout.net/blogs/joshua/archive/2005/06/15/6556.aspx
http://support.microsoft.com/?kbid=196652