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

, , ,

Leave a comment

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…

, , ,

Leave a comment

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!

, ,

Leave a comment

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

, , , ,

Leave a comment

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’

, ,

2 Comments

Enabling MMS on iPhone – can not send accept picture text/sms messages

**You will use this method on your own risk. Even though it has worked for me, I can’t guarantee that it could work for you**

I have been using iPhone for a while and I was not able to send/receive picture and video messages though. Since I have started to mess with my phone badly, I have fixed that problem and I will share it with you in a easier way.

Step 0. Make sure you are connected to the internet through the wi-fi connection.
Step 1. You need to have an access to the inner files of the iPhone.
This can be done thru a lot of softwares like iFuse and the like. But I prefer the ssh method

Step 1.2 Install ssh. Openssh is available for iPhone from the cyndia, it is an effortless process to install. Don’t forget to change your root password and to REALLY REALLY remember your root password. If you forgot it, the damage is huge as to reinstall your ios..

Step 2. Once you install openssh, you can ssh to your iPhone to access the files. Being on the ubuntu/Linux terminal do:

sudo ssh root@YOUR-IPHONE-IPADDRESS

Followed by your root password
Your iPhone ip can be found from your iPhone settings->General->Network: go to the wi-fi and click on the network you connected. There you would get the ip-address.

Once you are on the directory navigate to

private/var/mobile/Library/Prefrences

The file of our interest is com.apple.mms_override.plist.
The config for this file could be a bit different per carrier. For example the T-Mobile one can be found at t-mobile along with the instruction on t-mobile instruction

Hope it helps a bit… you can post your questions on the comment section and I will try to help you based on your questions

, , ,

4 Comments

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");
    }
}

, ,

Leave a comment

SVN Info equivalent in mercurial for find repo url/address

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

, ,

Leave a comment

undefined variable error javascript with php

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

, ,

2 Comments