Showing posts with label technology. Show all posts
Showing posts with label technology. Show all posts

Tuesday, October 02, 2012

Building a code generator, and running a marathon

485778_4347864811580_1796142993_nMany have been told about how writing code resembles to exhaust training. The long hours, the dedication, the exclusion of what others think of fun, and specially how others can’t understand what you do or why you do it. (assuming you also code for fun)

In the latest months I’ve been doing both of them, training for a marathon and writing the Genexus “Tilo” Windows 8 generator… but unlike the Win8 generator, I can say I finished the marathon (in one piece).

Of course I can’t say the generator is finished, the guys from Android and iOS have been working on them for over a year now so there’s a ton of work to be done. But just like while running the marathon(*), I’m not going to think about what’s missing but what we have achieved instead.

In Genexus we care about letting you model your solution, your needs, and don’t worry about what platform you’re targeting. We call it “platform-independent” or “platform-agnostic” but what I think is most important is our “non platform-ignorant” philosophy. And what does that mean for our Win8 generator? That you as a customer will want your app to use all the “cool features”  Windows 8 has as you would if you develop the app from scratch (meaning writing all the code yourself). So the cool thing is we already wrote all that code so it’s dead simple for you to use. Here I’ll show you what we have and what you need to do in order to have it running on your next Genexus Win8 app.

Lives Tiles

tiles

Lives Tiles is probably the first feature that will call your attention. This feature allows the “icon” (tile) of you app to show different info about your app. A news app for instances shows the latest news, a weather app shows the current conditions and so forth.

With Genexus all you need is a DataProvider that exposes the data you want to show in your tiles. That DataProvider must populate a known structure (SDT) so the app “knows” what to use for the image and what to use for the description. You have to keep in mind that only the latest 5 tiles will be displayed so you might want to limit that on the server side, on the dataprovider itself.

Genexus will provide the SDT (called ‘TileSDT’) and an example of the DataProvider, so all you need to do is modify the DataProvider to populate the SDT as you wish. Remember the [Count = 5] so you don’t send unused data to your app.

Full Device Integration

This was something simple to implement but it is very useful for apps. If you declare an attribute as an Image and you want your users to edit it they will want to use all the features they already have on the device. So that picture could be a file from the local hard drive, or a photo taken with the device’s camera or use any of the images that image providers apps provide. For instance, Windows 8 comes with a Photos apps that connects with your facebook account, flickr, skydrive and other computers, so you can choose an image from your facebook wall album to upload into your app. Cool uh? 

This comes “out of the box”.

Semantic Zoom

SemanticZoom

Semantic zoom lets you see a grid with a bigger picture view. So let’s say you’re showing contacts in your app and you have a grid where every item is of course a contact. You might want to reach to someone you know his name starts with an ‘S’ (like me). So you can scroll all the way to the S and then try to find me, or you can ‘pinch’ the grid and you will see a different view of the same grid, now grouped by the first name letter, doing it easier to go straight to the ‘S’ letter.

With Genexus you already have the “break by” feature of a grid, and you can now define different layouts for the same grid. So with that info you can have semantic zoom in your app.

Heterogeneous layouts

You probably had seen this but didn’t know the name of it. Heterogeneous layouts is the feature that allows you to see specific items of a grid with a different layout.

In Genexus you can define different layouts for your grids and pick on runtime the one you one for a specific pattern. Let’s say you want the item of the grid to be a big 2x2 square, or you want every 5 item to show one as a 2x1 ‘column’. Trust me, it sounds hardar than it is.

Search Charm

Charms is another cool feature of Windows 8. With the search charm you can search your apps, files, settings or in the context of an app. So you can search for ‘Angry Birds’ in the context of the Windows Store (which is an app) of course.

Windows 8 Genexus generated apps comply the search contract so once you call it swiping your finger from the right, your app will be there as a search provider.

Search

In Genexus, select the object where you want to display your results by setting the property “Search Result Object”. This object must have a grid with an attribute set as ‘Search’. That attribute will be the one your app will query for.

Share Charm

The share charm allows you share something from you app with someone else. Depending on the sharing apps you have, and the content you’re trying to share, some apps will appear as sharing target. Some of those apps will allow you to twit, send over email, send to skydrive, or maybe publish to your facebook wall.

Share is not an app wide feature, meaning that you must choose for every panel, that suits sharing of course, the attribute/variable you want to share.

Panels in Genexus have now a Share property where you can set the Attribute or Variable you want to share. Another way of sharing is by calling the Interop.SendMessage function.

Everything else

Of course there are tons of features that work as you would expect. Keep in mind we’re not even in beta yet but if you put a Date attribute the Date picker will be display, or an Enum domain will show you a combo or even the dynamic combos (Country – City) work as expected.

As mentioned before, there are some missing features… maps, notifications, audio, and more.

That’s a wrap!

So as you can see, there are quite a few cool Windows 8 features that your Genexus app can take advantage of. I encourage you to join the Genexus betatester program that will be available in a few weeks, download the Genexus Tilo night builds and give this generator a try. Right now there’s a alpha test program (at www.genexus.com/tilo) that you could apply if you have a project for Windows 8 (right now), if you just want to play around with it you’ll have to wait.

Also, just in case you just arrived earth from outer space, there’s this big (22nd) Genexus International Meeting in Montevideo from Oct 1 to Oct 3. There are a few sessions you might be interested in (if you found this post interesting), but there are tons of sessions, keynotes, labs and activities you’ll find amusing and educational. I’ll be there so come down and say hello and I’ll be happy to show you all this features live! It’s easy to locate me, I’ll be the guy in the suit.

works-on-my-machine] 

As I always say, this is “works on my machine” certified, but this time it’ll be soon ready for your machine :) stay tuned!

* When I reached the km 33 I hit “The Wall”… from that point on it was all will. I knew I had 9 km ahead of me, and by that time that seemed a lot, by I had already ran 33km, so giving up was not in my plans.

Read Full Post

Monday, January 25, 2010

YATC (yet another twitter client)

image My twitter followers have probably realize by now that I’ve been playing around with the Twitter API. I’ve been trying out the API and I created a command line tool to update my twitter status.
I tried lots of clients but it is still a pain in the a*s to go to a different application or web browser to update my status.
I have a command line window open all the time so now I’ll be easier to update my status. In case you want to give it a try you can download it from here. The use is real simple, just type twit <your status> and that’s it. If it is the first time you run it it’ll ask you for your twitter credentials.

Edit: as of today (Jan 28th, 2010) twit has bit.ly integration. Just type your status with a url and twit will post the bit.ly short version of it. Yes! I like playing with web APIs.
As always, this bits have the “works on my machine” warranty :)
works-on-my-machine-starburst_3

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

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

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

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

Friday, December 12, 2008

Starting up with SQL Data Services (SDS)

SDS A few days ago I got my invitation code to the SQL Data Services CTP and last week I decided to take a peek of the ‘new technology’. Since I could not find a straight forward example of what to do when you want to test the SQL Data Services (FKA: SQL Server Data Services), I decided to post here a short version of what I did and hopefully someone will find here what I found in many places.

So, first of all I assume you already signed up for a SDS account at Microsoft Connect. They’ll send you two emails. The first one tells you your code to sign in but it also says the service is not available yet. And then, you get another email saying that the service in now available for you and that you need to sign in with the code they’d sent in the previous mail. Why don’t they send you just one mail when everything is ready? beats me!

And then what? well, is not easy… as I mentioned before, the site sucks big time. You need to go to the Azure site and click on the Sign In button at the top right corner. You might think you we’ll be prompted for user credentials, but no. Just click on Microsoft .Net Services & Microsoft SQL Data Services (or click my link). Now here you’ll have to sign in. Type your invitation code, the one they sent you in the first mail, here and click on Sign Up. Then you need to create a solution (remember this solution name for further reference). They also assign you a password (which you can change).

After that, click on the SDK link and download the Microsoft SQL Services SDK. After installing the so called ‘SDK’' open the SSDS Explorer. Read the doc to create and Authority, Containers and Entities (ACE is a mnemonic you might want to remember). I suggest you play around for a while before trying to write some code. Create Containers, and Entities. Create entities whit a different name (other than Entity) and same thing for the entity properties… notice you can write what ever you want there. Try some LinQ to query your entities.

In order to keep the post short I’ll show you some code in my next post.

Edit: I forgot to mention that the credentials asked by the SSDS Explorer are the name of the solution (the one you created before), and the password they gave (which hopefully you changed it)

Read Full Post

Thursday, September 11, 2008

Easy Remover also goes open source

 EasyRemover[3]

Following Milano’s BuildConsole my “Easy Remover” is also going open source, as I did before with Goomez. Now in a Google Code hosted project since I wanted to try it out. I think I’ll move Goomez there too.

For those of you who don’t know Easy Remover and don’t understand spanish (the original post was in spanish), Easy Remover is my alternative to the “Add/Remove Programs” feature in Windows. I always thought the loading was way too slow, had some missing features, and found no use for some of the info displayed there, like the size of the program and how often I use it, I already know that thank you.

Easy Remover loads much faster than the standard/official feature, and lets you search in your installed programs refining the showed programs to the word (or pieces of it) you are looking for.

In the original post, Gusbro posted a link to a blog where it was explained how Windows collects the info to show in the standard form, which explains why it is so slow to load. (here’s the link)

But as mentioned before, I just wanted to let everyone know that Easy Remover goes now open source. Here’s the project site http://code.google.com/p/easyremover/.

One more thing… I posted the project as GNU Public cause they don’t have the “Works on My Machine” license ;)
works-on-my-machine-starburst_3

Read Full Post

Sunday, August 03, 2008

Next stop: Florida!

dklogo

I didn’t want to say anything but a few days ago Milano mentioned it in a post in our forum so I guess that gave me the green flag :)

We are now working on the next version of DeKlarit code-named “florida”. We want to add a lot of new stuff but I think one of the most important features will be the Silverlight addin which will let you create web applications with Silverlight controls. We are still in the process of making a few decisions like, will it be a full Silverlight app or will it have aspx pages as containers for the Silverlight controls? We believe the second is the best choice right now since we have two excellent web addins and we can use the navigation logic we already have in those. That means it will be pretty easy for you to migrate your current WebGenerator generated app to a brand new Silverlight app. Cool uh?

Also, we’re thinking on REST support for our WCF addin, WPF for a fully funtional WinGenerator addin independent of third party controls, something you guys’ve been asking for, and full text search in generated applications among others. Also, I have to work on our security features for the generated apps and add a few features like allowing a user to change his password, sending conformation emails and more.

So if you have any suggestions, now is the time. I can’t assure you we’ll implement them all but we’ll surely keep’em under the radar.

 

Read the full thread of the “announcement” here.

Read Full Post

Saturday, June 21, 2008

Is Apple doing it again?

Apple-logo In a way, we’re getting used to be amazed by Apple news. The iPod, the iPod shuffle, the iPod Nano, the iPhone, the iPod touch, the MacBook Air and so on. The have also been showing some huge improvements in the software division, iTunes, Time Machine (my favorite) and more. Today I read an article about Apple’s newest file system called ZFS to be released on Snow Leopard.

I didn’t realize that NTFS is 20 years old already, and if you think about it, what are you using today from 1988?. Anyway, I like the comparison Harris does with Microsoft and GM.

I said it before… I was happily surprised by Microsoft Live Mesh, but let’s be honest, it’s not even close to releasing a brand new top of the line FS :(

What’s Microsoft doing about it?

http://blogs.zdnet.com/storage/?p=335

Read Full Post