sim.plified.com

Chris Pollock

Chris Pollock - web developer & ecommerce entrepreneur
undivided… my thoughts on world, family, church, business, technology and Jesus Christ (all in all)

Restarting Dansguardian on OSX

I recently installed Dansguardian on my mac to have finite control over web traffic.

This post from drb80 was very helpful in getting it installed.

After you edit the conf files you'll need to restart the daemon. Here's how to do it:

sudo launchctl unload -w /Library/LaunchDaemons/org.macports.dansguardian.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.dansguardian.plist

[ Leave a Comment ]

Mac OSX: Resize Image on Right Click

I resize a lot of images to the same size for use in my blog and on my web site.  This automator script allows you to quickly resize and image from the right click menu.

Resize Image on Right Click - Automator

[ Leave a Comment ]

Must Have Mac Software – Web Developer

It's been almost a year since I switched to using a Mac from a PC.  Since then there have been a number of other converts.  Our entire household now uses Mac computers and I know other people who are switching as well.  I wanted to list out some of the software that I've found helpful over the past year.  Note that this is mostly from the perspective of a web devleoper

  • Transmit – Great FTP clients that even supports S3 – http://www.panic.com/transmit/
  • Sequel Pro – Must have manager for anyone who deals with mySQL – http://www.sequelpro.com/
  • Time Out – Prevents eye fatigue by prompting you to take breaks – http://www.dejal.com/timeout/
  • Text Wrangler – Good text editor – http://www.barebones.com/products/textwrangler/
  • Apple developer tools – Install these from the disk that comes with your Mac.  The program I use the most is FileMerge
  • Growl – notification software – http://growl.info/
  • Adium – IM client – I love how it can be tucked away off screen – http://adium.im/
  • Hyperdock – I use this to manage my windows – allows them to be made full size or part size by dragging them around the screen – http://hyperdock.bahoom.com/
  • USB Overdrive – http://www.usboverdrive.com/USBOverdrive/News.html - a necessity for running my Evoluent Vertical Mouse – http://www.evoluent.com/
  • Typinator – a shortcut text expander program – http://www.ergonis.com/products/typinator/
  • Alfred – quick launcher application – http://www.alfredapp.com/
  • Clean Archiver - take the junk out of the standard mac compression – http://www.sopht.jp/en/cleanarchiver/
  • Jing – great for quick screen casts – http://www.techsmith.com/jing/
  • Jumpcut – clipboard app that keeps a record of your latest clipboard cuts – http://jumpcut.sourceforge.net/
  • iStats Menus – allows you to keep an eye on our processor and memory – http://bjango.com/mac/istatmenus/

There are a lot of other programs that I use that are more well known, but these form the foundation of smaller apps that make computing on the mac even easier.

[ Leave a Comment ]

Track 404 Errors with Google Analytics

Tracking 404 pages is a part of being a web master. I was using a service called Link Patch, but they recently shut down. Why this never occurred to me before I don't know, but I thought, why not just track 404s as an Event in Google analytics. I tried it and it worked like a charm.

Here is the code I placed on my 404 page:


<script type="text/javascript">
	// log 404 in google analytics
	_gaq.push(['_trackEvent', 'Error', '404', '<?php echo $_SERVER['REQUEST_URI']; ?>']);
</script>

This will place the url for the page in the events menu under the "Error" category

What I love about this approach is that:

  • Groups multiple errors together to help me track trends
  • Allows me to filter and get reports across date ranges
  • Get reports emailed to me on a weekly, monthly, quarterly or yearly basis

I think this is going to be a great shift. I just sorry I didn't set it up earlier!

[ Leave a Comment ]

Make DOMPDF work with Magento

I’m currently working on a project where I wanted to use DOMPDF to export html from magento.  With some help from some folks who got DOMPDF to work with Zend I was able to get it working with Magneto.

Step 1

Copy the dompdf folder to the lib directory of your magento install.

Step 2

Edit app/Mage.php to include the following code

include_once 'dompdf/dompdf_config.inc.php';
spl_autoload_register('DOMPDF_autoload');

This goes around line 52 inside the else statement right after

 include_once "Varien/Autoload.php";

Step 3

Use the code.  Here’s an example of what I  am doing inside on of my custom contollers

public function printAction(){
        
        
        if ($quote = $this->_iniQuote()) {
            
            $html = $this->getLayout()->createBlock('crm/quotes_print')->toHtml();
            
            $dompdf = new DOMPDF();
            $dompdf->load_html($html);
            $dompdf->render();
            $dompdf->stream("sample.pdf");
            
         }
        
    }

Basically that’s it.  Pretty straight forward and seems to work like a charm.

NOTE:  This was done using DOMPDF 0.6.0 beta1 and Magneto 1.4.0.1

[ Leave a Comment ]

Transition to Mac NOT going as well as had expected

I hope this attempted transition to MAC doesn’t end in tragedy, but it looks like its heading that way fast…

  • MS Excel 2008 maxes processor
  • Cannot drag and drop files into Dreamweaver file manger
  • Lack of any “finder” based SVN client (e.g. such as tortoise SVN)
  • Lack of blogging software that holds a candle to MS Live Writer (come on! this is a Microsoft product)
  • MAC Skype client doesn’t support multi video
  • Have to pay for a lot of programs I got via open source before.

Yes there are some things I like, but I’m afraid that this list is only going to continue to grow. 

Update After this momentary crisis I didn't just ditch the MAC. I kept with it and am enjoying it more and more.

[ Leave a Comment ]

Stand and Work!

On my company blog I posted a complete step by step processes with videos of a standing desk that I built.  As a programmer I do a lot of sitting and the standing desk is a great way to get out of the seat and be productive.  Learn more about this project: Simplified Building – Standing Desk

Standing Desk - Finished! Standing at the Desk

Standing Desk - Finished!

Standing Desk - Finished!

Standing Desk - Finished!

[ Leave a Comment ]

Get Location Information via visitor IP with Yahoo Query Language (YQL) and PHP

I was reading a Read/Write Web article and YQL and started to monkey around with it a bit today.  I was in need of an script that returned information on the users location based upon their IP.  In a few minutes I was able to pull together a quick script to start parsing out information based on a user’s IP.  Nothing fancy here, but it works!  There are some limits to how many times you can query YQL (read the documentation for more information).

    $ip = $_SERVER['REMOTE_ADDR']; 
    
    $url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20ip.location%20where%20ip%3D'{$ip}'&format=xml&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
    $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
    
    // if you need to see what is coming back.. uncomment below.
    // print_r($xml);
    
    // store the information you want using xpath
    
    $country =  $xml->xpath("/query/results/Response/CountryCode");
    $city =  $xml->xpath("/query/results/Response/City");
    $lat =  $xml->xpath("/query/results/Response/Latitude");
    $long =  $xml->xpath("/query/results/Response/Longitude");
    
    echo "<p>" . $country[0];
    echo "<p>" . $city[0];
    echo "<p>" . $lat[0];
    echo "<p>" . $long[0];

[ Leave a Comment ]

Expression Engine – Extension to Show Custom Fields in Edit Tab (by Label)

An extension that showed custom fields in the edit had already been developed and was readily available on the EE forums.  However, I needed to mod this extension a bit to be based on field label instead of field id.  Functionally this allowed me to grab custom fields in different custom field sets and display them in the same column.  The use case for this was as follows.  I had multiple custom field sets, the user was entering the title in German and I wanted to be able to see a title in english.  So I added a field to each custom field set with the same label “english_title”.  I used that to pull the English title in the edit tab (so if I needed to find something I could, see as I don’t speak German). 

Download: ext.edit_custom_field_by_label.zip

To use the extension, install the files in their standard locations, enable and then edit the settings (fill in your field with the appropriate field label).

If you have any problems feel free to leave a comment and I’ll help you when I can.

[ Leave a Comment ]

My Latest Creation: Simplified Safety

Just about 18 months ago we conceived of a new web site that was focused on safety solutions.  As we conducted business on Simplified Building Concepts we saw an increased emphasis on safety railing and safety products.   This led us to create an entire site that focused on providing safety solutions and advice.  The site was designed in collaborations with Squared Eye.   Matthew Smith from Squared Eye did a fantastic job working with me to put together a site that is both beautiful and usable.  I highly recommend his services.

I welcome you to visit the site and give feedback (use the black tab on the right side).  In the future I plan on releasing some posts on the ins and outs of the architecture of the site.

Here’s a bit of information about the site:

Simplified Safety is a company specializing in safety products and advice.  We aim to provide customers with tested, top quality safety gear and the appropriate advice to identify the products that are needed by each individual customer.  Working closely with each customer to arrive at a tailored safety solution is how we hope to set ourselves apart in the industry.  Here are a few examples of the safety products we supply: Guardrails, Skylight Protection, Lifeline Systems, Personal Protection Equipment, Harnesses, Lanyards, and more.

 

ssi-home

[ Leave a Comment ]

Next,

Things I see

New responsibilitiesPhotoMy mom found these. Married 14 years this June to @amylpollock #marriage #iloveit#gvll practice at Aberdeen#amerksGreat practice tonight #gvllPhotoSharingT-minus 6 days to sping training #littleleague #gvllGrandma and Grampa are back.PhotoSnowing again. Baseball starts in a week!They might be cannibals.#lego #spring. A collaboration from Isaac and Caleb.Photo

Chris Pollock

Web Developer - proficient in both PHP and ASP.NET.
Rochester, New York

View my web developement site.

View Chris Pollock's LinkedIn profile

My Pictures

New responsibilitiesPhotoMy mom found these. Married 14 years this June to @amylpollock #marriage #iloveit#gvll practice at Aberdeen#amerksGreat practice tonight #gvllPhotoSharingT-minus 6 days to sping training #littleleague #gvllGrandma and Grampa are back.PhotoSnowing again. Baseball starts in a week!They might be cannibals.#lego #spring. A collaboration from Isaac and Caleb.Photo