In my old posts, I have always made rants about how cool and comfy Python is. Here’s a tiny code snippet that shows how I fetch remote Git repos with Python and the awesome GitPython library:
import git, os, shutil
DIR_NAME = "temp"
REMOTE_URL = "https://github.com/hasinhayder/LightBulb.git"
if os.path.isdir(DIR_NAME):
shutil.rmtree(DIR_NAME)
os.mkdir(DIR_NAME)
repo = git.Repo.init(DIR_NAME)
origin = repo.create_remote('origin',REMOTE_URL)
origin.fetch()
origin.pull(origin.refs[0].remote_head)
print "---- DONE ----"
PS: Installing GitPython is just a breeze on *Nix with:
sudo easy_install GitPython
Another year passed – the time has come to look back one more year and set expectations for the next year.
In 2011:
– I enjoyed a lot in Leevio, learned Zend Framework, built DeployNinja and contributed to Kuestions besides other projects.
– I have learned Windows Phone 7 development and some .NET (C#). I built the first Windows Phone 7 application from Bangladesh that made it’s place in the app store.
– I have mainly used Windows 7 as my primary OS all the year long. Switched to Zorin OS in December. Chose PhpStorm as my IDE and Zend Framework as my primary web framework.
– I have spoken at the phpXperts seminar 2011, my 2nd time as a speaker on this annual event.
– I have become a moderator of the phpXperts group.
– I have become the Campus Lead of Microsoft Student Partners, Khulna University.
– Arranged “Imagine Cup boot camp” in KU early in the year.
– Arranged “msdnaa installation fiesta” in Khulna University.
– I along with Hasin vai and Murshed vai created the group “nixers” to promote *Nix in a healthy way. Interestingly the group was created on the 16th December, the Victory Day of Bangladesh.
– I became a moderator in “nixers” too.
– I have learned a lot of Javascript and jQuery.
– Built a WordPress plugin and ASP.NET User Control for Avro Phonetic Keyboard on Rifat vai’s awesome jQuery plugin.
– Learned Git and started using Github.
– Tried some cool cloud offerings – phpcloud, pagodabox, phpfog, epio etc.
– My knowledge in CSS has improved.
– Contributed to “Python programming” chapters in a book published from Ankur ICT foundation.
– Written a few Bangla blog posts on Python but later paused. Also did a few screen casts.
– Learned django.
– Switched to Banglalion from BTCL ADSL.
– Bought a few gadgets.
– Became 2nd in the 2nd year 2nd term, yes, magic numbers
Looks like 2011 hasn’t been that bad for me. Thanks to the Almighty for blessing me with a good year. What do I wish for 2012? Well, seriously, I will put that to the grace of the Almighty. May the Almighty bless me in the year 2012, may I receive the very best of what I deserve.
Plans in 2012:
– Get a Macbook Pro when my current notebook dies.
– Learn a lot of Javascript, PHP and Python. Yes, more focus on JS, then PHP and lastly Python.
– Avoid picking up a new language unless it’s extremely necessary, mastering the available ones should get priority.
– Stay on *Nix, focus on web development.
– More and more community involvement.
– Contribute to the open source community.
May the Almighty Allah grant me success and guide me in the right path. Wishing you all a very happy and prosperous 2012! May the Almighty be with us all!
Good bye, 2011!
Welcome, 2012!
I am running Zorin OS 5 which is based on Ubuntu. I had a NTFS drive which was somehow corrupted. This is how I fixed the issue:
Install ntfsprogs package:
sudo apt-get install ntfsprogs
Find the drive’s device path:
sudo fdisk -l
Unmount the drive if already mounted:
sudo umount /media/storage
Run ntfsfix tool to fix common NTFS issues:
sudo ntfsfix /dev/sda3
Now mount again and have fun:
sudo mount /dev/sda3 /media/storage
That was simple, no?
The idea is pretty simple: A web user control for ASP.NET that loads the Avro Phonetic keyboard and binds the text inputs and text areas.
The control can be downloaded from: http://masnun.googlecode.com/files/Avro.zip
How to use it?
1) Extract Avro.zip and you shall get two files in the Avro folder: “Avro.ascx” and “Avro.ascx.cs”. First one is the user control and second one is the codebehind file.
2) Crate a new website project in Visual Studio or open your existing project.
3) Copy the above mentioned two files (NOT the entire directory, just the files) into your project. For better organization you might want to create a “Controls” directory (if you haven’t already). Paste the two files inside your desired directory.
4) Now, we add the controls to a web form. Open a page, say Default.aspx. Just below the Page directives, add the following Register directives to register the control:
<%@ Register Src="~/Controls/Avro.ascx" TagPrefix="asp" TagName="Avro" %>
Here, Src is the location to the Avro.ascx file. TagPrefix and TagName makeup the custom tag that loads the control. In this case, you now have a <asp:Avro> tag which you can use to load the control.
5) Let’s add the control:
<asp:Avro Bangla="true" Callback="avro_callback" runat="server" />
The control accepts two attributes – “Bangla” and “Callback”. Setting Bangla to “true” or “false” enables or disables Bangla by default. The Callback attribute accepts the name of a Javascript function which is called when the keyboard state changes.
6) Let’s test the control by adding a text area and the defined callback function:
<textarea></textarea> <script type="text/javascript"> function avro_callback(isBangla) { console.log(isBangla); } </script>
Load the web page in your browser. If you have Firebug installed in Firefox, the callback should print out state of the Bangla layout on the console.
For brevity, here is my entire Default.aspx file:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Src="~/Controls/Avro.ascx" TagPrefix="asp" TagName="Avro" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <asp:Avro Bangla="true" Callback="avro_callback" runat="server" /> <textarea></textarea> <script type="text/javascript"> function avro_callback(isBangla) { console.log(isBangla); } </script> </asp:Content>
Rifat vai has released an awesome jQuery plugin which adds Avro Phonetic layout to your text inputs. I converted it into a WordPress Plugin. Hats off to Rifat vai for the awesome job!
How to use it?
Click on the download link below. It should show you the raw php source of the plugin file. Save it as “avro-phonetic.php” and upload the file to “wp-content/plugins/” directory. Now go to your “Plugins” page from WP Dashboard. Activate the plugin.
The plugin is a very simple one. The jQuery Plugin it relies on is still in beta. EXPECT BUGS! But don’t panick! Submit your bug reports to the official issue tracker of the plugin.
Download: https://raw.github.com/masnun/Avro-Phonetic-WP-Plugin/master/avro-phonetic.php
Github Repo: https://github.com/masnun/Avro-Phonetic-WP-Plugin
Official Page: http://torifat.github.com/jsAvroPhonetic/
Knows Issues:
- Doesn’t work with the Visual Editor (TinyMCE) of WordPress. Please use the HTML editor.
-
Doesn’t show any visual clue of which language (English or Bangla) is active.It now shows a black box with language identificationThanks to the Avro team for the nice icons.
Ctrl + M toggles between Bangla and English. It’s your responsibility to let the users know how to use it. The plugin doesn’t have any fancy instructions displayed to the users.It now has a widget. Add the widget to your sidebar.
Forces to load jQuery 1.7.2 without caring if an older version is already loaded. Had to do this because wp_enque_script() was not loading jQuery on some themes/setup.Thanks to Mehdi vai, the loading is now done using JS after checking if a version is loaded already!
Contribute:
Feel free to fork the codes on Github and send me pull requests. If you’re not used to Git, send me the modifications over email. I shall merge them and commit. My email address is available on masnun.com
Have fun!

