2008-02-06

2007-11-14

Long time ago we saw action here... it's a PR4 (because of the links from Nyman)...sooo...

När man ska ut och resa så är internet en oändlig källa av information; vart ska jag resa, vilka flygbolag har de billigaste flygstolarna? En bra startpunkt för att hitta den billigaste flygen är på sajten Billiga flyg - förutom detta så hittar du även information om resmål och flyg destinationer, t ex billiga flyg till Zagreb.

Ska du resa till Göteborg finns det bra och prisvärt boende, på sajten Hotell Göteborg. Kolla in den.

2006-01-23

We are growing BIG!

This blog started as humble collection of posts with things I found interesting enough to share with other people. I noticed there is a number of good blogs I am reading, but with time, there is less and less good postings on them. Authors start with nice, on-topic postings, but after they write some 10 or 20 short articles, they cannot keep such rhytm of quality texts, so we are reading about their personal life. From 80/20 (professional/personal) ratio they soon reach 20/80.
Yes, blog is short for "web log", but I really do not think my personal life is interesting enough for me to share it with you. And if I ever do, please stop reading this blog. That way you will tell me I am on the wrong way.
So, I decided to post interesting links in the days when I do not have something important and useful to say.

Obviously, some other people liked this concept, so after few weeks Emil decided to join me, and lately Niklas gave us a honor of good company.
That makes three of us, and I said: "Guys, there is no place in this blog for all of us".

So, we started new site GoYasd (http://www.goyasd.com). We will do no more posts here, and you are welcomed to visit us at new location. Everything you liked about this blog will continue on the new one. I hope you will enjoy reading it as much as we enjoy making it.

2006-01-14

Simple custom URL rewriting in ASP.NET 1.1

This post can also be found here

This post describes how you can create a simple url rewriting engine in ASP.NET in order to create custom urls for your webpage..
I’ve used the great tutorial on 15 seconds, Rewrite.NET - a URL Rewriting engine for .NET written by Robert Chartier and modified some minor parts.
Instead of fetching the urls from inside the web.config file, I’ve used a simple xml document to store my customs paths.
I have also found a method for preventing the postback issue and will describe on how to change the file extensions in your urls.

We will start off by creating a xml file and calling it MyUrls.xml. I chosed to move the content from the web.config file because I whish to be able to easily change the urls from a web interface that's not causing the project to reboot which will happen when you re-save the web.config file.

<?xml version="1.0" encoding="utf-8" ?>
<urls>
<url custom="/project/Start.aspx" real="/Project/index.aspx?id=123" />
<url custom="/Project/Custom.aspx" real="/Project/index.aspx?id=456" />
</urls>

We now create a new class called RewriteClass.cs and add it somewhere in our project.

using System;
using System.Xml;

namespace UrlRewriting
{

public class RewriteClass : System.Web.IHttpModule
{
public RewriteClass()
{
}

public void Init(System.Web.HttpApplication Appl)
{
Appl.BeginRequest +=new EventHandler(Appl_BeginRequest);
}

private void Appl_BeginRequest(object sender, EventArgs e)
{
//cast the sender to an HttpApplication object
System.Web.HttpApplication

Appl=(System.Web.HttpApplication)sender;

XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Web.HttpContext.Current.Server.MapPath("MyUrls.xml"));

XmlNodeList xnl = xDoc.SelectNodes("//urls/url");
for(int i=0; i<xnl.Count;i++)
{
//see if we have a match
string custom = xnl.Item(i).Attributes[0].Value;
string real = xnl.Item(i).Attributes[1].Value;
if(Appl.Request.Path.ToLower() == custom.ToLower())
{
SendToNewUrl(real,Appl);
break;
}
}
}
public void SendToNewUrl(string url, System.Web.HttpApplication Appl)
{
Appl.Context.RewritePath(url);
}
public void Dispose()
{
}
}
}

Now we’re almost finished. We have to add this code inside the web.config <system.web> [code goes here] </sytem.web>.

<httpModules>
<add name="RewriteClass" type="Project.RewriteClass, Project" />
</httpModules>

All done! Now for the postback issue. Go to /Project/Start.aspx and look at the form-tag in the page source code. Here’s what you will see:

<form name="Form1" method="post" action="index.aspx?id=123" id="Form1">

If we do a postback to this page, the real url will show. We can easily prevent this with a JavaScript code that we will register inside index.aspx.cs. Add this code of line inside Page_Load:

RegisterStartupScript("PostBackFix","<script type=\"text/javascript\">document.forms[0].action='';</script>");

This will prevent the real url from showing when postbacking unless user doesn’t have JavaScript enabled. The small amount of people how doesn’t have JavaScript enabled wont be harmed according to me.

Custom file extensions
If you wants to use another file extension instead of .aspx, let’s say .html, all you have to do is to map the .html extension to the aspnet_isapi.dll file.
Open up the properties for your webpage inside IIS and click on Configuration. If you can’t find .html in the Mappings list, click Add. Now browse your way to the aspnet_isapi.dll file stored here C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322[or your version]\apnet_isapi.dll.
Click Ok and move over to the Extension field and add .html. Check Limit to: and add GET,POST,HEAD. Now uncheck Check that file exists and click Ok. Finished!
You can now go back to MyUrls.xml file and modify Start.aspx to Start.html.

This of course can be a problem if your application is stored at a web hotel. But if you ask nicely, maybe they’ll help you out. My hotel did :)

References:

2006-01-11

Lightbox JS

"Lightbox JS is a simple, unobtrusive script used to to overlay images on the current page. It's a snap to setup and works on all modern browsers."

2006-01-10

Looking for a job?

Preparing for a job interview is like writing a personal diary - if you do it the right way, you will have chance to ask yourself some fundamental questions and get some answers that will help you develop further.
Beside standard questions ("can you tell me something about yourself"), some companies tend to develop set of questions that are meaningless at first sight ("how would you move Mt.Everest", "design 1m x 1m bathroom"), but answering them reveals your creativity, mindflow and stress bearing capability.
As an illustration, here is Google's GLAT test (p1, p2, p3, p4) with answers, and some of the questions Microsoft use.

2006-01-09

BigTable: A System for Distributed Structured Storage

Did you ever wonder how Gmail can offer almost 3Gb of storage for each registered user, or where all those indexed pages and cache are kept? Okay, here is the answer - video lecture with explanation of BigTable, storage system used at Google.