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"
Monday, February 20, 2012
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.
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
$ 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.
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.”
“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
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
Labels:
debugging,
Hardware,
linux ubuntu,
troubleshooting
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/
$ 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
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.
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
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/
# 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.
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.
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.
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.
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
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
Script above will output
<?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.
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
https://github.com/twilio/twilio-php/issues/18
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 forResource:
//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
)));
https://github.com/twilio/twilio-php/issues/18
Subscribe to:
Comments (Atom)