Fang Talks

Life is a team sport

Remember that Seriously Simple Reader for RSS I was working on? It’s actually coming along nicely!

At the start of today I already had most basic functionality implemented. You could register, login, add feeds, view them, and it even (in some cases inaccurately) keeps track of unread items! Periodically, the server will check the saved feeds for new items, and push any of those into the database so they can be viewed by users. This way, the program doesn’t have to check every feed on every page load. Optimization!

There’s still a couple features I want in that just aren’t there yet, but I didn’t bother with those today. Instead, I tackled the flow of the application. This morning, adding a feed or refreshing your list of items required the page to be reloaded (manually). I didn’t like that, and wanted to go for the single-page web-app thing. I already had the functional code, but now I just needed a way to run that without refreshing the page. AJAX to the rescue! I bit the dust and used jQuery instead of writing my own implementation of it. jQuery has a couple of nice shortcuts for calling other pages and retrieving their output. This way, I can give error- and success-messages without reloading the page, and can have it periodically check if the user’s list contains new items, giving an alert when it does.

It’s still far from perfect, but it’s a good start. I feel hella inexperienced with jQuery because frankly I am, so there’s a lot to learn there, too. But first I’ll be tackling the unread items problem. It currently keeps track of the highest item ID in the database at the moment a user views the page, and determines unread items that way. But what if the user adds a feed for which we already have some items stored? Those won’t be marked as unread for that user, because they’re older than the items at the top of his list. Think I already have a solution for this, but not sure if it works as well in practice as it does in my head.

So there’s that. Have a nice weekend, y’all!
~ Fang

Post a comment

Your email will stay hidden, required field are marked with a *.

Experimental anti-spam. You only have to do this once. (Hint: it's "Fang")