Showing posts with label source control. Show all posts
Showing posts with label source control. Show all posts

Sunday, September 23, 2012

Conflicts and setbacks


So, ran into a few challenges recently.

I have mentioned that I work at Microsoft, but here it becomes relevant that I specifically work on the Windows Phone marketplace: the experience you have when you install an app as a user. As part of my job, I was involved in investigating and diagnosing <a href="http://windowsteamblog.com/windows_phone/b/windowsphone/archive/2012/08/14/can-t-download-an-app-here-s-why.aspx">the recent problem installing app updates</a>, and I also know the team involved in managing app certification, so I was well aware of the subsequent <a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2012/08/14/app-publishing-temporarily-on-hold.aspx">delays in app publishing</a>.

This was pretty inconvenient for me personally, as I submitted the PAX Digital Assistant update for Prime to the marketplace only the day before certification was temporarily halted. I waited for my app to make its way through certification once everything resumed, and kept waiting. I checked at work and knew there were major delays catching up with the queue of apps that had built up, and so it wasn't unbelievable that mine hadn't made it through yet. I knew that I could contact the guys who ran the process and have my app fast tracked, but I couldn't decide if that was reasonable or not. In hindsight, I think it would have been: I had a good justification with the event actually happening, and other developers do contact a developer evangelist for similar deadlines. However I decided that it felt a little unfair to use my internal position like that, so I didn't do anything, and my app didn't make it through publishing until September 6, well after the useful moment had passed. Now I feel like I inconvenienced a bunch of people and made myself look flaky and unreliable, all for no good reason. Damn.

On the worse side, four days before PAX my apartment was flooded by a burst pipe, and my laptop was destroyed. As detailed in my last post, I did have a remote backup for the PAX app - but I hadn't done incremental uploads to the server of the last couple days of work I'd done before finishing it for Prime, so that work is now gone forever. The Flashcard app I'd created is also completely gone, as I hadn't bothered backing it up to the server at all (not a huge loss, but a foolish mistake). Could have been worse, of course: a month earlier the entire PAX app was stored only on my local machine and would have been gone. But could have been better as well. I need to make the incremental backup to the server as easy as the local incremental backup.

Sunday, August 5, 2012

Success: a 7.1 app backed up on a remote server!


I've spent a bit of time now trying to get the upgraded 7.1 version working, however the app crashes on loading the schedule pivot page containing the jumplist.  I decided to try and put a plain list of the items in order to get a functioning 7.1 app - but  found that the crash wasn't caused by the telerik controls at all.

I tried to get the minimal list going with this:
        <controls:Pivot
           
 x:Name="schedulePivot"
           
 HeaderTemplate="{StaticResource pivotTitleTemplate}">
            <controls:PivotItem>
                <ListBox
                   
 ItemsSource="{Binding events}"
                   
 ItemTemplate="{StaticResource eventTemplate}">
                </ListBox>
            </controls:PivotItem> (line 64)
        </controls:Pivot>

I got this XAML parse error: AG_E_UNKNOWN_ERROR [Line: 64 Position: 34]


        <controls:Pivot
           
 x:Name="schedulePivot"
           
 HeaderTemplate="{StaticResource pivotTitleTemplate}">
            <controls:PivotItem>
                <TextBlock Text="hello" />
            </controls:PivotItem> (line 61)
        </controls:Pivot>

Gives me the same error on line 61, so it isn't about the lists at all.

It turns out I got this error as soon as I add any PivotItem to the pivot, even an empty one.

Ok...looked into the exception stack trace and it included this detail:


            at System.Windows.UIElement.UpdateLayout()
            at Microsoft.Phone.Controls.Pivot.OnItemsChanged(NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemCollection.NotifyCollectionChanged(NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemCollection.NotifyCollectionReady()
            at System.Windows.Controls.ItemsControl.NotifyAllItemsAdded(IntPtr nativeItemsControl)
            at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr)
            at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString)
            at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
            at PAX7.View.SchedulePivotView.InitializeComponent()
            at PAX7.View.SchedulePivotView.OnNavigatedTo(NavigationEventArgs e)
            at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)

So I thought perhaps the exception was something to do with the pivotitems I was creating not working with the data I'm assigning to it? I removed the PivotItems and set DataTemplates on the Pivot itself, like this:


        <controls:Pivot x:Name="schedulePivot"
                       
 HeaderTemplate="{StaticResource pivotTitleTemplate}"
                       
 ItemTemplate="{StaticResource pivotListTemplate}">
                        
        </controls:Pivot>

Referring to existing templates like this:
        <DataTemplate x:Key="pivotListTemplate">
            <ListBox
               
 ItemsSource="{Binding events}"
               
 ItemTemplate="{StaticResource eventTemplate}">
            </ListBox>
        </DataTemplate>

Magic! Finally I have a working app built on the 7.1 SDK :) Obviously I committed it straight away. Then I remembered that I hadn't got a backup on a separate machine yet, so I googled remote repository hg nearlyfreespeech, and found this awesome page:

Before sending it up to my new remote repository,  I thought I'd make sure it wasn't including all my generated files. I found a couple relevant Stack Overflow questions  (e.g. http://stackoverflow.com/questions/3426231/mercurial-hgignore-some-questions-on-how-to-ignore-a-single-file) that led me to the help page (http://www.selenic.com/mercurial/hgignore.5.html). Although when I look at 'all files' in the repository it doesn't list the bin/obj directories now, when I ran the clone it still did because it was looking at the history of the repository, which obviously still mentioned them.

Then cloning failed anyway with an 'invalid argument' error. Google told me there was a known issue with clone/push/pull of large filesets on windows? Lame! (http://mercurial.808500.n3.nabble.com/TortoiseHG-Large-File-Commit-only-40Meg-is-size-td2140178.html) 
So I tried creating a bundle of just the latest revision (http://tortoisehg.bitbucket.org/manual/0.9/changelog.html#revision-context-menus) and cloning it, but tortoise just went ahead and tried creating a stupid huge bundle again when I hit clone, instead of pulling from the bundle. So I turned on the server option, but couldn't figure out what the url should be - when I tried hg pull <url listed in serve ui> I got an error that the hostname wasn't recognised.
I uploaded the bundle I'd created through ssh, and tried pulling from it locally (inspired by http://weblogs.java.net/blog/kohsuke/archive/2007/08/mercurial_trans.html) but got an error that the parent wasn't recognised. However import/export also didn't work, saying it couldn't find files to patch. So I created a backup bundle as listed here (http://www.southampton.ac.uk/~fangohr/computing/hg.html#use-mercurial-without-access-to-server-using-bundles) and copied that to the server, pulled from that and finally had a repository. Done!

I think the whole rigmarole indicates that I don't have a strong enough grasp on how hg is supposed to work.  Let's see how it goes when I try and just copy over a changeset...

Saturday, July 21, 2012

Source control/backup and testing.

So for most of my projects I have a Mercurial repository for version control (totally saved my ass when I found a bug in the submitted version of Pax while halfway through unsuccessfully updating the code to 7.1), but no backup. I thought about setting up remote repositories (I have hosting with Nearly Free Speech), but I also remembered that GitHub had recently released their Windows client. I was unable to download/install the client over the coffeeshop wifi so had to set that up at home later - now you can see the code at https://github.com/jacalata/FlashCards. If that works nicely I'll put my Pax code up there as well.

I have created a test project for my Pax app in the past, but...a long time in the past. So I found this guide (http://blogs.msdn.com/b/amit_chatterjee/archive/2011/06/26/unit-testing-the-windows-phone-7-applications.aspx) as a reminder, and also found that the dll's I had were all 7.0 projects, so updated them. Added the first couple of unit tests, more to go.  Does feel better knowing I have a test framework though :)