Serialization issues with datetime in infopath to sql2005

BronwenWeeGo.jpgBeen having some “issues” trying to serialize datetime fields from infopath to SQL2005.  The problem lies in the serialization expects a fully qualified datetime value including locale e.g. 2006-09-20T01:56:45+10:00.  However, Infopath, and XML in general doesn’t record the local e.g. 2006-09-20T01:56:45

So after doing some searching i came across the adjust-dateTime-to-timezone function for xsl V2.0.  So to change a datetime to a sql2005 date do the following:

<xsl:value-of select=”adjust-dateTime-to-timezone(ns1:formUpdateDate)“/>

Which works great until you use the .net XslCompiledTransform class.  Unfortunatly it only supports V1.0 so doesn’t recognise the adjust-dateTime-to-timezone.

So my dodge workaround for the moment is to add the timezone onto the end “manually”.  When I work out a better way to do this, i’ll write it up.

Tech.Ed feedback

BronwenWeeGo.jpgThought it’d be easier to put the comments here than make a GIANT comment on Frank’s blog.

Comments on Tech Ed that most come to mind:

Tech Ed

  • The venue – in general it was well layed out and had enough space (apart from some sessions see below)
  •  Overlap in content in sessions.  There was way too much overlap in session with a common theme.  This is ok if you go to one of them..but if you go to a theme you’d almost be better off going to every 2nd session.  For me, the sessions tended to be very high level.
  • Same e.gs – It seemed like every web session and/or virtual earth session showed THE SAME real estate agent site
  • Overcrowding – A lot of rooms were overcrowded where you had to stand or be so squished to the person beside you you end up cramping up
  • The party – hmm..what can i say…a night club full of geeks…not a great venue for the number of people.  Didn’t really enjoy watching people play xbox all night
  •  labs – Labs were good but not enough time to work on them unless you skipped sessions – maybe open early till late for those keen to learn?
  • community project – great in theory – needs to be broken into tasks 1/2 to an hour long so people can contribute more easily.  I was keen to contribute but found it hard to find a task that wasn’t dependant or atomic enough to work on in the time I had spare.
  •  Bar Code Scanners – I’m not a grocery item going through a check out
  • Deep Dives – maybe have more deep dives at the end of tech ed once you know what stuff you’re interested in diving into.  This may satisfy my craving for more than a 1 hour overview of a really big topic.
  • Tech Ed Bags –  Bags were great – even fit a 17″ dell
  • The Food – if you are patient…there was heaps of food.  Maybe need a few more snack areas to nip in between talks
  •  PC’s / internet access  – there were heaps
  • Tech Ed Shirts – love the embroidery
  • Key and Lock Note – both interesting and something different to think about

How to turn off Sticky Keys

BronwenWeeGo.jpgI accidentally turned on sticky keys in XP today.  Which, if you’ve ever done makes it really hard to write code, and especially to search Google to switch off.

To get rid of Sticky Keys press both Shift keys at the same time.

Virtual Earth – Set Pushpins to show default popup onclick

johnWeeGo.jpgIf you have played with Virtual Earth you will have noticed that if you click on a pushpin it actually cancels the mouseover event and your popup ballon doen’t appear. To fix this you need to add an onclick event manully through the DOM and then call the onmouseover event manually, There is a slight difference between browsers to take of also. Check out the solution


var map = null;
var pinID = 1;

function GetMap()
{
    map = new VEMap('myMap');
    map.LoadMap(new VELatLong(47.6, -122.33), 10 ,'h' ,false);

    AddClickablePin(new VELatLong(47.6, -122.33),null,"test","some nice details")
}

function AddClickablePin(location, icon_url, title, details)
{
    var pin = new VEPushpin(pinID, location, icon_url, title, details);
    map.AddPushpin(pin);
    var element = document.getElementById(pinID);
    element.onclick = EventHandlerOnClick;
    pinID++;
}


function EventHandlerOnClick(e)
{
    if (e!=null)
    {
        document.getElementById(e.currentTarget.id + "_" + map.GUID).onmouseover();
    } else
    {
        document.getElementById(window.event.srcElement.id).onmouseover();
    }
}

Custom Pushpin’s Offset in Virtual Earth

johnWeeGo.jpgA little trick for when you add your custom Pushpin in Virtual Earth, if you need to modify the postion of the pin slighty to line up the point of pin or centre of crosshair with the correct pixel you must set a “iconstyle” and do it in css.


//set an iconStyle when adding the pin in js
var x = new VEPushpin(id, location, icon_url, title,
       details, iconStyle, titleStyle, detailsStyle);

/*The css class for the pushpin, use left and top to adjust offset*/
.MyPushpinStyle {position:absolute;left:0px;top:-20px;}

7 to take 33% share in Engin – the future of VOIP

BronwenWeeGo.jpgNoticed this annoncement on ASX today…7 to take 33% in Engin.  We’ve had Engin for awhile now and we love it.  Our phone bill went down from $80/mth to about $13/mth.  We get to use our existing phone, have a real number etc.  We can do cool stuff like see our bill online, block numbers permenantly or for a fixed period of time (great for stopping unwanted persons ringing at dinner).  We’ve gotten about 4 other people onto it (including my olds).

Interesting to see that 7 is investing in it after reading reports that in the US VOIP is dead.

New Polygons in Virtual Earth

johnWeeGo.jpgA nice new feature in Virtual Earth is the addition of polygons. If you have used polylines then with one additional line of code to set the fill colour you can do polygons.


 function DrawPoly(id,points,width,color)         
 {               
    poly = new VEPolygon(id,points);            
    poly.SetOutlineWidth(3);
    poly.SetOutlineColor(color);
    poly.SetFillColor(color);
    map.AddPolygon(poly);                  
 }

polygons.JPG

Media Center + Vista = World’s most expensive dvd player

BronwenWeeGo.jpgSo we downloaded the 2.5 GB Vista RC1 and installed on our DIY media center in the hope it’d fix a few things that annoy us.  Unfortuantly, we now have the world’s most expensive dvd player that only operates using a mouse.  Luckily we installed it on a new RAID 0 setup so we can easily go back to the XP Media Center version (on a completely different HDD) until Vista is released and maybe a few service packs later…

What works:

  • We can play DVD’s
  • We can look at pictures
  • We can play music

What doesn’t work:

  • The remote control
  • Tv tuners

So we can’t watch TV and have to navigate using the wireless mouse.  That’s what we get for being on the bleeding edge.  We originally tried the Beta, and at that point it wouldn’t detect our projector…so it was basically useless, so it was quickly unistalled.  So at least we’ve moved in a forward direction.

 

How angry am I?

BronwenWeeGo.jpg Looks like i’m not as angry as i thought:

 

You Are 44% Angry

 Generally, you are not an angry person.
But you’re easily frustrated and enraged. You have one heck of a temper.
And because of your anger, you tend to feel resentful and even spiteful.
You already know how to quell your anger. You just need to do it more often.

The cost of elections

johnWeeGo.jpgThe amount of resources at our election on saturday got me thinking about how much it costs the tax payers of Australia. Did you know a federal election cost in excess of $100 million?
http://www.aec.gov.au/_content/when/elections/costs.htm

Cost of the 2004 federal election:


EXPENSES                                    $  
Employee Expenses                    36,968,991.45  
Property Expenses                     2,844,248.49  
Election Supplies and Services 
(inc Freight, Election Equipment, 
Call Centre Services, Forms)         13,252,749.19  
Consultancy                             974,587.29  
Travel                                1,123,817.31  
Advertising and Promotion            10,192,979.25  
Computer Services                     2,586,777.87  
Mailing Services                      1,488,254.74  
Printing and Publications             5,540,491.90  
Legal Services                          198,154.73  
Training of Polling Staff                79,465.95  
Other Expenses                           88,193.72  
SUB TOTAL                            75,338,711.89 
Public Funding                       41,926,158.91 
TOTAL EXPENSES                      117,264,870.80 

Elections – still in the dark ages

BronwenWeeGo.jpgIt never ceases to amaze me how manual and error prone the election system is.  Now i know you can check your electoral information on the internet, and they definatly store it in a database cause they sent us a nice mail merge letter with our electorate and locations etc.  but on election day, it’s all paperbased.

So i rock up to one of 10 or so polling booths available to me.  I give my name, no identification.  The nice lady behind the desk opens one of 3 books in this booth (so there must be over 30 books printed for my electorate).  She askes if i’ve already voted, and runs her finger across the page a few times (assuming to make sure she’ll put a tick next to the correct name), hands me a piece of paper and it’s all over.

Nothing need to prove who i am, or stopping people from voting multiple times, or someone making a mistake and checking off the incorrect name.  Not sure about anyone else but this is CRYING out for a computer system.  Maybe not vote online, but at least use a computer to record who has or hasn’t voted.

I don’t even want to imagine the job of collating back all those books to work out who didn’t vote so they can get sent a fine in the mail.  And what happens if they find someone’s name ticked off twice.

With the number of pamplets handed out at each booth, I’m surprised there isn’t some one at the entrance picking up the “used” ones to re-use them, or at least a big paper recycle bin to put them in.

 

Transparency for our Politicians

johnWeeGo.jpgThis weekend all of Queensland will vote for a new state government. The problem is who do we vote for, i don’t know anybody listed in my seat?

How about a website that lists each poly with what they actually did (bills they created) and how they voted on every bill. That way I could see exactly how my local member voted and earnt his/her money (lets list that as well). If i didn’t agree with him/her i could vote for someone else. Maybe all the candidates could also list how they would have voted and what bills they would have put up?

Why is it we live in an information age and yet all we get from the politians is propaganda and slander.

Convert to Decimal Degrees

johnWeeGo.jpgUseful little function and logic to convert to decimal degrees for use with Virtual Earth


private double degreesMinutesSecondsToDecimal(string degminsec)
   {
      //Divide the number of seconds by 60, 28.79 ÷ 60 = 0.5166. 
      //Add the result to the number of minutes, 31 + .47983. 
      //Divide the result by 60, 31.47983 ÷ 60 = 0.52466383. 
      //Now add that to the number degrees, 48 + .52466383. 
      //The result is 48.52466383° 

      double seconds = Double.Parse(degminsec.Substring(degminsec.Length - 4, 4));
      double minutes = Double.Parse(degminsec.Substring(degminsec.Length - 6, 2));
      double degrees = Double.Parse(degminsec.Substring(0, degminsec.Length - 6));

      if (degrees > 0)
      {
          return (((seconds / 100 / 60) + minutes) / 60) + degrees;
      }
      else
      {
          return degrees - (((seconds / 100 / 60) + minutes) / 60);
      }
    }

Namespaces in Javascript

johnWeeGo.jpgWith so much code be written in javascript for modern web2.0 sites it is important to start using namespaces to ensure your code can won’t conflict with other functions and varibles. This is a nice technique that also allows for private varibles and private methods.


var namespacename = function() {
	var private_var;
	function private_method() {
		// do stuff here
	}
	return {
		method_1 : function() {
			// do stuff here
		},
		method_2 : function(something) {
			// do stuff here
		}
	};
}();

Now you can call namespacename.method_1(); or namespacename.method_2(foo); from your page or call private_method(); from within method_1 or method_2.