The easiest way to add custom elements to a syndicated (ATOM/RSS feed) is to use an XElement, like this:
SyndicationFeed feed = new SyndicationFeed("FeedName", "Feed description");
//fill feed with items (omitted)
XNamespace ns = "http://tempuri.org/myapp";
feed.ElementExtensions.Add(new XElement(ns + "myCustomProperty", "hello"));
return new Atom10FeedFormatter(feed) // to return as an atom feed
Happy feeding!
Thursday, August 28, 2008
Wednesday, August 6, 2008
Sunday, August 3, 2008
Entity Framework will hit with VS2008 SP1
Finally its coming! With Visual Studio SP1, the final version of entity framework will be included.
I'm expecting the .NET 3.5 certification exam to go live shortly after, finally!
I'm expecting the .NET 3.5 certification exam to go live shortly after, finally!
Wednesday, July 30, 2008
Friday, July 18, 2008
Grab that icon with .NET
Many people just dont know there's a very easy way to get any program icon you need.
Here's the code
Icon icon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
using (FileStream fs = new FileStream(@"c:\explorer.ico", FileMode.Create))
{
icon.Save(fs);
}
Here's the code
Icon icon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
using (FileStream fs = new FileStream(@"c:\explorer.ico", FileMode.Create))
{
icon.Save(fs);
}
Sunday, July 13, 2008
Embedded resources and clean folder structure - yes you can.
If you have a bunch of embedded resources in a folder, the single most efficient way to get a stream to them is to create a dummy class in that folder. Aside from it being internal or public, it doesn't have to do a thing.
You then use the type of this object in calls to get this resource, eg Assembly.GetManifestResourceStream. With this type, the namespace is looked up for the folder, and the embedded items in it are effortlessly resolved.
eg:
Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(ImageResourceResolver), "myicon.ico");
You then use the type of this object in calls to get this resource, eg Assembly.GetManifestResourceStream. With this type, the namespace is looked up for the folder, and the embedded items in it are effortlessly resolved.
eg:
Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(ImageResourceResolver), "myicon.ico");
Saturday, July 12, 2008
//You do not need to understand this
Maintenance programming... hated by most, yet essential.
Good things to do for the poor sod who has to maintain your code after you left:
heheeh.... maintenance programming has its ups and downs. But you can make it hell if you like. If you happen to hop into a job where you get thrown at code that looks like the latter... I do not envy you :)
Good things to do for the poor sod who has to maintain your code after you left:
- Comment clearly and not too much
- Put in a clear roundup what the function is supposed to do
- ... add some explanation for your parameters
- Keep speaking variablenames, but go easy on the length :)
- Be consistent in these names.. p preceeds a pointer, s a string, i an integer and so on
- Avoid pressing complicated statements into one line
- Ignore all of the above
- i is good, use often like nested for{} statements with i for the outer loop and ii for the next :)
- Take extremely good care of your pointers and never set them to NULL when you free()
- Place comments like //Taking care of X... when you do nothing the like
heheeh.... maintenance programming has its ups and downs. But you can make it hell if you like. If you happen to hop into a job where you get thrown at code that looks like the latter... I do not envy you :)
Subscribe to:
Posts (Atom)