Simple 2D physics engine for flash

Flade open source actionscript 2.0 library for simulating 2D physics written by Alec Cove. It currently features rectangular, circular, & wheel primitives, spring & angular constraints, and surfaces composed of line segments, circles, & rectangles.

This is an example I made with a tank thingy in a ramp.

1. Click one time on the screen.
2. Control with left<>right arrow buttons

By Jesper Lind

Drop shadow with transparent PNG

I found an interesting article on about how you can create dropshadows with transparent PNG images.

The HTML code for creating a box looks like this.

<div class="outerpair1 textbox"> <br /> <div class="outerpair2"> <br /> <div class="shadowbox"> <br /> <div class="innerbox"> <br />This is a demo showing how to make drop shadows with transparent PNG images. <br /></div></div></div></div>

View a demonstration
Link to CSS
By Jesper Lind

Create a RSS-feed

RSS is getting popular and is a great way to let the users subscribe to the content of your web site. This is how you create an feed in Asp.Net.

//Funktion som skapar RSS flöde
protected void GenerateRss()

//Fysisk sökväg på servern (Byt ut mot den på din server)
string strXMLPath = "C:/ . . . /rss.xml";

FileStream objFileStream = new FileStream(strXMLPath,FileMode.Create);
XmlTextWriter xtw = new XmlTextWriter(objFileStream,System.Text.Encoding.GetEncoding("iso-8859-1"));
xtw.Formatting = Formatting.Indented;

//skriv ut <rss version="2.0">

//skriv ut <channel>

//skriv ut element som tillhör <channel>
xtw.WriteElementString("description","Code Odyssey - expanderar webben");
xtw.WriteElementString("copyright","Copyright (c) 2004-2006 Code Odyssey");

OleDbConnection conn = new OleDbConnection (strConn);
bool boolPermission = false;
OleDbDataReader objDataReader=null;
string strSQL = "SELECT Blog.Id, Blog.Title, Blog.Body, Blog.PublishDate FROM Blog ORDER BY Blog.PublishDate DESC";


OleDbCommand objCommand = new OleDbCommand(strSQL, conn);
objDataReader = objCommand.ExecuteReader();
while (objDataReader.Read() == true)
int Id = Convert.ToInt32(objDataReader["Id"]);
string Title = Convert.ToString(objDataReader["Title"]);
string Body= Convert.ToString(objDataReader["Body"]);
//Se till att datum följer RFC-822 standard
string PublishDate = Convert.ToString( ((DateTime)objDataReader["PublishDate"]).ToString("r"));

//skriv ut <item> och dess innehåll
xtw.WriteElementString("link","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
xtw.WriteElementString("guid","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
catch (Exception objException)
Trace.Warn("GenerateRss() Fel!",objException.Message);

//skriv ut </channel>

//skriv ut </rss>

//Stäng xml skrivaren
catch (Exception objException)
Trace.Warn("GenerateRss() Fel!",objException.Message);

This is how to add the icon in the browser.

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="xml/rss.xml" />

This is how to add such a link from the code behind:

//Add RSS link HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "application/rss+xml");
link.Attributes.Add("rel", "alternate");
link.Attributes.Add("href", "feed/rss.xml");

By Jesper Lind

Still some bugs in PNG support of IE7

I quote this from some comments of a IEBlog post. Mainly to remember for myself when I try out some of that PNG magic.

There are at least 2 major bugs with PNG support in IE7 at the moment.

1.) The Gamma is all wrong, meaning all images are darker than they should be.
2.) Transparency fails, if overlaid over any background that is also set to transparent.

Since the whole issue with PNG support that we complained about in IE6, was the lack of full alpha transparency, I see the current implementation as only half way there.

By Jesper Lind - new web shop

Today we released a new web shop that we have been working on the last year. DJ Digga at Shelta has done the fine design himself and we have developed the shopping system. Sorry, the site is in swedish only.

By Jesper Lind

How to do URL-rewrite with ASP.NET?

To have the .aspx-prefix at the end and a lot of querystring parameters at the end of the URLs feels rather ungraceful. And it's not any good from a SEO-point of view. IIS 6 and ASP.NET has not got any good built in solution to do URL rewrite. But there are some solutions and I will collect a few links here that I read on the subject.

In Ruby on Rails URL-rewrite seems simple and is a natural part of the language. On Apache servers there are the mod_rewrite module which is great for all the PHP-developers.

With ASP.NET it's possible to use HttpContext.RewritePatt, but it's not as simple as it first appears. I found a lot of articles about soultiuons but many of them described problems with cacheing, themes and problems with Postback.

On there's an open source component that claimes to have solved a lot of these problems. I have not tried this myself though.

I have also read about the coming IIS 7.0 and that there will be a better support for URL rewrite. Lets hope so!

Some mixed references


By Jesper Lind

Adding appSettings items programmatically

This shows how to add appSettings items from your codebehind.

Configuration config = ConfigurationSettings.OpenWebConfiguration("~");

AppSettingsSection appSettingsSection = config.AppSettings;

appSettingsSection.Settings["MyKey"] = "The value to save!";


By Jesper Lind

Transactions with Asp.Net

Read about how to create a database transaction with Asp.Net.

SqlTransaction trans = null;
conn = new SqlConnection ( . . . );
trans = conn.BeginTransaction();
cmd = new Command();
cmd.Connenction = conn;
cmd.Transaction = trans;

catch(Exception objException)

By Jesper Lind