Archive for the ‘Uncategorized’ Category

Toys for Tots: Donation Locations

I thought the donation location features of the Toys for Tots website could be improved so I created https://donateit.to/toys-for-tots/  It’s a mobile-friendly location-based tool that displays the nearest donation sites.  It supports the entire United States, which is over 19,000 drop off locations.

Tool for finding Toys for Tots donation sites

Tool for finding Toys for Tots donation sites

 

The code is based off of Derek Eder’s Searchable Map Template.

NonProfitLocator.org Launched

screenshot of NonProfitLocator.org

I’ve been considering resurrecting Gigoit.org. In addition to finding people to donate items to, one of the essential features on the development roadmap for that site was finding nonprofit organizations that needed material donations.

It’s been a long time since I looked at that data, so to get a better handle on what was available and how it was structured I decided to build NonProfitLocator.org. At the moment It’s an early version, basically a minimum viable product that displays tax exempt and nonprofit information in an easy to read format, performs some comparisons on an organization’s data compared to others nearby, and allows you to find nonprofits in a geographic area.

I plan to further flesh the site out in the coming weeks with enhanced tools, paving the way to use this data with other projects.

AWS PHP SDK – UploadSyncBuilder Uploads files already present remotely

I recently ran into an interesting issue with the Amazon Web Services PHP SDK, when using UploadSyncBuilder, as described in this section of the AWS documentation. The problem was that in some cases, Amazon cares about leading / characters, and other cases they do not matter.

For example, assume you are uploading a file with the following key: /myFiles/myLargeFile.txt. Amazon will effectively remove the beginning slash, and store that object as simply myFiles/myLargeFile.txt. This becomes problematic when using the UploadSyncBuilder as it relies on Aws\S3\Sync\ChangedFilesIterator. ChangedFilesIterator will do a string comparison of your local object key name with those remotely on S3. This means that it will assume, incorrectly, that the object ‘/myFiles/myLargeFile.txt’ does not exist because it does not exactly match ‘myFiles/myLargeFile.txt’.

If you use UploadSyncBuilder, and you find your finds being reuploaded regardless of if they are on the server, make sure you check that the local and remote keys match!

Using Compass and Sass with Symfony Assetic in Vagrant

[yaml]
# This file is auto-generated during the composer install
parameters:
# Your parameters

assetic.filter.compass.bin: /opt/vagrant_ruby/bin/compass
assetic.sass.bin: /opt/vagrant_ruby/bin/sass
assetic.ruby.bin: /opt/vagrant_ruby/bin/ruby
[/yaml]

To make sure the assets can be accessed by non bundle notation
php app/console assets:install web –symlink

Make sure you filter only scss files with compass, and not all css files. If you filter all CSS files with compass you will likely get indentation errors.

FIXED: Doctrine 2 Unknown database type enum requested

Unknown database type enum requested

While working on ACARateQuote.com I came across an issue using symfony2’s doctrine schema update command from the terminal.

Here’s the command

php app/console doctrine:schema:update --force -vv

Here’s the error:


[Doctrine\DBAL\DBALException]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.

The issue is that Doctrine inspects all the tables in the database, even if those tables are not currently mapped to any entities, and that Doctrine does not natively support MySQL’s ENUM column type. In my case, I had a table created with raw data that had not been fully normalized and contained several ENUM columns.

The quickest solution to this problem, is to update your app/config/config.yml to map the ENUM column type to a string column type. The highlighted lines below show the change.

Once you make the update to your config.yml you should be able to execute the console command again without any issues.