Thursday, 26 May 2016

When The White-throated Kingfisher Comes Visiting

A White-Throated Kingfisher Perching On My Roof One Morning (click to enlarge)

Just outside my bedroom window, there is this more-than-50-year-old mango tree. Doves, both Zebra and Spotted, make this tree their home. Regular tenants every night, some 4 or 5 of them.

Every now and then though, a White-throated Kingfisher will make this tree its dwelling too. Not permanent but just temporary for over a couple of days, even weeks maybe. I sometimes wonder why? Why such a short stay unlike the Doves.

Friday, 20 May 2016

Getting Xiaomi Mi 4i Detected On Windows XP

I have spent about 4 days working on this. So, I suppose it is worthy of me writing it down somewhere so that I won't have to slog through the whole process again.

Phone Not Detected

Someone in my household bought a new Xiaomi Mi 4i smartphone 2 months ago. Great phone at a great price, by the way. Being quite popular here in Asia, the last thing I would have thought is to have problems in getting this phone connected to Windows XP. The recommended way, I presume, was to install "Mi PC Suite" since the setup program was already included in the phone. But upon successfully installing "Mi PC Suite", Mi 4i was undetectable. No connection to Windows XP means no file transfers between the PC and the phone.

Mi 4i Device Drivers

Windows Explorer With The Xiaomi Mi 4i Device Detected On Windows XP

After working frantically for 4 days, and trying out various drivers, I am glad to say that I finally got the phone connected to Windows XP in the end. As far as I could tell, there were no problems with the transferred files. The file system and transferred files on the phone shows no sign of being corrupted.

Thursday, 5 May 2016

Python Script For Posting To Blogger (Via OAuth2)

I hope somebody will find this Python script useful. I actually used this Python script to test things out first (and make sure that everything works) before I started work on fixing RavenPlus last year. I can't remember now, but I think the gist of this script came off from b.py - a Python script for posting blog posts to Blogger and Wordpress.

To post to your blog from this script, remember to replace the blogID "1087XXX5764091XXX95" in the line

post = service.posts().insert(blogId="1087XXX5764091XXX95", body=body, isDraft=False).execute(credentials.authorize(Http()))

with your blog's blogID.

To update an existing blog post, just replace the line above with the following (NOTE: you will need to find out what your blog post postID is, otherwise the statement will fail):

post = service.posts().update(blogId="1087XXX5764091XXX95", postId="4781959859649019078", body=body, publish=True).execute(credentials.authorize(Http()))

The OAuth2 login credentials is named 'plus.dat' and it must be located in the same directory as this Python script file.

I ran this script file under Python 2.4 with some customisation made to the Google API Python Client Library Version 1.2.

The Source Code