There’s always been plenty of cats in our neighborhood. And they all stroll up and down the same trail facing my office window almost daily when the sun is up. But recently they decided to come closer and into our lives. Continued…
Posted in Blogging, Cat, Mood, Pets.
Tagged with cats, feral.
By abdallah
– January 20, 2012
Disclaimer: This setup is just a bit crazy, and I wouldn’t recommend it for a production site. Works for me.
I needed to allow some clients to test a web app I’m working on. But I didn’t want to deploy the code to a server for now for different reasons (mainly memory constraints). So the solution was to setup a reverse proxy using apache to my local machine. Check out the code after the break Continued…
Posted in Tools, Work.
Tagged with apache, proxy, reverse proxy, ssh, testing, tunnel, tutorial.
By abdallah
– December 29, 2011
Simple command line: pm-suspend
An interesting alternative would be: pm-suspend-hybrid
Continued…
Posted in Tools.
Tagged with android, connectbot, electricity, hibernate, lebanon, linux, ssh, suspend, ubuntu.
By abdallah
– December 27, 2011
Two easy steps to create a tunnel from a remote server port to your localhost. It’s handy if you’re trying to connect to a mysql, jboss, etc. installation bound to localhost only (for better security. Check out the screenshots after the break Continued…
Posted in Tools, Work.
Tagged with firewall, glassfish, mysql, putty, server, ssh, tunnel.
By abdallah
– December 21, 2011
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 Continued…
Posted in Blogging, Coding, Work.
Tagged with class-based, django, generic views, jqm, jquery, jquerymobile.
By abdallah
– December 20, 2011
First, get the API keys from the control panel at https://rimuhosting.com/cp/apikeys.jsp

The documentation for the API can be found here
So to reboot, I use the following script:
-
#!/bin/bash
-
APIKEY=00000000000000000000000000
-
VPSOID=0000000
-
VPSNAME=whatever
-
curl -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: rimuhosting apikey=$APIKEY" -X PUT -d ‘{"reboot_request": {"running_state": "RESTARTING"}}’ https://rimuhosting.com/r/orders/order-$VPSOID-$VPSNAME/vps/running-state
That seems to be much safer than running: sudo reboot
Posted in Tools, Work.
By abdallah
– October 26, 2011
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 = assetManager.
open("es12_E.epub");
-
// Load Book from inputStream
-
this.book = (new EpubReader()).readEpub(epubInputStream);
-
getSpecificdate("2012-12-1");
-
-
Log.e("epublib", e.getMessage());
-
}
-
-
private void getSpecificdate
(String day
) {
-
-
int dayOfMonth;
-
int monthOfYear;
-
-
try {
-
d = dateFormat.parse(day);
-
cal.setTime(d);
-
String hrefDate = hrefFormat.
format(d
).
toUpperCase();
-
dayOfMonth=cal.
get(Calendar.
DAY_OF_MONTH);
-
-
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 = this.book.getResources().getByHref(hrefDate);
-
WebView wv = (WebView) findViewById(R.id.webView1);
-
-
wv.loadDataWithBaseURL("file:///android_asset/", data, "text/html", "utf-8", null);
-
-
e.printStackTrace();
-
}
-
-
}
Posted in Coding.
Tagged with android, epub, epublib, esd, java, scriptures, snippet.
By abdallah
– October 12, 2011
For a couple of weeks now I have been trying to get the Android Plugin for Eclipse to play nicely on my new 64bit Ubuntu 11.10.
It was always hanging without a good explanation. The only message I got was “Loading Data for Android 2.3.3″ and it reaches 100% but stays there.
I thought it was related to the fact that I’m using the latest Indigo (3.7) eclipse, but that wasn’t it (I tried with earlier versions). I also thought it was because of the 64bit java I installed separately (not using apt). That wasn’t it either (the apt installed version didn’t work either). Stupid solutions, I know, but I had to try!
The solution was to rename the SDK directory and remove the _x64 from the end of that. After that, I set it in Windows -> Preferences -> Android -> SDK location and applied the changes and voila! It works now.
I’ll be fixing the ESD app based on some kind feedback from friends. And maybe work on other pending projects as well. Stay tuned.
Posted in Work.
Tagged with android, eclipse, fix, ubuntu.
By abdallah
– October 5, 2011
I was trying to mount one of the disks from a failed RAID array. The disk was put in a USB enclosure and hooked to the machine. Here’s what I saw:
-
srv0:~# mount /dev/sdc3 /mnt/usb/
-
mount: unknown filesystem type ‘mdraid’
-
srv0:~# mdadm –examine /dev/sdc
-
mdadm: No md superblock detected on /dev/sdc.
I panicked a little, then tried the following that worked:
-
srv0:~# mount /dev/sdc3 /mnt/usb/ -o ro -t ext3
-
srv0:~# ls /mnt/usb
-
bin dev etc initrd.img lib64 media opt root selinux sys usr vmlinuz
-
boot home lib lost+found mnt proc sbin srv tmp var
Posted in Work.
Tagged with array, disk, linux, mount, raid, recovery.
By abdallah
– September 28, 2011
I’m working my way through installing my simple django app on a new Ubuntu machine using the components mentioned above.
So far, here’s what I’ve done:
- apt-get install nginx-full
- apt-get install uwsgi uwsgi-plugin-python
- installed django from svn described in the docs
The nginx configuration can be found in /etc/nginx/sites-available/default. Of course, it’s best to make a copy of that file and edit it for the site/app I’m working on. Here’s what I put in it:
-
server {
-
listen 80;
-
server_name sss.grat.in;
-
access_log /var/log/nginx/sss.grat.in-access.log;
-
location /media {
-
alias /home/sss/app/media/;
-
}
-
location /static {
-
alias /home/sss/app/static/;
-
}
-
location / {
-
uwsgi_pass unix:///var/run/sss.grat.in.sock;
-
include uwsgi_params;
-
}
-
}
Now for the uWSGI configuration file. I created the file /etc/uwsgi/apps-available/sss.ini and added the following lines:
-
[uwsgi]
-
chdir = /home/sss/app
-
pythonpath = /home/sss
-
env = DJANGO_SETTINGS_MODULE=app.settings
-
# load django
-
module = django.core.handlers.wsgi:WSGIHandler()
it’s really just that. What took me so long was to figure out that in Debian/Ubuntu you have to install uwsgi-plugin-python, otherwise you’ll keep on getting weird error messages. Also, the default ini file has most of the settings (in /etc/default/uwsgi) so you should either read or edit that to make sure you’re getting all the right values.
Posted in Tools.
Tagged with configuration, django, nginx, python, uwsgi.
By abdallah
– September 23, 2011
Recent Comments