Tuesday, December 27, 2011

Godaddy Goodbye

Baligena.com has transferred its domain name out of Godaddy.

Haha whats up with the discount until 12/29/11 Godaddy. I hate when companies act as if they're above their customers and when the shit hits the fan they come back apologizing, expecting everything to be alright. But its too late to apologize and if Godaddy is having a hard time understanding, below is a video that will help.



Baligena is now with namecheap.com because it's being mention alot from internet advocates such as techcrunch, hacker news and reddit. Also they are also apposed to SOPA and I their current slogan. Exercise your right. Yes, you're damn right I'm going to exercise it. They also have good prices.

I invite you to join me.
Click here for step by step instructions on how I did it.

Sunday, December 25, 2011

Stick to you commitment

You lose track of your purpose when you achieve little success. You cannot change your path even though success is coming. Once you made a commitment you stick to it. -Baligena

Saturday, December 24, 2011

View all MySQL tables in console

You may be wondering why phpmyadmin is showing more tables than the console or vise versa.

The reason is because one of them does not have the privilege to view them all. I was having a issue with seeing all my tables in the mysql console and this is what fixed it. I had to log in as the root. (I'm using a linux computer)

$ /opt/lampp/bin/mysql -u -p


If its the other way around which phpmyadmin doesn't show all the databases is because you have put the wrong user in phpmyadmin source code. Change phpmyadmin settings to fix this.

tags:
phpmyadmin database does not match console
mysql hidden tables console
not all databases are shown in console
show all databases

Access MySQL console in Linux using XAMPP

Open the terminal and type:

/opt/lampp/bin/mysql

Then press enter and the terminal will turn into the console.

To exit the mysql console type exit and press enter

Thursday, December 22, 2011

Programming Insomnia

Programming may give you Insomnia, it kept me up a couple of nights. Not because I had a deadline due the next morning but I couldn't stop thinking about coding. But this may be good insomnia. According to studies and also mentioned by VSauce when you dream about something difficult it's your subconscious trying to solve the problem. I had an experience once that I could not figure out a trigonometry problem but I went to sleep and woke up with the solution.

Monday, December 19, 2011

Listen to your users?

Steve Jobs from Apple made the statement that he doesn't conduct focus groups because customers don't know want they want because they haven't seen it yet. But there's a difference between being a visionary and not listening to users. When users were complaining about the IPhone dropping calls because the way it was held, Apple had to address that issue.

Another example is Todd Howard the directory of Elders Scroll Skyrim rated the best game of the year. Todd Howard personally goes on forums to read every comment to find out what players where complaining about until he hit mass success with Oblivion and couldn't read all of it anymore. He personally plays many successful and competitors games to find out what people are liking. He takes all this, new ideas and integrates into his game.

Friday, December 16, 2011

Don't fix what's not broken

Programs and websites are always trying to find the sweet spot between functionality and design, have those two things balanced. Now what sucks is having both of them close to perfection but changing it, like YouTube. YouTube new home page design is crap! How do you go from easy to use to hard. Yes it wasn't the prettiest design but the functionality was good. Functionality beats pretty any day.

The best program are self explanatory and use common sense. If a site needs a tutorial on how to use it, it's on the wrong path. WHY!?

Is it because they want their programmers to get busy like fast food restaurants make employers clean something that was already cleaned 1o minutes ago just for the the sake of being busy.

I understand change can have negative effect and it's necessary but when it jeopardizes usability. Someone needs to rethink their strategy, don't fix what's not broken.

Wednesday, December 14, 2011

You're being tracked

Be careful when you download torrents because it can be tracked. Checkout what you been tracked on youhavedownloaded.com

Monday, December 12, 2011

Turn PHP array into objects - stdClass

Want to access the contents of an array as simple as $array->firtParam

Here's how you do it

<?php
$person = array (
'firstname' => 'Richard',
'lastname' => 'Castera'
);

$p = (object) $person;
echo $p->firstname; // Will print 'Richard'
?>

Multi-dimensional array example

<?php
function arrayToObject($array) {
if(!is_array($array)) {
return $array;
}

$object = new stdClass();
if (is_array($array) && count($array) > 0) {
foreach ($array as $name=>$value) {
$name = strtolower(trim($name));
if (!empty($name)) {
$object->$name = arrayToObject($value);
}
}
return $object;
}
else {
return FALSE;
}
}
?>

<?php
$person = array (
'first' => array('name' => 'Richard')
);

$p = arrayToObject($person);
?>

<?php
// Now you can use $p like this:
echo $p->first->name; // Will print 'Richard'
?>
Reference

Wednesday, December 7, 2011

Concatenate Variables names in PHP

This is for when you want to have a variable to be part of a new variable nam

$var1 = 'category';
$var2 = 'one';
${$var1.$var2} = 'sometext';

//OR
$var1 = 'category';
$var2 = 'one';
$var = $var1.$var2;
$$var = 'sometext';

/*
this creates the var $categoryone
with with the value of 'sometext'
*/

Intergrate Zend into Codeigniter

Use Zend framework Libraries in CodeIgniter framework

click me

tags:
youtube API, GData

Monday, December 5, 2011

Do not develop in IE or Opera

Opera is suppose to be fast and conserve bandwidth because it downloads the page onto your computer but it sucks for developing!

The issue is the downloading makes the changes unaffected in development mode. I spent hours trying to fix the position of a background to later find out that I had delete the downloaded data for it to display correctly.

To delete the data go to Opera>Settings>Delete Private Data.

Now Internet Explorer does the same thing but it sucks in everything. I wish IE will disappear from the face of the earth.

Friday, December 2, 2011

960.gs Bookmarklet

Reference

The bookmarklet below will draw grids on your webpage

javascript:(function(){var%20jqLoader={go:function(){if(!(window.jQuery&&window.jQuery.fn.jquery=='1.3.2')){var%20s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js');s.setAttribute('type','text/javascript');document.getElementsByTagName('head')[0].appendChild(s)}this.ok()},ok:function(){if(typeof(window.jQuery)!=='undefined'&&window.jQuery.fn.jquery=='1.3.2'){this.init()}else{setTimeout((function(){jqLoader.ok()}),100)}},init:function(){$.getScript('http://www.badlydrawntoy.com/static/960grid/js/jquery.960grid.bk-1.0.min.js',function(){$('body').addGrid(16)})}};jqLoader.go()})();


Tags:
grid

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!

Monday, October 31, 2011

Best Javascript Debugger

While in production the best javascript debugger is the line of code below.
window.onerror = function(error,file,line){alert(error+'\n'+file+'\n'+line);}
Add it to the beginning of your script and the error will be alerted. The alert will have the error, file name and what line the error occurred on. Make sure to remove it once out of production mode.

Friday, October 28, 2011

Example: Small Javascript library

In jQuery you can call a function like $.ajax() and insert an object inside of it and each property does an action. Below I have simplified an example to demonstrate how this works.


//create the library
var lib = {
sum: function(num){ //create a method
var num1 = num.a;
var num2 = num.b;
this.result = num1 + num2;
},
table: 'table' //this is a random property, its not necessary
}

//call a method and create an object inside of it to send data to the library
lib.sum({
a : 1, //these are the properties that will be processed
b : 4
});
alert(lib.result); //output 5



//above is similar to the jQuery AJAX below
$("#input").keyup(function(){
var data = $('#input').val();
$.ajax({
url:"models/post.php", //these are the properties that will be processed
type: "post",
data: ({name:data, age:'15'}),
success:function(result){$(".result").html(result);}
});
});



jQuery Deconstructed is a rather nice way to look through the source. You will learn alot by studying it.

Wednesday, October 26, 2011

Quote: Discipline is the Bridge

“Discipline is the bridge between goals and accomplishment.” -Jim Rohn

Saturday, October 22, 2011

Tip: Multiple class per element

Below is an example on how to use multiple classes per element. I needed it when I used the 960.gs grid framework.

<style>
.blue {
color: blue; /*makes the font blue*/
}
.underline{
text-decoration:underline;
}
</style>

<div class="grid_12 blue underline">Make me blue and underline using three different classes</div>
The space separates the two classes. KISS

many classes

Friday, October 21, 2011

Internet is like a Candy Store, Open Source is its Candy

The internet is like a candy store and the candy is free. They're many free stuff online but what makes me excited is the open source, this is high quality free. It may be hard for someone who doesn't program to understand what I'm talking about. I feel spoiled when I run across an open source software. Seriously, these are unequivocally amazing. From programing languages such as PHP, Python and javascript, to libraries like jQuery and jqPlot to applications such as piwik, to software like blender, to frameworks like CodeIgniter, to operating systems like Ubuntu linux, mail transfer agent like Postfix and the list goes on. There's so many its hard to use them all. Here is a list of high quality open source projects per category.

Wednesday, October 19, 2011

Web Charts - PHP and Javascript

pChart.net and jqPlot.com are two different libraries that allow you as a web developer create beautiful charts and graphs.

jqPlot is a javascript library that uses jQuery. jqPlot is great because it can pull data directly from multiple mediums such as csv, txt, json and so on. However it sucks because different charts may need different plugin files and you need to make sure the right script is included, but its still simple.

pChart is a PHP libray that uses its GD library. You may need to configure your php depending if this library is installed or not. pChart is a object oriented class that creates an image of a chart on the webpage. The webpage becomes an image which will not let you output any html. The only way you can link to the chart is by using <img> or <iframe> tag. Whats great is that you can create an image that can be save but what sucks is that you may not be able to use AJAX and it takes a huge load on your CPU.

Monday, October 17, 2011

Milestone: 100th Post

Since March 28th I been at it consistently. There were days I didn't want to post and days I couldn't wait to post. Posted some great content and not so great. I have learned and improved skills because I decided to take a couple of minutes, 3 days a week to put what was in my head and expose it to the world.

Stats:
start date - March 28, 2011
Number of Days - 203
Post - 100
Most Popular Post - How to get the microphone to work, Ubuntu 11.04
Total views - 1,275
average views per day - 6.28

Friday, October 14, 2011

Example: JSON

WARNING!! Do not test it in Chrome it will not work. Only live.

JSON: is used for data storage and can be an alternative to XML.

HTML:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script>
window.onerror = function(a,b,c){alert(a+b+c);} //if error alert
$(document).ready(function(){
//Short hand
$('button').click(function(){
$.getJSON("info.js", function(json) {
alert(json.name[1].first)
});

//Long
$.ajax({
async: false,
url: 'info.js',
dataType:'json',
success: function(json) {
ret = json.name[1].first;
}
});
});
});
</script>

<p>hello</p>
<button>Click Me</button>

JSON (info.js) - everything must have double quotes except numbers. You cannot comment in JSON. It has to look like the example below and it has to be in object/brackets {}

{
"name" : [{"first" : "Britney", "last":"Spears"},
{"first" : "Angelina", "last":"Jolie"}],
"age" : 25
}

Wednesday, October 12, 2011

Quote: Mother of Invetions

Necessity is the mother of invention. -Plato

We always end up creating what we need, go fill that need. Even Plato knew that hundred of years ago.

Monday, October 10, 2011

Watch and Transfer videos to PS3 using a Flash Drive or Hard Drive

Do you want to watch videos on you Play Station 3? Do you want to transfer movies from computer to PlayStation 3? Below are the instructions using a flash drive/hard drive

Make sure the flash drive or hard drive is formatted to FAT32. Create a folder inside the flash drive / hard drive named VIDEO (must be all caps). Put your videos inside this folder (h264, AVI...).

In PS3:
Navigate to the video. Select the flash drive or hard drive then select the video.

Friday, October 7, 2011

Javascript Object Inheritance - Extend and Multiple

These two javascript functions does the inheritance
//inheritance
function extendCopy(obj){
var n = {};
for(var i in obj){
n[i] = obj[i];
}
n.uber = obj;
return n;
}

//multiple inheritance
function multi(){
var n={}, stuff, j=0, len = arguments.length;
for(j=0;j<len;j++){
stuff = arguments[j];
for(var i in stuff){
n[i] = stuff[i];
}
}
return n;
}

Below test the object to see if it worked
//Setting objections
var first_obj = {name:'first', doSomething: function(){alert(2+2);}}
var second_obj = {date:'today', location: 'USA'}
var third_obj = {felling:'happiness', status: 'fun'}
http://www.blogger.com/img/blank.gif
//append/inheritance first first_obj to second_obj
var second_obj = extendCopy(first_obj);
document.write(second_obj.name); // first

//add both the first_obj and third_obj at the same time
var fourth_obj = multi(first_obj,third_obj);
document.write(fourth_obj.felling);// happiness


Another example of javascript inheritance using constructors

Thursday, October 6, 2011

Quote: How to Fail

Failure is not a single, cataclysmic event. You don't fail overnight. Instead, failure is a few errors in judgement, repeated every day. -Jim Rohn

Monday, October 3, 2011

Javascript String Manupulation Examples

Below are javascript functions to manipulate the URL and most common used string manipulators.
<script>
var content = encodeURI(window.location);
document.write(content + '<br >');

document.write(content.charAt(0) + '<br />'); //returns the character at the number position http://www.blogger.com/img/blank.gif
document.write(content.length + '<br />'); //string length
document.write(content.indexOf('a') + '<br />'); //position of first occurence
document.write(content.lastIndexOf('a') + '<br />'); //positions of last occurence
document.write(content.substring(5,10) + '<br />'); //substring(start,end)
document.write(content.substr(2,3) + '<br />'); // substr(start, length from start)
// Try not to confuse substr and substring the completely different

</script>
Additional JavaScript String Objects

Saturday, October 1, 2011

Decrypt and Encrypt in MySQL example

If you need to put encrypted data (eg.credit cards) into MySQL database. Below are examples on how to encrypt and decrypt your data. We don't use the password function because once encrypted it cannot be decrypted.

Make sure the data field accepts special charaters like char() not varchar()

Encrypt:
INSERT INTO tableName (fieldName)
VALUES (AES_ENCRYPT('dataGoesHere','ThePasswordGoesHere'));

Decrypt:
SELECT aes_decrypt(fieldName,'ThePasswordGoesHere') 
FROM tableName;

Wednesday, September 28, 2011

Hide a file in Windows

There various ways to make a file hidden in windows but the example below will make it really hidden, it's like magic.

open CMD

To select file:
C:\Users\Fel\Dektop>attrib [filename] +h +s

The file will disappear. You cannot find it in the GUI or the CMD when dir command is used. It also will not show if you have the "show hidden files" selected in the folder options. (make sure you hide it first to make it work)

Now for the prestige (bring it back)

C:\Users\Fel\Dektop>attrib [filename] -h -s

Monday, September 26, 2011

Resizing <Table> with CSS. Staying within the wrapper

Having issues with keeping the table as the same size of the wrapper or parent? See code below.

<style>
/*Center the content*/
#wrapper {
margin: 0px auto;
width: 230px;
height: 100px;
background: grey; /*this is only to show how the table is within the wrapper*/
}
table {
table-layout:fixed; /*makes the table to be a specific size*/
width: inherit; /*need to be include to make the table specific size*/
}
input {
width: 100%;/*size of the input box, keeps the table inside the wrapper*/
}
th{
overflow: hidden; /* hides text overflowing the field*/
}
</style>


<div id="wrapper">
<table border="1">
<tr>
<th id="livesearch">Date</th>
<th id="livesearch2">First_Name</th>
<th id="livesearch3">Last_Name</th>
</tr>
<tr>
<!--the onfocus and onblur what makes the <th> resize when selected, this is not necessary to make the table a fixed size-->
<td ><input onfocus="document.getElementById('livesearch').style.width='100px';" onblur="document.getElementById('livesearch').style.width='auto';"class="date" type="text" /></td>
<td> <input onfocus="document.getElementById('livesearch2').style.width='100px';" onblur="document.getElementById('livesearch2').style.width='auto';" class="type" type="text" /></td>
<td> <input onfocus="document.getElementById('livesearch3').style.width='100px';" onblur="document.getElementById('livesearch3').style.width='auto';" class="type" type="text" /></td>
</tr>
</table>
</div>


Notes: Overflow in table, wrap text in table, table width

Friday, September 23, 2011

DOMDocument, accessing other sites HTML. Bypassing the Same Origin Policy

Below is a code that retrieves <a> tags from a webpage outside the server using the DOMDocument. A built in PHP class that retrieves HTML and XML from a webpage. Bypassing the Same Origin Policy. This is an alternative to cURL which downloads the entire HTML page.



$keywords = array();
$domain = array('http://bing.com');//select website to extract

$doc = new DOMDocument;
$doc->preserveWhiteSpace = FALSE;

foreach ($domain as $key => $value) {
@$doc->loadHTMLFile($value); //Load HTML from a file
$anchor_tags = $doc->getElementsByTagName('a'); //get <a> tags by accessing the DOM
foreach ($anchor_tags as $tag) {
$keywords[] = strtolower($tag->nodeValue);
}
}
echo '
';
print_r ($keywords);
echo '
';

Wednesday, September 21, 2011

Don't be specific

When coding, you should attempt to be the least specific as possible. One way to achieve this is by using more variables.

This is beneficial because if you ever need to update your code you only do it at one location, easy maintenance. I created an application that fetched data from a database. But coded using code specific to a table and database at multiple locations in the app. When I decided to change the table I would get an error because different parts of the code was requesting data from different tables. It took me hours to search through my code to match all these request.

Monday, September 19, 2011

Quote: Stand up

"It is the first responsibility of every citizen to question authority".
-Benjamin Franklin, one of the Founding Fathers of the United States

Wednesday, September 14, 2011

Setting the input className to the object value

The code below creates and set the value of the object when filling out a form. This can be used for POST or GET method request.

<input type="text" class="balls" />
<input type="text" class="bat" />
<script>
var stat = {
data: {date: '2011-02-01', type: 'balls'},
column: //sets the value to stat.data
function(){
$('input').focusout(function () {
var attr = $(this).attr("class");//get the attribute (className) of tag
//create and set value for the object
stat.data[attr] = $(this).val(); //set value to stat.data
});
}() //this autostarts the function
}
<script/>

From locahost/stats website

Monday, September 12, 2011

Optical character recognition (OCR)

Optical character recognition

I had a scanned document on my computer as an image and I didn't want to type the whole thing out nor did I have expensive software to covert the text on the image to "encoded text". I found a free software called onlineocr. It does exactly that, I wished I had something like this back in college.

Friday, September 9, 2011

Don't Think

Don't think. Want to get it done? Don't think. If you do think you will think about how long it will take, think about the chances of failing, think about another time to do it (procrastination), think yourself out of it. Don't Think, DO.

Wednesday, September 7, 2011

Chrome is Pissing me Off

I've been programming lately and this week I had Google Chrome web browser not work correctly. I was using jQuery JSON and AJAX, and tried to view a webpage source and these three instances didn't work in Chrome but worked perfectly in Firefox. I don't know if the issue is because I'm using it natively on my desktop to test, I hope it is. Chrome is a good browser to surf the internet but not the best to test your code. Imagine the frustration of coming to a conclusion that a code doesn't work but later finding out it works because chrome doesn't work when using local files. That's a bunch a BS.

I would say "I hope they fix that" but I'm going to do what I can control. I'm switching to Firefox.

Monday, September 5, 2011

Javascript Object Inheritance and Overwriting - Using Constructors

Read the comments(green text) in the code below
function shape(){ 
this.name='shape';
this.tostring = function() {return this.name;};
}

function TwoDshape(){
this.name = '2D shape';
}

function Triangle(side,height){
this.name = 'Triangle';
this.side = side;
this.height = height;
this.getArea = function(){return this.side * this.height /2;};
}

//Inheritance
//overwriting objects sort of. if you print the TwoDshape.constructor it will show the assigned object but all the properties from inside both functions are accessible unless one has the same name, the original is printed so below shape() properties is added to TwoDshape() and TwoDshape() is added to Triagle(). making Triangle() have itself and shape() and TwoDshape() propeties within

TwoDshape.prototype = new shape();
Triangle.prototype = new TwoDshape();



//good idea to reset the constructor after inheriting, because overwrite the object has negative side effects
TwoDshape.prototype.constructor = TwoDshape;
Triangle.prototype.constructor = Triangle; http://www.blogger.com/img/blank.gif

var my = new Triangle(5,10);
document.write(my.getArea());
document.write(my.tostring());

The output is 25Triangle

Another example of javascript inheritance using the pure object

Special Thanks Object-Oriented Javascript

Friday, September 2, 2011

jQuery AJAX .load()

jQuery AJAX is wonderfully powerfull. The more I use it the more I like it. Its very simple compared to the pure AJAX javascript code. jQuery has a couple of different AJAX syntax but the simplest is the .load(). Choose which element you want to target and which location/file you want to pull content from. Barabam AJAX.

Example:
$('div').load('test.html');
Above changes the div tag in current page to the test.html

One cool feature is the ability to pull a selected portion of the location by having a space after the location name and specifying the part.

Example:
$('div').load('test.html #content');
Above changes the div tag in current page to the test.html where the id equals "content"

More information check .load() – jQuery API

Wednesday, August 31, 2011

MySQL Cheat Sheet

MySQL Commands

//select database
mysql> use [databasename]

//show all databases
mysql> show databases;

//show database tables
mysql> show tables;

//describe table, must have the database selected
mysql> show tables;

//a search query that allow regular expressions
SELECT * FROM customers WHERE city like 'Air%';

//create table, must have a type after the name. eg: name=customerid, type=text
create table books
(customerid text, name text);

//delete table
drop table balls;

//insert values
insert into customers values
(null,'blahblah', 3);

//connecting subqueries
select name from customers where customers.customerid = any (select orders.orderid from orders,order_items where orders.orderid = order_items.orderid);

//Update record
update books set price = price1.1;

//alter table, add columns. its like create table, name and type
alter table books
add (tax text);

alter table books
drop tax;

//delete record
delete from customers
where cus

Monday, August 29, 2011

Center HTML/Webpage

To center your webpage its simple. By setting the width and margin you can achieve this. However, depending on the browser (Internet Explorer) you must include the doctype or it will not work. See the code below


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body>
<html>
<style>
#main {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="main">



</div>
</body>
</html>

Thursday, August 25, 2011

Quote: Stick to it

Steve Jobs stepped down as CEO at Apple today. He is an inspiration to me and many others through his products, life and beliefs.

The problem with the Internet startup craze isn’t that too many people are starting companies; it’s that too many people aren’t sticking with it. That’s somewhat understandable, because there are many moments that are filled with despair and agony, when you have to fire people and cancel things and deal with very difficult situations. That’s when you find out who you are and what your values are.
So when these people sell out, even though they get fabulously rich, they’re gypping themselves out of one of the potentially most rewarding experiences of their unfolding lives. Without it, they may never know their values or how to keep their newfound wealth in perspective. -Steve Jobs

Wednesday, August 24, 2011

Frameworks

Don't reinvent the wheel. Below are frameworks that allow you to code without having to start from scratch.

HTML - Boilerplate

PHP - CodeIgniter

CSS - Twitter Bootsrap

CSS structure - 960

Javascript - jQuery

Sunday, August 21, 2011

Self-discipline

Simple definition to self-discipline

The ability to make yourself do, what you know you should do, when you should do it, when you feel like it or not. That's the difference between success and failer is whether you feel like it or not. -Brian Tracy

Saturday, August 20, 2011

Giveaway

This is baligena first Giveaway. What better way to thank all you who been supporting the site. baligena will be giving an iPod shuffle. The giveaway starts today and ends on September 3rd 2011.




Now here is how to win

1. First you must subscribe to my feed by putting your email under "Follow by Email" on the left sidebar and click submit.

2. Leave a comment on any of my post saying "This is the first comment".

Wednesday, August 17, 2011

Just Try

"There is nothing impossible to him who will try." - Alexander The Great

Monday, August 15, 2011

Principle of Least Privilege

The principle of least privilege can be used to improve the security of any computer system. It's a basic but important principle that is often overlooked. The principle is as follows:

A user (or process) should have the lowest level of privilege required to perform his assigned task.

It applies in MySQL as it does elsewhere. For example, to run queries from the Web, a user does not need all the privileges to which "root" has access. You should therefore create another user who has only the necessary privileges to access the database you just created.

Excerpt from PHP and MySQL Web Development page 223

Friday, August 12, 2011

Quote: The climb is the best part

"To climb up the mountain is the best thing. you know preparing for it. Living every day in practice, working hard, talking about it, seeing the commitment out of the kids, everybody on the team is at practice, 100 percent all the time and just working hard every day. That’s where the comradely happens that’s where you bond and hopefully when you get the chance you'll be able to do it" -Russ Cozart Brandon High School Wrestling Coach

Cozart makes this statement in an interview about the next chance he gets at the National High School Dual Meet Wrestling Tournament after lost in the finals.

Watch the interview

Wednesday, August 10, 2011

Youtube Data API

Below is a PHP script that uses Youtube API through xml to show the comments on your personal website.

I didn't include any CSS.
Use this link a reference
http://code.google.com/intl/it-IT/apis/youtube/2.0/developers_guide_protocol.html

<?php

//// video id
$videoId='M1Wm9nGJcYo';

//echo the video
echo "";

// url where feed is located
$url="http://gdata.youtube.com/feeds/api/videos/$videoId/comments";

// get the feed
$comments=simplexml_load_file($url);

// parse the feed using a loop
foreach($comments->entry as $comment)
{
echo '
'. $comment->content .'
'. $comment->author->name .'
';
}



?>

Monday, August 8, 2011

.inc vs .php file extention

.inc stands for include.
Some may prefer to name their file page.inc when using the php function include() because it looks prettier.

include('page.inc');

page.inc or page.php both work the same way.

I would stick with the .php extension instead of the .inc extension because the difference is that the .inc is easier to identify when navigating through files in website directory. It has security issues because if positioned in the wrong directory it will not be parse as php by your host if opened directly, making you code readable. But when you have a .php extension php is parsed and the code is not shown to the outside.

Thursday, August 4, 2011

Quote: Taking risk

Life is about taking risks. You are very young and have a promising future. Why are you willing to subject yourself to this disability just because of that 1% risk? Take that 99% chance of success and do yourself a favor."

Monday, August 1, 2011

AutoStart WAMP when windows start(apache and mysql)

Auto starting Mysql and Apache when windows starts gives you a desktop application feel built on PHP.

The Instructions:
Easiest way is to move 'start wampserver' from the start>program menu>wampserver and drag it into your start>program menu>startup folder. However if windows ask for permission to start the program the option below will fit your needs better

Go start>run> type in 'services.msc' and press enter

scroll down to the two services

wampapache
wampmysql

right click them and select properties.

on the general tab change startup from manual to automatic.

WARNING: Doing this method will not show the wamp icon at the bottom right hand conner of screen

in order to adjust Apache and Mysql settings start wamp and the icon will then appear

Saturday, July 30, 2011

jQuery $.ajax and $.post

Below is an ajax jQuery code that allow uses for POST. Communication between two pages.

$.post is a simpler version with less features than $.ajax. In the code below they are both configured to do the same concept.






mouseover me Type in box to see ajax

Wednesday, July 27, 2011

The Power of Persistence

Below is great video about survival persistence. This man went hunting after a deer and chased it for hours even when he couldn't see it until it gave up and collapsed. There was no force only perseverance. Persistence will be painful (he rubs his knee to relieve pain) but also pay off greatly.

Monday, July 25, 2011

How to redirect

Below are examples on how you can redirect your website. When someone visits your site and you want the traffic to go somewhere else. Choose your language, modify url and copy and paste.

Javascript:

<script>
location.replace("http://baligena.com") //or
location = "http://baligena.com";
</script>


PHP:

<?php
header( 'Location: http://www.baligena.com' ) ;
?>


HTML:

<meta HTTP-EQUIV='REFRESH' content='0'; url='http://www.baligena.com'>

Saturday, July 23, 2011

Debugging Elder Scrolls IV Oblivion

Below is a video of the making of Elder Scrolls IV Oblivion. Here gives an understanding on how debugging works in a group.

Wednesday, July 20, 2011

Working with .htaccess

What is .htaccess:
.htaccess (hypertext access) is the default name of a directory-level configuration file that allows for decentralized management of web server configuration. -Wikipedia

.htaccess is a way to modify the web server without editing the Master file.

In Apache the master file is called httpd.conf

How to create 404 and 403 pages:
404 pages appear when it doesn't exist (alternative to index.html in every directory on site) and 403 is a page exist but is forbidden to access.

In order for .htaccess to work you need to configure httpd.conf
AllowOveride must be set to All. See below. Remember its case sensitive. For some reason apache ships as "all" instead of a capitalized "All".

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

What to put in .htaccess:
ErrorDocument 404 /yourerrorpage.html
ErrorDocument 403 /yourerrorpage.html

# Options -Indexes is what allows the 403 error to work
Options -Indexes


If you don't want to use .htaccess you can simply put
ErrorDocument 404 http:yourerrorpage.html
ErrorDocument 403 /yourerrorpage.html

Warning: Make sure you always restart Apache when changes are made to the httpd.conf because the changes won't be taken into effect until you do

You must edit httpd.conf at the server, you can't use ftp unless it's not secured. It should be located at /etc/apache2/httpd.conf



How to rewrite URLs?
To manipulate your links like transfroming ?name=page&URL's into /friendly/cute/links
you must activate rewrite_module in Apache.

Left click on the wamp icon then hover over "Apache" and go to "Apache Modules" and click on rewrite_module (or mod_rewrite) so it has a check. (or 500 Internal Server Error may throw)

or open httpd.conf and uncomment(remove #) the line below
LoadModule rewrite_module modules/mod_rewrite.so

Wait for Apache to restart.

In .htaccess insert this code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) mvc/index.php/$1

------or-------

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

More information:
http://corz.org/serv/tricks/htaccess2.php

Good MVC clean URL video


_________________________________________________
Ubuntu sever 11.10
Now the mod rewrite is a little different in the Ubuntu server. You have to create a "rewrite.load" symlink from /etc/apache2/mods-available to /etc/apache2/mods-enabled by running:
$ sudo a2enmod rewrite
then edit:
$ sudo nano /etc/apache2/sites-available/default
and make line 11 to AllowOverride None to AllowOverride All, see snippet below

<Directory /home/marko/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>


then restart apache:
$ sudo service apache2 restart

reference: http://www.techytalk.info/enable-apache-mod_rewrite-on-ubuntu-linux/


description: mod_rewrite wamp, .htaccess issue (500 - Internal Server Error), .htaccess apache mvc configuration 500, redirecting and rewriting

Monday, July 18, 2011

Debugging for Internet Explorer

I posted earlier that I will stop going out of my way to make a site compatible with Internet Explore. However that is not a choice for everyone and if you have a client who is out of touch they might want comparability with IE so here is a link to My Debugbar IE tester. Its a free software that allow you to test your website on all IE version without having to download IE.


Seen at Slice and Dice that PSD second video towards the end.

Sunday, July 17, 2011

Reset CSS

Reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on

Paste code below in stylesheet and delete the elements you do no need

/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

Saturday, July 16, 2011

Creating columns in website

This tutorial shows how to create columns in website and prevents the div from wrapping when the browser is minimized






Syntax Source:
<html>
<head>
<style>
#main {
width: 600px;
}

.col {
float: left;
border: 1px solid red;
padding: 10px;
margin: 0px 20px 0px 0px;
}
</style>
</head>
<body>

<h1>Columns</h1>
<div id="main">
<div class="col">
<h3>Title</h3>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
</div>
<div class="col">
<h3>Title</h3>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
</div> <div class="col">
<h3>Title</h3>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
<p>asdfasdfxiv</p>
</div>
</div>
</body>
</html>


Cancel an eBay bid

Buyer wanting to cancel
fill out the Bid Retractions form.
Warning!! Retraction request are not accepted if it was placed more than an hour ago and is for an auction that ends in 12 hours or less.

Seller wanting to cancel
fill out the cancel bid form

Wednesday, July 13, 2011

No security

Be careful when you trust your job. I had a couple of bad experiences at a job. You never know if your boss is going to fire you, lay you off, go out of business, or disapprove you work history. I always try to improve my skill. The main reason is that if I lose my job at least I can fall back on something. Whatever skill you acquire at your job rarely will be transferred to another. Your going to have to start from the bottom again. I worked at many places where the supervisor only watches people and surf the internet for a living. It makes me sad to know that they're screwed if they lose their job. Be like the ant the prepares for the winter, do this in all areas of life.

Monday, July 11, 2011

Finding the Solution

Sometimes finding a solution to a problem is best not thinking.

When I was trying to solve a javascript loop problem I tried so hard to figure it out but later got distracted by someone speaking to me and when I came back the answer came to me in a split second.

When I was building the FQ shows I couldn't figure out how to get the dreamweaver snippet interact with php. I went to the movies to watch Tron and when I came back the answer came to me instantly.

Sunday, July 10, 2011

Tutorial: Wordpress Beginner Series

ThemeForest.com has a great series of tutorial if your trying to learn wordpress.

Click Me

Wednesday, July 6, 2011

What to say to haters

Don't let someone discourage you in achieving your goal.
Fill in the blanks:

I was _________ before you came and I will be _________ after you leave.

Sunday, July 3, 2011

No off Season

When I wrestled in high school what separated the best wrestlers from the crap wrestlers was there was no such thing as an off season. We trained all year round.

Part of the season was training, competing, testing your skills and winning awards and the second part was just training. The first part was the funnest, most rewarding, shortest and the in season.

After the season ended more than a third of the team stopped training and came back when the "season" started back again. All those who did this eventually quit or achieved mediocre success. Whats great about an individual sport is that all the work you put in is exposed. There's no one to blame but yourself.

Whats separates the champion from the loser is sometimes "showing up". Working at your goal not only when you feel like it but when you don't, in season and out of season. Remember there's no such thing as an off season to the successful.

Saturday, July 2, 2011

Learning Git

Git allows you to work on your code with the peace of mind that everything you do is reversible. It makes it easy to experiment with new ideas in a project and not worry about breaking anything.

Resources:
nettus.com
gitcasts.com
Git Magic

Friday, July 1, 2011

True Underdog

An underdog is a person or group who is popularly expected to lose.

Wednesday, June 29, 2011

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

Tuesday, June 28, 2011

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

Monday, June 27, 2011

Put yourself First

Create for yourself first then share it with the world. At least someone will use it.

Examples:
Andrew Kramer from videocopilot.net
Drew Houston from dropbox.com
37signals Basecamphq.com

Feel free to add more in the comments...

Saturday, June 25, 2011

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

Wednesday, June 22, 2011

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.

Monday, June 20, 2011

Windows Activation Expired

If your running windows and all of sudden your computer says that your activation has expired and you own the operating system on your computer because you bought it from the store. The way you can easily access your files in to run your computer in Safe Mode and it will bypass the warning.

Saturday, June 18, 2011

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.

Wednesday, June 15, 2011

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.

Monday, June 13, 2011

Sort an Array of Arrays in PHP

Want to know how to sort the code below by [name]?
Click me to navigate to the tutorial.
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 '
';
print_r($result);
echo '
';

Sunday, June 12, 2011

Adding Syntax Highlighting to Blogger

Do you want to show code on your blog like I'm doing below? Click Me to see instructions.

<?php 
echo "hello world";
$ball = "ball";
?>

Saturday, June 11, 2011

Coolest Website Design

There's always a trade off. A cool ass website and slow or boring website and fast. The one to use will be determine by your needs. Tijuana Flats is by far the coolest website design I've seen.

Wednesday, June 8, 2011

I have no Time. Shut up!

Today I was sitting at my desk contemplating all the things I don't do because I don't have time. Then I stopped and remember that I'm a programmer. And then I told myself real loud, in my head of course because there were people around me. "Shut up and build it".

Having limited time is a gift because it forces you to create things that are efficient, automatic and non-time consuming.

Monday, June 6, 2011

Security Tip: Inserting index.html in every folder

Building a website is simpler than most people imagine. Its a bunch of folders with files. Now to increase your website security is to include a index.html in every folder that is accessible to the visitor. Here's why.

index.html is a default document that is automatically loaded when someone visits the webpage. If its not loaded the visitor has access to view ALL your files in your directory. Some files are not meant to be seen by the visitor because it can give information that may comprise your security.

Lets use www.example.com/folder/photo.html as an example. If photo.html part of the url is deleted (www.example.com/folder ) the visitor now has access to see all your files in that directory/folder. To avoid this vulnerability put an index.html in every folder inside your website.

CodeIgniter is a PHP framework which follows this concept.

Check out the site example below
Now delete /edit/ to see what page it leads you to

Saturday, June 4, 2011

Making your server accessible to the internet (outside your own network).

If you want to see a prettier version of this post with pictures and color coding (part of this post won't make sense if you don't see the pictures) click on the link below to view the pdf format
setting up your server.pdf

There are two types of IP address. I like to call it the internet ip address and the server ip address. The way it works is that the internet ip address points to the server ip address. The INTERNET cannot access your server directly but can access your internet ip address.

Figure:
This works
INTERNET(The world)->your internet ip address ->your server ip address

This doesn’t work
INTERNET(The world)->your server ip address

To find your internet ip address go to http://myipaddress.com

Your server ip address is what you created with Ubuntu or any server.

To point your internet ip address to your server ip address you need to access your router. You do this by typing 192.168.1.1 in browser (for Linksys, it may be different if you have a different router). What we will be doing is Port Forwarding.

In Applications & Gaming-> Port Range Foward

Applications-> can be anything you want
Start and End-> needs to be 80
Protocol->needs to be Both (TCP & UDP)
IP Address -> need to be your server IP

Save and exit

That’s it . Type your internet ip address in the browser. It will now direct you to your server.

Connect using domain name
I purchased my domain from godaddy
All were doing is connecting a domain name to the internet ip address

Log into godaddy.com account
Select the domain name you want to use
And access you Domain Manager
Click Launch where it says DNS Manager



Put your internet ip address (not the server) under Points To (next to Host) where its highlighted in blue


Then save

Now when you type your domain name it will take you to your site

Figure:
INTERNET(The world)->Domain Name->your internet ip address->your server ip address


You did it!!!
Thumbs up Everybody for Rock and Roll

Wednesday, June 1, 2011

How to set up Static IP address for Server

Its good practice to give your server a static IP address because
1. You don't always need to reconfigure your router
2. It's easy to do

Click on the link below for a full explanation

http://www.howtogeek.com/howto/ubuntu/change-ubuntu-server-from-dhcp-to-a-static-ip-address/

PS. It's not true that you need a static IP address for the world to access you website from you server. You can also use a dynamic (DHCP), which is the default when you set up your Ubuntu server.

For more infomation on Making your server accessible to the internet

Monday, May 30, 2011

Changing permissions for /var/www Ubuntu Server

The video below explains how to change the permissions for /var/www Ubuntu Server




Saturday, May 28, 2011

How to Fix it. IPhone sound stop working

FYI

If your IPhone or Ipod Touch internal sound stop working, the volume control is non-reponsive and the sound meter does not appear. Below is what you need to do.

On the top of your device there is a small button. Click and hold it, then slide to power off and turn it back on. This reboots your device and the mic will work again.

Wednesday, May 25, 2011

Don't trust your memory

A good habit is to always document and comment your discoveries. Have a piece of paper or computer be an extension of your brain. Many may say "I figured it out once, I can figure it out again." That may be true but it sucks!

When I discover something new I tend not to write it down because I trust my memory. However, its not always reliable when working with huge amount of data. Our brain can only hold so much. Recently I forgot how I set up a feature in Microsoft's Access which I created 3 days ago. I can recreate it but with an unnecessary headache.

Monday, May 23, 2011

Difficulties in your path

All afternoon I tried to get gmail to send an email using php. When I finally discovered what was wrong I remember the poem Push on.

There are difficulties in your path. Be thankful for them. They will test your capabilities of resistance; you will be impelled to persevere from the very energy of the opposition. But what of him that fails? What does he gain? Strength for life. The real merit is not in the success, but in the endeavor; and win or lose, he will be honored and crowned. William Morley

Saturday, May 21, 2011

Create and Learn

In a canoe, if you decide to row only on one side what will happen? You will go around in a circle. So why are you only studying? If you're only learning a craft but not putting into practice what you learn, you're shotting yourself in the foot. I have spent a lot of my time learning new techniques and software however I can't find time to create. I have committed everyday to learn about programming but now I'm committing some days to only creating. Because what's the point of knowledge if you're not going to do anything with it?

Wednesday, May 18, 2011

printObj() => outputs object properties

The javascript function below is used to output the objects and its properties. Alternative to the php function => print_r
I use it mostly for looking up the document DOM eg. printObj(document)

Insert code inside JavaScript <script> tags
_________________________________________________

function printObj(obj) //reads the objects properties
{
var object ="";// sets the variable
for(var type in obj)
{object += type +"=> " + obj[type] + "<br /> ";}
document.write(object);
}

//create a new array or object
var num = new Array(1,2,3,45,6);
//outpuy the object and its properties by
printObj(num)
______________________________________________

Output:
0=> 1
1=> 2
2=> 3
3=> 45
4=> 6



bookmarklet: shows all the the p tags for the page. Copy and paste the code below in the address bar.

javascript:e = document.getElementsByTagName('p');function printObj(obj){var object ="";for(var type in obj){object += type +"=> " + e[type].innerHTML + "<br />";}document.write(object);}printObj(e);

Monday, May 16, 2011

Bad Experience: Ergonomics

Couple of months ago I bought a Microsoft Ergonomic Keyboard and a Logitech Wireless Trackball M570 to make my computer experience more comfortable. However, I started feeling pain on my wrist like I never had before. I didn't want to believe that these devices were causing pain so I wore wrist braces to see if it would help and it didn't. I pulled out my non-ergonomic keyboard and regular mouse on 04/25/11 and the pain has diminished. I have since sold my ergonomic keyboard and trackball to an advertised fool. What I do now is put a pillow under my arm when typing and that seems to solve the problem.

Saturday, May 14, 2011

Running 2 hard drives

Running two hard drives is easy. What's needed is connecting an extra hard drive on your motherboard. It can be either a SATA and or a IDE connection. Once the new hard drive is plugged in (the motherboard automatically detects it) enter into your computer BIOS and change the boot order.

The BIOS software is built into the PC, and is the first code run by a PC when powered on, access by pressing a specific key when the computer boots up, before the operating system is loaded .

Usually the original hard drive is listed first. Change the boot order so the new hard drive is listed as first boot, make sure an operating system CD is insert and reboot the computer. Once the computer restarts the new hard drive will boot and the operating system will install.

To change back to the old hard drive go back to BIOS and change the boot order.

If any question leave a comment.

Wednesday, May 11, 2011

10 years from now

When I hear someone 10 years younger than me talk about how they will be going on a field trip at their school, will be meeting up with friends, are getting into trouble and etc. It takes me back, I stop and think about when I was that age and wish I did more. But then I remembered that no one has invented a time machine yet so my only option is to change. Stop waiting to make a billion dollars to have fun. Go out and travel more, meet with friends, take risks, overcome fear and live your life not someone else because the last thing you want is to look back 10 years from now and wish you did more.

Monday, May 9, 2011

Setup xampp/lampp on Linux unbuntu

video below gives everything you need to set up xampp/lampp

and the link below gives additional information. Like how to create a xampp control panel app.


PS. if you looking to reset password. Follow the video and you'll discover it.

Saturday, May 7, 2011

How to get the microphone to work, Ubuntu 11.04

First click on the speaker on the right hand corner->sound preference->input. Make sure that a input device is selected, the input volume is not muted, or isnt set too low.
------------------------------------------------------
Open terminal and enter:
alsamixer

press F5 to view all controls bars
tab allows you to select a specific bar (the description will turn red)

the arrow keys up and down allows you to increase or decrease the property selected

Capture, Capture 1, Input Source, Rear Mic and Rear Mic Boost was what allowed my microphone to work.

Initially I turned everything up until I saw a red square on each bar. Then I played with the Input Source and realize that by setting the first Input Source to Rear Mic it made my microphone work. Then I played with the volumes to reduce the background noise.

I used the 'sound recorder' to test my microphone. I tried skype and the microphone also worked.

AlsaMixer v.1.0.24.2 my configuration











Any questions leave it in the comments

Wednesday, May 4, 2011

The way to Learn

Studying sucks! The best way to learn is multiple exposure. You retain more of a movie when you watch it twice compared to once, and more on the third than second and so on. It's the same with studying. Stop this memorizing bull that makes a fun subject boring. Watch a tutorial and read a book but don't try to remember everything. Realize that as long you're being exposed to the information multiple times over time your subconscious mind will link things together.

Monday, May 2, 2011

It ain't easy being Lazy

Larry Wall the creator of Perl programming language couldn't put it better. One of the first qualities of being a great programmer is laziness. He later says "its only a joke" but deep down I know its not. However, its not the same laziness of sitting on the couch all day watching TV but a laziness towards doing repetitive tasks.

Growing up I was always taught not to be lazy but here goes another unconventional way of life for a programmer. It seems that programmers are always breaking the rules, next we will be break the law of gravity.

Programmers make computers their slaves not the other way around. Computers were meant to make our life simpler, free our time and be more efficient. I'm really stating the obvious. The desire to be lazy was what created amazon.com, zappos.com and other online stores.

Saturday, April 30, 2011

37 signals Blog

I spend hours reading their blog and enjoying their unordinary views of how to run a business.

Check them out

Wednesday, April 27, 2011

Revenue means CRAP!

Companies measure success by quoting their revenue to the public but the bottom line is its all deception. Revenue (the amount of money exchanged) means nothing. I can teach a 5 year old kid how to created a million dollars in revenue.

Buy 2,000 iMac computers and sell it for $500 on eBay. You will sell those incredibly fast and easy, make $1 million in revenue but also $1.4 million in loses.

Instead of stating the amount of revenue give us the amount of profits. The amount of money left over after all the expenses have been paid.

Monday, April 25, 2011

Secret on how to Sell online

Ever wonder how to sell online. Here's the secret

JUST SELL!!!

Last year I decided to sell online but didn't know where to start. eBay seemed to be the best idea. It was more important to get started than to make a profit at the time.

So I looked around my table and spotted this cheap calculator, created an eBay Sellers account and guess what happened next. It didn't sell, and I posted other things that didn't sell either. Eventually I was able to sell a golf club. Once I sold my first item I was addicted and continue to sell and learn. Now I have made over $200 from the things lying around the house, expanded to Amazon.com, and now working on my online store.

Saturday, April 23, 2011

Intelligent Fool

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius—and a lot of courage—to move in the opposite direction.

-Albert Einstein

Einstein

Thursday, April 21, 2011

Birds of a Feather

Business school always felt like a waste of time, effort and especially money. My professors made me uneasy because they taught how to run a business while they couldn't do it themselves.

The concept of setting a 5 year projection for a business that hasn't started never made sense. The notion that your business isn't successful because it won't appeal to venture capitalist made me cringe.

Is there a way to start a business without a load of money?
Is this school stuff a bunch of crap?
Am I the only one who FEELS THIS WAY?..........NO

What David Heinemeier Hansson writes and says feels like my mind speaking back to me. David is the creater of Ruby on Rails and a partner in a multi-million dollar company called 37 Signals that started from nothing. He is known for is controversial views and arrogance but what he says contain truth.

Monday, April 18, 2011

Proxy site for you

I have a proxy site without any ads, restrictions or funny stuff. You can use it for as long its last because I don't think the server likes hosting proxies. But if it stop working notify me by leaving a comment below.

And for those who don't know what a proxy is. It allows you to surf the internet anonymously

Below is the link:

Free credit check. 4REAL!!!

Just for the record this is not a commercial, a sponsor or anything that will make me money. I'm just sharing something that helped me and I think it will help you too.

I wanted to know what was on my credit report today however I didn't want to sign up, cancel and give out my social security number to these free credit report sites. I used to work for a company that did soft pull credit reports. Soft pull credit report are when your credit is pulled up and doesn't record that someone look at it, doesn't effect it and cannot determine your credit score. I don't really care about my score because I have no intention of buying anything, I just wanted to know what was on it. I'm paranoid that someone will steal my identity and use it to take out loans.

The company is called Lighthouse Credit Foundation, they been around for 10 years, they're a non-profit organization, they're located in Clearwater, FL and what they do is help you get rid of you debt if you qualify or decided to do so. Now they don't give out credit reports as part of their business they just pull it up to find out if you qualify for their program. So indirectly they're giving you a free credit report.

So I called them up today, they asked for basic info like what you name, address, date of birth and they were able to pull my credit. I was surprised they didn't need my social security number. In minutes they told me what was on it and it was accurate.

Now I advise you to do your own research and below is their infomation.

Lighthouse Credit Foundation
1-800-873-9906 ext. 3709

Sunday, April 17, 2011

This will speed up you PHP scripts

In PHP you can concatenate with a comma instead of a period when using echo. Commas make you script faster. (warning: works only with echo)

example:

the fast:
echo $var . $var2;

the furious
echo $var, $var2;

check out detail information at

Saturday, April 16, 2011

Upload database to godaddy.com using phpmyadmin

Received this error
MySQL said:
#1044 - Access denied for user

1. click on the database you want export out of your localhost to godaddy, eg. my_db

2. Click on export, and then click go. It will prompt you to save file. Save as .sql

3. go to godaddy phpmyadmin and click on the database you want to import it to

4.click on import and click on choose file

wala you're done

I wanted to put screen shots but it was too big for this blog

Friday, April 15, 2011

Removing nav bar from blogger

Ever wanted to remove the bar on top of you blogger account because you don't want people to know your using a free service. The link below explains a real simple way.


Thursday, April 14, 2011

Leaving a trail.

I listened to an interview of Collis Taeed the creater of Envato on how he started his business. Something that caught my attention was when he was starting out in order to get initial traffic he would go on message boards and post a comment and leave his trail which was his website information. I have started couple of sites and in order to get traffic I did the same thing but I stopped. Now that I look back I made a mistake. The reason I stopped was because I thought it was wrong to beg people to check your site. If it is wrong? I don't want to be right. So for now on whenever I post something online I will put my website information.

Wednesday, April 13, 2011

Relationship vs Skills Job?

There's two type of jobs a skill job and a relationship job. People with the skill are those who really don't care if they fired because they know they can move on to another job that pays the same or more. However a relationship job is the job that if fired you are screwed. You move up the company because you been there for so long or because you know the boss or better you blew the boss. I'm tired of reading stories about people who lost there job and are complaining because they can't find what will allow them to the same thing with the same pay. Like watch youtube and surf facebook all day. They expect to be high paid babysitters for the rest of their lives and yes I'm talking to you managers. Anyone can do your job, you have no skill and if the company go bankrupt you're the next one to complain to the world. So stop your winning and complaining, how long did you expect watching youtube and facebook for a living was going to last

Monday, April 11, 2011

I'll write whatever!

I'm sitting here ready to go to sleep and drinking some strawberry milk while I write this. Sooo good. wooo I almost tipped over my drink.

I'm a strong believer in saving money. Sacrifice now, then you can tell your boss to go to hell. However, I also believe that in order to start a business you need to spend money. I been thinking about saving some money so I can start a computer company but something always comes up in which I need to spend it somewhere else. Today I bought a Logitech M570 910-001799 Wireless Trackball Mouse for 53 dollars. I never paid that much for a mouse and I was thinking about returning it to Best Buy after a couple days because I will soon regret the purchase. But I'm really falling in love with it and since I use my mouse all the time it's a good investment. This type of mouse is also considered to be good ergonomics.

Logitech M570 Wireless Trackball Mouse

Wednesday, April 6, 2011

We control the world?

As more and more people become dependent on computers the more we developers are needed. From doctors office to garbage truck drivers they all use devices created by a programmer. We are everywhere. The device the doctors use to help them in their practice, was it a doctor that created it? NO. The movies you watch I created, the screen you see I created, phone you answer I created. I'm the creator, I'm a developer.

Monday, April 4, 2011

Stops and Skip Loop. PHP & Javascript

//stops a loop and skip loop. Its the same in javascript
//except the variables are named differently
//and substitute echo to document.write('i')
for($i=0; $i<10; $i++) //start at 0; don't go over 10; increment by 1
{
if($i == 2){continue;}//skips
if($i == 4){break;}//stops the loop here
echo "$i, ";
}