Main menu:

Site search

 

Categories

Archive

Changing OLPC locale the hard way…

this post is just for a reminder for me :) . Now OLPC build contains sugar-control-panel so changing locale from that is very easy! just a simple command and walla! the locale is changed.

how? here it is … $ sugar-control-panel -s language Urdu/Pakistan

simple aint it .. but why i am writing it because i have to experiment with a historic build and its useful for Fedora as well

$ cd /etc/sysconfig/
$ vi i18n
add LANG= “ur_PK.UTF-8″

and then restart X or restart you machine ( for fedora/olpc Users )
and if you are using my Favourite Ubuntu and want to change to locale of the machine then its simple just edit
$ vi /etc/environment
add LANG= “ur_PK.UTF-8″
and restart X or machine and there you go then locale or orientation of you desktop is in urdu i.e. right hand side writting scheme.

soon ill be writing more about localization issues :) from PO files to MO and from Keyboard configuration to Font installation

Counting characters in String in Bash

walla i’ve learned bash. i am not a pro coder in bash right now but now i can under stand bash really well. Here is an interesting thing i found or you can say that the thing most bugged me when i was writing bash scripts were how to count the resulting string characters, and also how to substring.

so here is what i found and was amazed with the power of bash or regular expression.

first to substring on a string based on my character

#! /bin/bash
String=waqastoor #substring based on t
resultingString= ${String%t*} #will result in waqas
resultingString=${String:5} #will result in toor

easy isn’t it

now counting the characters part

resultingString=${#String} #will result in 9

strange how you can manipulate string in bash just with regular expression. Some people prefer sed and awk to make these work. But i believe digging deep into bash and regular expressions you wont be needing sed , awk etc may be those are used when things get really nasty in string manipulation. But the tasks i achieved from string compare to string concatenation to substring and finding a character in string. You can use simple regular expression and in bash you can achieve it.

Now looking from a problem with string where bash and regular expression fails :)

for further reading for the interested ones http://tldp.org/LDP/abs/html/string-manipulation.html

I am back

so i am back and i’ve got a lot of stories to tell :) was busy with a lot of coding and designing and will now share what i found interesting in my fight with all those tools and languages :)