>Quote: Your Time is Limited

>“Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma – which is living with the results of other people’s thinking. Don’t let the noise of other’s opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.”

-Steve Jobs at Stanford Commencement

>Windows Microphone doesn’t work

>Recently I’ve been having issues with my computer microphone both in linux and windows. I solved the linux problem now here is the windows.

Note: I recently installed a new operating system

One of the reason why your microphone isn’t working is because “Realtek High Definition Audio” drive isn’t installed.
What we need to do is install Realtek High Definition Audio. Click here to install (Vista and Windows 7)
When dowloaded extract it with winrar.
Then open the extracted folder and click “Setup” icon.
Once your computer reboots the microphone will start working.
Make sure all other setting are configured like the volume and the microphone is plugged in.
Any questions leave it in the comments

>YouTube Success

>Internet is one of the best things that happened to mankind. To have the ability to build a business from scratch is liberating. Your internet success isn’t determined by your weight, height, race, nationally, looks, gender, family background or your boss but by you.

Freddiew has been able to create a successful business by making youtube videos. He also shares his knowledge. Read his post on how to become a successfull youtuber.

As a side note, I think too many people get hung up on ideas. From my experience, ideas are worthless. Execution is more important than anything else -FreddieW

>Programming and Writing have in common

>Have you ever heard someone say? “You build it before, build it again”.

Its like telling a writer to rewrite a book word for word. You will be able to write the story again but not word for word. Its impossible! Creating applications is the same when coding you’re in the present and the creativity is flowing but once you leave that state you may have to start all over (research) to recreate the application. It’s important to document all your discoveries.
Don’t try to learn every function in the language but be an expert at the basics and add as time goes.

>Brand New Computer for $50

>I owned many computers and all of them had the same fate. After 2 years it became very slow to the point where I needed to delete all the memory and reset to factory settings. The computer did run faster but it would get slow again in half of the time when I first bought it. Eventually I was forced to buy a new computer because resetting wasn’t resolving the problem.

Here is what I discovered. Older technology is not the main reason why your PC slows down its the internal hard drive. Consider your hard drive like your breaks in your car. The more you use it the worse it gets.

You want a brand new computer? Change the internal hard drive (you will need to install an operating system). You can buy new one 500gb for $49. Click here to see the one I bought.

>Internet Explore extinction

>Two years ago the only browser I had installed on my computer was internet explore. I always used IE and never understood why people had something against it until I started using Chrome. Everyday that goes by I hate IE more.

From a developer prospective you need to always make exceptions for that piece of crap software and as an user for its extremely slow and unfriendly interface.
It seems that Microsoft doesn’t care. They don’t change or improve their software.
Microsoft you think you can get away with this crap huh? Its Internet Explore extinction. I won’t create or allow anyone with an IE browser to access my website. I’m not getting that many users from IE anyways. Below is how I’m going to do it.

<!--[if IE]>
<script>location = 'http://chrome.google.com'; </script>
<![endif]-->

I’m going to put this code inside the <head> tags of my site and its going to redirect the user to download chrome.

Sort an Array of Arrays in PHP

Want to know how to sort the code below by [name]?

Array(  
    [0] => Array(
        [id] => 1
        [name] => Rob
    )  
    [1] => Array(
        [id] => 4
        [name] => Ultimate
    )  
    [2] => Array(
        [id] => 8
        [name] => Dog
    )

eg:

    //for array  
    function views($a,$b){  
        return strnatcmp($a['name'], $b['name']);//to reverse the sort swap the variables(letters)  
    }  
    //for stdClass object array  
    function viewsObj($a,$b){  
        return strnatcmp($a->name, $b->name);  
    }  
    usort($result,'views');  
    echo '<pre>';  
    print_r($result);  
    echo '</pre>';

Below is an example how to put the above code inside a class.

class receipt_model  {
    private $array;
    public function __construct($array){
        $this->array = $array;
    }

    public function do_sort(){
        $cmp = function($a,$b){ //function needs to be defined this way or it cannot be callable/callback inside a class
            return strnatcmp($a['name'],$b['name']); //relationship by date
        };//dont forget the semicolon

        usort($this->array,$cmp);
    }
}

Navigate to the full tutorial.

02-05-2014
Came across an issue not sure if its a php bug or was done on purpose but ‘strnatcmp’ ignores whitespace in the sorting. Here is an alternative workaround.

function sort_by_group_whitespace($first, $second){ //doesnt ignore whitespace
    if ($first[0] == $second[0]) {
        return 0;
    }
    else {
        return (strtolower($first[0]) < strtolower($second[0])) ? -1 : 1;
	}
}

Resource:
http://stackoverflow.com/questions/18276425/why-are-spaces-ignored-in-natsort-strnatcmp-strnatcasecmp

tags:
nested