<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ask Your Question</title>
	<atom:link href="http://askbahar.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://askbahar.com</link>
	<description>Lets Talk</description>
	<lastBuildDate>Sun, 11 Mar 2012 09:50:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP Bijoy to Unicode Converter</title>
		<link>http://askbahar.com/2012/03/11/php-bijoy-to-unicode-converter/</link>
		<comments>http://askbahar.com/2012/03/11/php-bijoy-to-unicode-converter/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 09:46:59 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bijoy]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=172</guid>
		<description><![CDATA[<p>In our latest project at <a title="PROGmaatic Developer Network" href="http://progmaatic.com" target="_blank">PROGmaatic</a>, we needed a converter to convert lots of information written in Bangla. Unfortunately  everything was in Bijoy (SutonnyMJ) font. But our requirement was Unicode formatted data and language preference was PHP.</p> <p>&#160;</p> <p>I thought, no big deal. There should have been lots of converters available, and [...]]]></description>
			<content:encoded><![CDATA[<p>In our latest project at <a title="PROGmaatic Developer Network" href="http://progmaatic.com" target="_blank">PROGmaatic</a>, we needed a converter to convert lots of information written in Bangla. Unfortunately  everything was in Bijoy (SutonnyMJ) font. But our requirement was Unicode formatted data and language preference was PHP.</p>
<p>&nbsp;</p>
<p>I thought, no big deal. There should have been lots of converters available, and most of them might be in PHP. After hours of searching (Yes I don&#8217;t like coding when I can find something free <img src='http://askbahar.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ).</p>
<p>Well, I haven&#8217;t found a single script which would do what I needed. Two of the following did help me to understand how to develop the converter:</p>
<ul>
<li><a href="www.repulsivecoder.com/2009/06/04/bijoy-to-unicode-converter/" target="_blank">www.repulsivecoder.com/2009/06/04/bijoy-to-unicode-converter/</a> [Oops! javascript only]</li>
<li><a href="http://mynul.com/bangla/" target="_blank">mynul.com/bangla/</a> [Mr. Mynul was kind enough to send me the source code. Unfortunately it didn't work for me when I included it in my project. Probably because of encoding dependency. Also I didn't like the mapping. But it encouraged me!]</li>
</ul>
<p>So finally I end up coding one myself. Fork it from my <a title="Bijoy to Unicode Converter" href="https://github.com/bahar/BijoyToUnicode" target="_blank">Github</a> account.</p>
<p>In the coding process I have learnt two valuable lessons <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>1. javascript string method &#8216;<strong><em>substring</em></strong>&#8216; is not equivalent to PHP&#8217;s string function &#8216;<strong><em>substr</em></strong>&#8216; [I spent only 5 hours for this mistake!!!]</p>
<p>2. Nothing is better than step-by-step Debugging!</p></blockquote>
<p>&nbsp;</p>
<p>Future modifications:</p>
<blockquote><p>1. Make <strong>mbstring</strong> independent. (I actually figured out the way, but right now I don&#8217;t need it since I have mbstring support <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>2. Make memory efficient.</p></blockquote>
<p>&nbsp;</p>
<p>Check the code and let me know if you find a better way, find a bug or need some modification. I will be happy to make the changes and give you the credit <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2012/03/11/php-bijoy-to-unicode-converter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Netbeans (with prerequisites) in Ubuntu 11.04 and later</title>
		<link>http://askbahar.com/2011/09/27/install-netbeans-in-ubuntu-11-04/</link>
		<comments>http://askbahar.com/2011/09/27/install-netbeans-in-ubuntu-11-04/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 04:44:01 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[sun jdk]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=159</guid>
		<description><![CDATA[<p>To install <a title="Netbeans " href="http://www.netbeans.org/" target="_blank">Netbeans</a> in <a title="Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu 11.04</a> (or later versions) you will need Java JRE or JDK to be installed beforehand.</p> <p>Now I like openJDK a lot, but I still prefer Sun Java JDK for development So heres the recipe to cook everything -<br /> </p> <p>1. Install JRE</p> [...]]]></description>
			<content:encoded><![CDATA[<p>To install <a title="Netbeans " href="http://www.netbeans.org/" target="_blank">Netbeans</a> in <a title="Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu 11.04</a> (or later versions) you will need Java JRE or JDK to be installed beforehand.</p>
<p>Now I like openJDK a lot, but I still prefer Sun Java JDK for development <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So heres the recipe to cook everything -<br />
<span id="more-159"></span></p>
<p><strong>1. Install JRE</strong></p>
<blockquote>
<pre><code>sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts </code></pre>
</blockquote>
<p>During the installation press ‘OK’ in the screen that appears within the Terminal (see the below screenshot, <em>the screenshot was collected from internet</em>). You can do so by navigating using the ‘Tab’ key and once ‘OK’ is highlighted in red, press ‘Enter’.</p>
<p><a href="http://askbahar.com/wp-content/uploads/2011/09/java-ubuntu-11.04.jpg"><img class="alignleft size-medium wp-image-161" title="JRE installation in Ubuntu" src="http://askbahar.com/wp-content/uploads/2011/09/java-ubuntu-11.04-300x175.jpg" alt="Sun JRE license agreement" width="340" height="198" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>2. Install JDK</strong></p>
<blockquote>
<pre><code>sudo apt-get install sun-java6-jdk</code></pre>
</blockquote>
<p><strong>3. Install Netbeans</strong></p>
<blockquote><p>The Ubuntu repository has Netbeans 6.9. The latest available version is Netbeans 7.0.1. So I prefer manual installation (Applicable for any version of Netbeans).</p>
<ol>
<li>Download your appropriate version of Netbeans from <a title="Download Netbeans" href="http://netbeans.org/downloads/index.html" target="_blank">http://netbeans.org/downloads/index.html</a></li>
<li>Remember the download location. In my case, it was <em>/media/software/SDK-IDE</em></li>
<li>Apply sudo chmod a+x /media/software/SDK-IDE/netbeans-7.0.1-ml-linux.sh</li>
<li>Applying this command we are giving permission to the Netbeans installer file to be run as an executable program.</li>
<li>Now double click the file and then click on “run” to install NetBeans IDE</li>
<li>Follow the instructions <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
</blockquote>
<p>Thats all <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2011/09/27/install-netbeans-in-ubuntu-11-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add scheduled task to run php scripts in Windows</title>
		<link>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/</link>
		<comments>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 07:20:24 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[scheduled task]]></category>
		<category><![CDATA[schtasks]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=124</guid>
		<description><![CDATA[<p>Few days ago, for one of our PHP / MySQL project, we were needed to run two php scripts at every minute. We usually develop/deploy our projects in LAMP environment, where we use <a href="http://adminschoice.com/crontab-quick-reference">crontab</a> for our scheduled tasks. But our client have wanted us to run the system in Windows. So we have chosen  [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago, for one of our PHP / MySQL project, we were needed to run two php scripts at every minute. We usually develop/deploy our projects in LAMP environment, where we use <strong><a href="http://adminschoice.com/crontab-quick-reference">crontab</a></strong> for our scheduled tasks. But our client have wanted us to run the system in Windows. So we have chosen  <strong><a href="http://www.apachefriends.org/en/xampp-windows.html">XAMPP</a></strong>. To run our two php scripts every 1 &amp; 2 minute, we thought of developing a simple tool for windows which would run at background and execute those two php scripts. Fortunately we have found about <strong><a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true">schtasks</a></strong>, a native scheduler in Windows to run scheduled task smoothly in command prompt.<br />
<span id="more-124"></span><br />
I will not describe our actual situation, rather I will demonstrate with 2 simple php scripts.</p>
<p>1. Create a directory in your <strong>htdocs</strong> folder inside XAMPP installation directory. In my case, it was <em>C:\xampplite\htdocs\test</em></p>
<p>2. Create two php scripts, <em>test1.php</em> and <em>test2.php</em> inside test directory using the following respective code.<br />
[php]&lt;?php<br />
//test1.php<br />
//creates, appends current time in a file called dump1.txt<br />
date_default_timezone_set(&#8216;Asia/Dacca&#8217;);<br />
$time = date(&#8216;Y-m-d H:i:s&#8217;);<br />
$file = &quot;C:/xampplite/htdocs/test/dump1.txt&quot;;<br />
file_put_contents($file,&quot;job1 run on: $time\r\n&quot;, FILE_APPEND);<br />
?&gt;[/php]<br />
[php]&lt;?php<br />
//test2.php<br />
//creates, appends current time in a file called dump2.txt<br />
date_default_timezone_set(&#8216;Asia/Dacca&#8217;);<br />
$time = date(&#8216;Y-m-d H:i:s&#8217;);<br />
$file = &quot;C:/xampplite/htdocs/test/dump2.txt&quot;;<br />
file_put_contents($file,&quot;job2 run on: $time\r\n&quot;, FILE_APPEND);<br />
?&gt;[/php]</p>
<p>3. create a batch file <em>php_service_creator.bat</em> with the following code.<br />
[vb]<br />
SCHTASKS /Create /RU SYSTEM /SC MINUTE /MO 1 /TN &quot;test_sch_task1&quot; /TR &quot;C:\xampplite\php\php-win.exe -f C:\xampplite\htdocs\test\test1.php&quot;<br />
SCHTASKS /Create /RU SYSTEM /SC MINUTE /MO 5 /TN &quot;test_sch_task2&quot; /TR &quot;C:\xampplite\php\php-win.exe -f C:\xampplite\htdocs\test\test2.php&quot;<br />
[/vb]</p>
<blockquote><p>
1. <em>test_sch_task1</em> task will run on every minute.<br />
2. <em>test_sch_task2</em> task will run on every fifth minute.
</p></blockquote>
<p>to understand the used (and other possible) parameters, please visit <a href="http://www.robvanderwoude.com/schtasks.php">this link</a></p>
<p>4. Run just created <em>php_service_creator.bat</em>. Please note that you have to run this from an account with administrative privileges. </p>
<p>5. After about 20 minutes, check <em>C:/xampplite/htdocs/test/dump1.txt</em> &#038; <em>C:/xampplite/htdocs/test/dump2.txt</em> files for output.</p>
<p>6. To check/view all the added scheduled tasks, type <em>schtasks</em> in command prompt.</p>
<p>7. To delete any scheduled task, type <em>schtasks /Delete /TN TASK_NAME_FOR_DELETE</em> in command prompt.</p>
<p>I hope it helps some people like me.</p>
<p>Comments, suggestions are appreciated <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add command shortcut in Ubuntu shell</title>
		<link>http://askbahar.com/2011/04/01/how-to-add-command-shortcut-in-ubuntu-shell/</link>
		<comments>http://askbahar.com/2011/04/01/how-to-add-command-shortcut-in-ubuntu-shell/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 04:43:30 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=111</guid>
		<description><![CDATA[<p>When you need to write long commands in Linux shell, like me, you must have been looking for a way (if you haven&#8217;t found the way already ) to create shortcuts for those long commands.<br /> Based on your need, you can do any of the following:<br /> alias: If you need a shortcut for [...]]]></description>
			<content:encoded><![CDATA[<p>When you need to write long commands in Linux shell, like me, you must have been looking for a way (if you haven&#8217;t found the way already <img src='http://askbahar.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ) to create shortcuts for those long commands.<br />
Based on your need, you can do any of the following:<span id="more-111"></span><br />
<strong>alias: </strong>If you need a shortcut for only the current shell session, use alias.</p>
<ul>
<li>To check current aliases list: <em>alias</em></li>
<li>To check an existing alias: <em>alias ALIAS_NAME</em></li>
<li>To add new alias: <em>alias </em><em>COMMAND_SHORTCUT = </em><em>&#8216;LONG_COMMAND&#8217; </em>[example: <em>alias apacheReload = '/etc/init.d/apache2 reload'''</em>]</li>
<li>To remove an existing alias: <em>unalias ALIAS_NAME</em></li>
<li>Learn more about alias at <a href="http://en.wikipedia.org/wiki/Alias_%28command%29" target="_blank">Wikipedia</a>, <a href="http://ss64.com/bash/alias.html" target="_blank">Bash Man Page for Alias</a></li>
</ul>
<p><strong>Symbolic Links: </strong>This is actually my favorite. Does not depend on current shell session. FYI. each command is actually an executable script.</p>
<ul>
<li>To create a shortcut for all users, create a soft symbolic link of the executable script in <em>/usr/local/bin</em>. For example, to execute apache related commands using just apache, issue this command<br />
<em>ln -s /etc/init.d/apache2 /usr/local/bin/apache </em>#this command will create a soft symbolic link of apache2 in /usr/local/bin directory. Now you can just manage apache by using <em>apache</em> command<em>.</em></li>
<li>To create a shortcut only for current user, create a soft symbolic link of the executable script in <em>$HOME/bin</em></li>
</ul>
<p><strong>Using your own shell scripts</strong>: This requires understanding of shell scripting. You can create a shell script which essentially provide the full ability to create new system commands. Make the script executable, keep it in home directory.</p>
<p>&nbsp;</p>
<p>I hope it helps some one. Please use the comment section to provide your feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2011/04/01/how-to-add-command-shortcut-in-ubuntu-shell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to run Python scripts in your shared hosting server</title>
		<link>http://askbahar.com/2010/10/28/how-to-run-python-scripts-in-your-shared-hosting-server/</link>
		<comments>http://askbahar.com/2010/10/28/how-to-run-python-scripts-in-your-shared-hosting-server/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 03:38:18 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Shared Hosting]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[cgi-bin]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[run python]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=108</guid>
		<description><![CDATA[<p>Direct to the how-to </p> First make sure your hosting supports Python. Now a days almost all shared hosting providers support Python. Find your python installation location, this is required for &#8220;shebang&#8221; line added at the top of your python script. Usually this is /usr/bin/python or /usr/local/bin/python Make sure to include two print statements which [...]]]></description>
			<content:encoded><![CDATA[<p>Direct to the how-to <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ol>
<li>First make sure your hosting supports Python. Now a days almost all shared hosting providers support Python.</li>
<li>Find your python installation location, this is required for &#8220;shebang&#8221; line added at the top of your python script. Usually this is <em>/usr/bin/python </em>or <strong><em>/usr/local/bin/python</em></strong></li>
<li>Make sure to include two print statements which will print the content-type and an empty line.<strong> </strong></li>
<li>Now put the script in <em>cgi-bin</em> directory inside your root public folder, usually <strong><em>public_html</em></strong></li>
<li>Change the permission of the script to <strong><em>0755</em></strong></li>
<li>Try to browse now <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p><span id="more-108"></span></p>
<p>Example, hello.py:</p>
<blockquote><p>#! /usr/bin/python</p>
<p>print &#8216;Content-type: text/html&#8217;<br />
print &#8221;<br />
print &#8216;Hello, World!&#8217;</p></blockquote>
<p>Now look at the top of hello.py script, you will notice the &#8216;shebang&#8217; is <strong><em>#! /usr/bin/python</em></strong>.And also the first two print statements <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now its little bit annoying to put all python scripts inside that cgi-bin directory. So heres what you will need to do to run a python script inside any directory&#8230;</p>
<ol>
<li>Make an empty <em style="font-weight: bold;">.htaccss </em>file inside the directory you want to drop your python scripts. (Just open the existing .htaccess file, make sure you have enabled &#8216;Show Hidden Files&#8217; in cPanel File Manager or in your favorite FTP manager)</li>
<li>Add the following two lines and save.</li>
</ol>
<blockquote><p>Options +ExecCGI<br />
AddHandler cgi-script .py</p></blockquote>
<p>Tips:</p>
<ol>
<li>You will get <em style="font-weight: bold;">500 </em>error if anything goes wrong.</li>
<li>Make sure to clear your cache, when you modify any settings/content</li>
<li>And there is always the nice people waiting for you in hosting support section, try them <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p>I hope it helps. Let me know your comment <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/10/28/how-to-run-python-scripts-in-your-shared-hosting-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What is the difference between the variables of Python and other language</title>
		<link>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/</link>
		<comments>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 14:31:11 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[identifier]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=104</guid>
		<description><![CDATA[<p>If you are from C/C++/Java and started learning Python, this should be an interesting topic for you.</p> <p>In languages like C, C++, Java, PHP etc a variable is a memory location where its value is saved. When you copy a variable into another variable, both of them still in existence and you can use both [...]]]></description>
			<content:encoded><![CDATA[<p>If you are from C/C++/Java and started learning Python, this should be an interesting topic for you.</p>
<p>In languages like C, C++, Java, PHP etc a variable is a memory location where its value is saved. When you copy a variable into another variable, both of them still in existence and you can use both of them.</p>
<p>But in Python, its different. As a matter of fact Python don&#8217;t have any variables, it has &#8216;name&#8217; or &#8216;identifier&#8217; attached to an object (everything in Python is an object).</p>
<p>Let me clear this using an example:</p>
<p><span id="more-104"></span></p>
<blockquote><p>In other language:</p>
<p>int a_variable = 1; //Here a_variable has a value of 1.</p>
<p>a_variable = 2; //Now a_variable has an updated value of 2.</p>
<p>int another_variable = a_variable; //Now another_variable is a new variable with a value of 2.</p>
<p>int sum = a_variable + another_variable; //you can still use both of the variables.</p>
<p>In Python:</p>
<p>a_variable = 1  #Here integer object 1 (see, everything is an object) has a name tag (or identifier) &#8216;a_variable&#8217;</p>
<p>a_variable = 2 #Now a_variable name tag is now attached to integer object 2. Old integer object 1 can&#8217;t be accessed via a_variable anymore.</p>
<p>another_variable = a_variable #Now both another_variable and a_variable name tag is attached to integer object 2.</p></blockquote>
<p>Though we still call them variables in Python, but you see, they behave differently (almost like the pointers in C).</p>
<p>I hope it helps. Let me know your comments <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to find all seven dates of any week in python</title>
		<link>http://askbahar.com/2010/10/23/find-all-seven-dates-of-week-in-python/</link>
		<comments>http://askbahar.com/2010/10/23/find-all-seven-dates-of-week-in-python/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 05:23:02 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python-date-calculation]]></category>
		<category><![CDATA[python-datetime]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=98</guid>
		<description><![CDATA[<p>I am new to Python (in comparison to my experience in other languages) Last month I have done some experiment with python date time calculation. Also one of my project required a function, which will compute all 7 dates of any week of any year in Python.</p> <p>After some learning (and searching) heres my work [...]]]></description>
			<content:encoded><![CDATA[<p>I am new to Python (in comparison to my experience in other languages) <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Last month I have done some experiment with python date time calculation. Also one of my project required a function, which will compute all 7 dates of any week of any year in Python.</p>
<p>After some learning (and searching) heres my work :</p>
<p><span id="more-98"></span></p>
<pre class="syntax python">__author__ = "bahar"
__date__ = "$Sep 23, 2010 4:13:29 PM$"

import datetime
from time import strptime, strftime

def _getWeekDates(_Year = 0, _weekStart = 2, _weekNo = 0):
    """
        Returns a list with all the 7 dates of provided week and year (or any supplied week number)
        _year , example 2010. will be computed, if not provided
        _weekStart, (0 is Saturday, 6 is Friday) to start day of week
        _weekNo, will be computed, if not provided
    """

    now = datetime.datetime.now()
    if _Year = 0:
        _Year = now.year

    if _weekNo = 0:
        _weekNo = datetime.date(now.year,now.month,now.day).isocalendar()[1]
    WeekDates = []
    janOne = strptime('%s-01-01' % _Year, '%Y-%m-%d')

    dayOfFirstWeek = ((7-int((strftime("%u",janOne)))+ int(_weekStart)) % 7)

    if dayOfFirstWeek == 0:
        dayOfFirstWeek = 7
    dateOfFirstWeek = strptime('%s-01-%s' % (_Year, dayOfFirstWeek), '%Y-%m-%d')
    dayOne = datetime.datetime( dateOfFirstWeek.tm_year, dateOfFirstWeek.tm_mon, dateOfFirstWeek.tm_mday )
    daysToGo = 7*(int(_weekNo)-1)
    lastDay = daysToGo+6
    dayX = None
    while daysToGo = lastDay:
        dayX = dayOne + datetime.timedelta(days = daysToGo)
        resultDateX = strptime('%s-%s-%s' % (dayX.year, dayX.month, dayX.day), '%Y-%m-%d')
        WeekDates.append(strftime("%Y-%m-%d", resultDateX))
        daysToGo += 1
    return WeekDates

if __name__ == '__main__':
        now = datetime.datetime.now()
        weekNo = datetime.date(now.year,now.month,now.day).isocalendar()[1]

        WeekData = _getWeekDates()
        days = ['Monday', 'Tuesday', 'Wedensday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
        result = dict(zip(days, WeekData))

        for day in days:
            print day ,':', result[day]</pre>
<blockquote><p>Output:</p>
<div id="_mcePaste">
<div id="_mcePaste">Monday : 2010-10-18</div>
<div id="_mcePaste">Tuesday : 2010-10-19</div>
<div id="_mcePaste">Wedensday : 2010-10-20</div>
<div id="_mcePaste">Thursday : 2010-10-21</div>
<div id="_mcePaste">Friday : 2010-10-22</div>
<div id="_mcePaste">Saturday : 2010-10-23</div>
<div id="_mcePaste">Sunday : 2010-10-24</div>
</div>
</blockquote>
<p>For Python date time related functions/modules, I find this site useful: <a href="http://www.tutorialspoint.com/python/python_date_time.htm" target="_blank">http://www.tutorialspoint.com/python/python_date_time.htm</a></p>
<p>Any suggestion/advice via comments are welcome <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/10/23/find-all-seven-dates-of-week-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to restore volume icon in Ubuntu Gnome</title>
		<link>http://askbahar.com/2010/09/21/restore-volume-icon-in-ubuntu/</link>
		<comments>http://askbahar.com/2010/09/21/restore-volume-icon-in-ubuntu/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 04:09:39 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[volume]]></category>
		<category><![CDATA[volume icon]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=96</guid>
		<description><![CDATA[<p>So why would someone need this at the first place? When someone like me make a stupid mistake by removing them </p> <p>Restoring volume icon is different in Ubuntu 9.10 or later versions.<br /> </p> <p>So if you are in Ubuntu 9.04 or earlier,</p> <p>1. Right click on the panel and click &#8216;Add to Panel&#8217;</p> [...]]]></description>
			<content:encoded><![CDATA[<p>So why would someone need this at the first place? When someone like me make a stupid mistake by removing them <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Restoring volume icon is different in Ubuntu 9.10 or later versions.<br />
<span id="more-96"></span></p>
<p>So if you are in Ubuntu 9.04 or earlier,</p>
<blockquote><p>1. Right click on the panel and click &#8216;Add to Panel&#8217;</p>
<p>2. Find Sound/Volume</p>
<p>3. Add it.</p></blockquote>
<p>And if you are in Ubuntu 9.10 or later like me</p>
<blockquote><p>1. Right click on the panel and click on Add to Panel</p>
<p>2. Find &#8216;Notification Area&#8217; and add it. (IN case you have already have a notification area added like me, you can skip this step).</p>
<p>3. Right click near Notification Area</p>
<p>4. Find &#8216;Indicator Applet&#8217; and add it.</p></blockquote>
<p>By any chance if the above method does not work for you, you can restore your gnome panel by applying following commands in your terminal.</p>
<blockquote><p><code>rm -f ~/.gconf/apps/panel<br />
sudo /etc/init.d/gdm restart</code></p></blockquote>
<p>Partial credit for this post: <a href="http://ubuntuforums.org/showthread.php?t=1357005" target="_blank">Ubuntu Forum</a> <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let me know if you have any problem figuring this <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/09/21/restore-volume-icon-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to prepare bootable flash drive of Windows 7 and Ubuntu</title>
		<link>http://askbahar.com/2010/09/19/prepare-bootable-flash-drive-windows-7-ubuntu/</link>
		<comments>http://askbahar.com/2010/09/19/prepare-bootable-flash-drive-windows-7-ubuntu/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 13:11:36 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Bootable ISO]]></category>
		<category><![CDATA[Links Collection]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu Maverick]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[boot os]]></category>
		<category><![CDATA[bootable ubuntu]]></category>
		<category><![CDATA[flash drive]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[universal usb installer]]></category>
		<category><![CDATA[winodws 7]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=92</guid>
		<description><![CDATA[<p>There are bunch of articles and softwares available online to achieve this. So instead of writing another tutorial, I am sharing the available tutorials which I have used often when I needed.</p> <p>Here are the links:</p> <p>Make your own bootable Windows 7 Flash Drive</p> Recommended: <a href="http://kmwoley.com/blog/?p=345" target="_blank">http://kmwoley.com/blog/?p=345</a> Without using any additional software: <a href="http://maketecheasier.com/boot-and-install-windows-7-from-usb-flash-drive/2009/01/23" target="_blank">http://maketecheasier.com/boot-and-install-windows-7-from-usb-flash-drive/2009/01/23</a> With [...]]]></description>
			<content:encoded><![CDATA[<p>There are bunch of articles and softwares available online to achieve this. So instead of writing another tutorial, I am sharing the available tutorials which I have used often when I needed.</p>
<p>Here are the links:</p>
<p><strong>Make your own bootable Windows 7 Flash Drive</strong></p>
<ul>
<li>Recommended: <a href="http://kmwoley.com/blog/?p=345" target="_blank">http://kmwoley.com/blog/?p=345</a></li>
<li>Without using any additional software: <a href="http://maketecheasier.com/boot-and-install-windows-7-from-usb-flash-drive/2009/01/23" target="_blank">http://maketecheasier.com/boot-and-install-windows-7-from-usb-flash-drive/2009/01/23</a></li>
<li>With Microsoft provided software: <a href="http://store.microsoft.com/help/iso-tool]http://store.microsoft.com/help/iso-tool" target="_blank">http://store.microsoft.com/help/iso-tool]http://store.microsoft.com/help/iso-tool</a> (only 2.6 MB)</li>
<li>Using 3rd party software: <a href="http://maketecheasier.com/updated-boot-and-install-windows-7-from-usb-flash-drive/2009/09/" target="_blank">http://maketecheasier.com/updated-boot-and-install-windows-7-from-usb-flash-drive/2009/09/</a> (only 6.7 MB)</li>
</ul>
<p><strong>Make bootable Ubuntu using Flash Drive</strong></p>
<p>Actually this is very much easy, and same for all distro. all are free n opensource.</p>
<ul>
<li><a href="http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/" target="_blank">Universal USB Installer</a></li>
<li><a href="http://unetbootin.sourceforge.net/" target="_blank">UNetbootin</a></li>
</ul>
<p>I hope it helps, if you need any help, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/09/19/prepare-bootable-flash-drive-windows-7-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Sun Java JDK/JRE in Ubuntu Maverick</title>
		<link>http://askbahar.com/2010/09/18/how-to-install-sun-java-jdkjre-in-ubuntu-maverick/</link>
		<comments>http://askbahar.com/2010/09/18/how-to-install-sun-java-jdkjre-in-ubuntu-maverick/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 04:24:49 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Java JDK]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu Maverick]]></category>
		<category><![CDATA[jdk install problem]]></category>
		<category><![CDATA[maverick]]></category>
		<category><![CDATA[sun jdk]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=85</guid>
		<description><![CDATA[<p>As Sun (Oracle) repos has been removed completely from Ubuntu Partner repos in Ubuntu Maverick, you can&#8217;t install Sun Java JDK or JRE any more.</p> <p>Running sudo apt-get install sun-java6-jdk will produce the following error</p> Package sun-java6-jre is not available, but is referred to by another package. This may mean that the package is missing, [...]]]></description>
			<content:encoded><![CDATA[<p>As Sun (Oracle) repos has been removed completely from Ubuntu Partner repos in Ubuntu Maverick, you can&#8217;t install Sun Java JDK or JRE any more.</p>
<p>Running <strong>sudo apt-get install sun-java6-jdk </strong>will produce the following error</p>
<pre dir="ltr"><strong>Package sun-java6-jre is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jdk has no installation candidate</strong></pre>
<p><span id="more-85"></span><br />
Same error will be produced if you want to install Sun JAVA JRE.</p>
<p>To solve the issue, you have to switch back to <strong>Ubuntu Lucid </strong>distribution temporarily. After installing JDK/JRE switch back to original Ubuntu Maverick distro again.</p>
<blockquote><p><em><span style="font-style: normal;">1. System-&gt;Administrator-&gt;Synaptic Package Manager</span></em></p>
<p><em><span style="font-style: normal;">2. Settings-&gt;Repositories</span></em></p>
<p><em><span style="font-style: normal;">3. Other Softwares</span></em></p>
<p><em><span style="font-style: normal;">4. Select Canonical Partners, click Edit, change Distribution to <strong>lucid</strong>, click OK</span></em></p>
<p><em><span style="font-style: normal;">5. Repeat step 4 for Canonical Partner (Source Code)</span></em></p>
<p><em><span style="font-style: normal;">6. Hit Reload</span></em></p></blockquote>
<p>Now try to install Sun Java JDK/JRE <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Don&#8217;t forget to change back to original distribution <strong>Maverick </strong>following the same steps once you are done.</p>
<p>Tips credit: <a href="http://www.thewindows7site.com/forum/threads/18438-Ubuntu-10.10-Maverick-Meercat-and-Sun-JRE" target="_blank">Ubuntu 10.10 Maverick Meercat and Sun JRE</a></p>
<p>If you need any help, have any query please use the comment form below <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/09/18/how-to-install-sun-java-jdkjre-in-ubuntu-maverick/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

