Thursday, May 30, 2013

Arabic support on non-rooted Nook Simple Touch



Nook simple touch is the second generation of e-readers made by B&N, although it's released in 2011, it’s based on Android 2.1 (released in 2009!), and hence its native support for Arabic eBooks is very poor, combined with fact you can't change system fonts , all you will see is bunch of ? A square here is a sample of Arabic Epub book on NST:


So, is there any way to overcome this problem?
Rooting is the easy and the best way , once the device is rooted , you can replace certain files with patched ones +replacing DroidSansFallback.ttf with any Arabic font ( I use DroidSansNaskh (don't forget to rename it )  in /system/fonts to have proper support of Arabic, once done you will see Arabic texts  in most apps (ES file explorer, EzpdfReader , etc)



For Arabic Eups reading I highly recommend using moon reader+ pro 1.6 or any version that supports RTL (Right to left texts) .



 Even with this method B&N stock reader won't display Arabic texts properly  as its engine doesn't understand/support RTL . 

So, all mentioned above is for rooted devices, what about poor non-rooted NST users?
Well, here what I did
 [css font hack]
  1. first we are gonna use sigil as epub creator tool ...
  2. create a new epub file 
  3. add Droid Sans Naskh font to your Fonts folder
  4. edit the html source and add the following 

 
@namespace h "http://www.w3.org/1999/xhtml";
@font-face {  
 font-family: "Droid Sans Naskh"  
 font-weight: normal;  
 font-style: normal;  
 src: url('../Fonts/DroidSansNaskh.ttf');  
 }  




Now the hard part,
By default, as you can see above, NST reader displays the Arabic words reversed and with un-connected letters, so we need to modify the text in a form NST can display properly
They are different way to do it but the most accurate way is to use php class called PHP-AR
To use the script, I will assume you use Linux,
·         Install php on your system
·         Extract the file to any folder you like
·         Create 1.php file in the I18N folder and paste the following code

  <?php  
  include 'Arabic.php';  
 $lines = @file("1.txt");  
 $obj = new I18N_Arabic('Glyphs');  
 foreach($lines as $line ){  
 $text = $obj->utf8Glyphs($line);  
 echo "$text \n" ;  
 }  
 ?>  
Paste your Arabic text in a txt file named 1.txt
In your terminal cd to the I18N directory
cd /home/live/Downloads/Arabic-3.6.0/I18N
Execute the following command
php a.php >2.txt
The converted Arabic text will be saved in 2.txt
Open the file and copy the incomprehensible back to sigil, save your work.
This is how the file will be displayed using NST reader
.
The result is satisfying =) , thanks to the php-Ar class , diacritics handled and displayed properly on the NST., but alef-lam combinations needs some work from the developer.
You can download all the files needed from this link

If you have a question, or want a clarification, leave a comment

Wednesday, May 8, 2013

How to add "show desktop" button to Tint2 panel ?

As openbox user , who uses tint2 and likes it very much , i tend to miss my show desktop button I enjoyed in other panels (xfce4,etc) ...
here is brief how-to guide to add "show desktop" button to Tint2 panel..
1-you need to have tint2-svn version of tint2 which includes applications launcher
2- make sure you have wmctrl app installed ..
3- cd to /usr/bin

cd usr/bin
 and create show_desktop.sh script with the following code
 #!/bin/sh  
 if wmctrl -m | grep "mode: ON"; then  
 exec wmctrl -k off  
 else  
 exec wmctrl -k on  
 fi  
save the file and change its permission to a+x

chmod a+x show_desktop.sh

now we need to create .desktop entry for our script 

cd usr/share/applications

sudo mousepad show_desktop.desktop s

add the following

[Desktop Entry]

Version=1.0

Exec=/usr/bin/show_desktop.sh

Icon=/usr/share/applications/Desktop-32.png

Terminal=false

Type=Application

Icon line is optional , but if you want to use customized icon ,
move the icon to /usr/share/applications ,
 identify the icon
identify Desktop-32.png
 and modify the line accordingly
modify your tint2rc configuration file and add the following
#------------------------------------------
#LAUNCHER
#------------------------------------------
launcher_icon_theme = areao43
launcher_padding = 4 4
launcher_background_id = 1
launcher_icon_size = 40 
launcher_item_app = /usr/share/applications/showdesktop.desktop

here is screenshot of my desktop =)
 

 sources used in this how-to with some personal modifications

 https://wiki.archlinux.org/index.php/Tint2#Application_Launchers_in_tint2-svn_.28AUR.29
http://crunchbang.org/forums/viewtopic.php?id=6455
 http://code.google.com/p/tint2/wiki/FAQ#Adding_a_%27show_desktop%27_button

Thursday, April 25, 2013

Chinese characters not displayed properly in firefox ?

I use Arch -Linux linux distribution, I don't speak chinese , but I surf some chinese trackers from time to time , the problem is the characters are not displayed properly as you can see in this screenshot
so, how can we fix it?
just install this package .. which is basically a sans-serif font with all chinese glyphs 
sudo pacman -S wqy-microhei

that's it.

Thursday, April 11, 2013

How make usb-headset as default sound card in Arch Linux

last week I installed ArchBang as replacement to ubuntu ,the installation process went smoothly since all partitions were already set-up, I like it so far , it's more challenging and the learning-curve for me has been great, it requires much more tweaking but in the end , you are in control of every bit of your system. I had few problems though, one of them was cofiguring ALSA sound drivers to take USB-Headset as default card for sound playback, it's possible to choose the audio driver in Smplayer and VLC but not all apps offer this feature and best solution is to edit system-wide setting to take the usb-headset as default.
this is the source I used (if you are into reading  +1000 word guide =) ).
here what i did:
I created a sh script  to generate .asoundrc file with usb-headset as default device
 nano asoundrc.sh  
 paste the following code
 % cat /usr/bin/asoundrc  
 #!/bin/bash  
 # asoundrc v0.1.0 20090101 markc@renta.net GPLv3  
 # asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3  
 #  
 # A simple script to create a particular default audio device regardless  
 # of what cards are loaded or in what order. It could be used anytime or  
 # placed in a ~/.bashrc script for a persistent setup every login.  
 #  
 # Usage: asoundrc [DEFAULT_CARD] > ~/.asoundrc  
 # use the first parameter as the card name, or else  
 # look for the sound card, discarding those that are only microphones  
 # when there are multiple cards, use the first one  
 if default_card="${1:-$(cat "$(for f in $(ls -1 /proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}"; done \  
 | sed -e '\|^[\[:blank:]\]$|d' -e 'q')/id" 2>/dev/null)}"; then  
   echo "Using sound card: ${default_card}" >&2   
   cat /proc/asound/card[0-9]*/id | \  
   gawk --assign default_card="${default_card}" \  
 '{print "pcm."$1" { type hw; card "$1"; }\nctl."$1" { type hw; card "$1"; }" }  
 END {print "pcm.!default pcm."default_card"\nctl.!default ctl."default_card}'  
 else  
   echo "Warning: No sound cards found." >&2  
 fi 
 
 chmod a+x asounrc.sh  
execute the script

here is the output in my case


Using sound card: Intel
pcm.Intel { type hw; card Intel; }
ctl.Intel { type hw; card Intel; }
pcm.CinemaTM { type hw; card CinemaTM; }
ctl.CinemaTM { type hw; card CinemaTM; }
pcm.Headset { type hw; card Headset; }
ctl.Headset { type hw; card Headset; }
pcm.!default pcm.Intel
ctl.!default ctl.Intel
as you can tell, the default card  is Intel (last two lines) , all we need to replace intel with Headset ,copy the text
now create .asoundrc file in your home folder , paste the code , log out then log-in , to see the changes

 #create .asoundrc file in your home folder  
 sudo nano ~/.asoundrc  
 #paste the code and save your work  
 pcm.Intel { type hw; card Intel; }  
 ctl.Intel { type hw; card Intel; }  
 pcm.CinemaTM { type hw; card CinemaTM; }  
 ctl.CinemaTM { type hw; card CinemaTM; }  
 pcm.Headset { type hw; card Headset; }  
 ctl.Headset { type hw; card Headset; }  
 pcm.!default pcm.Headset  
 ctl.!default ctl.Headset  

there are may be other ways to do the same thing but this one sounds simple and did the job for me.


Friday, April 5, 2013

Copy , the new player in Cloud Storage field

They are tens of cloud storage services out there, most popular include -but not limited to- dropbox, gdrive, skydrive, ...
recently we got a new one called Copy ...
it offers 5 Gb as a start, cross-platform with support for linux and android devices.
nice web GUI , sharing options are plenty and easy to use.. you can try it out by registering through this referrral link where both of us will get extra 5 GBs =) 

Friday, February 8, 2013

Google maps vs Openstreetmaps


One shouldn't take Google services for granted ,all these greedy companies care about is money , and even though they use users' input and geotag data to update their maps , they charge you indirectly for it...
it's true I enjoy using Google Navigation app for free on the Galaxy S2 ,but I think it's wise to explore other options in the future...
opnestreetmaps.org is like Wikipedia for maps. it's still lacking compared to Google maps especially in third world countries but that's could be changed if more users contributes the project, take a look at this picture provided in the article and compare it too Google maps.

For me , instead of complaining about the inaccuracy of the openstreet maps , I started adding information about my area, mainly main roads,schools, markets, worship places ,etc... and that's the beauty of open-source project , if you don't like it , you could modify it to suit your needs, but I got to admit it takes time to get used to the editor