Monthly Archives: July 2012

This Week

Not so productive days.
Down with fever.
Way too much of sleeping and idleness, its sick.
Symposium Gang Split with friends on both side.
Time to get myself busy.
via QuickPress

Advertisements

Up and Running on http://fbcoverapp.appspot.com

  • Facebook Cover Generator is Up and Running on http://fbcoverapp.appspot.com
  • Caching Facebook Cover directly via Profile Link is way buggy. I don’t know whether its my fault. It runs perfectly well locally, but returns “NoneType” Exception when deployed. So it found its place in Junk Code :-)
  • It’s not well written. Not all errors are handled. But it works. Enough for a relatively small usage.
  • If the participants of the symposium get access to a wifi network, probably I might try to develop a mobile application that keeps them updated of current events and venue.

via QuickPress

Working On

I’m surprised its taking a lot of time ( hell a lot! ), to fix things and get the script to work as intended. The script to fetch cover pic from fb, and mask it with Symposium’s Poster.
Learn’t how image files can be converted to strings to store it in a db, or just use it without storing at all, just toggling them vice versa.
Lazily written bad code , chains up a train of bugs as reward.
It takes me an entire night to get, atleast to a working version of a relatively simpler application. Damn ! I have to upgrade my Intelligence Quotient or I die of insomnia.

via QuickPress

Log For A not-yet-done App

This is a collection of steps for building the app, Since I had to digg them from an awful lot of sources scattered around the Web, Just to put them together and make it easy for me to refer tomorrow.

Trying to write an Application that will generate a fb cover pic for my College’s Symposium promoters. First I needed to learn how PIL processed images, and yes, I got it. The Story goes like this,

  • And in the beginning there were two images and they were good :-)
  • One which the user uploads(Generating a common cover, would have been easier, but using user uploaded images give it a personal touch), and another image that will be designed by me to mask the user’s image.
  • A bit of editing of user’s pic. Increase brightness ImageEnhancer.Brightness(UserPic).enhance(1.5)
  • Then a desaturated effect with ImageEnhancer.Color(UserPic).enhance(0.5)
  • Then, a blurry touch with ImageEnhancer.Sharpness(UserPic).enhance(-0.5)
  • Thats it, Now blendedImage = Image.blend(MyPic, UserPic, 0.5) will give me a masked and merged image.
  • Then comes the slogan or tag whatever you call it. For this I have to use ImageDraw Class.
  • canvas = ImageDraw.Draw(MaskedImage)
    canvas.text((10,10),"My Text",(0,255,0))
    This wil write my text on the image, in programmer’s green :-)
  • Image ready to be stamped with our Symposium’s Seal. Stuff that can be done later, when the name gets finalised.

Instead of my friends uploading their pic, which is actually a boring part, why not let them enter their fb profile link and let my app fetch their current cover picture as ‘UserPic’.
That would be a bit more elegant way.
But it holds a problem. ‘Smart’ facebook coders have hidden all personal data from being read by any pre-programmed script.
This is the part where geeks have their role.
A bit of a hacking had to be done, after I came to know the intentionally placed "" had to be removed before parsing the html source.
import re
hackedHtml = re.sub('<!--', ' ', SecuredText)

That tiny piece of code did the thing.
So, Now I get hold of the user’s Cover and we all live happily ever after…
via QuickPress

DevLog: How It Worked(QuickPress)

This will be of no use to you. This is just a log of how QuickPress came into life.

  • Had to install the tools required- PyQt4, PyKDE4(Linux),pyuic4,python-wordpress-xmlrpc,lxml
  • Designed the user interface in QtDesigner which generated the .ui file. This could have been coded, but I hate diving into documentation for reasonably trivial thingies. The greatest advantage was by looking at the code generated, I learnt GUI Programming and learning from code is far better than any of the best books. Sort of Reverse Engineering
  • Generated the python script from ui file using pyuic4.
  • Wrote the main handler script which imports the designed GUI Object and wrote a thin wrapper to modify its properties. This is where my actual code goes.
  • Time to turn it into an executable that runs on multiple platforms. Why else could anybody choose Qt for?
  • Used PyInstaller. The process was way too smooth for windows. In Linux there were bugs, in hooks for importing modules. Worked it out by hardcoding the buggy import statement in the raw Python Script.
  • Everything else, pyinstaller and its long schezophrenic log messages took care.
  • For Gnome, KDE I had to write a QuickPress.desktop configuration file, that took care of linux specific stuff.
  • …..and Finally, It was done. I anticipated a slower performance, since it was written with a scripting language, but to my surprise, the app responded exceptionally perfect.
  • My First GUI app, a Greeting card Application, written in Java was responding a little bit faster than a turtle walk, to the GUI events! That should be so, because it had to draw its own interface using its swing or awt classes.
  • But in QuickPress, Qt was just a binding to the OS’s native GUI elements. that made it faster and better. Even, its looks gently morphed with the OS’s native looks and gives a homely touch.
  • And here comes Sunday Morn! Time to sleep.

via QuickPress

Vote Of Thanks

Successfully shipped QuickPress from linux to Windows. So, Lets ‘hurray’ for that!
Its time to thank.
Thanks Qt, and your excellent cross platform support.
Thanks PyInstaller for doing the actual porting work.
Last, but not the Least, thank you pyQt4 and Qt Documentation, without you it would never have been possible. Thankyou, Once again.

Hey, I thought I was a bad orator! :-P

via QuickPress

QuickPress – A Desktop GUI to publish to WordPress

A Handy GUI Tool to publish my posts to WordPress, Wouldn’t it be cool?

GTK was lacking updated Documentation, Well, atleast for me, I didn’t find any up-to-date content. Thanks, lazy me.
Qt on the otherhand, had extremely wide set of resources, and it helped.

My App, its just a QMainWindow that displays a QTextEdit Object and QLineText Object, a Kpushbutton that listens for the “clicked()” SIGNAL and executes the “post” SLOT. Ultra Simple. Way more to go.

Snapshot:

Code @ github