Thursday, February 22, 2007

Reading Syndic8 Feeds with Xml-RPC using C#

Recently , i need to query syndic8 database for feeds with some interest. The syndic8 is an excellent source for all types of feeds. This site is caching feeds since 2001 and got richer in content by its graceful users.

Syndic8 lets query in XML-RPC. The web-service section of the site provides all the necessary function informations to get you started. There are also some references of how to write app consuming XML-RPC.As i like to get things done in C#. I found a pretty cool xml-rpc library written completely in C# that enables you to make proxy in WCF(Windows communication foundation) style.I would definitely suggest to give a try. The library could be found at- http://www.xml-rpc.net/.

To get started with this , all it takes an Interface with endpoint defination and some method skeletons.

For example , a sample interface could look something like the following.

[XmlRpcUrl("http://www.syndic8.com/xmlrpc.php")] -- // end point
public interface ISyndic8 : IXmlRpcProxy
{
[XmlRpcMethod("syndic8.GetAllFeedTags")] -- function signature in sydnic8
string[] GetAllTags();

[XmlRpcMethod("syndic8.FindFeeds")]
int[] FindFeeds(string pattern, string field, int limit, int index);

[XmlRpcMethod("syndic8.GetFeedFields")]
string[] GetFeedFields();

[XmlRpcMethod("syndic8.GetFeedInfo")]
Feed GetFeedInfo(int feedId);

[XmlRpcMethod("syndic8.GetFeedInfo")]
Feed[] GetFeedInfos(int[] feedId);

}

Note, i have also defined a custom struct for holding the syndic8 feed ,which is nothing but a struct filled with properties defined in sydic8 that i have found from their own GetFeedFields routine.

Finally to wrap this up , i just created simple interface reference using the rpc library and the rest is just call and get.

ISyndic8 proxy = (ISyndic8)XmlRpcProxyGen.Create(typeof(Syndic8Test.ISyndic8));
//the proxy will expire after single call, so that you can call multple methods in one instance. Default is true.
proxy.KeepAlive = false;


Hope, this gives a brief overview of sydic8 repo and xml-rpc libray for .net for getting your database filled with feeds in no time.

Sunday, February 18, 2007

Http POST variables from C# to php

In php >= 4(so far i know) , developer can do set-get with POST variables in the following way

HTTP_POST_VARS['flakeIds'] = array('guid1','guid2','guid3');

This means you have array of guids in post vars, which has a element id named "flakeIds".Now, let's say someone gives you a php link that takes array of items, which you need to send from your C# code as confirmation or something like that.

Generally you will do a web request , with method type set to POST. This type of scenario , where it is necessary to pass array items over http POST,you should prepare your query string in the following way..

string params = "flakeids[]=1171722632&flakeids[]=1171723000";

byte [] bytes = System.Text.Encoding.ASCII.GetBytes(params);

Notice , just the same element name terminating with an "[]". Interesting huh.

Happy Coding!

Friday, February 16, 2007

Life at Startup

Though , working in startup is always a fun, with the sheer adrenalin rush and round the clock routine. Still, one should try,only if he is really bored with his life(Please dont try this at home).

In normal job, life is more streamlined. You will go to office at 9 and come at 5 and blah blah... But startups are complete different in that context. It has no fixed time, every day is a new day and every night can just become a nightmare for you when you have gone to bed thinking , what a perfect day it was, and suddenly your boss calls you up telling that your code crashed the server or a piece of text, inside a span tag that works in all browser, does not even show in IE6 :-)

Hey, scared already. Good news is people join at startup, because they want to do something on their own or see a baby grow right in front of their eyes. it is always a fun to see a little company growing bigger or vice-versa.
To be honest, if you like to work and work , join a startup, else go to bed.

Sunday, February 4, 2007

Windows Vista goes live

The worldwide release of Windows Vista , ended up with parties and musics. Anyone , who wish to see how the release looked like, can go to Microsoft's website and hit for the on-demand webcast. It's a pretty nice one, where Bill Gates, gave an overview of how it was like 12 years back , when the release of windows 95 takes the world by storm and how technology has evolved since, with pcs having lesser form factor, easy broadband access and ever growing web 2.0 apps.

Here in Kualalumpur, Malaysia the feel isn't much different. Release event in KL convention center, shows and games in Plaza Low Yat celebrating the release of windows vista were just awesome. Being an early adopter, i was walking around the stores hoping to upgrade from my vista beta to RTM. I saw some stores selling copies which are meant for delivering with newly assembled pcs, but will wait until the original retail copy of "Vista Ultimate" is available :-).

A Reader's Toolbox

There are basically two types of business web hosting one is for windows server and second is for UNIX server. You will find windows cheap hosting as compared to other hosting. Most of hosting companies are offering package sales and providing free web site templates. There are many companies providing webhosting reviews. There are lots of companies that are providing wireless hosting services for their customers. You can easily find web host online so that you can get all information about. The best hosting services are available for you at gator so you can use them.