up and down, round and round.


Retrieve RSS Feed and publish to webpage as HTML UL list.
23/08/2011, 08:39
Filed under: ASP.NET, C#, Programming, RSS

A simple method for retrieving an RSS feed and convert it to an HTML unordered list. Some feeds may differ in the xpath used, so change the
XmlNodeList rssNodeList = rss.DocumentElement.SelectNodes(“channel/item”);
and
string itemTitle = rssItem.SelectSingleNode(“title”).InnerText;
string itemLink = rssItem.SelectSingleNode(“link”).InnerText;

to get it tailored like you want it :-)

/// <summary>
/// Converts an RSS feed to an HTML UL list with title and links to the article, blogpost etc.
/// </summary>
/// <param name="pRssFeedToLoad">The RSS feeds URI. (Either from disk, or url)</param>
/// <returns>A fully XHTML formatted unordered list with css class "RssFeed"</returns>
protected string ShowRSSFeed(string pRssFeedToLoad)
{
// setup initial stringbuilder, for creating an HTML UL list.
StringBuilder sb = new StringBuilder();
sb.AppendLine("<ul class=\"RssFeed\">");

// create a new xml document used for parsing
XmlDocument rss = new XmlDocument();

// load the rss feed either from disk or url.
rss.Load(pRssFeedToLoad);

// select the items
XmlNodeList rssNodeList = rss.DocumentElement.SelectNodes("channel/item");

// traverse the items in the feed.
foreach (XmlNode rssItem in rssNodeList)
{
// get the needed data from the item.
string itemTitle = rssItem.SelectSingleNode("title").InnerText;
string itemLink = rssItem.SelectSingleNode("link").InnerText;

// create HTML LI element.
sb.AppendLine("<li>");
sb.AppendLine(string.Format("<a href=\"{0}\">{1}</a>", itemLink, itemTitle));
sb.AppendLine("</li>");
}

// close the HTML UL list.
sb.AppendLine("</ul>");

// return the HTML UL list.
return sb.ToString();
}



Using Python with S60.
16/02/2009, 11:31
Filed under: Programming, School | Tags: , , , , , , , ,

Want to write an application for your smartphone but don’t have the C++ knowledge required or want to write in another language (or perhaps you know Python already and want to utilitize your knowledge)? Why not use Python? For all Series 60 (S60)  enabled smartphones Nokia has released a runtime and shell interpreter for Python that let’s you write your own Python scripts / applications with a bit more ease than writing it in C++.

The Python package for the S60 are called “PyS60″ and this can be downloaded from Sourceforge.net [Link]

Look at this page called Mobilenin for some pyS60 tutorials. [Link]
The pyS60 tutorials are written by Jurgen Scheible and are easy to follow to create some nice python application examples.

Jurgen Scheible had a presentation at my university about a year ago, where he talked about Python for the Series 60 phones. He also showed some examples and let the attendants write some simple test applications. It’s worth to take a look at, if you would like to write a program in a different language than C++ or Java :-)

Have fun!

“If it moves, compile it.” -GentooLinux




Follow

Get every new post delivered to your Inbox.