VB Magic

2012/09/18

Windows Store App (Was Metro) And Shared Files

Filed under: Windows 8, Windows Store App — Tags: , , , — vbmagic @ 6:08 pm

Just a quick post about an issue I came across when trying to develop and app and share the files between my Laptop and Desktop via Dropbox.

I use this method quite successfully for most of my development work, but it seems different for Windows 8 Metro App Store development.

Problem

I build a windows store app on my Desktop and store the resultant solution in my dropbox directory structure. It builds and runs fine. I go to the office and load the application via my laptop. So far it all seems ok. It builds with no issues. But when you run it, you get an Application Failed to start error message. And looking into the exception, it boils down to a COM error:

“Error HRESULT E_FAIL has been returned from a call to a COM component.” err -2147467259

Next I created a similar app on the laptop it built and ran okay and then I loaded the app on my desktop and exactly the same thing happened.

Solution

Hopefully I’ll find out Friday at the Windows 8 DevCamp in London (21st September).

2012/07/31

Argon R1 A new UK developed .NET Gadgeteer Main Board released

Filed under: .Net Micro Framework, Gadgeteer — Tags: , , — vbmagic @ 1:10 pm

Just a quick post about a new Gageteer main board that was developed in the UK by Love Electronics.

Argon R1 Starter Kit

Specifications:

  • Processor: 120Mhz LPC1788 Cortex-M3
  • RAM: 32MB
  • FLASH: 128MB
  • Sockets: 14
  • Size: 92mm x 57mm
  • Weight: 40g

https://www.loveelectronics.co.uk/Blog/24/argon-r1-now-shipping

They also have some modules available:

https://www.loveelectronics.co.uk/categories/97/.net-gadgeteer

2012/07/27

CentOS 6 Azure VM Disk errors

Filed under: Azure, CentOS, VM — Tags: , , , , , — vbmagic @ 2:05 pm

Just a quick post about getting I/O and disk errors on a CentOS 6 VM running in Azure.

I created said VM, did a yum update and then rebooted the VM,

Once it was back up I then started to get lots of I/O errors reported and the file systems were mounted read-only.

After a bit of trial and error plus some web searching I came across this article which had a solution that worked.

http://social.msdn.microsoft.com/Forums/en/WAVirtualMachinesforLinux/thread/0d349334-94ac-478f-b123-cfa970725826

I basically Deleted the VM. Then deleted the Cloud Service associated with the VM. Finally I re-created the VM with the same details from the un-attached disk from the original VM (My Disks part of the Gallery).

Now the file systems are mounted correctly and there are no more IO error messages.

2012/07/19

Taking a IIS pre-generated web service and putting into Azure

Filed under: Azure, Learning, SQL Azure, VB.NET — Tags: , , , , — vbmagic @ 3:11 pm

I had, what I thought, was a simple job to do; but it took over two weeks of discovery to find out it actually was easy, but not quite in the way I was planning to do it.

I had two web services that I needed to host in Azure. For a temporary measure, I create a single Azure instance and this had a simple elevated start up task that installed required run-times and then downloaded 7zip file from Azure storage and then extracted this file.

I then connected to the instance via remote desktop, launched IIS Manager and created the web applications there. I also manually started a back end process.

The next step was to try and automate the deployment of this process using two instances. I moved the required database into SQL Azure which worked fine.

Next I created a new C# Azure project with an ASP.net web role and added the tasks to install the runtime and also looked up the commands required to add the website applications.

I hit a problem that I never really managed to solve where the installation of the C++ 10 runtime would just hang the start-up task. After spending around three days trying to diagnose what had happened I decided to start again from scratch.

I created a new VB Azure project with an ASP.net web role. I added the same task which ran a batch file. This time round the run-times installed with no problem. (I guess I’ll never know what went wrong with that one)

The next part of the script was to download and extract the 7zip archive file. (To download from storage I used the Azure Command Line tools from Rob  Blackwell/Two10 Degrees: https://github.com/RobBlackwell/AzureCommandLineTools)

I then extracted the archive using 7zip command line tools (http://www.7-zip.org/download.html)

It was when I came to run AppCmd.exe to add the extracted web applications, I learned about the order that Tasks etc. are run in Azure. (After a day or so of tracking things down)

The following article helped clarify this a lot. (I’ve borrowed the picture from the article below) http://msdn.microsoft.com/en-us/library/windowsazure/hh127476.aspx

Azure Startup flow chart

Azure Startup flow chart

 

So basically, any start-up tasks would not be able to run scripts that try to modify the website (Like adding the web applications). I abandoned that idea.

Now there is an Elevated Simple task which installs the required run-times and downloads and extracts the files required.

Then there is an Elevated Foreground task which starts the back end process.

All that was left to do was get the web applications (Which were extracted by the Simple Task onto the C: drive)

After a lot more web searching I decided to modify the service definition file for the website and added the virtual applications to this file. (As described in this article: http://msdn.microsoft.com/en-us/library/windowsazure/gg433110.aspx )

I pointed the physical directory to where the application will be extracted to on the C drive of the instance. This caused a build error saying it couldn’t find the directories. I created these directories on the C drive of the machine I was publishing from which allowed the publish to complete.

Unfortunately the deployment got stuck in busy until I deleted it. (Waited a good few hours and tried a couple of times just in case of a “Glitch”).

As a last resort, I extracted the web applications and added the files to the web role’s project folder and then included them into the project. Next I modified the physical directory to a relative directory pointing to the included application directories.

Published and to my great surprise it actually work. Phew!

Took a few weeks but was a great learning process (If a bit frustrating at times 😉 )

Jas

2012/06/24

.Net Micro-Framework and VB.net on Fez Spider…A couple of Gotcha’s

Filed under: .NET, C#, Fez Spider, Gadgeteer, VB.NET — Tags: , , , — vbmagic @ 11:50 am

Hi,

I’m at last coding in VB.net with the .net Microframework thanks to the hard work of the people at GHI converting libraries over to use .netmf 4.2

There are a couple of gotcha’s I’ve come across so far converting my Tyrannt game over to VB.

Firstly there is a small problem with the Auto-generated code for resouces which I expect will be fixed by the time the release comes out of Beta.

Inside the code-behind Resources.Designer.vb

Namespace TyranntVB
    Partial Friend Class Resources
        Private Shared manager As System.Resources.ResourceManager
        Friend Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
            Get
                If (Resources.manager Is Nothing) Then
                    Resources.manager = New System.Resources.ResourceManager("TyranntVB.Resources", GetType(Resources).Assembly)
                End If
                Return Resources.manager
            End Get
        End Property

You’ll notice there is a Namespace being used. This is what is required in C# but not in Visual Basic. If you remove the Namespace commands

Partial Friend Class Resources
    Private Shared manager As System.Resources.ResourceManager
    Friend Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
        Get
            If (Resources.manager Is Nothing) Then
                Resources.manager = New System.Resources.ResourceManager("TyranntVB.Resources", GetType(Resources).Assembly)
            End If
            Return Resources.manager
        End Get
    End Property

Code like this

Resources.GetFont(Resources.FontResources.tyrannt)

Will compile successfully.

Secondly, by default, the project will not know about constants like vbCr and vbLf. I used “\n” quite a bit inside the C# code and when I came to use vbLf the equivalent in VB.net, it caused a compilation error. This is simple to fix. Add the following Imports statement to the top of your code and away you go.

Imports Microsoft.VisualBasic.Constants

I’ll hopefully post again when I have the code ported and running on the Spider.

2012/05/24

A great open source library of plug in’s…

Filed under: Azure — vbmagic @ 2:09 pm

A great open source library of plug-in’s that should hopefully make life easier in Azure to make use of third party software or currently unsupported components like Classic ASP.

Richard's avatarRichard Astbury's Blog

tl;dr

An open source library of plugins installed with a command line tool (a package manager). Once a plugin is installed, it can be easily packaged with an Azure deployment to install application dependencies on a Web or Worker role.

http://richorama.github.com/AzurePluginLibrary/

Watch a screen cast demonstration

Background

One of the key strengths of Windows Azure, is the Platform as a Service offering. Why would you want to patch an operating system, manage the deployment of your application, and check the health of your infrastructure? It’s better left to someone else (Microsoft) so you can focus on your application. However, the pitfall is when your application depends on something extra being installed or configured on the machine.

There are a few ways for installing 3rd party components on an Azure instance. This blog post has a good summary of the options.

In summary, start-up tasks are the best mechanism available for…

View original post 327 more words

2012/04/30

HomeOS

Filed under: .NET — Tags: , — vbmagic @ 10:49 am

I’ve just seen this new concept from Microsoft Research.

http://research.microsoft.com/en-us/projects/homeos/

This type of thing is fascinating to me. Using the .net framework to control equipment/cameras at home. Things like switching the light off after a certain point at night and it turns off the TV/AMP etc. too.

I currently use my NAS to monitor a camera I have at home, but you are limited to what that software allows you to do; with the HomeOS system, you can do what you like as long as you can code it.

I could also create my own “Devices” using the Gadgeteer system and link them into the HomeOS server.

I cannot wait for a CTP to become available for this.

2012/04/20

Free 1 month subscription to Pluralsight Training Course.

Filed under: .NET, ASP.NET MVC, Learning — vbmagic @ 3:28 pm

If you wanted to learn ASP.net MVC with a bit of Entity Framework Code First, HTML 5 and jQuery thrown in Pluralsight are offering a free months subscription to this course:

http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=web-development

All you need to do is follow them on twitter https://twitter.com/#!/pluralsight

And then go to this web page on their web site: http://www.pluralsight-training.net/microsoft/TwitterOffer

And put in your twitter name.

I’ve been a subscriber to their courses for a while now and find them invaluable.

2012/03/30

What’s new in VB11

Filed under: .NET, VB.NET — Tags: , — vbmagic @ 10:57 am

Hi,

Just posting a link to a blog which shows some of the new features of VB in Visual Studio 11

http://blogs.msdn.com/b/lucian/archive/2012/03/29/talk-what-s-new-in-vb11-vs11-beta.aspx

I’ve also added this blog to the blog links to the right.

  • Win8 support
  • VBCore (=> new platform support for VB on Phone, XNA, MicroFramework, Kinect, Surface…)
  • Async
  • CallerMemberInfo
  • Iterators
  • View Call Hierarchy
  • Namespace Global
  • AnyCpu32bitPreferred allows EnC on x64 machines
  • Better codespit and pretty-listing
  • Better performance
  • Better error-reporting for lambdas, and (not yet in VS11beta but will be) no more 102-error-limit for vbc/msbuild
  • Fixed language corners in ForEach, ReturnArrayLiterals, OptionalParameterOverloads, GenericOverloadResolution

The video was recorded at DevConnections2012 in Vegas on 2012.03.26

2012/03/27

atomus – Solution for sharing session data in the Azure Cloud between JBoss/Tomcat instances

Filed under: Azure — Tags: , , , — vbmagic @ 2:48 pm

Another problem I was having was solved using this solution. I needed to share session data for an application in the Azure cloud between multiple JBoss instances. Due to issues where clustering of JBoss was not a viable solution for the application. I came across this solution thanks to a post by Rob Blackwell (Java on the Windows Azure Cloud).

The solution just required a minor configuration change and adding of a few .jar files in JBoss and it just worked. I’ve not tested this with a large scale out of instances but for my purposes it did exactly what I needed.

atomus can be obtained from the following URL.

https://github.com/atomus/TomcatAzureSessionManager

« Newer PostsOlder Posts »

Blog at WordPress.com.