Archive for August, 2012
Ubuntu 12.04 display problem – it shows application windows like winxp classic
How is the ride with ubuntu 12.04 precise so far? I love it.
But I added one more monitor to it and played a bit with xorg.conf> and with nvidia settings.
All worked perfect. But, when I try to view my applications like netbeans or even firefox it shows them like an old classic windows xp thing..
I solved the problem by using gnome classic :(.
Here is all you have to do to get it working
Go to your terminal and type
sudo apt-get install gnome-session-fallback
Then log out.
When the log in screen comes, click the little circle on the right top corner of the login screen and select gnome classic
DO-NE
How to View WIFI password in Mac
Here is step by step way to see the wifi password on your mac. It is customary to usually forget the wifi password and, of course, seeking it for our other gadget.
1. Go to Applications folder – it sits the far right of the dock [if you have the default setting of the dock]
2. Go to Utilities
3. Open Keychain Access
4. You would see the name of the wifi on the list – open it. You can open it by doulbe clicking on it or just select and hit enter.
5. On the opened window, there is a show password checkbox. When you click on the checkbox to select it, you would be provided with another window asking you your administrator password.
6. Enter your password and hit enter. You will see your wifi password next to the show password checkbox.
Happy Passwording…
localhost shows 403 forbidden in snow leopard mac
In mac, to set up your apache all you have to do is:
Go to terminal and type
sudo apachectl start
– you can get the terminal by going to Application folder and then to utilities and by clicking terminal.
Then go to your browser and type http://localhost.
Now if you get the error 403 forbidden then:
Open /etc/apache2/extra/httpd-vhosts.conf file and make sure you have proper directory setting for example:
ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/Library/WebServer/Documents" ServerName local.com ErrorLog "/private/var/log/apache2/local.com-error_log" CustomLog "/private/var/log/apache2/local_access_log" common
In the above example, the document root is in Library/WebServer/Documents. Which means if I want to create a website, then the website folder has to be inside that and will be accessd as http://local.com/website
**if you name server as localhost, then you can access it as http://localhost
Finally, check if hosts file has correct ip-servername mapping by looking into the file /etc/hosts
Then reload your apache
sudo apachectl restart
EnJoY!
Changing computer name/hostname in Linux
This is simple in Linux. Say your old name is oldname and you want to change it to newname
1. Goto /etc/hostname and change the name to newname
2. Go to /etc/hosts and update the name from oldname to newname
3. restart your machine
D O N E
Invalid command VirtualDocumentRoot perhaps misspelled apache failur error
So you got the above error ha? I have been dealing with that as well. Here is the solution.
The root of the problem is mod_vhost_alias.so file.
This file would be used to enable the the mod_vhost_alias. Once this is enabled you are done.
Step 1.
go to
/usr/lib/apache2/modules
and verify the file mod_vhost_alias.so exists. If not, google that file and put it there
Step 2.
go to
/etc/apache2/mods-enabled
and create a file named vhost_alias.load
vi vhost_alias.load
and put the following inside it
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
Step 3.
Do step 2 inside mods-available
Step 4.
restart apache
sudo /etc/init.d/apache2 restart
Step 5
Show 🙂 face!!
This analogy can be used for errors like
Invalid Command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration. Action ‘configtest’ failed’
and for
Invalid Command ‘rewriteengine’, perhaps misspelled or defined by a module not included in the server configuration. Action ‘configtest’ failed’
Find the first occurence of number in the sorted array
This is relatively easy algorithm. But a bit tricky at the same time.
It can be done with log(n) with almost o(1) space complexity
#include /* * Find the first occurence of the given number in index. * @author Kaleb Woldearegay */ void main() { int nums[] = {1,1,3,5,8,8,8,10,12,23,23,55}; int len = sizeof(nums)/sizeof(int); int start = 0, end = len-1, search = 8; int found_right = -1; while ((end - start) > 1) { if (found_right != -1) { if (nums[end] != search) { break; } found_right = end; end -= 1; continue; } int mid = (end + start)/2; int val = nums[mid]; if (val == search) { end = mid-1; found_right = mid; } else if(val < search) { start = mid; } else { end = mid; } } if (found_right != -1) { printf("found at %d", found_right); } else { printf("found No where"); } }
SVN Info equivalent in mercurial for find repo url/address
Posted by gullele in Programming Tools on August 2, 2012
for finding repo info from the mercuiral module/repo
1. goto the module
2. open the .hg hidden folder
3. open the hgrc file and you will find it there
undefined variable error javascript with php
Posted by gullele in jQuery/JavaScript/CSS, PHP on August 1, 2012
you want to do something simple like passing variable like this
<?php $variable_name = "some value"; var some_var = <?=$variable_name" ?>;
but it didn’t work
Here is the solved version…
Very simple than you thought
<pre> $variable_name = "some value"; var some_var = "<?=$variable_name" ?>"; </pre>
yup, just quote it from left and right so that it wont be considered as string not JS variable. If the value in variable is number, there would not be any problem