Nodes with physics engine in Flash
Been playing some more with the physics engine Flade. In this example you can create new wheels by clicking on the screen.
Instructions
1. Click one time on the screen.
2. Mouse click to create small wheels
3. Control with left<>right arrow buttons
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.
Instructions
1. Click one time on the screen.
2. Control with left<>right arrow buttons
Drop shadow with transparent PNG
I found an interesting article on PositionIsEverything.net about how you can create dropshadows with transparent PNG images.
The HTML code for creating a box looks like this.
Link to CSS
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.
protected void GenerateRss()
{
try
{
//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;
xtw.WriteStartDocument();
//skriv ut <rss version="2.0">
xtw.WriteStartElement("rss");
xtw.WriteAttributeString("version","2.0");
//skriv ut <channel>
xtw.WriteStartElement("channel");
//skriv ut element som tillhör <channel>
xtw.WriteElementString("title","Codeodyssey.se");
xtw.WriteElementString("link","http://www.codeodyssey.se/");
xtw.WriteElementString("description","Code Odyssey - expanderar webben");
xtw.WriteElementString("language","sv-SE");
xtw.WriteElementString("copyright","Copyright (c) 2004-2006 Code Odyssey");
OleDbConnection conn = new OleDbConnection (strConn);
bool boolPermission = false;
OleDbDataReader objDataReader=null;
try
{
string strSQL = "SELECT Blog.Id, Blog.Title, Blog.Body, Blog.PublishDate FROM Blog ORDER BY Blog.PublishDate DESC";
conn.Open();
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.WriteStartElement("item");
xtw.WriteElementString("title",Title);
xtw.WriteElementString("link","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
xtw.WriteElementString("guid","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
xtw.WriteElementString("description",Body);
xtw.WriteElementString("pubDate",PublishDate);
xtw.WriteEndElement();
}
objCommand.Dispose();
}
catch (Exception objException)
{
Trace.Warn("GenerateRss() Fel!",objException.Message);
}
finally
{
if(objDataReader!=null)
{
objDataReader.Close();
}
onn.Close();
}
//skriv ut </channel>
xtw.WriteEndElement();
//skriv ut </rss>
xtw.WriteEndElement();
//Stäng xml skrivaren
xtw.Close();
}
catch (Exception objException)
{
Trace.Warn("GenerateRss() Fel!",objException.Message);
}
}
This is how to add the icon in the browser.
This is how to add such a link from the code behind:
link.Attributes.Add("type", "application/rss+xml");
link.Attributes.Add("rel", "alternate");
link.Attributes.Add("href", "feed/rss.xml");
this.Page.Header.Controls.Add(link);
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.
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.
Shelta.se - 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.
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 Urlrewriting.net 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
http://weblogs.asp.net/fmarguerie/archive/2004/11/18/265719.aspx http://www.aspnetpro.com/NewsletterArticle/2003/09/asp200309pj_l/asp200309pj_l.asp. http://www.developersdex.com/gurus/articles/793.asp?Page=3 http://www.webforum.nu/showthread.php?t=145530. http://www.raftweb.info/SEO/1032.aspx
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!";
config.Save();
Transactions with Asp.Net
Read about how to create a database transaction with Asp.Net.
try
{
conn = new SqlConnection ( . . . );
conn.Open();
trans = conn.BeginTransaction();
cmd = new Command();
cmd.Connenction = conn;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
}
catch(Exception objException)
{
if(trans!=null)
trans.Rollback();
}
finally
{
if(conn!=null)
conn.Close();
}