May 2006 - Posts

[Vista] What does Vista do when it Sleeps?

I have to say the new "power button" which puts Vista into the new "Sleep" mode seems nice. My 2 Ghz laptop (which doesn't have much on it yet I must admit) goes to sleep in 1 second and starts up in pretty much the same time. Superfast - I like it.

As I understand it, by default a laptop is put into sleep mode when the power button is pressed, then goes into hibernate (saves memory to disk) after a few hours or so, to save power. When resuming from hibernate it takes a bit longer for the box to get going, but that's understandable. It's possible to configure what happens when you press the power button or close the lid, also depending on if you're on battery or plugged in.

You can read more of what Vista does when it's in sleep mode on the Microsoft Vista Performance pages.

Posted by jdanforth | 1 comment(s)
Filed under:

[Ajax] GWT - Google Web Toolkit

Related to what I wrote in my previous post about Script#, there is already GWT - Google Web Toolkit, which does something similar but with Java. You write your front end in the Java language, and the GWT compiler converts the code into JavaScript and HTML.
Posted by jdanforth
Filed under:

[Ajax] Check Out the Script# Prototype

This should interest all of you who are into AJAX, Atlas and that kind of stuff no the ASP.NET platform - Nikhil (who is an architect on the Web Platform and Tools team at Microsoft) releases a prototype of a C# to Javascript/Ajax compiler and looks for feedback:

Script# brings the C# developer experience (programming and tooling) to Javascript/Ajax world. This post shares a prototype project for enabling script authoring via C#...

Check it out - Nikhil also got a video to explain how it works.

Posted by jdanforth
Filed under:

Stylish Quotes in Blog Posts

I found a few CSS tips and tricks to format (in my view) prettier quotes in your blog posts. For example:

This is a quote.


For the above, I added this CSS:

blockquote {
  background: transparent url(quoleft.png) left top no-repeat;
}

If you want to add a closing quote to it as well, add this:

blockquote p {
  padding: 0 48px;
  background: transparent url(quoright.png) right bottom no-repeat;
}

If you use <P> inside the quote, you may get additional quote signs, so use a couple of <BR /> instead.

Posted by jdanforth | 2 comment(s)

[Vista] Is Sami the Default Swedish Language?

I had heard about this before, but someone had also said it was going to be fixed for beta 2. Looks like it wasn't because when I selected Sweden as my region, it defaulted to Sami, Lule (Sweden) as language :)

There were actually 3 different Sami dialects available; Lule, Northern and Southern, which is amazing in itself. I had no idea we had all these different versions of the Sami language... I can't remember seeing Finnish in that list though, but it should be.

Overall, the installation went really smooth, but I'm installing on the bare metal here, and not in VPC or Virtual Server. Graphic is stunning...

Posted by jdanforth
Filed under:

[Vista] Beta 2 Available on MSDN Subscription

Guess I'm not the first to notice, but beta 2 of Vista is available for download to MSDN subscription owners. 3200 MB ISO :)

EDIT: There still (day after release) seems to be a problem with generating license keys for any other Vista version than the premium home edition. I guess we'll have to check back on the MSDN Subscription page every now and then and see if it gets fixed.

Posted by jdanforth | 3 comment(s)
Filed under:

[.NET 2.0] Anonymous Methods

My mate Eric blogs about how useful Anonymous Methods could be when calling on multiple asynchronous methods. Check it out.

 

Posted by jdanforth
Filed under:

Using .NET Stored Procedures in Oracle 10g R2

I've not been doing too much 10g development lately, but this was completely new to me. Quote from an OTN article about this feature:

If you are a .NET developer, one of the most exciting features of Oracle Database 10g Release 2 for Windows is the ability to implement stored procedures using the .NET language of your choice, via Oracle Database Extensions for NET.

I think I have to try this out some time.

Posted by jdanforth

Copy Code and Paste as HTML From VisualStudio 2005

There are 100's of macros and add-ins and plug-ins doing this, but I got this one from "CodingHorror" installed and configured an ALT-C shortcut to copy the code as HTML. It's a manual installation process, but it's good enough for me.

Now why VS 2005 doesn't ship with a proper copy/paste functionality is something I don't really understand. But it gives a whole lot of happy late-nighters a chance to whip up something useful on their own :)

Posted by jdanforth

[.NET 2.0] Testing Generics, Collections and Yield Return

I've not looked too much at the yield return statement in c# 2.0 yet, but if you learn how to use it I'm sure it will become something you use "every day" when programming. Whenever you need to do some conditional iterations on a collection, array or list, yield may be a nice solution to go for. A few, silly and not perfect, snippets which helped me understand how to use yield return:

using System;
using System.Collections;
using System.Collections.Generic;

public class Program
{

    
static void Main()
    {
        // Build up a few arrays and a list to work with
        
string[] names = { "Johan", "Per", "Thomas", "Lina", "Juan", "Jan-Erik", "Mats" };
        
int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
        
List<int> list = new List<int>();
        list.Add(1);
        list.Add(2);
        list.Add(3);
        list.Add(4);

        
Console.WriteLine("Get the names which contains an 'a':");

        
// Iterate on all names which contains letter 'a'
        foreach (string name in EnumerableUtils<string>.GetNamesContainingLetter(names, 'a'))
        {
            
Console.Write("{0} ", name);
        }
        
Console.WriteLine();
        
Console.WriteLine();

        
//iterate through first half of this collection
        Console.WriteLine("First half of the name-array:");
        
foreach (string name in EnumerableUtils<string>.GetFirstHalfFromList(names))
        {
            
Console.Write("{0} ", name);
        }
        
Console.WriteLine();
        
Console.WriteLine();

        
//iterate through first half of another collection
        Console.WriteLine("First half of the value-array:");
        
foreach (int value in EnumerableUtils<int>.GetFirstHalfFromList(values))
        {
            
Console.Write("{0} ", value);
        }

        
Console.WriteLine();
        
Console.WriteLine();

        
//iterate through first half of a List
        Console.WriteLine("First half of the value-list:");
        
foreach (int value in EnumerableUtils<int>.GetFirstHalfFromList(list))
        {
            
Console.Write("{0} ", value);
        }
        
        
Console.WriteLine();
    }
}

public class EnumerableUtils<T>
{
    
public static IEnumerable GetNamesContainingLetter(string[] names, char letter)
    {
        
foreach (string name in names)
        {
            
if (name.ToLower().Contains(letter.ToString().ToLower()))
                
yield return name;
        }
    }

    
public static IEnumerable<T> GetFirstHalfFromList(List<T> arr)
    {
        
for (int i = 0; i < arr.Count / 2; i++)
            
yield return arr[i];
    }

    
public static IEnumerable<T> GetFirstHalfFromList(T[] arr)
    {
        
for (int i = 0; i < arr.Length / 2; i++)
            
yield return arr[i];
    }
}

Posted by jdanforth
Filed under:
More Posts Next page »