I received my Raspberry Pi Zero W a couple of weeks ago and finally had the chance to set it up. My goal is to to setup some cameras in my basement and garage.
I received my Raspberry Pi Zero W a couple of weeks ago and finally had the chance to set it up. My goal is to to setup some cameras in my basement and garage.
Today I received all the parts I need to begin setting up my own personal home dashboard. When I first began my career in programming, Home Automation was always something I’ve been very intrigued with; only it was very expensive and there weren’t many products out there to support it. Now, with the recent boom in IOT devices and products, its easier and far more cost effective to do this on your own.
In Backbone, Events is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Events do not have to be declared before they are bound, and may take passed arguments. For example:
1 2 3 4 5 6 7 8 9 10 11 |
<script> var person = {}; _.extend(person, Backbone.Events); person.on("scream", function(msg) { alert("I am " + msg); }); person.trigger("scream", "screaming"); </script> |
To enable hidden files/folders in finder windows:
1 |
defaults write com.apple.Finder AppleShowAllFiles YES |
You should find you will now be able to see any hidden files or folders. To revert:
1 |
defaults write com.apple.Finder AppleShowAllFiles NO |
Sometimes you just need to clear your history in Terminal. It’s actually pretty easy to do.
1 |
history -c |
If you’d rather not have your history saved to a file at all, add the following line to your ~/.bash_profile:
1 |
unset HISTFILE |
This way, your command history is limited to only those commands you used during the current session. More information and options can be found on the bash man page
1 |
man bash |
To clear DNS cache in Leopard, use the following command:
1 |
dscacheutil -flushcache |
Chances are good that you’re already familiar with apt-get, a command which uses the “advanced package tool” to interact with the operating system’s underlying package system. The most relevant and useful commands are, (to be run as root):
1 |
apt-get install [package-name] |
This command installs the package(s) specified, along with any dependencies.
1 |
apt-get remove [package-name] |
This command removes the package(s) specified, but does not remove dependencies.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script> $(function(){ $.ajax({ url: 'http://api.twitter.com/1/users/show.json', data: {screen_name: 'rcastera'}, dataType: 'jsonp', success: function(data) { console.log(data.followers_count); } }); }); </script> |
I was recently asked as a test to write a function that outputs the Fibonacci sequence in PHP. Here it is:
1 2 3 4 5 6 7 8 9 10 11 12 |
function fib() { $current = 1; $previous = 0; $evaluation = 0; while($evaluation < 100) { $evaluation = ($current+$previous); $current = $previous; $previous = $evaluation; echo $evaluation . '<br>'; } } |
I have XAMPP setup on my Mac. Getting MySQL and PHP to run in terminal didn’t work after installation. To be able to run mysql and php you have to add the xampp application to the .bash_profile file in your users home directory.
1 2 3 4 5 6 7 8 9 10 |
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export XAMPP_HOME=/Applications/xampp/xamppfiles export PATH=${XAMPP_HOME}/bin:${PATH} export PATH unset USERNAME |
To check that it has worked, open a new terminal session and type in:
1 2 |
which mysql which php |
Both should point to /Applications/xampp/xamppfiles
Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.