Showing posts with label Azure. Show all posts
Showing posts with label Azure. Show all posts

Saturday, November 29, 2014

Deploy to Azure button, WOW!

Deploy to Azure Button

Every now and then some technology, technique, product or whatever comes along that makes you open your eyes wide open and drop your jaw.

A few days ago Microsoft released the Deploy to Azure button, you can read the original post here, but TL;DR it’s a button you put in the README.md file of your GitHub repository and it would “automagically” deploy your repository to an Azure Web Site.

At first I thought, cool, but I’m sure there’s something they’re not telling you, like what’s the structure I need to have in my repository? do I also need to add my binaries, will they build my solution and deploy the assemblies?

So today I gave it a try. I do have a repository on GitHub which output also run on an Azure WebSite so I thought this would be the perfect test. The project is Azure Storage Explorer, and if you take a look the structure of the repository looks it is just a solution file (.sln) with two folders that are a web site project and a helper library.

github

So I added the button to my README.md file which in my case that meant adding this line to the file:

[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/?repository=https://github.com/sebagomez/azurestorageexplorer)

And that’s it. After I pushed it to GitHub I clicked on the button and this site called azuredeploy.net showed up telling me that my repository was going to published to an Azure Web Site. It let me pick a few config settings like the name of the web site AND THAT WAS IT!

What happened in between? I don’t know, I guess something cloned my repo, found and .sln file and built the solution and then moved everything (?) to a web site? I don’t know what they did, I’m just glad it worked the way it did. I’m not saying it is rocket science, it’s just that it’s nice when you find such a simple solution for a much complicated task to do manually.

Kudos to whoever thought having that button was a good idea!

p.s: I wish we had something like that in Genexus Server. I guess we could…

Read Full Post

Tuesday, June 19, 2012

The @FindMyPlane bot

A few days ago I wrote about the Genexus Challenge developer edition and my first Smart Devices app, Find my Plane. Once I get, what I think is, a good idea in my head I get around it a lot to improve it in every possible way. But this is not the case, sort of.

Right after I deployed the app to the Apple’s app store, I thought “how can I advertise it, without paying for advertising of course”, I needed people to find out about the app and download it, and a good word about it would be awesome too. So I thought about social networks… Facebook is for friends and I already told them to download it (did I mentioned it’s free?!) so twitter came to mind… but what can I do to promote my app from twitter, other than twitting about it of course.

So I thought of the @FindmyPlane bot and this post will tell you how I did it, not that it’s rocket science, but I found an interesting use of Windows Azure’s Worker Roles*. Wait, what?! you’re gonna tell people how to build a twitter spammer bot? No, let me get into that.

The @FindMyPlane twitter account works like this. You send a twit to @FindMyPlane with your flight number and find my plane will answer that tweet with useful info about it, the same kind of info you’d get in the Find My Plane app, but of course, only the info that fits in 140 characters.

So this is how it works. There’s a worker role (called Receiver) that every ten seconds access the twitter api looking for mentions for the @FindMyPlane account. Once it gets the list of tweets (if any of course) it saves them to a Table from Azure Storage and saves the latest tweet id in a Queue (also from Azure Storage) so the next time it just asks from that tweet on.

This is pretty much the code:

string lastTweet = "";
string previousMessageId = "";
foreach (CloudQueueMessage message in Queue.GetAllMessages(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_QUEUE))
{
previousMessageId = message.Id;
lastTweet = message.AsString;
}

bool first = true;
foreach (Status status in Mentions.GetMentions(fmp, lastTweet))
{
try
{
Table.Insert(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_TABLE, TweetEntity.FromStatus(status).ToString());
}
catch { }

if (first)
{
lastTweet = status.Id;
first = false;
}
}

if (!first)
{
Queue.DeleteMessage(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_QUEUE, previousMessageId);
Queue.CreateMessage(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_QUEUE, lastTweet);
}




And there’s a second Worker Role (called Replier) that every ten seconds queries the table where the tweets were saved for those that have not been replied yet and don’t have errors. For every tweet I try to get info of the flight number sent, if I do find info, I reply the tweet with that info and update the record on the table as replied. If I can’t find info, let’s say you tweeted “@FindMyPlane is awesome!” I update the record as ‘with errors’. This is just a way for me to know when I couldn’t reply because of an error on the system or because what I got was not a valid flight number.



Code here:



string query = "Replied eq 'False' and Error eq 'False'";
foreach (TableEntity entity in Table.Query(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_TABLE, query))
{
string flightNumber = entity["Text"].ToUpper().Replace("@FINDMYPLANE ", "");
try
{
FlightInfo info = FlightStatus.GetFlightStatus(flightNumber);
string tweet = string.Format("@{0} {1}", entity["UserScreenname"], info);
Update.UpdateStatus(tweet, fmp, entity["Id"]);
entity["Replied"] = "True";

Table.UpdateEntity(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_TABLE, entity);
}
catch
{
try
{
entity["Error"] = "True";
Table.UpdateEntity(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_TABLE, entity);
}
catch
{
Table.DeleteEntity(Constants.AZURE_STORAGE_ACCOUNT, Constants.AZURE_STORAGE_KEY, Constants.AZURE_TABLE, entity.PartitionKey, entity.RowKey);
}
}
}



Cool uh?!



Here’s how all this works together



image



(*) for a good read on the Azure platform, Worker Roles and Storage (Table, Queues & Blobs) go to: http://bit.ly/SGAzure



You can download the ‘Find my Plane’ for Android and for iPhone.

Read Full Post

Friday, August 06, 2010

Annoy Smarx from Windows Phone 7

Annoy Smarx is a web app that Steve Marx showed in Windows Azure Firestarter event. It is a web app that once you clicked on an image, Steve’s notebook wallpaper would change to the selected image. It was a pretty cool demo cause it showed you a good practical sample of AppFabric ServiceBus.

Last week I started playing around with the new Windows Phone 7 SDK, and I faced the problem I do when I start something new, “what should I code”? I t has to be simple cause I’m new to this stuff (I’m no too familiar with silverlight either) but not too simple… I hate the “Hello World!” sample. So I thought maybe I can create a client for the AnnoySmarx sample and so I did.

I liked it cause it a simple project, yet it has many cool features, like downloading blobs from Azure Storage, using a ListBox to show the images, handling the double tap event on Windows Phone 7 (there’s no OnDoubleTap event, so it might be a little more complicated than you think), and calling a rest service on ServiceBus which is actually running on my computer.

You’ll find all the resources you need at Steve’s post and the code for this client here.

I recorded a video of the app running on the emulator…

pretty cool uh?!


works-on-my-machine-starburst_3_thumb[1]

Read Full Post

Monday, April 19, 2010

My Run 2.0 samples

annoysgomez Last week Run 2.0 took place in Montevideo and I had the privilege of working with Guadalupe Casuso (from Microsoft) and Luis Pandolfi (from Infocorp) on part of the Keynote, we talked about Windows Azure and if you ask me it was too short.

After the keynote I talked to some people who told me the session was great, but most of them already knew about Azure, so I guess I never know how good/clear was for someone new to the Windows Azure Platform (if you’re in this category please send me a line). One thing Guadalupe told us, and I guess she was right, is that there’s no point of showing something you can’t use yet… it’s like showing a kid a candy. I don’t know, but one thing I do know is that we could have use the entire conference to talk about Azure :)

On my part of the session I had to show something on ServiceBus so I showed Steve Marx’s AnnoySmarx sample. I changed a few thing from the listener, one thread would never end unless you close the cmd window, and added a few messages for demoing purposes. The sample is pretty cool cause it let you change the wallpaper of my computer by clicking the images from an online web page (in this case hosted on Windows Azure). For my sample I deployed the web app at http://gomezwallpaper.cloudapp.net/ and people from the audience would get online and click on the images while on the main screen you could see the wallpaper of my notebook changing. I was pretty cool and showed how you can get servicebus up & running with a little extra work from what you do to host regular WCF services.

Another tool I used is Windows Azure Storage Explorer which I built myself to browse and manage items from a Storage Account. I recently uploaded the source code to codeplex, the project is here.

Read Full Post

Tuesday, March 09, 2010

New features to the Azure Web Storage Explorer

storageexplorer
On the first version you could only manage blobs, upload, delete and download them. Now I added the same functionality for Queues and Tables.
I found a pretty cool way of showing unstructured data from the Azure tables from a gridview control. How? with my good old friends the DataSets :)
I also updated the source code so you can download the source files from the version that it’s right now running on the Azure platform.
Go to http://storageexplorer.cloudapp.net/ to see the application running and here to download the source code.
Feedback is always welcome!

Edit: url is now http://azurestorage.azurewebsites.net

Read Full Post

Wednesday, December 16, 2009

Windows Azure Web Storage Explorer

A few days ago I posted about my first useful Azure application, which is hosted on here http://storageexplorer.cloudapp.net http://azurestorage.azurewebsites.net. Today I just wanted to announce I just uploaded the code to a Google Code project called windowsazurewebstorageexplorer :)
It is a good (I think is good) example of both programming for the Windows Azure platform and programming against the Windows Azure Storage client API.
So feel free to download it and let me know what you think. (Make sure you download the Windows Azure tools for Visual Studio 2008 first)
As usual, this code is certified to apply every “works on my machine” standard :)
works-on-my-machine-starburst_3
Note: Too bad the December 2009 Windows Azure-Related Developer Challenges are for US only :(

Read Full Post

Thursday, November 26, 2009

Mi first useful Azure application

Azure I’ve been plying around with Windows Azure for over a year now, I started with the CTP Microsoft showed at PDC 2008 and played with SQL Azure (FKA: SDS) and Windows Azure ever since.
But today I uploaded my first useful application. I’m currently working the on Genexus deployment project which includes being able to deploy Genexus-generated applications to every supported platform (including of course Windows Azure). More on that in a future post.
So, to deploy an application to Windows Azure programmatically, you have to tell Azure where your package is (by its url) so the best choice is to upload you package to the you Azure storage account. But the storage does not have a nice UI, so I thought first on creating an application to actually see what’s in my storage account and then decided to make it a web application, and allow other to use it.
I know, it does not have a great user interface. I’m not good at it, and I didn’t care for it at all for this version. But I’ll promise I’ll add some functionality and improve the user experience.
If you want to check it out go to http://storageexplorer.cloudapp.net http://azurestorage.azurewebsites.net enter your account name and your access key and see what’s in your storage account. (Read only, for now!)
So I’m happy to announce that this application not only “Works on my Machine” but it also does on the Windows Azure platform :)
WorksOnAzure
Edit: now with improved UI :)

Read Full Post

Thursday, September 24, 2009

Great simple explanation on Windows Azure

During the last GeneXus International Meeting held in Montevideo, I had the chance to talk for a few minutes with Steve Marx from the Windows Azure team. Milano and I were telling him what we expect to do with GeneXus and the Windows Azure platform.

The first scenario is having a one-click deployment to the cloud (Windows Azure platform) of the GeneXus generated applications. Since the SQL Azure is now a relational database (good old SQL Server) our reorganization programs can generate the tables in the cloud. Also, our applications are 100% compatible with the Azure environment so you could upload you application to the Azure platform today.

The other scenario is running GeneXus Server from the Azure platform. In this scenario we still have a “little” work to do. So we were asking Steve about the worker roles since we want to be able to specify and generate in the Azure platform and I have doubts about what could actually run in this “cloud”, so Steve explained it to me in a great simple way. He said, imagine I have a Windows Server 2008 installed out of the box with the .net framework 3.5 and all the latest service packs. Everything you could put on a portable USB drive and run from there will run on the Azure platform. He added, everything that needs a setup wizard, writing on the registry, and stuff won’t work.

As I said, great yet simple explanation of what you could run on the Azure platform.

Read Full Post

Friday, September 04, 2009

Microsoft .net Framework 2.0 Configuration missing?

SDKAfter my Windows7 install I needed to modify some of the machine.config properties thru the .net configuration utility and I could find it. It wasn’t where it used to be (Administrative Tools) and even the Snap-in on the MMC was not present.

After a little bit of search I realize I had to install the .net framework 2.0 SDK. I guess I did it a long time ago cause I don’t remember even doing it.

Here are the links.

http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en (32bits)

http://www.microsoft.com/downloads/details.aspx?familyid=1AEF6FCE-6E06-4B66-AFE4-9AAD3C835D3D&displaylang=en (64 bits)

We’re welcome :)

P.S: I needed it in order to deploy a web app to the Azure platform, that’s why I’m tagging this post as “cloud computing” related

Read Full Post