How do I read all feed items? - c#

I want to read all items of a feed in C#. The solutions I've found are only for the latest items like just the last 10 days.
Anybody has a good solution for this?

Libraries for reading feeds typically read all the data in the feed, but feeds typically only contain recent data - you need a source of data that includes older items, not a better library for reading the data you have.
Most entities publish feeds to allow people to track when new content is published, not to make all their data available in a more convenient machine readable format. For this purpose, publishing recent data only makes sense as it saves on bandwidth.

If you can tie into something like Google Reader, which archives old feed items (although I'm not sure it's a permanent archive or not), then perhaps you can accomplish this.

Most RSS feeds are only written to deliver a relatively short period of time - 'all' items in a feed generally need you to have created your own archive over time.

Extending thomas' answer, The two google-related archives of feed data you can find are the official one:
Google AJAX Feed API
http://code.google.com/apis/ajaxfeeds/
which will limit you to 250 items, and the unofficial one:
Google Reader API
http://www.niallkennedy.com/blog/2005/12/google-reader-api.html
which will give you unlimited (i think) items but you will need to work around their authentication (something with cookies) and pray they don't change or drop the API (as it is undocumented).

I tried Google Reader, but ther archive was incomplete. I know the people who run the blogs, so I just asked them for a export.

Related

Reading OBS PBF files using C#

I downloaded a .osm.pbf file at http://download.geofabrik.de/europe.html.
I need to convert the data (streets etc) to Graphs so I can calculate routes. I believe these files already work with Nodes but I have trouble reading the data.
I tried using http://www.osmsharp.com/ but I don't really understand the software.
Can someone give me links to a proper library or give me a few tips in how to access the data from the OSM. Some pseudo / example code is fine aswell.
I'm new to openstreetmaps and this kind of parsing, so I'm sorry if this is a rookie question.
If you have questions please do tell!
Thanks!
I suggest to play around with OSM XML first to get an idea about how OSM data works. It is also very helpful to launch an OSM editor (e.g. the browser editor iD or the standalone editor JOSM) to take a look at real OSM data.
Later you can read about the PBF format (it is mainly smaller and faster than OSM XML) and about PBF software support. Use one of the existing libraries, don't try to reinvent the wheel.
Also read about how to calculate a routing graph from OSM data. Also look at routing in the OSM wiki. There is some general information available as well as a list of online and offline routers. If you are stuck you can take a look at their implementations.

Code to read Word docs

I need a script (or other code, C#, etc.) that will fetch every paragraph/sentence containing a particular word in a set of Word 2007 documents and move them to a new Word document, recording the filename of the original (source) document they were extracted from.
What about using a document indexer, such as dtSearch to index your documents (word, pdf, etc), and then tap into their API to do your unique searches that way. From what it sounds that might be the fastest way to accomplish this. Granted indexers like dtSearch cost money (not a whole lot), but sometimes it may be worth the cost compared to the hours you will spend trying to write your own code to do the same thing.
Some articles that I have found that might lead you in the right direction if you don't want to use an indexer are:
http://omegacoder.com/?p=555
and
http://weblogs.asp.net/guystarbuck/archive/2008/05/13/automated-search-and-replace-in-multiple-word-2007-documents-with-c.aspx
Edit
To find a sentence that contains a specific word, you can try this link http://msdn.microsoft.com/en-us/library/bb546163.aspx
This might give you a start: http://msdn.microsoft.com/en-us/library/ff834910.aspx
Office Interop is an option but beware: it is not supported by MS in server-like scenarios (like ASP.NET or Windows Service or similar) - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2 !
You will need to use some library to achieve what you want:
MS provides the OpenXML SDK V 2.0 (free)
Aspose.Words (commercial)

.net API for managing pst files

I have an old PC on which i have a large pst file , and i have the idea to write a small C# program to spilt it into smaller files so that i can better manage them if needed ( i know that sounds weird and that there are also available tools in google but i thought it will be fun to play with it ).The problem is that i can't find good article or API info which functions are best suited ( if there are any at all ) for managing those files , Ideas ?
Thanks in advance
Take a look at Redemption API. This API does not require Outlook to be installed (only stand-alone MAPI) and does not require outlook to run.
First just a clarification by PST file you mean you outlook information?
Running on that I know of no API to manipulate it but you can get the documentation for it at http://msdn.microsoft.com/en-us/library/ff385210(v=office.12).aspx this is a large and complex specification for a binary format. Always play with a copy of it not the real thing.
One approach that might be better is using the ActiveX/COM interface provided by outlook to interact with this file abstractly, so instead of dealing with the physical layout of the file work with contacts, folder and email messages.
It may be worth your while finding out how open source mail clients (Like thunderbird) import from outlook. You may be able to pull there code out into an API, as long as you follow the licence conditions.
Not the easier answer, but it is the one I have.

Subscribe to an RSS Feed

I am writing a very simple RSS reader - all it needs to do is get the xml doc, and print to the console the title and publish date of every item. I got started using these two questions:
How can I get started making a C# RSS Reader?
Reading the Stack Overflow RSS feed
I'm trying to figure out how to subscribe, and as far as I can figure you do it one of two ways. Send an HTTP request to the feed site so it pushes you updates as they come, or poll the site every X seconds and simply print the new ones.
I find it difficult the believe that there is no way to subscribe due to the millions of RSS readers running at any given moment, popular RSS sites like facebook, twitter, or myspace would be hit hundreds of millions of times per second due to all the RSS readers "subscribed" to it and look like a DOS attack.
So what is the "standard" way to subscribe to an RSS feed, if such a standard truely exists?
The standard way is to poll. Not every x seconds but every x minutes or x hours.
The reasoning behind RSS is to keep the feed extremely simple. Small download and the same file can be served to all subscribers (easy to cache in memory and no processing overhead to find out exactly what and when to send to each client).
Not sure you quite understand the concept of RSS feeds.
It is simple:
You application (RSS reader) sends an HTTP GET request to given RSS feed url.
You get XML in return.
You parse that XML and show that data on your UI.
And generally, the websites you mentioned are smart enough to identify DOS attacks (for example, frequent requests from same IP in very short time). So, you don't have to worry about that.
Also, while creating an RSS reader, every time you get new XML from feed url, you have to identify new posts from old ones (that you already have on your UI). Timestamps are generally used to identify posts, but, there no standard way of doing that.
RSS on a site / server does not manage any suscriptions. The suscription is only a concept in the RSS reader. That keeps stuff simple on the RSS server side, as there's no need for suscription management which made the protocol easy to adopt.
You have to periodically poll the RSS feed by an HTTP GET to the feed URL. You get a XML document in the RSS format in return. Then you parse it and display the infos you like. Voila.

Resume in upload file control

I did read the following posts:
Pause/Resume Upload in C#
resume uploads using HTTP?
But didn't got a perfect solution to my problem.
In the above posts, one of the answers says "client and server needs to identify the file some how i suggest the use of a Guid so the server knows what file to append the extra data too." Request you to plz visit the first link of the aobve and find that answer. This answer is all about streaming. Can someone plz provide links using which I can build such kind of code?
In these posts one of the answer said "you can send several small file pieces and rebuild them server side"...HOW?
Can't I use something like checksum etc to detect how much part is uploaded and how much more needs to be and append it to that file? If yes, how?
Streams are a fairly fundemental concept in working with files on the .NET platform (as it is in Java, C and other languages). You should start by reading about them and how to use them. See the Stream class on MSDN.
HOW? By using streaming - you stream parts of the file, in small chunks (using an offset into the file and the size of chunk). Again, see Stream documentation.
You could, but checksums of different files may be the same - with a GUID the chance of a collision is pretty small compared to checksums.

Categories