Category Archives: Coding

Django Class-Based Generic Views

After working with Paypouy on a quick project using the php-based, shared-hosting-friendly CodeIgniter, I’m back to the more familiar waters of Python/Django.

I was asked to create a small organizer/calendar type app for a client to be used mainly from a smart phone. The app seemed very straight forward, so I thought I’d rely on the generic views for most of the work.

Check out some of the code after the break Continue reading

Similar Posts:

Tagged , , , , ,

Using ePubLib for Android

I’m rewriting the Examine the Scriptures Daily android app. With the ESD files published as ePub files it’s easier to get the data now, and it will allow more languages to be supported without the hassle of converting from WTLib.

Here’s the code snippet I’m using to read the ePub book. The library I’m using is ePubLib, and I’m displaying the page in a standard WebView:

    // Load the book and get a specific date
    AssetManager assetManager = getAssets();
    try {
		// find InputStream for book
		InputStream epubInputStream ="es12_E.epub");
		// Load Book from inputStream = (new EpubReader()).readEpub(epubInputStream);
	} catch (IOException e) {
		Log.e("epublib", e.getMessage());

    private void getSpecificdate(String day) { 
		Date d; 
		int dayOfMonth;
		int monthOfYear;
		Calendar cal = Calendar.getInstance();
		try {
			d = dateFormat.parse(day);
			String hrefDate = hrefFormat.format(d).toUpperCase();
			hrefDate += (dayOfMonth==1) ? ".xhtml" : "-split"+dayOfMonth+".xhtml";
			hrefDate = dblzero.format(monthOfYear+4)+hrefDate.substring(2);
            // Here's the part you're looking for
			Resource r =;
			WebView wv = (WebView) findViewById(;
			String data = new String( r.getData() );
			wv.loadDataWithBaseURL("file:///android_asset/", data, "text/html", "utf-8", null);
		} catch (ParseException e) {

Similar Posts:

Tagged , , , , , ,

Site ScreenShot Part 2 – Planning

I was having a little conversation with my friend Ghassan from LebanonDesign and he mentioned his company was actually using something similar to SiteScreenShot to generate thumbnails for their different websites. So I thought I could scale my code to do the same. Of course, plenty of changes should be considered:

  • Snapshot generation currently takes 3-5 seconds to complete. So I need to do 2 things:
    • Tell the user that the app is actually working on generating the snapshot
    • Provide a way to retrieve the pic once the snapshot is generated
    • Make things go faster if possible
  • Getting more users means more load on the server, what should we use?
    • Replace Apache with Nginx for faster static file delivery
    • Use a queue manager like Celery/RabbitQM to distribute the load

I’m currently testing some code with django-celery and I’ll try to post more information here (so I can remember what I’m doing)

Also on my list is making the site accessible via a simple API.

I also need to research a better way to take the screenshots on a headless server.


Similar Posts:

Tagged , , , , , ,

Site Screen Shot

Last week my friend Fernando Duran posted a note about his Site2Pic weekend app. It sounded like a great idea, so I asked Paypouy to cook up a simple design and wrote my own version using django and a few other open source libraries.


My app now lives at SSS.GRAT.IN

Take it for a spin, and tweet me @abdallahdeeb if you like it 🙂

Similar Posts:

Tagged , , ,

Daily Scriptures Android App

I’ve been working on my M/WHM app for Android.

That was delayed because of a computer crash that brought me back a week or so on coding (thanks to github, everything is not lost). That gave me time to think through some design decisions, so I postponed going back to work on that for a little while.

Meanwhile, I wrote a daily scriptures reading app for android. The code is now on github at I will release it on the market in a few days when I test it some more.

A (mostly) working .APK is attached to this post. Feel free to contact me if you have any comments or requests.
The app is now in the android market. Use this link, or the QR code below. The page should have the latest news.
Examine Scriputres Daily - Android App

Similar Posts:

Tagged , , , , ,

Pidgin chat pounce plugin

I wrote the following plugin using the Pidgin Purple Perl_API. It’s pretty simple and to the point without too many bells and whistles.

We use an XMPP (jabber) chat room to communicate at work. That’s mostly for internal communication. Recently we added an external hookup to a campfire chat room via tinder. The campfire chat room is mostly for customers requesting support.

The problem is that when a customer enters the chat room, pidgin will display something like the following:

(02/23/2011 07:35:36 AM) Tinder: James Bond in Customer Service Desk: EnterMessage

There’s no way to make pidgin understand that’s a new user logging in as the ‘Tinder’ user is already logged in. Is there?

Here’s the codeI moved the code to github, including some enhancements from Adrian Deac. put the code in a file named ‘’ in your .purple/plugins/ directory

It’s been fun brushing up on my perl skills. I may write another plugin (to edit timestamps display) later as well…

Similar Posts:

Tagged , , , ,

Bypassing stupid security measures

A couple of weeks back, my esteemed bank BCL introduced a new “feature” (read annoyance) to their online banking site. It’s a “virtual keyboard” that sits on the login page and can be used only with a mouse. And it’s utterly stupid Continue reading

Similar Posts:

Tagged , , , , , , ,

YUI DataTable not refreshing in IE

IE is very annoying when it comes to JavaScript code. But that’s for another entry.

For now, I just learned that my code that refreshes the YUI DataTable will not work unless I stop the caching. I added the following code:

var refreshDataTable = function() {
            var currentState = History.getCurrentState("myDataTable");
            currentState = currentState + "&d="+new Date().getTime();

Similar Posts:

Tagged , , ,

Dave’s Notepad

We were chatting in the morning and my colleague Dave said:

echo “blog post about distro choice” | mail -s “blog post”
that’s my ‘notepad’. 🙂

I thought that was pretty useful, but tried to make it easier by creating a bash alias. Turns out it’s better to use a bash function instead. (see this note). So my ‘jot’ function is:
function jot() { echo "$1" | mail -s "$2"; }

I also noticed, that emails sent from my laptop were not reaching. It seems Ubuntu comes with Exim4 as a default MTA. I’m not too familiar with Exim, so I used the occasion to learn a new trick.

I might use this for micro-blogging next… let me go set it up 🙂

Similar Posts:

Tagged , , , , , , , , ,

Moving SVN repository

I moved the svn repository from my laptop to the server for easier deployment of
Here are the commands I used:

on laptop:
svnadmin dump /var/svn/repos/ > home-repository.dmp
gzip home-repository.dmp
scp -P39227 home-repository.dmp.gz mybox.server.xx:/home/myuser

on server:
mkdir -p /var/svn/repos
gunzip home-repository.dmp.gz
cd /var/svn/repos/
svnadmin load /var/svn/repos < /home/myuser/home-repository.dmp

again on laptop:
edited ~/.subversion/config:
sshtunnel = ssh -p 39227

svn switch --relocate file:///var/svn/repos/ svn+sshtunnel://mybox.server.xx/var/svn/repos/

And check it's all good (in the working copy directory):
svn up
svn info

Piece of cake 🙂

Similar Posts:

Tagged , , ,