"Murphy was an optimist!"
Cross-domain communication January 11, 2012 9:16 pm
Posted by Doug McCaughan in : HTML, Programming, TechnologyIf I have an aspx site on one server, let’s call it foo.com and I have a php site on another server, let’s call it bar.com, and I want to use an iframe to include data from foo.com within the bar.com site, security for iframes prevents this correct?
So, if I instead create a subdomain of foo.com, let’s call it bar.foo.com and use bar.foo.com for the aspx site, does that overcome the cross-domain security issue since both sites are now part of the foo.com domain or does the nature of bar.foo.com being a tertiary domain still create the security issue since bar.foo.com is technically different than foo.com?
add a comment
WordPress Hooks, Actions and Filters – Modifying the Publish function January 4, 2012 10:38 am
Posted by Doug McCaughan in : Blog, Communications, PHP, Programming, Publishing, Software, Technology, WordPressI’m writing a child theme to twentyeleven and want to modify the administrative post "Publish" function to do some additional processing during the saving of a new post. Does anyone know if there is a hook, action or filter that will allow me to extend the Publish function?
add a comment
Subversion Error Message On Branch/Tag September 15, 2011 11:21 am
Posted by Doug McCaughan in : Programming, TechnologyToday’s tech problem:
I am trying to create a new baseline for my code. I have checked my code out of my repository, updated individual files to the proper version for the baseline, and then when I try to tag or branch the working copy, I get an error.
Error Commit Failed (details follow):
Error File
Error ‘/svn/foo/bar/branches/blah/snafu/path/to/file/file.cfm’
Error already exists
Because of the failure, the branch attempt, or tag attempt, fail leaving the branch/tag empty.
How can the file already exist if the branch/tag starts out completely empty?
add a comment
From the mouths of programmers August 17, 2011 7:06 pm
Posted by Doug McCaughan in : Daily Life, From the mouths of babes, Programming, TechnologyNow that the day is over, I can finally begin my work.
add a comment
Google’s Voice Search June 17, 2011 10:49 am
Posted by Doug McCaughan in : Programming, Software, TechnologyI think I’ve seen this and never paid any mind to it. How long Google had voice search on Chrome?
1 comment so far
Call to action: WordPress Developers Please Comment February 17, 2011 9:33 am
Posted by Doug McCaughan in : PHP, Programming, Software, Technology, WordPressHello WordPress developers! (me included). When you make a theme, I implore you, please use a simple html comment at the top of each page to identify the template. For example: <!- – TEMPLATE: single.php – -> would allow someone unfamiliar with your theme to look in the generated source and see which template(s) are influencing the output. Yes, experienced WordPress developers should already know which files are being used but we don’t write themes only for experienced developers. And even experienced developers get stuck, tired, or would like things to be sped along and a simple comment, <!- – TEMPLATE: page.php – ->, would help tremendously. Thank you!
add a comment
Don’t use underscores in css ids November 17, 2010 4:35 pm
Posted by Doug McCaughan in : CSS, HTML, Programming, TechnologyToday’s reminder from your friendly neighborhood codeslinger is "don’t use underscores in css ids!" You know, those lines _ that programmers like to use instead of spaces in variable names (because you can’t really have spaces in a variable name in most languages). This was an illegal character in the original CSS1 and CSS2 specifications (updated in 2001 to be valid) so setting an id to foo_bar (e.g. <div id="foo_bar">) would be translated by the browser as foo\_bar (e.g. <div id="foo\_bar">), well, some browsers, not all browsers because you know browsers are so consistent in their interpretation and implementation of these so called web standards.
The solution? Instead of underscores, opt for dashes (e.g. <div id="foo-bar">) or camel case (e.g. <div id="FooBar">) but remember that id’s and class names are case-sensitive.
See also.
add a comment
jquery challenge of the day September 7, 2010 6:19 pm
Posted by Doug McCaughan in : CSS, Daily Life, JavaScript, jQuery, Programming, TechnologyAnd now for something completely different…
Let’s say you have a table that could have infinite rows. The table has an id but none of the other elements (ie. we won’t be traversing by id). The column to the furthest right of the row has an anchor tag in the for of an <a href> There are no other anchors on that row. What I want to do is when the anchor tag is clicked, have the <a href> text in the row above the clicked on turn bold and only that <a href>. Sample table:
<table id="tbl">
<thead>
<tr>
<th>col 1 label</th>
<th>col 2 label</th>
</tr>
</thead>
<tbody>
<tr>
<td>one</td>
<td>sometext <a class="tt" href="#">link</a></td>
</tr>
<tr>
<td>two</td>
<td>moretext <a class="tt" href="#">link</a></td>
</tr>
<tr>
<td>three</td>
<td>differenttext <a class="tt" href="#">link</a></td>
</tr>
<tr>
<td>four</td>
<td>othertext <a class="tt" href="#">link</a></td>
</tr>
</tbody>
</table>
So, if I click the link in row three, I want the text "link" in row two to become bold. This is using jquery and traversing this is kicking me hard.
8comments
jQuery roadblock August 12, 2010 6:33 pm
Posted by Doug McCaughan in : JavaScript, jQuery, Programming, TechnologyjQuery problem:
<table>
<tr><td>one</td><td>two</td><td>three</td><td><a class=”foo” href=”">click me first</a></td></tr>
<tr><td>one</td><td>two</td><td>three</td><td><a class=”bar” href=”">click me second</a></td></tr>
</table>
What jQuery would allow me to click on "click me second" and change the color of the text "click me first"?
It’s a little more complicated than that. The real source has a plus image on the first row. Once you click that I use .hide() to make the plus go away. I create the 2nd row which has a minus image and a plus image. If you click the plus image, it disappears and creates a third row. The minus image, should 1st) cause the immediate plus image above it to appear 2) then disappear its own row. All plus images have a class of "addrow" and minus images have a class of "deleterow" I thought prev() would be doing it but I get nothing. Specifically .prev(‘.addrow’).show();
add a comment
Simplifying Code August 11, 2010 9:55 pm
Posted by Doug McCaughan in : ColdFusion, Programming, TechnologyOften I run across code like this:
<cfif ArrayIsEmpty(Cart.Products)>
<cfset HasCart = False>
<cfelse>
<cfset HasCart = True>
</cfif>
Frankly, that makes me twitch a little. This has the same result:
<cfset HasCart = NOT ArrayIsEmpty(Cart.Products)>
2comments
Magento – Not currently favorite color January 28, 2010 7:54 am
Posted by Doug McCaughan in : Programming, TechnologyWhy is debugging and troubleshooting in Magento so difficult? Because of error messages like this:
Notice: Undefined variable: rootNode in C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php on line 53
Trace:
#0 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php(53): mageCoreErrorHandler(8, ‘Undefined varia…’, ‘C:\Domains\exam…’, 53, Array)
#1 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Widget\Form.php(196): Mage_Eav_Model_Entity_Attribute_Source_Config->getAllOptions(true, true)
#2 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tab\Account.php(54): Mage_Adminhtml_Block_Widget_Form->_setFieldset(Array, Object(Varien_Data_Form_Element_Fieldset))
#3 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php(58): Mage_Adminhtml_Block_Customer_Edit_Tab_Account->initForm()
#4 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(642): Mage_Adminhtml_Block_Customer_Edit_Tabs->_beforeToHtml()
#5 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#7 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#8 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml(‘left’, true)
#9 C:\Domains\example.com\wwwroot\magento\app\design\adminhtml\default\default\template\page.phtml(58): Mage_Core_Block_Abstract->getChildHtml(‘left’)
#10 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(144): include(‘C:\Domains\leoa…’)
#11 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(176): Mage_Core_Block_Template->fetchView(‘adminhtml\defau…’)
#12 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(193): Mage_Core_Block_Template->renderView()
#13 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#14 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Adminhtml_Block_Template->_toHtml()
#15 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Model\Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#16 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(347): Mage_Core_Model_Layout->getOutput()
#17 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\controllers\CustomerController.php(117): Mage_Core_Controller_Varien_Action->renderLayout()
#18 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(376): Mage_Adminhtml_CustomerController->editAction()
#19 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch(‘edit’)
#20 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 C:\Domains\example.com\wwwroot\magento\app\Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#22 C:\Domains\example.com\wwwroot\magento\index.php(65): Mage::run()
#23 {main}
Yes, it screams "undefined variable" which is rootNode but through Magento’s excellent use of object oriented spaghetti, the error does not in anyway reveal what is truly causing rootNode to be undefined nor where to even begin looking.
add a comment
IRC Support for Zend Framework is on Freenode January 24, 2010 6:23 am
Posted by Doug McCaughan in : Programming, TechnologyThe unofficial IRC support channel for Zend Framework is on Freenode at #zftalk.
add a comment
Current Magento Questions – getCustomerFormData January 21, 2010 10:18 pm
Posted by Doug McCaughan in : Programming, TechnologyThe Magento ecommerce question I am trying to answer right now is what does getCustomerFormData() do?
In AccountController.php and Register.php there is this reference $data = $this->_getSession()->getCustomerFormData(true); and this reference $data = new Varien_Object(Mage::getSingleton(‘customer/session’)->getCustomerFormData(true)); respectively. I’ve searched using grep and within eclipse’s file search but can find no other reference to getCustomerFormData.
I can find no reference to getCustomerFormData other than these two lines of code. So what is this supposed to be accomplishing?
add a comment
Magento – Developer Killer January 21, 2010 1:09 pm
Posted by Doug McCaughan in : Programming, TechnologyWhile trying to add some functionality to my client’s Magento ecommerce store, I came across an article that summed up my Magento experience quite well:
Most of us in ecommerce application development have already heard of Magento. Some would call it new ecommerce killer app. I myself stand with that statement for many of reasons. However I would like to call it with one more name, developer killer app. This developer killer is what I literally had in mind. Magento is currently one of the most difficult PHP systems out there a developer could learn and master. [Source, {}activecodeline, What makes Magento so hard to learn (emphasis added)]
I have put so much effort into learning this system that I both never want to touch it again AND must do more Magento development so that this exercise of gaining knowledge does not go to waste.
Today’s links for Magento success:
- Netbeans
- Eclipse
- ZendFramework
- MAGENTO_v1.3.2.4—Database_Diagram.pdf by ggoodwin
- ZendFramework Quikstart
1 comment so far
Magento References January 19, 2010 9:23 pm
Posted by Doug McCaughan in : Programming, TechnologyRelevant to my life right now:
- Class Mage_Eav_Model_Entity_Setup
- Installing Custom Attributes with Your Module
- Magento Architecture
- ERDs and other diagrams
- database diagrams
- Question about adding selects, radio buttons, and checkboxes to registration form.
- Designing for Magento
- Themeing Magento
- Categories, Products, and Attributes – part 1
- Categories and Attributes in Magento: Part 2
add a comment

