Saturday, November 26, 2011

Don't focus on the pain

Don't focus on the pain until the pain comes. When you go to exercise the main reason you procrastinate is because your trying to avoid pain but if you don't focus on that but focus on putting you clothes, then walking out the house, sketching and so on. Focus on the next step.

In programming I use the same philosophy. If I think about building this huge software I'll get discouraged but if I focus one day at a time, adding to a little each day makes it a lot easier to move foward.

Friday, November 25, 2011

Autostart XAMPP in linux ubuntu

This is the simplest and easiest way to autostart automatically xampp when your computer boots

1. run the line below in terminal, this opens the file rc.local for editing
$ sudo gedit /etc/rc.local

2. write this line of code in the file rc.local. Make sure you follow the instructions contained in the file
/opt/lampp/lampp start

3. save and exit




#no need to edit init.d

Wednesday, November 23, 2011

Quote: Pain Period

“The last three or four reps is what makes the muscle grow. This area of pain divides the champion from someone else who is not a champion. That's what most people lack, having the guts to go on and just say they'll go through the pain no matter what happens.” -Arnold Schwarzenegger

Monday, November 21, 2011

Keep it Sensitive, Case Sensitive!

They're case sensitive operating systems and programming languages, and others that are not. Now do you give in to the medium rules or do you stay congruent no matter what or where you are developing?

This is an easy question. Of course you stay congruent across mediums but the challenge is discipline. Because not being congruent today may not effect you now but it will in the future, like it happened to me.

Recently I transferred my websites from my windows to Linux server. I could not get the sites to work on Linux. After hours of debugging I found that the error lied in the case of the string. Not only did it effect my variables but also the URL. I looked around for a way to change this feature but realize that its a good thing to have. I was practicing a bad habit and needed to brake it now.

Now when you have that thought "Is this case sensitive." You'll know what to tell yourself. Keep it Sensitive.


Ways to be congruent:
Defining your variables, folders, files and so on in a standard naming convention. Camel back (camelBack) your variables and capitalize your classes.



Notes:
Case Sensitive => Linux, Unix, Javascript
Case Insensitive => PHP, Windows

Friday, November 18, 2011

Javacript Chaining

Javascript chaining pattern is the process of stringing methods/functions together without
having to recall the object. jQuery made this pattern famous.

jQuery Example:
$('div').css('color','red').html("I'm a second chain");

How to create your own:

var chain = {
first: function(){ //a method
alert("I'm first");
return this; //this is the secret
},
second: function(){ //another method
alert("I'm second");
return this; //this is the secret
}
}

//The chain
chain.first(); //alerts only the first
chain.first().second().first(); //alerts first,second and first(order insensitive)
This benefits you because the object doesn't need to be rewritten every time you want to use a method, resulting in less code. Call it once and add the methods to it.

The secret lies in returning the object (this). It resets the object allowing the next chain to use it.

Wednesday, November 16, 2011

Mind Cloaking

In my writing I have noticed that I can prof read and re-read and will not find any errors but if I change the background of what I'm reading on, the error becomes evident.

It's like your mind is auto completing, tricking, cloaking the errors.

There may be a name for this occurrence. It seems similar to those images with a black dot in the middle where if you stare at it long enough a secret image will show or when two colors are next to each other they look like the complete opposite but when apart they're only different shades of the same color.

This also happens in programming. You may be looking at a bug right in the face but you cannot find it unless you take a break or change the environment.

Monday, November 14, 2011

Set up a Custom Git Remote Server like GitHub



In the server:
# have ssh installed on your server
$ sudo apt-get install openssh-server

# install git on both local and server machine
sudo apt-get install git

# navigate inside the folder you want to contain the repository
# create a new repository
$ git init

In local machine:
# navigate inside the folder you want to contain the repository
# create a new repository
$ git init

# set the origin
$ git remote add origin ssh://michael@192.168.0.175/GitServerFolderCreatedLocation

# update the server
# when pushing to the server make sure your not in the branch your pushing to
# you may need to fetch and merge (pull) before you can push
$ git push origin --all          #or $ git push origin [branch Name]

# update the local machine, get data from server
$ git fetch origin [branch Name]

Friday, November 11, 2011

Skype Blacklist

Skype can be used as a blacklist. Sort out the calls you do not want to receive. Smart phone have applications that allow you to block incoming calls but what about landlines? You can block calls from your ex-girlfriend, debt collector or some pre-recorded call offering you a business opportunity.

The way it works is to have a skype number and your original number (cell phone, landline). Redirect skype calls to your orginal number. Now you can give skype number to whoever and not worry about getting on some calling list because you can now block it. Every number blocked on skype will not be redirected to your original number creating a black list.


If you need details on how to set it up, how to block it. Leave a comment.

Thursday, November 10, 2011

Whitelist. A Javascript Object

Blacklisted are those who access were removed and whitelisted are those who are specifically granted access or privilege. Below is a Javascript whitelist object.

//START OBJECT
var white = {
list: new Array(),
request: function(permitted){
for(var value in this.list){
if(permitted == this.list[value]){
return true;
}
}
}
}
white.list = ['jon','max']; //set who has can have access
//END

//Lets test the object
if(white.request('jon')){
//if access granted
alert('welcome VIP')
}else{
//not granted access
alert('Access was never granted to you');
}

Wednesday, November 9, 2011

Git Introduction Video

Awesome video explaining how Git (version control system) works and how to use it. Scott Chacon Evangelist & Ruby Developer from GitHub does a great job using images, graphs and demos to help illustrate.




Reference Site: gitref.org

Tags:
alternative to subversion

Tuesday, November 8, 2011

Quote: Byproduct

Winning is a byproduct of what you put in -The Compound wrestling coach

Friday, November 4, 2011

Looks can be Deceiving

Its funny how many companies, clients and employers miss great talent to hire or give an opportunity to someone because they're blinded by their perception of how something should "look like". If you look too young, look introvert, look blah blah blah.

Even if you have shown your capability the opportunity is given to someone who "looks" capable but can't back it up. I'm tired of reading stories about people leaving their high paid jobs to start their own company and who sold their companies but later quit because they didn't have the freedom to do want they wanted. If he created a successful company that made you want to buy why would you remove the creators ability to innovate, stupidity.

In a perfect world this wouldn't happen but we don't live in a perfect world, so don't spend time worrying about it. If you don't like it, move! You're not a tree. Maybe its time to hire or give the opportunity to that person you see in the mirror that you have overlook for a very long time.

Wednesday, November 2, 2011

Extention of your Memory

"Usually when I want to remember something I blog about it. Because I can go back and look it up". I read this somewhere and was able to relate to it.

Most of my post are about projects I've been working on that week or that day. It helps to remember what you have learned when its organized and made comprehensive to others in writing. It gives you clarity on what's in your head and also a better understanding. Most of my writing I have to rewrite because the first draft is crazy confusing and the information is fresh in my head. But whats fresh today may not be still there a month down the road, forcing me to forget. If everything fails I can always come to my blog, run a search and BAM there's the answer. Extention of your Memory!