Monthly Archives: December 2012

[PYTHON] Crazy for loop else statement

http://pastebin.com/cFWkexuB

Advertisements

[Ubuntu] Install Scrapy in Ubuntu 12.04/12.10 with easy_install

– I have tried to install Scrapy with easy_install ( install easy_install_tools)
– then when running easy_install Scrapy .
it got stuck at step installing twisted with some fucking error like

twisted/runner/portmap.c:10:20: fatal error: Python.h: No such file or directory
compilation terminated.

it turned out I had to install python-dev packge first
( ref: http://nickhumphreyit.blogspot.com/2011/10/buildbot-install-error.html )


apt-get install python-dev


[Ubuntu] How to install new font in Ubuntu 12.04 /12.10

Step 1 : install gnome-tweak tool by :

 sudo apt-get install gnome-tweak-tool

Step 2: open tweak tool ( press Super key then type in “tweak” ) 

then change everything you like 

 

 


[Instagram] How to get more than 60 images from Instagram service

Hi,

Recently, I have created an app that uses instagram images ,.( I made this app for other guy, so i can not reveal it here ).
The problem is that , Instagram only returned first 60 images per returned pack. So if you have more than 60 images, and you want to get these older images, you must find out some way to deal with that. And here is what I did in my app.

It turned out  Instagram provided us a pagination mechanism to get each 60 images, The first request will return 60 newest images, then you then the oldest id of images returned from previous pack.
Just add token “max_id” with the token’s value is the oldest image id:
For example, this is how I create my JSONObject for request more images.
JSONObject feedJson = executeHttpGet("https://api.instagram.com/v1/users/"
+ userId
+ "/media/recent/"
+ "?access_token="
+ token
+ "&count=" + mediaCount
+ "&max_id=" + mOldestId);

The excuteHttpGet is my private method based on HttpClient and HttpResponse to send get read the response from server.

That’s it.