Friday, March 30, 2012

Lazy programmer? Not really!

Influenced by an article, I wrote about how programmers are lazy people, but I take it back because it's completely far from the truth. It's true that no one likes repetitive tasks but they also don't have the desire or willingness to learn how to get rid of it, but programmers do.

We are consistently learning, building, and putting in the effort to be more efficient. Our desire to free up time puts out a lazy illusion which sometimes fools even ourselves(I'm a victim).

First and foremost programming isn't easy and it takes a lot of effort. We want to automate not because we are lazy but efficient. We are always trying to see how much we can get done in the least amount of time. Would you call yourself lazy because you drive to work instead of walking. No! because walking would take 5 hours instead of 30 minutes to arrive. Never did I build a program so I can just do nothing but free my time to do something else. So stop calling yourself lazy, it doesn't make look cool.

Wednesday, March 28, 2012

Post PC era, Really?

Recently there's been a lot of people talking about how the post PC era is upon us because of all these smart phones and tablets. Let me tell you secret, it's not true but I'll let you be the judge.

Would you trade up your keyboard for an on screen one? Would you trade power and speed for convenience? Would you trade Skyrim for Angry Birds?

If you said yes to those questions you probably use your computer like a Television, passively. Surfing the net, snooping other people lives on facebook and that's it. And yes! Post PC era has arrived for you because you never belong with a PC anyways. For someone to think that a tablet will make a PC obsolete is ridiculous. This is all propaganda for you and I to be another victims to advertising.

How can a tablet ever beat a PC in programming, special effects and gaming. Tablets were supposed to come before PC but we decided to skip it. When I first got an iPod Touch I used it a lot for downloading games and apps but now the only apps I use is Twitter, email, notes and calculator because everything else is really not that important.

Monday, March 26, 2012

The Answer

“Nothing in this world can take the place of persistence. Talent will not; nothing is more common than unsuccessful people with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent.” -President Calvin Coolidge

Friday, March 23, 2012

htaccess python script, Clean URL

I enjoy the clean URL when it looks like http://baligena.com/home/page

However every time I create a new app I have to re-edit/create a htaccess file. This is too much work and remembering. Below is a python script for windows and linux that once ran inside the root folder of your site it will create an htaccess file to make that clean URL you always wanted. You can also fork it at GitHub

Warning! You may need to configure apache and php for the htaccess file to work. Click me for instructions.

createhtaccess.py



# this script customizes and creates the .htaccess to correspond to the current directory

import os

def create_htaccess():
f = open('./.htaccess','w')
# get directory path
directory = os.getcwd()

# if linux
if os.name == 'posix':
dirname = directory[directory.rfind('/')+1:]
# if windows
elif os.name == 'nt':
dirname = directory[directory.rfind("\\")+1:]
else:
exit('error occurred: couldnt determine the system this computer is on')



f.write('''
# http://codeigniter.com/wiki/mod_rewrite
# make sure you change the root url on line 27 RewriteRule ^(.*)$ directory/index.php?/$1 [L]


RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ '''+ dirname + '''/index.php?/$1 [L]



# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php

''')
f.close()

if __name__ == '__main__':
create_htaccess()



Wednesday, March 21, 2012

Hit the road Dogma

Steve Jobs said it the best "Don't go out living other people dogma". In business, programming, sports and life people want to force their opinion on you wishing they had what you have and then telling what you should do. Oh if only I had your age, lack of money, computer, size of your head, number of toes.

When someone finds out that I'm a programmer they say "oh that makes a lot of money, you should work for blah blah blah". Why? What if I want to keep programming interesting and fun, not make into a dreading job.

People will hate on someone who finds satisfaction in things where the majority won't. If a millionaire lives a simple life or if a young professional athlete is not living a party life and has a strong religion(Tim Tebow) their must be something wrong with them.

Let my neighbor do his thang and I'll do my thang. I have my style, my vision, my perfection, my imperfections and if I have to change I will but not because of dogma.

Monday, March 19, 2012

Forgetting how to Program

As a programmer it's impossible to remember everything you learn. I saw this as being bad but today I see it as being good. Programs, languages, technology change and involve, and if you're not consistently learning you're being left behind and if you're remembering everything you are also being left behind.

Recently PHP had a new update with new syntax and deprecated old ones. Just like your memory, in with the new out with the old. Why hold on to all that useless code or memory? This is why I don't believe in computer science degrees. What you learned 5 years ago may not be relevant today. I would rather hire someone who consistently learns everyday for the past 2 years compared to someone who has a computer science degree 10 years ago.

Program everyday like you eat everyday, have your daily dose of it. Don't try to learn everything. At 9, when I started using a computer I didn't try to learn everything about it. I learned what I needed and that was how to play games. Today I'm not going to try to learn every language like its the end of the world but learn what is needed and it will lead to huge gains in the future without me noticing.

Friday, March 9, 2012

Internet Beauty: Location

Its one of the beauties of the Internet, freedom from location. We all should strive to create a business or a source of income independent on location. They're places in this world where its more expensive than others to live which also correlate with the average income someone makes. What if you can live at a location that the cost of living is the lowest but get paid in a location where its the highest, Internet is the answer.

You can live in Europe and have a job in America, you're not restricted to buildings and offices, you can travel the "Universe". This is freedom! We should strive for freedom to be where you want to be, when you want it and how you want it.

Now we cannot always get what we want like there's no perfect line of code, but we can get really close. Just to have the ability to imagine the possibilities is enough to make you excited to make into reality. You see, I don't quite have this freedom yet but its a work in progress.

Friday, March 2, 2012

Initial cost associated in selling a Mobile Application

When trying to sell an app you'll need to decide whether you want to developed for the iPhone, Android (2 most common) or both. You'll need to publish your app at each distributor store.

Android you'll navigate to their development site and sign up and pay a $25 fee. For the iOS is the same process you'll go to their development site and pay $99/Year to $299/Year.


tags:
itunes connect, create account, developing, develop, itunes, application

Wednesday, February 29, 2012

Programming Languages Comparison

Programming languages are alike. If you know how to program in one language changes are you know how to program in other languages. However the only difference is the syntax. I always wanted a chart that showed this and I finally found it hyperpolyglot.org.

Monday, February 27, 2012

Smart is the New Rich

"Smart is the New Rich" a trending phrase with a book and even a CNN show name after it but it's a load bullshit. This implies that at one point the "Dumb was the Rich" or the "Smart was the Poor"!

Last time I check smart people like Edison Ford, Bill Gates, Thomas Edison and Steve Jobs are not poor and they are old as dirt if not already dead. So this statement saying smart is the "new way" to be rich is only for the fools that believed otherwise. Success comes with hard work and the ability to consistently learn, improve your skills and become "smarter".

Show me someone who was dumb and became rich. Wait... Those who win the lottery, it doesn't take much brain power to pick 8 random numbers. But give them a couple of years before they end up in a worst position.

Friday, February 24, 2012

Quote: Hard work

Hard work beats talent and talent doesn't work as hard. -Mark Cuban

Thursday, February 23, 2012

Installing/Setup Arduino

The video below shows how to install/setup Arduino on Windows 7. However I have Vista and was able to setup up using the same method.





Tags:
install the drive

Wednesday, February 22, 2012

Installing Kdiff3 version control mergetool for Git

kdiff3 is a great GUI mergetool for git. However the installation is more tedious in Windows compared to Linux. Below is instruction on how to install it in Windows.

Download and install program:
http://sourceforge.net/projects/kdiff3/

Add kdiff3 as your Git mergetool
From Git Bash, run
$ git config --global merge.tool kdiff3

Open the file repository/.git/config
and paste the code below


[merge]
tool = kdiff3
[mergetool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
keepBackup = false
trustExitCode = false





tags:
git mergetool kdiff3 windows
kdiff3 mergetool is not available
better than vimdiff

Monday, February 20, 2012

Don't look at the results

Don't look at the results, look at the direction.

It's easy to get discouraged when the results are not what you expect it to be. In reality much of the result will come much time after. You may forget what you went through to be where you are today. A farmer cannot plant today and harvest tomorrow. Depending on what he is planting it may take to 7 years to see the fruits of his labor. Not to mention the contingency such as drought, freezing, storm and so on that can keep him from seeing his fruits even longer. But as long he keeps planting one thing is certain "there's a chance"

Friday, February 17, 2012

Desktop Shortcuts Ubuntu 11.10

If you didn't already know, in Ubuntu if you type ctrl+alt+T the default terminal opens up. Now if you wish for other programs to open using keyboard shortcuts, here is how you do it.

Go to "System settings". You can get there by clicking on the circle on the top right hand corner or searching it at the Dash Home (top left corner).

Under "Hardware" click on "Keyboard".

Go to the Shortcut tab and click on the Custom Shortcuts. Click the plus sign (+).

A little window will open asking for Name and Command. Name is for naming of the shortcut and command is the program. Example:
Name: myShortcut
Command: terminator

Now it will appear in the box. Now select it and click where it says disabled and enter the shortcut. Close the window.

That's it! Easy.

Wednesday, February 15, 2012

Linux: Launching a program from Terminal

In linux there're couple different methods to install a program. The most often used and easy is apt-get because it does all the work. All it is a line in the terminal like:
$ sudo apt-get install terminator
and the program will install.

Programs like XAMPP where the package needs to be downloaded and extracted to a specific location. Other programs like netbeans and Komodo Edit where the package is first downloaded then extracted and then run an install script.

Sometimes I like to launch a program using the terminal such as:
$ terminator

When you install netbeans it doesn't give you this feature but I going to show you how to create it.

When netbeans is installed it creates a netbeans folder in your home directory. There you will find a netbeans executable file (~/netbeans-7.1/bin/netbeans). If you run this file it will launch the program. What we need is to put this file symbolic link (symlink) inside the directory that holds these other executable programs which is /usr/local/bin. You do this by
$ sudo ln -s ~/netbeans-7.1/bin/netbeans /usr/local/bin/netbeans

that's it!

Now netbeans may give you an error stating that you do not have permission to write in ~/.netbeans/ What is needed here is to change the permission with chmod. I gave it full access by running
$ sudo chmod -R 777 ~/.netbeans/

now you should be able to open the terminal, type netbeans and the program will launch



tags:
command line

Monday, February 13, 2012

3rd Party Suck!

Don't store files in 3rd party servers! I knew it, look at megaupload was taken down with people files that were legal. That's why you need a personal server for storing important files to avoid these pitfalls. Now many are left with their thumb in their mouth because their work sank with the ship, it's at the bottom of the ocean and good luck trying to get it back.

I've seen web developers put their development source code in dropbox. Yes, it syncs with your other computers but seriously how safe is it to have it out there.

Think about it...

What happens if dropbox gets hacked, I never trust these 3rd party companies saying they delete your stuff. 3rd Parties are infamous in not telling what they do with your information. Someone once told me "its not how safe you are with your information but how safe others are."

Setting up your own server is not difficult, especially with technology getting cheaper. With a little knowledge of Linux, an old computer(or buy one for $70) and with the information on this site you can get it started.

The Benefits:
Not only does it pay for itself in the long run (hosting cost) it also gives you the freedom to customize it with software and hardware. It also give you control with the security. You'll will be able to access your files from anywhere thru ssh, ftp, http and so on. And best of all you'll learn alot.

To get started click this and this.

Thursday, February 9, 2012

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, February 8, 2012

Quote: Perseverance

To quote President Calvin Coolidge:
“Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan ‘press on’ has solved and always will solve the problems of the human race.”

Back in 1995, Steve Jobs added: “I’m convinced that about half of what separates the successful entrepreneurs from the non-successful ones is pure perseverance”.

Michael Jordan quote: “I’ve failed over and over and over again in my life. And that is why I succeed.”

Tuesday, February 7, 2012

Fixing the internet in Ubuntu using driver BCM4312 802.11b/g LP-PHY

What a pain! I recently reinstalled Ubuntu 11.10 on my Dell Latitude D630 and wireless wasn't working. It wasn't picking up any connections. My driver BCM4312 802.11b/g LP-PHY for some reason wasn't installed and when I went to Ubuntu "System settings->Additional Drives" and tried to activate the Broadcom STA wireless driver I would get an error to check /var/log/ folder that didn't exist.

So I connect to the internet using a wire connection and ran this in the terminal

$ sudo apt-get install b43-fwcutter

rebooted the computer then went back to "System settings->Additional Drives" tried to activate the driver again and it worked.

Resources:
https://help.ubuntu.com/11.10/ubuntu-help/net-wireless-troubleshooting-device-drivers.html
http://askubuntu.com/questions/95852/how-to-fix-bcm4312-driver-problem
https://www.evernote.com/shard/s18/sh/d245d647-45aa-474d-b093-a6346c7e9e27/e56bca9b17d774858fb6900cd302d047