Archive for May, 2009
Magento, MAMP and {{base_url}} Issues
Posted by Stuart in Troubleshooting on May 19, 2009
A local install of Magento may give you a warning to change {{base_url}} for security purposes. I believe this only applies to production environments but it is annoying nonetheless. To solve this, within your Magento admin section, go to System-> Configurations and select the ‘Web’ tab (it’s over on the left under the configuration sidebar). Open the “Unsecure” and “Secure” sections and where you see {{base_url}} (this will be in the Base URL fields of each section… ignore any that say {{unsecure_base_url}} and the like, they don’t matter here) put in your actual base url.
In MAMP you may have something like: http://localhost:8888/magento/ (don’t forget that last slash). This will solve the issue.
Interesting Article about Caching Models in Zend Framework
Posted by Stuart in Zend Framework on May 12, 2009
Interesting article over at http://www.contentwithstyle.co.uk/content/a-caching-pattern-for-models about implementing caching with Zend Framework models. In the comments there is a good point about how to refresh such a cache with the author suggesting using something like a $this->cache->clear() to clear the cache upon adding or updating content.
Zend_Tool Set-up
Posted by Stuart in Zend Framework, unix on May 7, 2009
Download Zend Framework (1.8.0 is the current version at present… change as needed):
wget http://framework.zend.com/releases/ZendFramework-1.8.0/ZendFramework-1.8.0-minimal.tar.gz
Unpack the downloaded file:
tar zxvf ~/Downloads/ZendFramework-1.8.0-minimal.tar.gz
Move into that unpacked directory:
cd ~/Downloads/ZendFramework-1.8.0-minimal
Find out where your PHP binary is:
which php
Put zf.sh and zf.php into the same dir as the PHP binary:
cp bin/zf.sh bin/zf.php /Applications/MAMP/bin/php5/bin/
Find out your include path:
php -i | grep "include_path"
Put the contents of the library folder into that location:
cp -r library/* /Applications/MAMP/bin/php5/lib/php/
Test Zend_Tool:
zf.sh show version
For ease of use, let’s alias zf.sh to just zf. First open your bash login file:
vim ~/.bash_login
Add this line:
alias zf=zf.sh
You are now set up. Next stop, actually creating a project with Zend_Tool!
Using UNIX’s find to locate modified files
This will find anything that was accessed in the past 30 minutes:
sudo find / -amin 30
Finds anything larger than 10k that was modified today:
find / -size +10k -mtime 0
Finds any file larger than 1MB that was not modified in the past year:
find / -type f -size +1M -mtime +365
Finds any php file larger than 1k that was accessed in the past 30 minutes:
find / -size +1k -name "*.php" -amin -30
Using Vault from the command line on OS X
Posted by Stuart in Troubleshooting on May 2, 2009
These are directions for using SourceGear’s Vault version control from the command line on a Mac (OS X 10.5). You will need the Vault client installed (the client, not the server… you’ll be connecting to the server) as well as mono. I recommend using a package manager like MacPorts to handle mono (and any other unixy linuxy command line stuff you need to install). Oh, here is a useful link to the SourceGear support forums (well, kind of useful, Mac users are not exactly a priority as this app is really meant to be used with a Windows GUI client… oh, and don’t bother asking for a Mac GUI client. It ain’t happening).
The basic set of commands to use Vault from terminal on a Mac involve enough typing to wear your fingers out quick (note that I am using a very old version of the client software. This is because the server I am connecting to is old and won’t work with the latest versions of the client). Thus we will create aliases for everything. So the basic command to get into Vault is:
mono /usr/local/bin/VaultClientAPI_3_1_9/vault.exe -repository "My Repository"
Let’s alias that in .bash_login:
alias vault='mono /usr/local/bin/VaultClientAPI_3_1_9/vault.exe -repository "My Repository"'
Now we only have to type “vault”! In these following commands note the need to type backslash, dollar sign, forward slash ( \$/ ) before your repository project path. Weird but you gotta do it (I think that Vault expects $/ and that initial backslash is simply there to escape the dollar sign).
Get a project’s files:
vault get \$/projectname/
Checkout:
vault checkout \$/projectname/assets/css/main.css
Checkin:
vault checkin \$/projectname/assets/css/main.css
Checkin but no changes:
vault checkin -unchanged undocheckout \$/projectname/assets/css/main.css
Add a file and commit the add (all in one):
vault add -commit \$/projectname/assets/images/speakers/ /local/path/to/files/projectname/assets/images/speakers/schmitt.jpg
Rename and commit a file (all in one):
vault rename -commit \$/projectname/about/index.php index_2.php
Help! Vault is all $#^@%& up!
Sometimes errors will crop up. You may have commits that didn’t take or adds or other changes that did not go through for some reason. This will clutter your changeset (give it a look if you’ve been using Vault for a while… you may be surprised). You can view the changeset with:
vault listchangeset
To delete the changeset or to reset things when something goes wrong you can delete certain files. For example:
CacheMember_ChangeSetItems
CacheMember_CheckOutList
These are located on a path named something like:
/Users/yourusername/.config/SourceGear/Vault_1/Client/F8FB077F-8F3B-44B1-80B3-8BDC93CBC0F1/admin/
Great but it’s still too much typing, homes.
For further ease you can alias some of these commands. For example:
alias vci='vault checkin'
or
alias vciun='vault checkin -unchanged undocheckout'
So that the entire series of commands to checkin an file goes from:
mono /usr/local/bin/VaultClientAPI_3_1_9/vault.exe -repository "My Repository" checkin \$/projectname/index.php
to
vci \$/projectname/index.php
and for an unchanged checkin:
mono /usr/local/bin/VaultClientAPI_3_1_9/vault.exe -repository "My Repository" checkin -unchanged undocheckout \$/projectname/index.php
to
vciun \$/projectname/index.php





