<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Solution Log &#124; Antonio David - NVNCBL &#187; xml</title>
	<atom:link href="http://www.nvncbl.com/tagged/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nvncbl.com</link>
	<description>A place to log my programming solutions for future reference</description>
	<lastBuildDate>Mon, 17 May 2010 21:39:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Solution to Excel&#8217;s CSV Output Formats</title>
		<link>http://www.nvncbl.com/2009/08/solution-to-excels-csv-output-formats/</link>
		<comments>http://www.nvncbl.com/2009/08/solution-to-excels-csv-output-formats/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 05:23:17 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=352</guid>
		<description><![CDATA[Recently I&#8217;ve had to import a client&#8217;s catalog data from Excel 2007 to the Magento eCommerce Platform.  The data in Excel was unsurprisingly in a format that was unsupported by Magento&#8217;s import methods.  Using code, I needed to parse Excel data into the format Magento required.  In PHP, I wasn&#8217;t aware of [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve had to import a client&#8217;s catalog data from Excel 2007 to the Magento eCommerce Platform.  The data in Excel was unsurprisingly in a format that was unsupported by Magento&#8217;s import methods.  Using code, I needed to parse Excel data into the format Magento required.  In PHP, I wasn&#8217;t aware of any way to interface with .xls or .xlsx files, so I tried exporting the data to flat-file CSV, where it could be easily manipulated using PHP&#8217;s native CSV functions.</p>
<p><span id="more-352"></span>Unfortunately, none of the three CSV formats that Excel outputs could be properly parsed as CSV.  For example, accepted CSV standards state that values should be:</p>
<pre>"value1","value2","escaped "" double quote", "value 3", "", "", "7th column"</pre>
<p>But in Excel&#8217;s version of CSV, that would look like:</p>
<pre>value1,value2,"escaped "" double quote",value 3,,,7th column
</pre>
<p>It&#8217;s terribly inconsistent in its use of double quotes, confusing the hell out of many CSV parsers.</p>
<p><strong>The Solution:</strong></p>
<p><a title="CSV to XML Converter" href="http://www.creativyst.com/Prod/15/" class="external">CSV to XML Converter</a> by <a title="Creativyst" href="http://www.creativyst.com/" class="external">Creativyst(R)</a>.  It takes in CSV garbage and returns immaculate and clean XML.  Then use your language-of-choice&#8217;s XML functions to work with the data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2009/08/solution-to-excels-csv-output-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Platform Revisited</title>
		<link>http://www.nvncbl.com/2009/01/magento-platform-revisited/</link>
		<comments>http://www.nvncbl.com/2009/01/magento-platform-revisited/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 18:59:27 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=196</guid>
		<description><![CDATA[It&#8217;s been almost three weeks now since I&#8217;ve started learning the Magento ecommerce platform.  With an impressive array of features, like product comparisons and a web services API, the platform sounds promising.  I had hoped that by the time I&#8217;d revisit this topic, I&#8217;d be able to say I&#8217;ve successfully implemented the software.  Instead I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost three weeks now since I&#8217;ve started learning the <a title="Magento - eCommerce Software" href="http://www.magentocommerce.com/" class="external">Magento ecommerce platform</a>.  With an impressive array of features, like product comparisons and a web services API, the platform sounds promising.  I had hoped that by the time I&#8217;d revisit this topic, I&#8217;d be able to say I&#8217;ve successfully implemented the software.  Instead I&#8217;m having trouble setting up my product catalog (it involves importing).  And how can I forget to mention the overall issue of speed?</p>
<p>Let&#8217;s start at the beginning, at installation.  Your web server likely has capable hardware, so you need to be sure that your <a title="Magento - System Requirements" href="http://www.magentocommerce.com/system-requirements" class="external">software configuration meets requirements</a>.  Luckily the host I&#8217;m on was set up just fine the way it was.  Obviously you need to download the software &#8211; I chose to download the Full Release (version 1.1.8 at the time).  <span id="more-196"></span>The zipped package contains 6k+ files so you may want to look into an &#8220;<a title="Unzip on server" href="http://www.3scriptz.com/snippets/unzip-on-server-using-php.html" class="external">unzip on the server</a>&#8221; solution or you&#8217;ll have to wait a <em>long</em> time like I did.  If you decide to wait, take the time to read through the User Guide and the Designer Guide.</p>
<p><strong>Setting up Magento<br />
</strong></p>
<p>Once you have the files uploaded, CHMOD the directory (where you dropped those files) to 777.  Then navigate to the installer script &#8211; http://www.yourdomain.com/your-magento-folder/.  The script is very simple, and the most important part of it is inputting database connection information.  Proceed to create an admin account and log in to the administration panel.</p>
<p>I easily set up a &#8220;website&#8221;, &#8220;store&#8221;, and &#8220;store view&#8221;.  For my purposes, just one of each was necessary so I named them &#8220;clientname_website&#8221;, &#8220;clientname_store&#8221;, and &#8220;clientname_storeview&#8221;.  I haven&#8217;t set up any roles other than Administrators yet, since for now it&#8217;s just myself and another developer .</p>
<p>My two main tasks to work on:</p>
<ol>
<li>Style the front-end to look like our client&#8217;s existing storefront</li>
<li>Import the client&#8217;s existing product catalog data (including manufacturer and category data)</li>
</ol>
<p>I decided to work on styling the front-end first, since it seemed to be the more difficult task.  I imagined thousands of CSS declarations I&#8217;d have to modify, not to mention figuring out the XML-based layout system.  As for the catalog import, I imagined it would simply be the mapping of data fields into the Magento model.  I prefer to tackle more difficult tasks first, for peace-of-mind reasons.</p>
<p><strong>Theming Magento</strong></p>
<p>As I predicted, getting Magento to look the way I needed proved to be a very difficult task.  I was hoping for a more <a title="Wordpress" href="http://www.wordpress.org" class="external">Wordpress</a> style header/content/left+right/footer type of deal, but what I saw was something much more complicated.  To make the simplest of changes took many hours, with my development process being something like:</p>
<ol>
<li>Figure out which file(s) contains the code (HTML, XML)  I need to edit.</li>
<li>Verify I have the right files.  Make a small test change and see if output is affected.</li>
<li>Remind self of what &#8220;block, layout, and template&#8221; mean.</li>
<li>( trial/error, server timeout ) x 10</li>
<li>Break.  Resume. Now, what was I doing? /MyCompany/MyCompany/?  Oh right.</li>
<li>Search Google on how to solve the problem.  Search is fruitless.  Try Experts-Exchange.</li>
<li>( trial/error, server timeout ) x 10</li>
<li>Almost there.</li>
<li>Major revelation! Break.</li>
</ol>
<p>All in all, theming was/is very complicated.  It&#8217;s hard to determine what references what, and how to go about making changes to get the desired effect.  My impression is that the Magento team would have us use their system in one way, and only that way.  The whole hierarchical system seems like a good idea, but in practice it&#8217;s cumbersome and difficult to master.</p>
<p><strong>Importing the Product Catalog</strong></p>
<p>After walking barefoot over hot coals, or theming Magento, I was really hoping that importing the product catalog would be a no-brainer &#8211; just map fields in my existing database to fields in the Magento database.  I couldn&#8217;t have been more wrong.  Magento&#8217;s database model is an instance of the <a title="Entity Attribute Value Model" href="http://en.wikipedia.org/wiki/Entity-Attribute-Value_model" class="external">entity-attribute-value model</a> (EAV).  The difference between EAV and conventional modeling is that table records don&#8217;t represent an instance of a data object.  Instead, the data object&#8217;s values are spread out over multiple tables, making manipulating the delicate database directly incredibly complex.</p>
<p>The route I decided to take, as recommended on several sites, was to:</p>
<ol>
<li>Create a single category (under &#8220;root category&#8221; or &#8220;Default Category&#8221; of course)</li>
<li>Create and assign a single product to that category.</li>
<li>Run the &#8220;Export All Products&#8221; profile to generate a CSV file</li>
<li>Export existing data to CSV according to the exported CSV&#8217;s column format</li>
<li>Upload the new CSV using the &#8220;Import All Products&#8221; profile.</li>
</ol>
<p>When exporting existing data to the Magento format, be sure to use the category ID values for category instead of the category names.  You can find out a category&#8217;s ID by navigating to its &#8220;edit category&#8221; page and looking at the URL.  The ID is in the URL.</p>
<p>When running the &#8220;Import All Products&#8221; profile, you might have to limit the number of records that you import at a time.  If that doesn&#8217;t work, (as in my case) try reducing the number of rows that are in the CSV file.  You would have to upload many many CSV files and run the profile over and over again for those files.  I don&#8217;t understand why adding records to just a few tables should consume a large share of server resources.  Import crashes for me a lot, which isn&#8217;t good because I&#8217;m unclear of whether all products have been imported or not.</p>
<p><strong>Speed and Performance</strong></p>
<p>I&#8217;ve decided to dedicate a section to speed and performance, because Magento&#8217;s slowness was a huge distraction during the development process.  It would be nice if at the very least that the system didn&#8217;t crash every 1/5 page loads.  It would also be nice if I could see the results of a few CSS declarations quickly.  There seems to be a LOT of overhead in Magento, I could go on forever about it.</p>
<p>Based on what I&#8217;ve read, you should go with a dedicated or a virtual-private-server (VPS) if you choose to run Magento.  A lot of developers working on a shared hosting solution seem to have huge speed issues.  Trust me, save yourself a lot of headaches and upgrade your hosting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2009/01/magento-platform-revisited/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embedding HTML Into Flash</title>
		<link>http://www.nvncbl.com/2008/12/embedding-html-into-flash/</link>
		<comments>http://www.nvncbl.com/2008/12/embedding-html-into-flash/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 07:27:30 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cdata]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[typeface]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=21</guid>
		<description><![CDATA[I recently had the opportunity to work on a website that used Flash as the front-end and using LAMP on the backend.  At first this seemed like a daunting task, since my Flash experience (outside of creating simple animation tweens and using the software as a drawing tool) was limited to dropping the auto-generated [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the opportunity to work on a website that used Flash as the front-end and using LAMP on the backend.  At first this seemed like a daunting task, since my Flash experience (outside of creating simple animation tweens and using the software as a drawing tool) was limited to dropping the auto-generated <object></object> code that Flash generates into an HTML page.</p>
<p>I had no experience whatsoever with interfacing Flash with the server.  I was surprised to learn that the task wouldn&#8217;t be as difficult as I&#8217;d imagined.  An SWF file can be set to load data from a server transparently, akin to AJAX&#8217;s behavior.  The only hint of an HTTP request is seen in the browser&#8217;s status bar.  Anyway, an SWF can query an XML file (or in my project&#8217;s case, XML-output generated via PHP) and parse that into objects that can be displayed to the user.</p>
<p><span id="more-21"></span>Whenever the SWF has to display data in a pre-defined format, for example for a biography page, I can simply send it xml in the format:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;person<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Person Name<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;birth<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>20000101<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/birth<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;biography<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Born.  Lived.  Died.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/biography<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/person<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Nice and simple, the data required by the SWF can be easily represented through XML structures.</p>
<p>When the data is not so structured however, we can feed it into flash via XML&#8217;s &lt;![CDATA[<em>content here</em>]]&gt; value.  It&#8217;s good to know that Flash can display HTML content, albeit in limited fashion.  For example, CSS is not readily supported (I believe it can be done using ActionScript, and that requires work on the Flash programmer&#8217;s part).  Since there&#8217;s no CSS, we have to use the &#8220;old-school&#8221; &lt;b&gt;, &lt;i&gt;, and &lt;u&gt; tags, as well as the dreaded &lt;font&gt; tag.  Remember &lt;font&gt;?  Those were the <span style="text-decoration: line-through;">good old days</span>.  For the official reference on supported HTML tags, here&#8217;s Adobe&#8217;s &#8220;<a class="external" href="http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000922.html">Supported HTML tags</a>&#8221; page.  Enjoy.</p>
<p>It&#8217;s important to note also, that when using the &lt;b&gt; and &lt;i&gt; tags, that the specified font has the bold and italic typefaces.  One of the issues I ran into was that for some reason the SWF wasn&#8217;t honoring &lt;b&gt; and &lt;i&gt; tags, due to this typeface unavailability.</p>
<p><strong>[Edit: updated link to Supported HTML tags]</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2008/12/embedding-html-into-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
