Back in the game
By: Kevin | November 14, 2015
After a long hiatus from the tank word I decided I would come back. This time back to my roots, freshwater. I am however trying a few new things like Bioballs. I’ve always used some sort of mechanical filter in the past so we will see how this goes. I’ve always done African Cichlids so I’m also trying new fish too. This blog will serve mostly as recording keeping for myself, water changes, pictures/videos of how things progress.
This tank had been sitting dry for at least a year. It previously was a salt water tank which I failed majorly at. I clean things up and did multiple rinses of the tank to get the salt out. I filled the tank 11/14/15. To help cycle the tank I also put in two Goldfish.
Add SSH key to OS X Keychain
By: Kevin | August 26, 2015
When you need to create an SSH key just run:
ssh-keygen -t rsa -b 2048 -f keyName
Enter your passphrase to generate your key. Then, add that private key to your OS X keychain for easy use by running:
ssh-add -K /path/of/private/key
This way when you
ssh email@example.com your private key will be presented for you on your MacBook and you’ll be all set!
How to upgrade Plex Media Server on Ubuntu
By: Kevin | March 30, 2015
Almost every time I need to upgrade my Plex Media Server I always forget the command and end up consulting the Google. So this post is for me,.. and hopefully help someone thats in the same boat as me.
- Go to Plex.tv
- Click on downloads -> Computer -> Linux
- I’m using Ubuntu on an old machine so I right click on 32-bit and copy link
- On your Ubuntu box paste the download link like so,
wget https://downloads.plex.tv/plex-media-server/WHATEVER-VERSION/plexmediaserver_WHATEVER-VERSION.deb. This will download the update.
- Next run
sudo dpkg -i plexmediaserver_WHATEVER-VERSION_i386.debto install the update.
- Easy peasy, your done.
I like to reboot the machine after updating, just for good measure.
How to enable curl, on Ubuntu LAMP installation
By: Kevin | September 9, 2014
So you installed LAMP but you’re missing the cURL library. I had the same problem. By default cURL is not included with the basic installation of LAMP on Ubuntu Server 14.04. To add the cURL library simply execute this command
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
Once the installation is complete be sure to restart Apache2.
[php]sudo /etc/init.d/apache2 restart[/php] OR [php]sudo service apache2 restart[/php]
Android – major version 51 is newer than 50, the highest major version supported by this compiler
By: Kevin | August 21, 2014
If you have ever seen this warning while trying to build an Android project and wasn’t sure what to do to fix it, let me save you some time.
“Major version” means Java version. Java 7 = 51 and Java 6 = 50. The code is written for Java 7, and that is something that Android’s dex supports.
The simple fix takes you into your project setting and change the version of Java you’re compiling against.
Of course you need to have Java 7 installed. If you don’t just do a quick google search and install and try the above again.
Android colors.xml with transparency
By: Kevin | July 8, 2014
While working on a project I found the need to use transparency in my colors.xml resource file. To add transparency just throw the below Hex value in front of your normal color.
ie. For 50% white you’d use #80FFFFFF. This way the Alpha channel is utilized and you get the desired transparency.
- 100% — FF
- 95% — F2
- 90% — E6
- 85% — D9
- 80% — CC
- 75% — BF
- 70% — B3
- 65% — A6
- 60% — 99
- 55% — 8C
- 50% — 80
- 45% — 73
- 40% — 66
- 35% — 59
- 30% — 4D
- 25% — 40
- 20% — 33
- 15% — 26
- 10% — 1A
- 5% — 0D
- 0% — 00
Converting an immutable bitmap to be mutable in Android
By: Kevin | June 11, 2014
I ran into this error while I was working with a custom view that allowed users to draw on a image using their finger.
[java]java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor[/java]
I found the quick fix is to just make a copy of the original bitmap and pass a true boolean which is the flag to make the copy mutable.
Bitmap immutableBitmap = coming from where ever your source is….
Bitmap mutableBitmap = immutableBitmap.copy(Bitmap.Config.ARGB_8888, true);//<–true makes copy mutable
Canvas canvas = new Canvas(mutableBitmap);
How to load php_curl.dll module in Apache – fixing Unable to load dynamic library
By: Kevin | June 9, 2014
While setting up my development environment I ran into a situation where I needed to use the php_curl.dll module to make http requests. However I kept getting the following error message from Apache in the error.log:
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\\PHP\\ext\\php_curl.dll’ – The specified module could not be found.\r\n in Unknown on line 0
Windows 7 64-bit
A Google search revealed that curl is dependent on two other files. Requires: libeay32.dll, ssleay32.dll (bundled) Source here. OK great, I need those two files, but the documentation doesn’t say anything else. The Bundled only hinted that I already have these files, and I did. So I looked in the root of my installation location of PHP and voila. However, obviously this still wasn’t doing the trick. This is what I did to get php_curl.dll module loaded in Apache.
1. Uncomment php_curl.dll in your php.ini file.
2. Copy libeay32.dll and ssleay32.dll from the root of your PHP folder then paste them into the bin subdirectory in Apache
3. Restart Apache services.
4. Call phpinfo() and make sure cUrl was loaded properly.
Presto! You should be hooked up! Happy cUrling!
How to set time zone in PHP ini file
By: Kevin | June 4, 2014
If you ever use the date() function in php you’ve likely ran into an error message like this:
Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Chicago’ for ‘-5.0/DST’ instead
As the error/warning message suggests you can set
at the top of your php script however that gets to be very repetitive and unnecessary. You could also just silence the warning with the @, however again this doesn’t really solve the problem. To get to the heart of the issue you need to edit the php.ini file. Go ahead and open the php.ini with a notepad editor. *NOTE* On Windows you need to first right click and “Run as Administrator” the on the text editor your choice otherwise sometimes it will not let you save. Add the following to line to the file then restart Apache for the changes to take affect. A full list of time zones can be found at https://php.net/manual/en/timezones.php
How to pass PHP array via POST
By: Kevin | May 5, 2014
I was working on a site which had two databases and different domain names. My problem was I needed to pass information from one database (domain) to another. I wasn’t sure the best way to approach this but finally came to this conclusion. So here it is.
//Select your data from the source
$sql = "Select * from orders where Id=’$orderid’";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);//$row is an array
So now we have our data in $row.
Next we will use the PHP function serialize. This function takes our array and turns it into a string representation of the data, or a bit stream. More on the serialize function here.
This doesn’t quit get us there. By using the serialize function we caused another problem. Our array is now a string with a lot of quotes (“) in it. The quotes don’t mesh well within a form and prevent a large amount from being passed to the other page.
To remove the quotes I use another php function called urlencode. urlencode is a straight forward function, it takes a string and replaces the quotes with html safe characters. More on urlencode here.
<form action="somepage.php" method="post">
//I have nested my calls to urlencode and serialize
//in the value below
<input name="row" value="<?=urlencode(serialize($row))?>" />
<input type="submit" value="Save">
After this form is submitted, we do the opposite to get our original array back. Be sure to do this in reverse order.
//unserialsize data coming from previous page
$row = unserialize(urldecode($_POST[‘row’]));
Ta-Da! Now you have the original array and the data from the previous database.