Jun 17, 2013

Composer and IIS

When running composer on a site hosted by IIS, the permissions of downloaded files aren't correct. The IIS user is not added, which means all of those packages you just downloaded cannot be used by your application. Fret not, there is a simple command to recursively update permissions (a la chmod, chgrp for linux).

icacls ./ /grant:r IUSR:"(OI)(CI)"F /t /inheritance:e

This took a bit of time to start and finish, but when it was completed, everything was good to go.

Jun 3, 2013

Updating Group File Permissions

From the command line:
chmod -R g+w *

This will give recursive group write access to everything. This is useful for me when my Apache is run under one user and my text editor is running under a different user (e.g. the user I logged in as). This will ensure both users, provided they're in the same group, will be able to edit the file.

May 15, 2013

XDebug

So - followed the steps to paste the phpinfo() output into the following webpage: http://xdebug.org/wizard.php. Pasted the instructions, followed the step where it said "add the following line to php.ini".

Few notes:

  1. XDebug needs the full path.
  2. The link above will say to just add zend_extension="path to dir". That is wrong. It needs to be the full path, including the directory, to  the xdebug dll.

Apr 10, 2013

WAMP MySQL Data File Location

Took me a few minutes to realize the default location for MySQL installation is under C:\wamp\bin\mysql\mysql5.5.20\data, whereas I was expecting it to be located under the C:\ProgramFiles\MySQL\ folder.

Mar 22, 2013

Creating SSL Certificates

Needed to do a bit of searching on the exact steps to create a ".cer" certificate. The default ssl-keygen will generate public and private keys, but this isn't enough for some applications. Some need a signed X509 certificate, which involves a couple extra steps. Note, because the certificate will not be signed by a trusted certificate authority, your browser/application may throw a fit and complain the certificate has errors. If that's the case, you can purchase an actual certificate from Verisign (very expen$ive) or from GoDaddy or some other lesser priced Certificate Authority your computer trusts. (Note, you could become your own certificate authority if you have complete control over the machines using your certificate. In which case, you can sign your own certificates and the browsers/apps will never complain).

Okay - let's get started. The following steps worked for me, and since I'll forget them, I've written them down as I'll likely need them again in the future.

First, run the ssh-keygen tool. 
cachedmemory>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cachedmemory/.ssh/id_rsa):
(Press Enter to accept the default location)
Enter passphrase (empty for no passphrase):
(Enter a passphrase if you like - it's more secure if you do)
Enter same passphrase again:

Your identification has been saved in /home/cachedmemory/.ssh/id_rsa.
Your public key has been saved in /home/cachedmemory/.ssh/id_rsa.pub.
The key fingerprint is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx cachedmemory@localhost
The key's randomart image is:

You should have two files created in the default folder: id_rsa and id_rsa.pub. These are your private and public keys. Woo hoo!

Okay - lets get cracking on generating that certificate things like browsers use, the X509 certificate.

cachedmemory> cd .ssh
cachedmemory> openssl req -new -x509 -key id_rsa -out unsigned-cert.csr -days 1095
(Enter whatever values you feel are necessary.)

You now have a .csr file you can use. All set!



Mar 7, 2013

Good to have when editing icons for Android:


  • drawable-ldpi (120 dpi, Low density screen) - 36px x 36px
  • drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px
  • drawable-hdpi (240 dpi, High density screen) - 72px x 72px
  • drawable-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px

Mar 1, 2013

InputStream vs. InputStreamReader

Came across this lovely gem. When reading a binary stream in Java, don't use an InputStreamReader. The issue I ran into is when casting a read() into a byte, the value wasn't always what it should be. Luckily when I ran the checksum it failed, otherwise I problably would have never realized this. Reading the start of each packet was working, as did reading the expected number of bytes after the start of the packet. "Works" is a loose term, it was returning data, just not what I expected.