Wednesday, May 9, 2012

I Moved!

Today it's official, out with the old in with the new. I'm done using blogger as a host to my blog and now moving to Wordpress. You might ask, why?
1. Wordpress gives me more control and customization
2. Wordpress is more professional
3. Wordpress doesn't mess up my Domain Name URL forwarding
4. Google can be scary with all their privacy policies.
5. Wordpress makes it easy for others to comment. No need for an account!

What does this mean to you.
You can access the site by going to baligena.com and all the content has been transfered there. This will be the last post on this server so if you ended here at this page go to baligena.com.

Monday, May 7, 2012

Installing Piwik

Piwik is an open source website traffic analysis. I decided to give it a try over google analytics, one of the reasons is because the data can be stored on my server if I choose to and its fast.

Installation was simple, one may be confused by different piwik has such as a plugin for wordpress and the actual source. The plugin for wordpress is only an integration that cannot be used by itself but with the actual source installation. Piwik can be installed on any server and it doesn't need to be inside wordpress directory. Below is a non-english video which shows how to install it. What he says is not important.

Friday, May 4, 2012

C++ MVC example

I'm calling this a MVC example for simplicity. It's actually separating 3 c++ files into 3 different responsibility for better organization and reuse-ability.

coordin.h
This is the header file which contain templates and functions prototype. This file will be included on the other 2 files.

#ifndef COORDIN_H_
#define COORDIN_H_

//structur templates
struct polar{
char from[50]; //distance from origin
char description[50]; //direction from origin
};

//prototype
int balls(polar test);

#endif


file2.cpp
This file contain functions called in file1.cpp
# include <iostream>
# include <cmath>
# include "coordin.h" //structure templates, function prototype, what links the scripts

//convert rectagular to polar coordinates
using namespace std;
int balls(polar test){
cout << test.description << endl << test.from << endl ;
}


file1.cpp
This file is where you put the meat of your program. This is where you bring all the previous files together.
#include <iostream>
#include "coordin.h" // structure templates, function prototypes. what links the scripts
using namespace std;

int main(){
polar test = {"mvc like","must compile both file1 and file2"};

balls(test);

return 0;
}


Now in order for this to work you must compile both file1.ccp and file2.cpp at the same time. Example:
$ g++ file1.cpp file2.cpp

Wednesday, May 2, 2012

You're a Business, The employed and self-employed

You probably heard it before "I enjoy being my own boss because I make my own rules and I have freedom". A very general description because you're free from WHAT? You may not have a person as a boss but that role is switched to your customers, they're your boss. You may have this false feeling of freedom but you’re bound to customer complaints, returns, paperwork and so on. It’s cool to walk around and say "I'm my own boss, I make my own rules" to your friends. But depending on the situation having your own business isn't the best idea. Being your own boss is still having a job but your responsibility is different, and many sacrifices are required to be successful.

I'm a business no matter what. If I'm an employee or employer whatever it is I'm still the owner of myself and the money I make. When I work I give my best and want to be compensated accordingly. If this can't be done, my business (myself) will switch different markets (job). When this market(job) is not cutting it then I should venture in new territories(self-employed).

There's always a flip side to the coin, a yin and a yang, risks and rewards and depending on the situation we find ourselves in we need to make the decisions for what is best. I'm all for starting your own business and it is my ultimate goal. I won't do it because I'm lazy of responsibility or work, but because my job just isn't cutting it anymore.

Monday, April 30, 2012

Quote: Seeds you Plant

“Don't judge each day by the harvest you reap but by the seeds that you plant.” -Robert Louis Stevenson

Friday, April 27, 2012

Server showing IP address in URL?

To link the domain name to your server the A (address) at the DNS site (eg. namecheap.com) needs to point to your public server IP address. Recently I was having an issue with my site because when I typed baligena.com it went to the site however when I click on a link it would be replace by my IP address in the URL. It's funny when you call for tech support its a waste of time because this shit is too advanced and they won't be able to help you. What I figured out it wasn't the domain name nor the server that was causing this error but Wordpress. Wordpress has an option to specify your site URL.

Wednesday, April 25, 2012

Point Domain Name to your Server

My domain names are hosted by namecheap.com after I decided to make a switch out of godaddy.com. However, I never got around to point my domain name to my server instead I had a simple webpage redirect. Below is a conversation I had with their support team where they explain to me what types of re-directions are and how configure it.

You are now chatting with Natalie Z. - Domains Support
21:47Natalie Z.: Hello, you've contacted Live Support! How can I help you today?
21:48kaka: I have a server where my website is located. I'm trying to use my domain name
21:50kaka: I'm basically trying to forward the domain name not a redirect. How do I do that
21:51Natalie Z.: What exactly you wish to configure on our side? Change nameservers? Create some host record? Create URL redirect?
21:52kaka: What is the difference between changing nameservers and URL redirect
21:55Natalie Z.: If you change the nameservers, you will delegate domain's zone file to the side of your hosting provider and you will need to manage host records there. If you set up URL redirect, you just make the domain redirect to other one, the nameservers are not changed, host records are managed on our side. Changing nameservers will give you some options on the side of your hosting provider to manage your domain there
21:56kaka: I have my server IP address and I want my domain name to direct me to it. But I dont want masking redirect but an actual change. Do understand what I mean?
21:57Natalie Z.: If you need to point your domain to IP address, you need to do the following
21:58Natalie Z.: Go to My Account -> Manage Domains, click on the domain and after the page refreshes choose All Host Records at the left side menu.
21:58Natalie Z.: You need to enter your IP address (xxx.xxx.xxx.x) for both the www and the @ fields and choose A (Address) as the Record Type from the drop down menu. Save changes
21:59kaka: what is the difference between A(address) and URL Redirect
22:01Natalie Z.: A (address) record should be created when you want to associate your domain or subdomain with IP address. URL redirect is used when you just want your visitors type the name of your domain in the address bar and being redirected to any specific web page
22:02kaka: what do i put in for TTL?
22:03Natalie Z.: You can put 1800 as a default value
22:06kaka: If I wanted direct to a specific location in my server like xxx.xxx.xxx.x/myfolder is this posible?
22:07Natalie Z.: Unfortunately, with A record it is not possible
22:07Natalie Z.: This should be configured on your server directly
22:09kaka: How long will it take for the changes to take effect?
22:10Natalie Z.: The changes will take effect within 30 minutes
22:10kaka: ok thank you

Monday, April 23, 2012

Adventure into Electronics

I'm a programmer and don't know anything about electricity, circuits and things in that family. Recently I decide to start programing microcontrollers in order to build these cool physical gadgets I see in the interwebs so I bought me an Arduino to get started but stood looking at it like a deer starring at headlights because I didn't know where to start. Next I bought Make: Electronics book to get me started. One major difference between building software and circuits is that one cost money. In order to build your circuits you need to buy parts and I went out today to Radio Shack and dropped $45.00 on these simple items. Slowing but surly I'm desensitizing to this technology. I'm not sure where this may lead but it looks promising.

Friday, April 20, 2012

I'm not IT bitch

The one thing that makes me cringe is when someones asks me if I'm IT or should do IT. Many miss use this term because they're ignorant.

I agree with Linus Torvalds and this is what he said:

"Oh, the absolute *last* thing I want to do is be seen as a support person. No way.

But I’m simply not really organized enough to be a good MIS person. And frankly, I lack the interest. I find the low-level details of how computers work really interesting, but if I had to care about user problems and people forgetting their passwords or messing up their backups, I don’t know what I’d do. I’d probably turn to drugs and alcohol to dull the pain".
source

I don't want to help you fix your mistake, your lack of knowledge, fix your screen resolution. I'm a programmer, I build things, I'm not IT bitch!

Wednesday, April 18, 2012

Programmer Hiring

When I started programming I kept hearing recruiters are clueless and don't know what they're doing. I recently ran into one who made me take a test at geekinterview.com

First I'm not a geek just because I'm a programmer. By definition I'm NOT a person regarded as foolish, inept, or clumsy.

Second, the questions were wrong like saying PHP is a programming language when in its a scripting language, some were dumb like who is father of PHP, who cares! How does knowing this make your software any better, some question were deprecated and finally bad practices and obfuscated. Overall silly!

Now I wonder what kind of developers they have employed. Recruits don't understand that programming isn't a multiple choice test and not necessary what you know but what you can discover. Without the internet I'm a worst programmer because I use it like an extension of my memory. I don't try to memorize every single function in a language because I'm not going to use them all and I can build my own if I have to.

Friday, April 13, 2012

Too many Options

Options are great but at times it can be a burden. As a programmer we have all kinds of goodies such as open source tools and languages. We have the option to choose whatever but it can lead to indecision, over thinking and incompleteness.

Did you ever start a project or idea but not finish it because another option appeared? When younger we normally had 2 or 3 games for our SEGA and we played those games so many times we could easily sing the songs. Now I have many games its a sacrifice to finish one.

Less options makes life simpler. Imagine if you had 5 toothbrush to choose from. How frustrating every morning would be and you'll probably end up using only one anyways.

Don't confuse less options with laziness to achieve them. I can but don't because I choose not to. Because the harder you work the more options you get.

Simplicity is what I strive for, not how cool looking or complex my code is. If it gets the job done why will I put an unprofitable twist to it?

Wednesday, April 11, 2012

SSH in Windows

One might ask "why do you need ssh?" And if you don't know what ssh is, learn it? It's very useful, you'll thank me someday.

The problem I was having is that ssh is shipped with Unix operating systems such as Linux and iOS but not on Windows. What if I need to securely access my files on my Windows computer, what will I do? No worries you can have ssh on on Windows but it takes extra work. You'll need to install cygwin a Unix-like environment and command-line interface for Windows. Click Me for detailed instructions on how to set it up.

Friday, April 6, 2012

Hello world in Node.js

First you need to install node.js. I'm running ubuntu 11.10 and I also needed to
$ apt-get install openssl libssl-dev

Create a file named test.js, and copy and paste the code below

//how to run the server output hello world
var http = require('http');

var server = http.createServer(function(request, response){
response.writeHead(200, {
'Content-type' : 'text/plain'
});
response.end('hello world');
});
// where the host in located
server.listen(8000); //see the code below
console.log('listening on http://127.0.0.1:8000'); //echo in the terminal whatever you want
To start the server go to the terminal and the run the script you created by typing
$ node test.js
Now go to the browser and enter http://127.0.0.1:8000 and your done.

Resource: http://net.tutsplus.com/tutorials/javascript-ajax/this-time-youll-learn-node-js/

Wednesday, April 4, 2012

Downloading files using PHP

Put the file you wish to download in your website directory. Example:
/file.rar

Now when you want to download it just go http://mysite.com/file.rar

It's that simple, don't over complicated it and you don't need PHP. Yesterday I tried to figure out how to download files but ran across all kinds of complicated methods. Using HTTP heaters, download helper; force_download in codeigniter, and PEAR. Maybe the reason I had such a hard time finding the solution was because its too obvious. Shot! I personally missed it.

Tuesday, April 3, 2012

Finish Strong

When in middle school I ran track and one of the things my coach taught was to pace yourself. But as rebel I had to learn the hard way. I tried to run a full sprint in the beginning of a 400 meter race and lost all my speed 3/4 of the way. It felt wonderful being in first most of the race but all of that went away when I almost finished last. It was a good start, but what's the point if the finish is horrible.

This analogy can relate to any goal. You may start off slow but if your pace is good you will finish on top. Slow but steady wins the race. Show me someone who is consistent and I'll show you a successful person. Lesson learned!

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

Sunday, February 5, 2012

Using git with restricted server/godaddy

You cannot install git on your godaddy hosting server. The alternative would be to connect godaddy server to your computer that already has git installed. What we will be doing is mounting the server folder to a folder on your computer using sshfs. This enables you to run programs installed on your computer for remote servers. (I'm using Ubuntu 11.10)

$ sudo apt-get install sshfs
#$ sshfs hostDirectory computerDirectory
$ sshfs username@hostname:/ ~/Desktop/mount
$ cd mount

# to unmount
$ sudo umount /path #its umount not unmount command


reference:
http://www.howtogeek.com/howto/ubuntu/how-to-mount-a-remote-folder-using-ssh-on-ubuntu/

Friday, February 3, 2012

Hide apache and server software version

When someone access your server from the web they may end up on a error page such as 403 and 404. The issue is having your server output what apache version and server you're running on. This can be a security the risk because if the malicious hacker knows what your working with it makes things easier for them. The way to not publish this information is to configure your apache options. On Ubuntu server 11.10 its located at /etc/apache2/conf.d/security

What needs to be changed is
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature Off


then restart apache:
$ sudo service apache2 restart

tags:
apache dont 403 error message
apache error message hide ip address
apache error message don't publish ip

Thursday, February 2, 2012

Developing Software

If you want to develop a kick ass software that is salable create an awesome almost impossible project. Let me explain.

You see many of the software we use today was created to solve a problem. It wasn't created because someone taught this would be nice and cool to have. Look at Weta Digital an Oscar winning visual effect company responsible for Lord of the Rings trilogy and Avatar. They created MASSIVE and CityBot because the work they needed in their movies. Another example is 37signals Basecamp which gave birth to Ruby on Rails. There's so many others as well.

I'm a firm believer in solving your problem first and maybe someone else may benefit it from it or not. But if they don't at least you solved your problem.

Saturday, January 28, 2012

ssh from anywhere

I have no trouble accessing my server inside my home from my laptop because I'm local (in the same wifi) but if I decide that I need to access my server from at a coffee shop thorough my ipaddress here is how I do it.

First make sure that ssh is install on your linux machine and you can access ssh locally.

All is need is to port forward the range 22 by accessing your router. That's it!

Now you can
$ ssh username@ipaddress





linux, ubuntu, putty, ssh anywhere port 22 connection refused port forwarding

Thursday, January 26, 2012

change IP address on linux

I was having issues with git connection to my laptop thru ssh. Then after looking into it, my laptop had changed IP address. Now I didnt want to change all the git fetch origin source on all my repositories so here is how to change the IP address back.

# sudo ifconfig [connection] [IP you want]
$ sudo ifconfig eth0 192.168.1.5



sources:
http://www.cyberciti.biz/faq/linux-change-ip-address/

Tuesday, January 24, 2012

Learn how to program thru examples

Learning how the program is like riding a bike. You cannot fully learn it without applying it. After learning various languages I noticed that not everything the languages contains is useful, at least for me at this time. I found this by building my own useful programs or dissecting one. I need examples!

I have found no use for interfaces, I have study it but i have yet to see it in a necessary program. You can learn all kinds of theories but if you dont apply it to real life situations, its a waste just like formal education, half of the crap you learn in school you never use. They teach you things that you "might" use giving you a general knowledge.

Saturday, January 21, 2012

Learn other programming languages

The first programming language I started learning was PHP then came javascript, python and c++. What I'm amazed is how much better understanding about a language when you study other ones. In reality programming languages are the same the only difference is syntax and couple different features here and there.

You'll enjoy learning a new language while refreshing general programming skills such as functions, loops, class, switch, if statements as so on. The other benefit is a common technique used in c++ might not be common in other languages. And now you have learned it and you can implement it into your language of choice.

OOP is quite new in PHP compared to c++. The reason PHP added this feature was because OOP made c++ very powerful and easy to maintain, and why not have the same for PHP.

Thursday, January 19, 2012

Test someone smartness

We are in an unique time in the world that we can easily test if someone is smart or dumb. All you have to ask them who they support as a republican candidate. If they say anything other than Ron Paul their stupid. Now this is a given but you can also probe them to confirm it. Here how I did it to someone today.

Me: so you support Mitt Romney
lady: yes
Me: did you know he would sign the NDAA
lady: (no response)
Me: Do you know what the NDAA is?
Lady: no
Me: (I exampled it)
Lady: this is already happening
Me: its not a reason to support it, I support Ron Paul
Lady: yeah he appeals to young people like you
Me: he is about the constitution and what are founders believed in

(after she saw she couldn't argue intellectually with me)
Lady: Ron Paul is too old, he doesn't have a image of a president
Me: So to be a president you need to look like it
Lady: yes
Me: if you're not a white male you cannot be president
Lady: (silence)
Me: we should not vote for a president just because he looks like he fits the job description but what he believes in and his past record.

This small conversation show how of an idiot this lady is. She didn't know why she supported Mitt Romney other than he “looks” like he could be a president. Unfortunately there's many others like her.

Wednesday, January 18, 2012

The cream always rise to the top

Don't let the fear of not posting because what you are writing is not perceived as high quality. Quality is in the eye of the beholder. Because at the end of the day you cannot please everyone.

Of course there's fine line between complete crap and low quality. But low quality shouldn't give you paralysis of analysis. Some will be good some will be bad and “the cream will rise to the top” or in other words “the best comes out ahead”

Things change, motivation alters and direction redirects. If what you're doing today changes don't get all worried because you steered away from your original idea. Its all about getting it moving and everything will add together.

Look at Apple, initially they were called Apple Computers but later changed their name to Apple because they decided they weren't going to only focus on computers but other technologies as well. Business and people need to learn how to adjust, become flexible and take advantage of an opportunity when it becomes available.

Sunday, January 15, 2012

Passwordless SSH login Tutorial

$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/bigbang/.ssh/id_rsa):
(Enter)
Enter passphrase (empty for no passphrase):
(Enter)
Enter same passphrase again:
(Enter)


# this creates a file ~/.ssh/authorized_keys
$ ssh-copy-id user@192.168.1.217
user@192.168.1.217's password:
(Enter Password)

Now test login in via ssh. It will not ask for the password






Saturday, January 7, 2012

SimpleXML, Birds Eye View

XML is always been a pain to me. The way I learn the best is by looking at examples. Below is a script from a project that I was recently working on using php SimpleXML object. It shows an organize format of the XML file to serve as a road map


<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie page="0" numpages="38">
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<great-lines>
<line>PHP solves all my web problems</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
XML;



//Output
$xml = new SimpleXMLElement($xmlstr);

echo '<pre>';
print_r($xml->movie);
echo '</pre>';
echo 'Example:' . $xml->movie[0]->title;

?>


Script above will output


SimpleXMLElement Object
(
[@attributes] => Array
(
[page] => 0
[numpages] => 38
)

[title] => PHP: Behind the Parser
[characters] => SimpleXMLElement Object
(
[character] => Array
(
[0] => SimpleXMLElement Object
(
[name] => Ms. Coder
[actor] => Onlivia Actora
)

[1] => SimpleXMLElement Object
(
[name] => Mr. Coder
[actor] => El ActÓr
)

)

)

[plot] =>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.

[great-lines] => SimpleXMLElement Object
(
[line] => PHP solves all my web problems
)

[rating] => Array
(
[0] => 7
[1] => 5
)

)
Example:PHP: Behind the Parser

Thursday, January 5, 2012

PHP file_get_contents() error, openssl

If PHP is throwing the error below its because protocols other than http is not allowed.

Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in ...

To allow other protocols the php_openssl extension must exist and enabled.

To enable go to php.ini and uncomment it or if using WAMP go to the PHP folder, then PHP extensions and check php_openssl


Problem Solved.

Monday, January 2, 2012

Twilio try-out and cURL error

I was using skype and I finding it expensive. Why $30 a year for a service plus $60 for a phone number? That's $90 dollars for an voip service a year! So I went looking for other services and found twilio. I will testing in the following days.

I was testing how to send sms messages via twilio API and ran into error. Below is how I fixed it

Error1:
undefined constant CURLOPT_USERAGENT
Solution:
check your php.ini file and uncomment the line (remove ;): extension=php_curl.dll
restart your apache server.
resource:
http://drupal.org/node/1044216

Error2:
SSL certificate problem, verify that the CA cert is OK
Solution:
Added the line of code
        //this is a temporary fix for 
//Uncaught exception 'Services_Twilio_TinyHttpException' with message 'SSL certificate problem, verify that the CA cert is OK
//this may have a security flaw
//resources: https://github.com/twilio/twilio-php/issues/18 http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/
$http = new Services_Twilio_TinyHttp('https://api.twilio.com', array('curlopts' => array(
CURLOPT_SSL_VERIFYPEER => false
)));
Resource:
https://github.com/twilio/twilio-php/issues/18