Fascinating algorithm to resize pictures

Dr. Ariel Shamir from Efi Arazi School of Computer Science is one of the co-inventors of a clever algorithm to resize images. Usually if you have an image that is to big in size you crop or resize it. Now if you resize it, important information might get lost because some pieces in the picture are getting to tiny that you can’t see them anymore (they might even get at a sub pixel level where they are merged with other pixels). On the other hand if you crop the image, parts are missing completely. That could also include important information! Another problem would be two hot spots in an image: you would need to crop and merge the two pieces somehow, which isn’t always an easy task.

Now the people around Dr. Shamir invented a way to resize pictures without losing important details. They have published a video on how their algorithm works. The paper describing the whole algorithm and ideas is found here.

A few days ago Dr. Shamir has been hired by Adobe. Wouldn’t it be very cool if we would get the algorithm as a feature in one of the next Photoshop versions?

Published on Aug 30th, 2007 — Tags: , ,
Comments (1)    digg it!    kick it   

Windows Vista Service Pack 1 announced!

It is official: the first Beta version of the SP1 for Vista is going to come in the next few weeks. The Beta version is going to be available for everyone. Microsoft did already ship a pre-beta version to a small group of testers, which are testing it right now.

WhatG??s going to be included in the SP1?
In addition to updates that have been previously released via Windows Update, SP1 will contain changes focused on addressing specific reliability and performance issues that have been identified via customer feedback. ItG??s also going to support new types of hardware. SP1 is also going to makes additional improvements to the IT administration experience. Microsoft didnG??t design SP1 as a vehicle for releasing new features; however, some existing components do gain enhanced functionality in SP1. More information on what is included in the Service Pack 1 can be found in the detailed white paper.

When will the final version be available?
The final version is going to be available in the first quarter of 2008. The team is saying that they target that time frame but if they encounter unknown problems the pack could be delayed. ItG??s important to ship a rock solid update instead of rushing out an update that may contain a lot of bugs and problems.

WhatG??s also interesting is that the Windows Vista SP1 and Windows Server 2008 engineering efforts are aligned. The server team also announced today that they are targeting the first quarter 2008 for their release to manufacturing (RTM).

Now letG??s hope that the Vista Explorer bugs are finally fixed. IG??m really waiting for that to happen. :-)

Published on Aug 29th, 2007 — Tags: ,
Comments (0)    digg it!    kick it   

.GetLast(), .TryGetLast() and .GetFirst() for IList<T>

How often have you done the following?

List<Foo> myListOfFoos = new List<Foo>();

// … some other random code

Foo last = myListOfFoos[myListOfFoos.Count - 1];

It’s always a pain to re-type the variable name, get the count and substract one to get the last item in the list. It’s also a possible source of errors because you could accidentally mistype the variable name (you may have a variable with a very similar name that is also a list; intellisense helps very much there) or you could omit the -1, who knows. It’s always best to remove error sources, isn’t it?

Wouldn’t it be nice to use it like that:

List<Foo> myListOfFoos = new List<Foo>();

// … some other random code

Foo last = myListOfFoos.GetLast();

Now with C# 3.5 and extension methods there is a way to get the second way working. :-) We only need to implement an extension method that gets the last element once and can use it from then on. I have decided to implement it for the IList<T> interface. That means that all classes that implement that interface provide that extension method.

We have only one problem now: an empty list throws an exception, if the method that gets the last item is called. To avoid that problem problem I have implemented a method that tries to get the last item. The method returns true, if the item could be fetched. The behaviour is the same as TryGetValue on Dictionary<TKey, TValue>:

public static class IListExtensions
{
    // Gets the last item in the list.
    public static T GetLast<T>(this IList<T> value)
    {
        if (value == null)
            throw new ArgumentNullException(“value”);

        return value[value.Count - 1];
    }

    // Tries to get the last item in the list.
    public static bool TryGetLast<T>(this IList<T> value, out T result)
    {
        if (value == null)
            throw new ArgumentNullException(“value”);

        if (value.Count == 0)
        {
            result = default(T);
            return false;
        }

        result = GetLast<T>(value);
        return true;
    }

    // Gets the first item in the list.
    public static T GetFirst<T>(this IList<T> value)
    {
        if (value == null)
            throw new ArgumentNullException(“value”);

        return value[0];
    }
}

Published on Aug 22nd, 2007 — Tags: ,
Comments (8)    digg it!    kick it   

Visual Studio Express 2008 Beta 2

Are you interested in programming for the Windows platform or even the web application via ASP.NET? Microsoft has released the Beta 2 of their Express Editions. The best is that they cost $0. They are completely free and may be even used in commercial products. I have also used them in some courses for my university work because they were free and I did want to develop in C#. The only problem is that the stand-alone installers are quite big: 400+ megabytes are a lot when you are on a dial-in.

The Express Editions are available for several .NET languages, such as Visual Basic 2008, Visual C# 2008, Visual C++ 2008 and Visual Web Developer 2008. Visual C++ Express allows for the first time (speaking of an Express Edition) to develop native Windows applications. Native Windows applications are applications that run without the .NET framework.

Each Express Edition can be installed side-by-side with the older 2005 versions or any other Visual Studio installation. Everything will just work.

If you have some free time, try them out. Problems and bugs that might be in the beta versions should be reported to Microsoft. They are usually very fast in providing answers. I have installed the Beta 2 on my computer and it seems to be very solid. The .NET Framework (version 3.5) that comes with the Beta 2 has also a go-live license. That means you can legally publish and distribute applications that are building upon .NET 3.5 Beta 2.

For more information about what has been changed in the Express Editions have a look at the series that Dan Fernandez started at his blog.

You are a novice programmer? You need introduction to the tools? Have a look at the G?Beginner Developer Learning CenterG?. ItG??s a great resource for beginners, who are interested in Windows and Web programming.

Another interesting toolkit for the hobbyist programmers is the G?Coding4Fun Developer Kit 2008 Vol.1G?. It is a collection of tools that provides a set of drag G??n drop controls and components that enable rapid development of hobbyists. Another example is the Facebook Developer Toolkit, which is a set of controls and components that provide Visual Basic and C# wrappers for the Facebook API that allow you to easily and quickly develop .NET applications that you can share with your Facebook friends.

Published on Aug 20th, 2007 — Tags: ,
Comments (0)    digg it!    kick it   

XNA Studio 2.0 and Gamefest 2007

One year after announcing the first XNA Game Studio the XNA team has announced version 2.0 at the 2007G??s Gamefest. The next version is going to be online by the end of this year and contains two major improvements: network support and the possibility to install as add-on for Visual Studio Standard and Professional!

Other improvements like a new XACT Editor and UI simplification are also coming in handy. I had always problems with the XACT Editor in Vista: speaking of random crashes. What’s also interesting is that XNA 2.0 allows hosting a game inside a Windows Forms application (as a component). I hope it is also possible to host the component inside a WPF window.

This year’s Gamefest was also interesting for people who couldnG??t make it there (like many students including me) because Microsoft streamed some interesting talks as webcasts. They are going to be available for view-on-demand in a few days. You should watch them if you hadn’t had the time to watch them live and you are interested in XNA, the new networking features or general performance tweaks for .NET applications!

Microsoft has also announced this yearG??s winners of the XNA “Dream-Build-Play” contest. The games were that good that the first three places have been shared among several projects: there are actually two games on the 1st place and two on the 2nd. I haven’t counted the number of games on the third place, but they all look very innovative and interesting.

Published on Aug 18th, 2007 — Tags: ,
Comments (2)    digg it!    kick it   

id’s Rage

Gametrailers.com is having 3 videos featuring the “mighty” John Carmack showing some of the ideas in Tech 5 (the new engine developed by id software).

The engine features MegaTexture (a new way of texturing) and is cross-platform (a game runs with zero to very few modifications on PS3, Xbox360, PC and MAC).

In the thirth video he is showing some features of the design tools (like realtime editing of the scenes etc.)

Video 1, Video 2, Video 3

Definitively worth a watch, if you are interested in game design.

Edit: Fileshack has another walkthough (high definition) and introduction video (50 minutes!) where a guy from id is explaining the tools etc.

Published on Aug 8th, 2007 — Tags: , ,
Comments (0)    digg it!    kick it   

Visual Studio 2008 side-by-side with Visual Studio 2005 on Vista

It works! I have installed Visual Studio 2008 Beta 2 (Scott Guthrie blogged about the release) side-by-side with my old Visual Studio 2005 (SP1 + SP1 for Vista) on Vista. I haven’t had any problems so far, although I’m only doing C# and sometimes a little bit C++ coding.

And by the way: the “You need to be admin to start this application” dialog that appears on Vista after starting Visual Studio 2005 is also gone. It don’t know if they only removed it or have fixed Visual Studio so far to work without admin rights. I expect the first, but hope the later.

If you have some free time download the beta and enjoy the LINQ and lambda experience! There’s also a Virtual PC image available, if you don’t want mess around with your current Windows installation. ;-)

Published on Aug 2nd, 2007 — Tags: ,
Comments (0)    digg it!    kick it