<?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>Dhampir Dreams &#187; Code</title>
	<atom:link href="http://dhampirdreams.com/category/techie/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://dhampirdreams.com</link>
	<description></description>
	<lastBuildDate>Wed, 25 Apr 2012 15:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Migration to greener pastures</title>
		<link>http://dhampirdreams.com/2012/04/migration-to-greener-pastures/</link>
		<comments>http://dhampirdreams.com/2012/04/migration-to-greener-pastures/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 17:39:23 +0000</pubDate>
		<dc:creator>C.W. Smith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[From the Field]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[Archives]]></category>
		<category><![CDATA[Darkscribes]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Stories.]]></category>

		<guid isPermaLink="false">http://dhampirdreams.com/?p=862</guid>
		<description><![CDATA[I&#8217;ve just purchased new space on Media Temple to get both Dhampirdreams.com and Darkscribes.org more reliable hosting. Godaddy just wasn&#8217;t doing it for us and I decided to get something better. Thing is it&#8217;s taking me a bit to get &#8230; <a href="http://dhampirdreams.com/2012/04/migration-to-greener-pastures/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just purchased new space on Media Temple to get both Dhampirdreams.com and <a title="Darkscribes" href="http://darkscribes.org" target="_blank">Darkscribes.org</a> more reliable hosting. Godaddy just wasn&#8217;t doing it for us and I decided to get something better. Thing is it&#8217;s taking me a bit to get it setup and migrate all the crap over there. I&#8217;m also having to do the same thing with this site, but it&#8217;s a lot easier in it&#8217;s own way. I&#8217;m going to keep trying to get things setup properly but it&#8217;s hard work all.</p>
<p>One of the things this may make me do on Darkscribes at least is reevaluate how the basic setup is. It&#8217;s a chance to clean up what I&#8217;d been doing and go from there. I hope at least. I can at least migrate all the users from the current database into clean database, preventing freakouts when it comes to things such as passwords and the like.</p>
<p>I can also remigrate in the story pages without much work no problem, though they all still need human eyes placed on them. This will also give me the chance to streamline some things, I hope at least. It will make life a bit easier in the long run development wise if I try to at least get things a bit&#8230; easier.</p>
<p>DhampirDreams.com will end up with some more original stories up here at some point. I&#8217;m going to update some fanfics here in a few weeks as Darkscribes gets to a point where it can be concidered online. I&#8217;m also going to try at least once I get back to where I was to get the old PHPBB database migrated over. If anything it will provide us with more forum content, even if the users are long gone.</p>
<p>Also reading Hunger Games on Amazon Kindle. I&#8217;ll probably go through it shortly or something like it. Frankly I love the amazon kindle setup. I prefer it to the Apple iPad setup frankly. But that&#8217;s me.</p>
<p>I&#8217;m also considering new development for the Imperium Nocturna storyline, possible new content and things of that sort. I&#8217;ll be building up that content as well as some more original content as well. At least in my spare time. I&#8217;ve got some thoughts on how to build up the content for everything but not much free time to do it in.</p>
<p>I&#8217;m back to working on Darkscribes now.</p>
<p>Laters.</p>
]]></content:encoded>
			<wfw:commentRss>http://dhampirdreams.com/2012/04/migration-to-greener-pastures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Everyday Mayhem</title>
		<link>http://dhampirdreams.com/2012/03/everyday-mayhem/</link>
		<comments>http://dhampirdreams.com/2012/03/everyday-mayhem/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 17:53:13 +0000</pubDate>
		<dc:creator>C.W. Smith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[From the Field]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[chaos]]></category>
		<category><![CDATA[Darkscribes]]></category>
		<category><![CDATA[stuff]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://dhampirdreams.com/?p=861</guid>
		<description><![CDATA[It is ironic how much chaos a day can bring. Just your normal day bring all sorts of unknowns. It was peaceful most of the day, the just around 4pm we had a lot of high winds pick up. A &#8230; <a href="http://dhampirdreams.com/2012/03/everyday-mayhem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It is ironic how much chaos a day can bring. Just your normal day bring all sorts of unknowns. It was peaceful most of the day, the just around 4pm we had a lot of high winds pick up. A front moved through, no rain thankfully. I have even had to start seriously learning gimp. Might even do blenders some. Gonna need a fuck ton of help learning that.</p>
<p>Looking at some other sites, I have a bit of an idea for how to build some of the module code that would be used for the node upload module I need to create. I have no idea how this will work in general however and will be asking for help. I need to be able to filter out crap from word html and the like. but it might be best if the system first takes the datafile, and then programatically creates the node. It&#8217;s a thought. That way I could keep things going a bit clearly. Not sure.</p>
<p>Banner Images for the Darkscribes site are difficult to figure out, but are coming along. I have a nice basic banner setup, and will hopefully have something for Darkscribes and DhampirDreams facebook pages as I go, not sure yet.</p>
<p>I&#8217;m getting better as I go learning Drupal. I&#8217;m starting to understand how to create custom pages of content which I need for the user profile pages. I&#8217;m going to enter in some basic information for myself and try to create some more information. I need a view to take care of a lot of things, but it&#8217;s going. Slow but still going. I just hope with all the taxonomies I&#8217;ve added to content that search will be easier. No idea yet.</p>
<p>Hunger Games has been the only entertainment thing I&#8217;ve heard about all week. I&#8217;m not sure I like the concept, but frankly I&#8217;ll buy the books first then wait for the movies on DVD/Blu-Ray.</p>
<p>I&#8217;ve been trying to think on story ideas of the original variety but I&#8217;ve had nothing really come up yet. I need to do something on that one. I&#8217;m also going to try to get some more stories into the database this weekend while also writing on my own, no idea if I&#8217;ll actually make any progress but who knows.</p>
<p>Eventually I want to make it so all my DD posts end up on Darkscribes as Blog posts. I&#8217;ll check with the folk in the Freenode #Drupal chatroom. Any recommendations for community features to investigate would be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://dhampirdreams.com/2012/03/everyday-mayhem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groups for a story site.</title>
		<link>http://dhampirdreams.com/2012/03/groups-for-a-story-site/</link>
		<comments>http://dhampirdreams.com/2012/03/groups-for-a-story-site/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 21:51:10 +0000</pubDate>
		<dc:creator>C.W. Smith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[Darkscribes]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://dhampirdreams.com/?p=858</guid>
		<description><![CDATA[I&#8217;m sitting here with a baby kitten in my lap and working on the Darkscribes themes at times through the day. I had some thoughts on user groups for Darkscribes and I&#8217;ve bee concidering things like Genre based, Series based, &#8230; <a href="http://dhampirdreams.com/2012/03/groups-for-a-story-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sitting here with a baby kitten in my lap and working on the Darkscribes themes at times through the day. I had some thoughts on user groups for Darkscribes and I&#8217;ve bee concidering things like Genre based, Series based, review groups, things of that nature. I&#8217;m not sure at the moment.</p>
<p>So the breakdown for groups would sort of be:</p>
<ul>
<li>Genre Groups -&gt; Humor, Action, Fantasy, Erotica, etc&#8230;</li>
<li>Series Groups -&gt; Evangelion, Harry Potter, etc&#8230;</li>
<li>Review Groups -&gt; Fanfic Yakuza, Book Reviews, Movie Reviews, etc&#8230;</li>
</ul>
<p>It&#8217;s slow going and open to a lot of interpretation,  but hopefully it will give some good  features for the users. Frankly I like the idea of adding groups and building up the support for people who are good with a particular genre. IT also gives a group of people for round-robin work and the like. Not sure though.</p>
<p>I had some ideas for stories as well. Fanfics, original stories, things of that nature. I&#8217;m thinking on a few ideas as I work here. I will probably go and add in a few things later. Not sure yet but it will be here I hope.</p>
]]></content:encoded>
			<wfw:commentRss>http://dhampirdreams.com/2012/03/groups-for-a-story-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Themeing, Designing, Writing</title>
		<link>http://dhampirdreams.com/2012/03/themeing-designing-writing/</link>
		<comments>http://dhampirdreams.com/2012/03/themeing-designing-writing/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 17:06:58 +0000</pubDate>
		<dc:creator>C.W. Smith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Techie]]></category>

		<guid isPermaLink="false">http://dhampirdreams.com/?p=855</guid>
		<description><![CDATA[I&#8217;m working on the Darkscribes site, trying to build it up and improve what I have as I go. I&#8217;m also trying to get the sites old fiction archive up and online slowly by hand. It&#8217;s not easy at all, &#8230; <a href="http://dhampirdreams.com/2012/03/themeing-designing-writing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on the Darkscribes site, trying to build it up and improve what I have as I go. I&#8217;m also trying to get the sites old fiction archive up and online slowly by hand. It&#8217;s not easy at all, but I&#8217;m slowly getting there. One of the things I&#8217;m working on is themeing. I&#8217;m trying to get an Omega based theme for Darkscribes that resembles the old Coldstar themes look and feel. Hopefully as I do I can get a better feel for Drupal CSS coding. But it&#8217;s a long task. Part of it involved cleaning up the old css in order for it to be human readable. That took up almost five hours there.</p>
<p>Part of what I&#8217;m doing is trying to figure out how to get the sites capabilities online. Things like document upload, story construction, and chapter organization. It&#8217;s been difficult and I&#8217;m no where near done. I just wish I could find an easy way to fix the issues. But slow and stead won the race. I&#8217;ve got some code provided by popupman from FFN that works ok, but could use some work.</p>
<p><code><!--?php <br ?--> /**<br />
* @file<br />
* A module which integrates with the Book module allowing file uploads<br />
*/</code></p>
<p>/**<br />
* Implements hook_help.<br />
*<br />
* Displays help and module information.<br />
*<br />
* @param path<br />
* Which path of the site we&#8217;re using to display help<br />
* @param arg<br />
* Array that holds the current path as returned from arg() function<br />
*/<br />
function book_uploader_help($path, $arg) {<br />
switch($path) {<br />
case &#8220;admin/help#book_uploader&#8221;:<br />
return &#8216;</p>
<p>&#8216;. t(&#8220;Allows users to upload files when creating a new Book Page&#8221;) .&#8217;</p>
<p>&#8216;;<br />
break;<br />
}<br />
}</p>
<p>/**<br />
* Alter the node form to include a file upload field<br />
*/<br />
function node_uploader_form_alter(&amp;$form, &amp;$form_state, $form_id) {<br />
if ($form_id == &#8216;book_node_form&#8217;) {<br />
$form['book-node-form']['page_content_file'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;file&#8217;,<br />
&#8216;#title&#8217; =&gt; t(&#8216;Or upload Content (supports txt/html/docx/odt)&#8217;)<br />
);<br />
$form['#validate'][] = &#8216;book_uploader_custom_validate&#8217;;<br />
}<br />
}</p>
<p>/**<br />
* In this function we attempt to load the uploaded file. If it exists,<br />
* we then convert it to HTML if it is docx or odt, and then replace its<br />
* contents into the body of the saved Book Page, before finally deleting<br />
* the temporary file<br />
*/<br />
function book_uploader_custom_validate($form, &amp;$form_state) {<br />
$file = file_save_upload(&#8216;page_content_file&#8217;, array(&#8216;file_validate_extensions&#8217; =&gt; array(&#8216;txt html docx&#8217;)));<br />
if ($file) {<br />
$form_state['storage']['page_content_file'] = $file;<br />
$is_docx = file_validate_extensions($file, &#8216;docx&#8217;);<br />
if(empty($is_docx)) {<br />
$wrapper = file_stream_wrapper_get_instance_by_uri($file-&gt;uri);<br />
$content = book_uploader_docx2html($wrapper-&gt;realpath());<br />
}<br />
else {<br />
$content = file_get_contents($file-&gt;uri);<br />
}<br />
$content = mb_convert_encoding($content, &#8216;UTF-8&#8242;);<br />
$form_state['values']['body']['und'][0]['value'] = $content;<br />
file_delete($file);<br />
}<br />
}</p>
<p>/**<br />
* @param file<br />
* Path to the docx file to convert to html<br />
*/<br />
function book_uploader_docx2html($file) {<br />
$output = &#8220;&#8221;;<br />
try {<br />
$path = book_uploader_docx2text($file);<br />
foreach(qp($path, &#8216;w|p&#8217;) as $qp) {<br />
$qr = $qp-&gt;branch();<br />
$output .= book_uploader_format($qr-&gt;find(&#8216;w|r:first&#8217;), &#8216;w|r:first&#8217;);<br />
$qp-&gt;find(&#8216;w|r:first&#8217;);<br />
while($qp-&gt;next(&#8216;w|r&#8217;)-&gt;html() != null) {<br />
$qr = $qp-&gt;branch();<br />
$output .= book_uploader_format($qr-&gt;find(&#8216;w|r&#8217;), &#8216;w|r&#8217;);<br />
}<br />
$output .= &#8220;r&#8221;;<br />
}<br />
return $output;<br />
}<br />
catch (Exception $e) {<br />
return $output;<br />
}<br />
return $output;<br />
}<br />
function book_uploader_format($qp, $findSelector = null) {<br />
// Create a new branch for printing later.<br />
$qr = $qp-&gt;branch();<br />
$text = &#8220;&#8221;;<br />
$text = $qr-&gt;find($findSelector)-&gt;find(&#8216;w|t&#8217;)-&gt;text();<br />
$text = (book_uploader_checkUnderline($qp-&gt;branch())) ? &#8216;<span style="text-decoration: underline;">&#8216;.$text.&#8217;</span>&#8216; : $text;<br />
$text = (book_uploader_checkBold($qp-&gt;branch())) ? &#8216;<strong>&#8216;.$text.&#8217;</strong>&#8216; : $text;<br />
$text = (book_uploader_checkItalics($qp-&gt;branch())) ? &#8216;<em>&#8216;.$text.&#8217;</em>&#8216; : $text;</p>
<p>return $text;<br />
}</p>
<p>/**<br />
*<br />
* @param QueryPath $qp<br />
* @return String<br />
*/<br />
function book_uploader_checkBold($qp) {<br />
$qp-&gt;children(&#8220;w|rPr&#8221;);<br />
return ($qp-&gt;children(&#8216;w|b&#8217;)-&gt;html()) ? true : false;<br />
}</p>
<p>/**<br />
*<br />
* @param QueryPath $qp<br />
* @return String<br />
*/<br />
function book_uploader_checkUnderline($qp) {<br />
$qp-&gt;children(&#8220;w|rPr&#8221;);<br />
return ($qp-&gt;children(&#8216;w|u&#8217;)-&gt;html()) ? true : false;<br />
}</p>
<p>function book_uploader_checkItalics($qp) {<br />
$qp-&gt;children(&#8220;w|rPr&#8221;);<br />
return ($qp-&gt;children(&#8216;w|i&#8217;)-&gt;html()) ? true : false;<br />
}</p>
<p>function book_uploader_docx2text($file) {<br />
return book_uploader_readZippedXML($file, &#8216;word/document.xml&#8217;);<br />
}</p>
<p>function book_uploader_readZippedXML($archiveFile, $dataFile) {<br />
if (!class_exists(&#8216;ZipArchive&#8217;, false)) {<br />
return &#8220;ZipArchive Class Doesn&#8217;t Exist.&#8221;;<br />
}<br />
$zip = new ZipArchive;<br />
if (true === $zip-&gt;open($archiveFile, ZipArchive::CREATE)) {<br />
if (($index = $zip-&gt;locateName($dataFile)) !== false) {<br />
$data = $zip-&gt;getFromIndex($index);<br />
$zip-&gt;close();<br />
return $data;<br />
}<br />
$zip-&gt;close();<br />
}<br />
return false;<br />
}</p>
<p>I found a site post that had some useful code I think but I have no idea how to integrate it or anything of that  <a title="How to extract text from docx and odt files" href="http://www.botskool.com/geeks/how-extract-text-docx-or-odt-files-using-php" target="_blank">here</a>.</p>
<p>All the While I&#8217;m trying to figure out ideas as well for my own stories and actually write them. It&#8217;s not easy to work all the time in to do all of this and it&#8217;s kicking my ass in a lot of ways. I just wish I knew if I was getting closer to done really.</p>
]]></content:encoded>
			<wfw:commentRss>http://dhampirdreams.com/2012/03/themeing-designing-writing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal for Darkscribes</title>
		<link>http://dhampirdreams.com/2012/02/drupal-for-darkscribes/</link>
		<comments>http://dhampirdreams.com/2012/02/drupal-for-darkscribes/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 03:58:37 +0000</pubDate>
		<dc:creator>C.W. Smith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Darkscribes]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://dhampirdreams.com/?p=653</guid>
		<description><![CDATA[I&#8217;m rebuilding Darkscribes.org and basing it on the Drupal Content Management System (CMS). It has a lot of features built in that make it an interesting choice for this kind of project. It however has a lot going for it &#8230; <a href="http://dhampirdreams.com/2012/02/drupal-for-darkscribes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m rebuilding Darkscribes.org and basing it on the Drupal Content Management System (CMS). It has a lot of features built in that make it an interesting choice for this kind of project. It however has a lot going for it in a lot of ways.</p>
<p><span id="more-653"></span></p>
<p>Ever since Tom decided to fuck us over cause he&#8217;s an ass who doesn&#8217;t even have the decency to LISTEN to people who don&#8217;t care about minimum security issues, I&#8217;ve been trying to bring the archive back. The first thing is that it has to be built on a Community supported system. Proprietary is not the way to go on this. There were a few options for this, including the <a href="http://efiction.org/" target="_blank">eFiction </a>story archive script. I looked it over, and if all I wanted to do was just story stories and the like. Not a lot possibility for community expansion.</p>
<p><a href="http://evamade.net" target="_blank">Evamade.net</a> rebuilt themselves on <a href="http://www.joomla.org/" target="_blank">Joomla</a>.  They got their forum back online and their community, but no fanficti on from their own archives.</p>
<p>Now I&#8217;ve been trying to get Darkscribes back online and it has NOT been easy. Drupal gave several options that made it preferable to the other offers. I&#8217;ve been getting help on the migrate from the folk at the Drupal chatroom on freenode. When done the old archive will be back 100% content wise. It also means we&#8217;ll end up with better ways to handle things long term. I hope at least.</p>
<p>It also has built in support for forums and other community possibilities. I like the idea of one point of login for the site and all options. It&#8217;s going to be interesting and once the original content is uploaded it will be all available. Everyone will be able to eventually get the stuff. And it will allow me the chance to add more content and concepts.</p>
<p>I&#8217;ve also got some code for an upload script donated by popupman that, when completed or at least advanced, will provide a module for Drupal that will parse documents into nodes as content. I have no issues allowing others to benefit from it. I&#8217;ll be adding a page on here about it later.</p>
<p>I need to find a way to offer what I come up with to the greater community as I do this. That way other folk can benefit from the work that has been done by me and the others offering their time.</p>
]]></content:encoded>
			<wfw:commentRss>http://dhampirdreams.com/2012/02/drupal-for-darkscribes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

