Posts Tagged ‘ python

Listing all your blogposts

So here is a quick snapshot at how to get all your wordpress blogposts using python [or wordpresslib to be specific]

#!/usr/bin/env python
import wordpresslib
import tinyurl
wordpress = raw_input('Wordpress URL:')
user = raw_input('Username:')
password = raw_input('Password:')
# prepare client object
wp = wordpresslib.WordPressClient(wordpress, user, password)
# select blog id
wp.selectBlog(0)
posts = wp.getRecentPosts(100)
for p in posts:
if p.title.find("p=")<0:
    print p.title," - ",tinyurl.create_one(p.link)
Now that is real easy to use IMHO, i just started using this in one of my scripts. It is easy to use this and plug into other systems which use python !
Resources:

Jailed in FreeBSD

Well, working on freeBSD right now some immediate learnings for most linux users

  • Ports is as good as apt-get [and i would say much better, when i started installing stuff]
  • You will need to start with installing vim and bash to make your life a lot easier

So the target was to install python and nginx, both of which are very easy to install once you understand how the whole ports collection system works. So here is the guide to installing nginx

portsnap fetch – This gets the portsnap collection file

portsnap update – This updates the collection directory at /usr/ports

Then goto /usr/ports/www/nginx and use make, it throws up a very nice module selection menu which i really like. I do wish that apt-get was like this when it came to installing stuff like this. The final step is a make install Simple is it not.

Python is very similar when you want to install as well ! More as i finish my installation and tweaking, having some issues with nginx latency !

obsessing about bdb, queues

So my nightmares do no cease to end, still debating queue solutions and databases. After spending a lot of time thinking about how to handle 100 million entries , concurrency and a lot of jazz here are some conclusions that I have reached.

  • Tokyo Tyrant needs some testing personally. Can it work well within a constrained VPS ? I doubt that after reading all the test results. So need to do a benchmark for this.
  • Tornado , the friendfeed (facebook) non-blocking server looks cool. The primary issues are the lack of an plugin architecture much like django or rails, guess that is something i can give back to them (if and when i start working on it).
  • Python set lookups are blazing fast, in a benchmark today it beat lists lookup (800000 entries) by 10 times

Feeling much better after the flu, I hope to write more often so that the ether (ie the internet) can crawl and archive my existence ;) .

bangalore, h1n1 and queues

So for that last one week a major area of work has been queues and here are the various queues that i encountered

  • memqueuedb - a speedy message queue based upon the memcached client protocol. The idea was to use it to cache certain objects in a system.
  • JMS – Seems to be an integral part of my J2EE learning, this is what often defines performance in an application. Especially when good high speed JMS library implementation cost big money.
  • Airport taxi queue – Now you get in line to get a coupon for a taxi (10 people ahead of you) and then you get on a line with 40 people ahead of you all waiting for taxis at My capital city airport. Awesome. (Did I just see a newspaper whack me on the head :P )
  • Python queue(or Queue) - The real star :) , it actually is well synchronised with locking and all. Quite a rock star data structure he he, must use one of these days for something.

That was the end of the queue rant. Forgiveness for having to bear that. Next on line is Bangalore, I regret carrying a camera as it is super picturesque. Though once i landed the really really dusty air got to me. So by day 2, I ended up with a fever. Sorry to Pallav, and the rest of my friends whom i could not catch up with.

Any how, the point is the first question I asked myself do I have H1n1 (aka swine flu). To make sure i did not, i have taken the pains to outline a checklist for symptoms for the same.

  1. fever
  2. cough
  3. sore throat
  4. body aches
  5. headache
  6. chills
  7. fatigue

Now I did not have 4,5,6 and 7, but just for precaution am going to the doctor and getting myself tested. The only way to stop this from becoming the “plague” of our generation, is that we all consciously take precautions (especially when you can afford to, which I believe most of my readers can).

It is 100% treatable (well, that is what they say) when diagonosis is early. Tamiflu is also going to be available at drug stores. Take care everyone.

Twitter background generator version 0.1

Working on a very basic twitter background generator, right now focusing on how to get the sidebar width right. It is very much under use at my twitter handle @dipankarsarkar (http://twitter.com/dipankarsarkar). The core idea is to be abe to communicate more information about what i do as a person using the background image. Some features that I personally want are

  • Transparency for the sidebar – The image underneath should be visible, right now its a grey opaque color.
  • A right sidebar – After some research , I figured out that the safest and optimal width to cater for is 1200px, with the core content on the left sidebar though. More thoughts on that as I deploy some new changes.
  • Better fonts – Although new fonts / languages can be deployed. The code is not flexible enough right now to add new fonts.

That is a long enough list for the day :) , attaching the background with this as well. Let me know in case having cool backgrounds excite you.