You are here

Home

Blogs

Greenhouse Automation

I bought my first Raspberry Pi a few weeks ago (picture on the right).  Within minutes - literally- I had a XMBC Media Center.  Thanks to a great tutorial on Life Hacker.  But the ability to explore Linux and greenhouse automation temps my soul. I know my strength and weaknesses ~ and making sure the greenhouse is the right temp all the time without automation is not going to work.  It needs to be automated. 

Research has yielded lots of good information.  Now I need to organize my thoughts, make a list of what I want to accomplish and create a plan.

The following links were a few of the websites I enjoyed the most in my research.  

The best one: http://hackaday.com/2012/06/05/large-scale-arduino-controlled-greenhouse-does-some-serious-farming/

Other sites of interest:
Garden Bot articles
http://www.sparkfun.com/news/598
http://gardenbot.org/howTo/

A more complex version
http://www.zen35309.zen.co.uk/wx/tech.html

How to set up Ubercart and PayPal Sandbox for Testing

PayPal sandbox preface:

The trick with the PayPal sandbox is you have 3 accounts, and you need to be logged into the system with your developer account when testing the website.

  • The primary account is your developer account. This logs you into http://developer.paypal.com/.
  • The other two (one Buyer one Seller) work within the sandbox system. You need to login with your developer account before you can use these other accounts.

The way I set mine up was to use my email address for the developer account and just use the default address generated by PayPal for the Buyer and Seller accounts. Also, if need be you can create multiple Buyer and Seller accounts under your developer account.

Below is a complete step-by-step for setup and checkout (tested with Drupal 7.15)

  1. Go to http://developer.paypal.com/ and create an account. This is separate from any existing PayPal account you may have.

  1. Click on “Create a pre-configured buyer or seller account.”

  1. Check “Buyer”, leave the email address alone, change the password if you’d like (but remember to write it down), then click “Create Account”. Note: for the screen shots for this tutorial I have changed the default Login Email to testac.  Remember to write down the password, you will not be able to access it again.

  1. Click again on “Create a pre-configured buyer or seller account.” but this time create a “Seller” account. 
  2. In Drupal, enable the PayPal module (under Ubercart – payments).
  3. Under “Administer » Store administration » Configuration » Payment settings” expand the “PayPal Website Payments Standard settings”.
  4. Set “PayPal e-mail address:” to the “Log-in email” you see for the business account you created (unless you manually set this the email address will be something like “you_12313131233_biz@here.com”). Remember to change it back when you are out of test mode. You should be able to get to “Test Accounts” page with the link: https://developer.paypal.com/devscr?cmd=_sandbox-acct-session and see your Seller “Log-in email” address.
  5. You can then change the rest of the settings in the Ubercart PayPal module as you’d like.

To complete a test checkout:

1. Make sure you are logged in to PayPal’s sandbox server using your main account (go here: http://developer.paypal.com)

2. In Drupal proceed to checkout as you normally would and after you click the button that would normally say “Submit Order”, you will be redirected to PayPal’s sandbox server. If you are properly logged in with your developer account you will see “XXX’s Test Store” at the top of the page.

3. Log in with your Buyer account information (something like “you_12313765733_per@here.com”). Careful here as this is constantly crashing FF3 on my machine.

4. Complete the transaction using your phony test account for the Buyer.

5. You will then see a page saying your transaction is complete and a button taking you back to your store. Order emails do not appear to get sent (to either the buyer or store admin) if the user does not click this button to return to the store, although the order’s status is updated to “Payment receiver”.

Information copied from: http://www.wootenswebdesign.com/how-set-ubercart-and-paypal-sandbox-testing

Drupal Windows 7 Patching

There are time when I would like to patch a module on my Windows 7 computer before uploading it. Here is a quick tutorial for patching Drupal modules on Windows 7 http://indiawebsearch.com/content/how-to-apply-a-patch-to-a-drupal-modul...

Drupal Tutorial - Limiting Access to Content Type

Challenge: Limit access to a content type based on role. Great tutorial: http://dev.nodeone.se/en/restricting-access-per-content-type

Links of Interest

DivTargets

I used a combination of these two scripts to create a script that shows the owner of a webcam all of the images over a specific time period.  These images can be emailed to the necessary places. 

JQuery Testing Area

It has been a long time since I've played with jquery and I enjoyed this testing area. http://jsbin.com/obopo3/edit#javascript,html

 

Zombies

I have a client who wants to create a page of zombies.  http://www.photoshoproadmap.com/Photoshop-blog/2008/01/16/70-horror-blood-and-gore-photoshop-effects-and-brushes/

Full Screen Background

I have not found an easy way to create a full screen slide show. http://css-tricks.com/3458-perfect-full-page-background-image/

Email Uploads

End Goal: Import content from several e-mail addresses utilizing cron.

Scope: To help other people understand how to create the connection between the feeds importer and Mailhandler Mailboxes.

There are two modules involved, for information on how to install them, please refer to their readme files.

  • Feeds
  • Mailhandler

There are four basic areas to understand and set up correctly

  • Setting up the e-mail addresses
  • Setting up a basic Feed
  • Automating the import by creating the connection between the e-mail addresses and the feed
  • Creating the connection between the feed and the content type of choice.

Setting up the e-mail addresses

The Mailhandler is set up to handle three e-mail protocols. This tutorial deals with the IMAP protocol.

  1. Before starting, send a test e-mail to the e-mail account.
  2. Location for setting up the e-mail addresses in the Mailhandler Module
    1. Drupal 6: Site Building-> Mailhandler Mailboxes
    2. Drupal 7: Structure->Mailhandler Mailboxes
  3. Create New Mailbox
    1. Protocol: IMAP
    2. Port: 143
    3. Extra commands: Review options, test as needed
  4. The module will test the account and list the number of e-mails in the account
  5. Continue until the e-mail connection works.

Setting up a basic Feed

Before we do the heavy lifting, setup and test the default mailhandler to make sure the connection between the mailhandler and the e-mail account works. We will be adjusting settings after we have confirmed that the basic settings are correct. 

  1. Location for setting up feeds in the Feeds module
    • Drupal 6: Site Building->Feeds-> List  ($baseurl/admin/build/feeds/list)
    • Drupal 7: Structure->Feeds->List 

       ($baseurl/admin/structure/feeds/list)

  1. Consider cloneing the Mailhandler and then check the following settings on the clone.
    • Basic Settings – Attached to
      • Leave this attached to [none] for now
    • Fetcher: Mailhandler fetcher
    • Message Filter: Nodes Only
    • Parser: Mailhandler IMAP stream parser
    • Mailhandler: IMAP stream parser settings keep default settings
    • Node processor: keep default of story
    • Create and Update nodes:
      • Set Subject to title
      • Body (text) to Body
  1. Send an e-mail to the e-mail account
  2. Go to $baseurl/import
  3. Choose the Mailhandler
  4. Choose the e-mail address to import from
  5. Import
  6. The software will display a notification if a node as been imported.  If this does not work, please recheck the settings until it does work.

Automating the Feed import

There are a few concepts to be aware of, the Feeds module will handle the connection from the e-mail account to a particular content type and handle mapping of information from the node to the content type of choice.  It will need two content types (discussed below) to do this.  The first content type creates the connection between the Mailhander Mailbox and the E-mail, the second is the content type of choice for data in the e-mail address.

Creating Connection Content Type

Creating a connection content type automates the feed import process.  This may take time to understand, so be patient. A second content type will be needed to store the information from the e-mail.

  1. Create a new content type – suggestion use Mailhandler Source
    • Submission Settings – Title Field: Title, delete Body Field Label
    • Workflow Settings – Published
    • Save
  1. This is the challenging part – how to create the connection. Normally we would add a field for Mailbox when we created the content type. Not true in this case.
  • In this case go to the Feeds Importer List. 
  • Choose the mailhandler, then Basic Settings.  Attach to: set this to attach to the Mailhandler Source. This adds a field listing the e-mail addresses available.
  1. Keep the rest the same – we know it works. We did much more than add a field to a content type, we created the connection from the Feeds Importer to a content type.
  2. Now, create content– Mailhandler Source. There is a new field – Mailbox. Choose the e-mail address.
  3. Save
  4. Importing has been automated.  Going to the $baseurl/import will not work anymore. (If you try, you will get a new content form). Now we have to run the cron to import.
  5. Test. 
  6. Keep in mind that we will need a Mailhandler Source node for each e-mail address.

Creating the connection between the feed and the content type of choice

One way to utilize the Mailhandler and Feeds modules is to have each e-mail address map to a specific content type, ie blogs, page, story, etc.  Note: For each e-mail address storing its information in a different content type a new importer and connection content type will need to be made.

  1. To accept file attachments go to the Mailhandler IMAP stream parser and make sure the File Processor command plugin is chosen.  Add all three commands.
  2. If you have CKEditor installed, make sure to remove the fields from the view.  Check the CKEditor: the ID for excluding or including this element just below the text field.
  3. Node Processor Setting: Choose the content type and import format
  4. Save
  5. Create and Update Nodes Mapping
  6. Map fields as needed.
  7. Save
  8. Test

Another tutorial to explore: http://www.fieldguidetoprogrammers.com/drupal/using-drupals-mailhandler-... I find myself going back to this tutorial.

Remember to use this patch!

 .../mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php b/modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
index 605f4b5..208d336 100644
--- a/modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
+++ b/modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
@@ -233,7 +233,7 @@ class MailhandlerPhpImapRetrieve extends MailhandlerRetrieve {
           $prefix = $part_number . '.';
         }
         $sub_parts = $this->get_parts($stream, $msg_number, $max_depth, $depth + 1,
-          $sub_structure, $prefix . ($index + 1));
+          $sub_structure, ($index + 1));
         $parts = array_merge($parts, $sub_parts);
       }
       return $parts;


Drupal Advertise Module

Drupal 6 Advertising Module (Download)

General Thoughts
 

I had some issues with this module.  Everything seemed to be working great - then I made a change and everything quit.  The website would not load.  I wish I had kept a copy of the line to share here, but I did not. I resolved the issue by going into the db - the ad table and deleting the ad whose node number was displayed in the line. The website loaded fine.  Now the module had my undivided attention.  Ultimately, I had to go in, delete all the taxonomy terms, all ads, all views and basically start again. I am not sure what caused the issue, which always makes me nervous.  But I do not have time to see if I can recreate the issue. 

Rotating Ads

Here are the screen shots for the rotating ads. 

Step 1: Set the Style to SLIDESHOW. 

STEP 2 - Set the Slideshow Options

Step 3: Set the Row Style to ADVERTISEMENT

Step 4:  Now here is where I had some challenges.  When I played with different row styles it corrupted things,and I would have to start all over.  Quite interesting.  I wound up using the last option and making sure that the AUTOMATIC LIVE PREVIEW was UNCHECKED.  It is checked in this screen shot.  Before I would submt the view change, I would uncheck the box.  In Firefox, the view page would load, then a new page would show up with the ad on it, and I could never get back to the view to save the changes.  Weird. 

Last Steps
Of course, the last steps are to set the Taxonomy term in the Filters section and activate the box. 

Concerns
I was not happy when I had to remove all the ads.  Had the site been live, I would have lost all data up to that point.  Making a back up of the db and file structure before changes is ALWAYS important. 

 

Pages