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

Wednesday, December 09, 2009

Great programming quotes!

I recently read on stackoverflow a ton of great programmers quotes I thought it’d be good to share.

Here are some of my favorites.

“Walking on water and developing software from a specification are easy if both are frozen.”

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.”

“Linux is only free if your time has no value”

“Debuggers don't remove bugs. They only show them in slow motion.”

Read the full list here.

Read Full Post

Wednesday, December 02, 2009

How to disable assert dialogs while testing (.net)

Why would you want to do that in the first place? Let’s say you have a complex (long) test you want to run in your application, so you decided to start it before going home so it’ll be ready tomorrow morning with the results. What would happen if when get to you computer the next morning you find an assert dialog waiting for you to “Abort”, “Retry” or “Ignore”? Believe me, it is frustrating and irritable!
I had a few “alternative ways” to ignore those asserts (http://twitpic.com/qvecx) but Willy told me the correct way to do it.
All you have to do is adding the following to your .exe.config file:

<system.diagnostics>
    <assert assertuienabled="false"/>
</system.diagnostics>



That code tells the framework that you don’t want to show a message box when a “Debug.Assert” is called, which is exactly what I wanted.


So, since my test is a msbuild script all I had to do is adding the above “code” in the msbuild.exe.config and now my tests runs smooth and the results are ready, waiting for me :)


More info on the assert tag here.

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

Wednesday, November 11, 2009

Ode to The Ramones

Google just released a new experimental programming language called Go, and they had the brilliant idea on titling their introductory post as The Ramones did with their songs… “Hey! Ho! Let’s Go!” … brilliant :)

Read more about it from the official blog at http://google-opensource.blogspot.com/2009/11/hey-ho-lets-go.html

Listen to the Ramones here:

Read Full Post

Tuesday, October 27, 2009

Internal Error 500 returned by IIS7 hosted WCF services

500 Here's an issue I had for quite a long time.
For some (unknown at the time) reason the server was returning a "500 - Internal Server error" whenever an exception was thrown.
Even the message on the exception was an html document (pasted below), so who was modifying my exceptions? it turned out to be the IIS itself due to some configuration settings.
There's a "feature" which avoids the IIS to send the real exception to the client sending instead a more "friendly" one.
So, how do you change that? (keep in mind this is IIS 7.0 and above)
Take a look at this great post (where I got the solution from) and follow step 2) of "Enable IIS7 detailed errors".

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<
title>500 - Internal server error.</title>
<
style type="text/css">
<!--
body
{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</
head>
<
body>
<
div id="header"><h1>Server Error</h1></div>
<
div id="content">
<
div class="content-container"><fieldset>
<
h2>500 - Internal server error.</h2>
<
h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
</
fieldset></div>
</
div>
</
body>
</
html>

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

Wednesday, September 02, 2009

Genexus X Evolution 1 Released!

GxXEv1

Genexus X Evolution 1 was finally released today at 12:55 (GMT-3). It is a great version with tons of new features and a great stability (check out the release notes here).

To me it’s a big deal since I was really involved in the new Team Development features and the communication with Genexus Server. BTW, GeneXus Server is now on RTM and will be released on the XIX Genexus International Meeting.

Hope to see everybody there.

Next stop, Cardal…

Read Full Post

Sunday, August 30, 2009

Windows 7: Best OS upgrade experience ever!

Windows-7-Upgrade-Chart-Unveiled-2

Despite the known chart, upgrading my notebook to Windows 7 was a great and easy experience. As some of you already know my notebook came with Microsoft Vista installed which I uninstalled after some time of work with it. (here’s my post about that)

Having Windows 7 installed at work I decided to go ahead and install it on my notebook.

Two things surprised me, first of all, the installer gave me the option to upgrade (which is not supported according to the chart). I didn’t take that option since I wanted to have a clean install but it was there, I don’t know what’d happened if I’d clicked it. And the second surprising thing was how fast it was… really, I didn’t time it cause it is one of those things you expect to take hours… and it probably did, but it seemed fast and almost “enjoyable”.

And one more cool thing. While I was installing it told me I had a previous Windows installed and since I didn’t choose to upgrade everything was going to be named Windows.old, I wouldn’t be able to run that windows installation but all the files would be there, and to my surprise that folder not only contained the previous Windows folder but also the program files and user settings. I found that really helpful cause you don’t always remember what programs to install after a clean up, so I now I have the old folder there.

I just read that the Windows.old folder was available on Vista :S
I guess that what you get when your product gives a first really bad impression (Vista).

Read Full Post

Saturday, August 15, 2009

Bing vs. Google

phpThumb_generated_thumbnailjpg It’s been quite a while since my latest post, and I encountered myself many times thinking I should blog about this and then for some reason I didn’t do it. So now I decided to stop for a minute (actually I’m waiting for the build) and write about this search engine ‘war’ we’re in the middle of.

At the red corner we have Google which does not need any further presentation, and on the blue corner we have Bing. Some time ago Microsoft came out with bing I decided to give it a try, but really give it a try setting it as my default search engine in my browsers. I decided to try it cause I found the design of the site pretty cool. There are tons of feature that I don’t get to use cause I’m not in the US, so I can’t search for the closest pizza place to where I am right now… but there a few other features that got my attention, for instance, no need to go thru pages when searching for images, just scroll down. Also, when searching for videos, you get a tiny screenshot of the video which you can play from the bing site itself.

All that it’s pretty neat, but, does it find what I’m looking for? mm mmm… well, not in the order I expected them. For instance, I use the search engines a lot to find solutions to error messages I get while programming. I also use them to find the members of a class I need to use… so, if I search for a class, I expect the msdn site to be at top and in bing that does not always happen, while it does with Google.

I guess Google’s page rank it is still a little better… and while bing is still a beta, I expect those results to come out right…

One point to microsoft though, I’m searching for stuff that belong to them and their own sites don’t show up on top, which means their algorithm is not as good as it should yet but they are not doing anything (they could) to show their sites on top…

Read Full Post

Tuesday, April 21, 2009

Log4net, WCF, and ASP.net trace

Forget what I said in my last post. Well… not all of them. What I posted before works! and that’s the way to do it if you want to enable asp.net trace in your WCF services.

So what’s wrong with that? The problem is that if one of your services uses something from the session, asp.net starts using a lock mechanism so two process don’t step over each other. In other words, you won’t be able to have two services running at the same time… if you make two calls ‘at the same time’, the first one to reach the server goes in and the second one waits for the first one to finish. And that’s not acceptable in my case.

So there… you can still use log4net with the RollingFile appender though.

Read Full Post

Thursday, March 19, 2009

log4net with WCF Services

This week I ‘ve been working on adding tracing to a WCF IIS hosted application. It all started pretty easy since log4.net already has an appender for asp.net.

So, I created a little wrapper around the log4net library and called the Debug function. My project had both aspx pages and svc services. These services were implemented in a separate dll (not in the web project). Oh! I forgot to mention that I wanted to use the AspNetRaceAppender so I could watch the trace in the trace.axd ‘page’.

But it was not working… I had a few debug entries and nothing appeared on the trace page. The ‘wired’ part was that if I’d copied and pasted the same debugging line in the aspx code behind’s it’d worked! So what’s up with that?

I started googling around I found close to nothing about log4net and WCF services. And that’s why I decided to post the solution here. Trying around many different scenarios I found the solution. You have to enable your wcf services to get the HttpCopntext from the web application. And in order to do that, you need to add the following line in your web app’s web.config file.

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />


Add that line inside the system.serviceModel part. Also, you have to add the following attribute to your services’s classes.



[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]


Hope this helps somebody!



P.S: All the code I write is “works on my machine” certified ;)



works-on-my-machine-starburst_3

Read Full Post

Thursday, March 12, 2009

Forget what I said about SQL Data Services :(

Remember my two posts about Microsoft Sql Data Services (Starting Up With SDS and Writing Data To The Cloud)?, well, they are both wrong now. Not wrong but old.

This week I read on the SDS blog that they will introduce relational data base features (which I think it’s great) but also that they are removing the good old ACE model.

Read the original post here

Edit: I just read a new post from the SDS team were they answered a few questions from developers.

This is what I asked them and what they answered:

You say, you will no longer support the ACE model since Windows Azure has the same data model. If I’m going to put my application in Windows Azure (as I did) my best option for data is SDS, right? As I understood, Microsoft’s approach for cloud computing was Windows Azure as the platform for developers and SDS to store the data. And now you say I can use Windows Azure storage… what’s the difference? What’s the path to follow?

The best storage option for an Azure Services Platform application depends on your application. At a very high level, if you require the features of a relational database, use SDS. If you require basic blob or “schemaless” storage, then Windows Azure Storage is for you. Both will be key capabilities available to developers in the overall Azure Services platform.

Read the whole Q&A session here.

Read Full Post

Sunday, February 15, 2009

Real-life Dilbert manager quotes

Even thought I find the winning quote brilliant, I have to say my favorite is the one from the Marketing Executive at Citrix Corp.

‘Teamwork is a lot of people doing what I say.’

from: http://blogs.msdn.com/architectsrule/archive/2008/07/01/real-life-dilbert-manager-quotes.aspx

thanks APC

Read Full Post

Thursday, January 15, 2009

Writing data to the cloud (SQL Data Services)

In a previous post I talked about setting up the environment for SQL Data Services. Now I’ll show you something I’ve done with it and hopefully it will help somebody thru.

I’ll use my Goomez project cause that’s like my sand box and also, and since it’s available online, you could download it and also play with it. I used the SQL Data Service to store and query the information, so instead of using Lucene.net I used SDS for this implementation, which I believe it’s a good scenario for SDS. That said, the changes you’ll see here were not committed to the svn repository.

But let’s get down to business. SDS has two interfaces, one is through web services, which implies importing the wsdl like any other web service which, if you do it with Visual Studio, it will create all the necessary proxy classes. The other way is REST and since I hadn’t tried anything with it before I thought it’d be a good idea to give that a try too (I must say it’s not a recommended practice, since if you crewed up, it’d be harder to know where).

One thing that I found missing is a good old REST API for .net. I don’t know if this is planed to stay like this, but it’s pretty crapy. You have to create a HttpWebRequest, HttpWebResponse and so forth… not something I enjoy doing. It was fun though (just for this time).

So, here’s the code of the function that actually saves the info of one of the indexed files (FileInfo) to the cloud.

Firts of all, create the request and response objects and set a few properties to the request

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_url);
HttpWebResponse response = null;
MemoryStream stm = null;

request.Credentials = new NetworkCredential("<YourSolution>", "<Password>");
request.Method = "POST";
request.ContentType = "application/x-ssds+xml";


In my example, m_url has the value https://goomez.data.database.windows.net/v1/goomezindex because goomez is the authority I created and goomezindex is the container. So now, the entities.



StringBuilder builder = new StringBuilder("<File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:x=\"http://www.w3.org/2001/XMLSchema\" xmlns:s=\"http://schemas.microsoft.com/sitka/2008/03/\">");
builder.AppendFormat("<s:Id>{0}</s:Id>", Guid.NewGuid());
builder.AppendFormat("<file xsi:type=\"x:string\">{0}</file>", file.Name);
builder.AppendFormat("<folder xsi:type=\"x:string\">{0}</folder>", file.Directory.FullName);
builder.AppendFormat("<extension xsi:type=\"x:string\">{0}</extension>", file.Extension.Replace(".", string.Empty));
builder.AppendFormat("<size xsi:type=\"x:decimal\">{0}</size>", file.Length.ToString());
builder.AppendFormat("<content xsi:type=\"x:string\">{0}</content>", GoomezSearchHelper.Tokenizer.TokenizeToIndex(file.FullName));
builder.Append("</File>");


Here I’m writing the xml which represents an entity, in my case, called File. The file variable you see here is the FileInfo I passed as a parameter to this function.



Now the ‘magic’:



XElement entity = XElement.Parse(builder.ToString(), LoadOptions.SetLineInfo);

stm = new MemoryStream();
entity.Save(stm);
request.ContentLength = stm.Length;
using (Stream stream2 = request.GetRequestStream())
{
stream2.Write(stm.GetBuffer(), 0, (int)stm.Length);
}

response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.Created)
{
throw new WebException(string.Format(CultureInfo.InvariantCulture, "Unexpected status code returned: {0}", new object[] { response.StatusCode }));
}


Create the entity element, save it at a MemoryStream and get the response.



So, what was that? what did that do? if you go to the SDS Explorer and query the index you’ll see the file you just ‘uploaded’.



SDS Explorer

Read Full Post

Friday, January 09, 2009

My first Parallel Computing programming experience

For some reason I have not researched on yet, processors aren’t evolving as fast as they did in the past. We don’t double the processor speed every 6 months like it used to be, so manufacturers are adding more processors to computers in order to gain a ‘little’ extra speed.

But what happens with your programs? will they take the advantage of more than one processor in your machine. The answer I would guess is “no, they don’t”, and if you’re working with the .net framework as I am, the answer is definitely NO. So if you want your programs to run smoother and take advantage of your computer’s processing power you’ll have to either learn a new parallel computing language or start playing around with the Parallel Computing extension for the .net Framework (like I did).

First let me tell you that if you’re used to work with threads (System.Threading) you’ll have no problem understanding the new parallel paradigm. When working with thread you would create one to say, calling a web service and not freezing the UI while doing it, right? well it’s the same thing here, instead of creating a new Thread you’ll create a new Task.

But this .net extension has another cool feature called PLINQ (Google it, I couldn’t find and official updated resource) which pretty much ease things for you. I’ll show you an example of this with something I did in my Goomez indexer.

So I had a function called IndexFiles that looked like this:

        private static void IndexFiles()
{
try
{
List<string> servers = GetConfigList(K_SERVERS);

foreach (string server in servers)
{
foreach (string folder in GetShares(server))
{
if (folder.EndsWith("$"))
continue;

string folderFullPath = @"\\" + server + @"\" + folder;

try
{
IndexFolder(folderFullPath);



and I wanted to change the outter foreach, which BTW that’s one of the team’s recommendations, so I switched to the following:



        private static void ParallelIndexFiles()
{
try
{
Parallel.ForEach<string>(GetConfigList(K_SERVERS), server =>
{
foreach (string folder in GetShares(server))
{
if (folder.EndsWith("$"))
continue;

string folderFullPath = @"\\" + server + @"\" + folder;

try
{
ParallelIndexFolder(folderFullPath);



see how my foreach is different now? what that change in my code does, is that for each server in my list the code executed inside the lamda expression is processed by the first available processor… pretty cool uh?!



To try this stuff you can either download the CTP of Visual Studio 2010 and the .net Framework 4.0 or the Parallel Extension to the .net framework 3.5 June 2008 CTP.



Quick note: if you don’t have two (or more) processors you would end up slowing your program a little bit because there’s a little overhead which they say will be eliminated in next versions.

Read Full Post