<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:series="http://unfoldingneurons.com/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The Tech Mind</title>
	
	<link>http://thetechmind.com</link>
	<description>Querying the Technology Hive Mind</description>
	<pubDate>Fri, 24 Oct 2008 09:21:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/TheTechMind" type="application/rss+xml" /><feedburner:emailServiceId>2149668</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><item>
		<title>My openLDAP performance tuning tip of the week</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/430529756/my-openldap-performance-tuning-tip-of-the-week</link>
		<comments>http://thetechmind.com/rants/my-openldap-performance-tuning-tip-of-the-week#comments</comments>
		<pubDate>Fri, 24 Oct 2008 09:08:34 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Rants]]></category>

		<category><![CDATA[Tip &amp; tricks]]></category>

		<category><![CDATA[indexing]]></category>

		<category><![CDATA[openldap]]></category>

		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=116</guid>
		<description><![CDATA[Intro
So let me just say it up front, &#8220;Index the objectClass attribute&#8221;. No really, go ahead and do it right now. Now that we have indexed our objectClass attribute, let me tell you  a story about how I learn that whatever you do, just index the objectClass attribute.
Background
I was working on a medium size openldap [...]]]></description>
			<content:encoded><![CDATA[<h3>Intro</h3>
<p>So let me just say it up front, &#8220;Index the objectClass attribute&#8221;. No really, go ahead and do it right now. Now that we have indexed our objectClass attribute, let me tell you  a story about how I learn that whatever you do, just index the objectClass attribute.</p>
<h3>Background</h3>
<p>I was working on a medium size openldap instance, about 70k records, it&#8217;s the user data for a university. We&#8217;ve spent the whole day migrating the old openldap setup to a new HA setup with rplication. But at the end of the day we were having problems with really slow queries. A typical &#8220;cn=a*&#8221; wildcard search takes about 20-30 seconds. Which, honestly, is stupidly slow.</p>
<p>My boss, bless him, decided to dive the logs. Well, technically he didn&#8217;t dive the logs, but he did dive into all the output from openldap running on the foreground with the -d option. Which is just as, if not more, tedious. Me, I can go through the most incredibly bad code and still survive, but log files are just not my thing. I just can&#8217;t do it especially after a long day. So rode shotgun, googling whenever he found a interesting piece of log output. And providing an extra sets of eyes for anything else.</p>
<p>After some time and experimentation it became clear that openldap is not going to the index for the cn or sn search, but instead bork out with index not found on objectClass and went merrily ahead and doing a full tree search. So we went ahead and add in an index for objectClass, did a slapindex and rerun the queries. The result came back in around 200 miliseconds.</p>
<h3>Hind sight</h3>
<p>After the event I thought to myself, that maybe I&#8217;ve did a WTF and forgot a very basic thing. Surely I the admin guide would have mentioned something like this. So I went through the <a title="OpenLDAP admin guide" href="http://www.openldap.org/doc/admin23/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.openldap.org');" target="_blank">openldap admin guide</a> again , and then I went to the <a title="OpenLDAP faq-o-matic" href="http://www.openldap.org/faq/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.openldap.org');" target="_blank">openldap faq-o-matic</a>, and then I hit google. The only mention that I could find is a guy saying in the openldap newsgroup, mentioning not to remove the objectClass index  in regards to another unrelated indexing issue. ( Can&#8217;t seem to dig up the link to that from google groups now ).</p>
<p>I must admit that it is uncommon for anyone to remove to index that was there by default, I really think that there should be some sort of documentation that explain this.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=Z3DGM"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=Z3DGM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=LCfym"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=LCfym" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/430529756" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/rants/my-openldap-performance-tuning-tip-of-the-week/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Frants%2Fmy-openldap-performance-tuning-tip-of-the-week</feedburner:awareness><feedburner:origLink>http://thetechmind.com/rants/my-openldap-performance-tuning-tip-of-the-week</feedburner:origLink></item>
		<item>
		<title>Google unveils chrome</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/381764486/google-unveils-chrome</link>
		<comments>http://thetechmind.com/news/google-unveils-chrome#comments</comments>
		<pubDate>Tue, 02 Sep 2008 22:33:37 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[browser]]></category>

		<category><![CDATA[google chrome]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=115</guid>
		<description><![CDATA[Google has reveal their browser Google chrome today. There is a comic that explains all about it on the google chrome site. 
The browser is open sourced and is based on the webkit project which powers browser like Safari. Google apparently have a little FUD going on there with their mention of browser tabs that eats [...]]]></description>
			<content:encoded><![CDATA[<p>Google has reveal their browser <a href="http://tools.google.com/chrome/?hl=en-US" onclick="javascript:pageTracker._trackPageview('/outbound/article/tools.google.com');">Google chrome</a> today. There is<a title="Google chrome comic" href="http://www.google.com/googlebooks/chrome/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');" target="_blank"> a comic</a> that explains all about it on the google chrome site. </p>
<p>The browser is open sourced and is based on the <a title="The Webkit OpenSource project" href="http://webkit.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/webkit.org');" target="_blank">webkit project</a> which powers browser like <a title="The safari browser" href="http://www.apple.com/safari/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.apple.com');" target="_blank">Safari</a>. Google apparently have a little FUD going on there with their mention of browser tabs that eats up memory in the comic(cough, firefox, cough).</p>
<p>How good is it? I can&#8217;t be sure yet but I&#8217;ve downloaded it and using it right now to write this post and I plan to coontinue using it for the coming weeks to see how it performs.</p>
<p>My prediction is it will critical mass as soon as someone comes up with a killer pluggin that lots of people use. My other prediction is that the pluggin will most probly be somekind of google service pluggin ( gmail maybe? Hmm?) , and more probly made my google themselves. <img src='http://thetechmind.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> We&#8217;ll see.</p>
<p><a title="Bllogscoped on Google Chrome" href="http://blogoscoped.com/archive/2008-09-01-n47.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/blogoscoped.com');" target="_blank">Blogscoped</a> have a very good rundown on the features of Google Chrome.</p>
<p>Speed, reliability and security with an open system is what Google promise, let&#8217;s see if they can live up to their big words.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=tFPEAL"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=tFPEAL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=hvDg5l"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=hvDg5l" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/381764486" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/news/google-unveils-chrome/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Fnews%2Fgoogle-unveils-chrome</feedburner:awareness><feedburner:origLink>http://thetechmind.com/news/google-unveils-chrome</feedburner:origLink></item>
		<item>
		<title>The programming “zone”. Fiction or myth?</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/355007752/the-programming-zone-fiction-or-myth</link>
		<comments>http://thetechmind.com/articles/the-programming-zone-fiction-or-myth#comments</comments>
		<pubDate>Mon, 04 Aug 2008 05:14:56 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[Rants]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=113</guid>
		<description><![CDATA[The programming craft
Programming is a creative process. Despite the technical nature of programming codes, the process of coding is involves a lot of creative thinking and problem solving. Paul Graham talks of &#8220;Hacker and Painters&#8221; and compares the work of us code ninjas to the creative process of painting. And like all other creative task [...]]]></description>
			<content:encoded><![CDATA[<h3>The programming craft</h3>
<p>Programming is a creative process. Despite the technical nature of programming codes, the process of coding is involves a lot of creative thinking and problem solving. Paul Graham talks of &#8220;<a title="Hackers and Painters" href="http://www.paulgraham.com/hp.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.paulgraham.com');">Hacker and Painters</a>&#8221; and compares the work of us code ninjas to the creative process of painting. And like all other creative task you require a certain amount of &#8220;flow&#8221; to get going with it. Many programmer talks about &#8220;getting in the zone&#8221; where once they get their flow going, productivity soars and work that has taken a few days to figure out suddenly seems easy and is done in a matter hours.</p>
<h3>Getting in the zone</h3>
<p>What do you do But how true is &#8220;the zone&#8221;?   <strong>Is this a guise in which we programmers procrastinate under?</strong> Do we truly belief that &#8220;just one more turn&#8221; of civilization, or that &#8220;one more level&#8221; deeper in nethack is really going to make us have a clearer head to code with?</p>
<p>I myself is a believer in the zone. I code my best late at night blasting Metallica through my headphones. And when I was stuck, an hour or two at gaming would be the answers. It worked well enough when I was doing it. But now I that I got a family, staying up late is no longer an option, my wife have to wake up early to go to work and the computer is in the bedroom. My new job also means that I can&#8217;t keep the hours that I used to. So now I have a small window of time after dinner and before bedtime that I have to code. I HAD to do it then because I would never have the time to do it at any other time. But still the code flow and work gets done. There maybe a few times when I have &#8220;coders block&#8221; and can&#8217;t think of a solution. I would then wrap up the day&#8217;s work and continue tomorrow. But then again even in the old days of midnight coding sessions I would also come across some speedbumps every now and then.</p>
<p>Another example is when dateline is near. Even if you never had a change of lifestyle that requires you to suddenly change your coding schedule, almost everyone have at one point or another be on a tight dateline. And no matter if you are in the zone or not. If the dateline is tomorrow, you still get stuff done at crunch time. So why does suddenly the zone doesn&#8217;t matter. Is it an illusion that we put up to justify our laid back approach and procrastination?</p>
<h3>Fiction, myth or excuse?</h3>
<p>Of course a quite environment that allows you to work without interruptions are essential for doing out work. So is a good tool for your job, for example a big, quality monitor for a designer to work on or a good IDE for the coders. But how do we justify arcade cabinets or networked starcraft sessions during the day or a trip to The Dark Knight Showing during work time.</p>
<p>Do you belive in getting in the zone? Do you have to do anything special to get in the zone? Do you think that it is about time that we own up to our procrastination and stop using the excuse of trying to get into the zone to avoid work.</p>
<p><small>Pictures from <a title="davestfu flickrt page" href="http://www.flickr.com/photos/davestfu/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.flickr.com');">davestfu</a></small></p>
<h3>Updates</h3>
<p>7th Aug: I&#8217;ve a a few reddit traffic, courtesy of <a title="reddit post" href="http://www.reddit.com/comments/6v3ff/the_programming_zone_fiction_or_myth/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.reddit.com');" target="_blank">this</a>,that saying that I am &#8220;claiming false dichotomy&#8221;. I&#8217;m not claiming any dichotomy at all. In fact the opposite, I&#8217;m saying that may be we could own up to our own lack of motivation instead of hiding behind the excuse of not in the zone. I still believe you have to be in a good environment to be able to code and a quite place to work with no distraction is a must and that will contribute a lot to being able to be in the zone. But sometimes work is work and it is tedious or boring and we just have to do it and if you set up conditions that are conducive to working then the flow will come.</p>
<p>Sorry for not being able to convey that message clearly.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=lSMW6K"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=lSMW6K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=u7KSLk"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=u7KSLk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/355007752" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/the-programming-zone-fiction-or-myth/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Fthe-programming-zone-fiction-or-myth</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/the-programming-zone-fiction-or-myth</feedburner:origLink></item>
		<item>
		<title>6 tips to make your fellow coders love you</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/350130709/6-tips-to-make-your-fellow-coders-love-you</link>
		<comments>http://thetechmind.com/articles/6-tips-to-make-your-fellow-coders-love-you#comments</comments>
		<pubDate>Wed, 30 Jul 2008 04:31:19 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[code readability]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[coding standards]]></category>

		<category><![CDATA[consistency]]></category>

		<category><![CDATA[readable code]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=110</guid>
		<description><![CDATA[6 tips to make your fellow coders love you
Code readability is paramount in an environment where you are not the only one reading and writing the code. And even if you are the only developer of your system, I know more than a few coders that read a code that they wrote last week and [...]]]></description>
			<content:encoded><![CDATA[<h3>6 tips to make your fellow coders love you</h3>
<p>Code readability is paramount in an environment where you are not the only one reading and writing the code. And even if you are the only developer of your system, I know more than a few coders that read a code that they wrote last week and thought “What the hell was I trying to do with this code?!” So, give your fellow coders a break and follow these 6 tips to make your code readable and make your fellow coders love you.</p>
<h3>1.    Consistency</h3>
<p>Consistency is <strong>the number one rule</strong> when writing readable code. It doesn’t matter if you but your braces in the same like as the if statement like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="cpp"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>x<span style="color: #000080;">==</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">//do stuff</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>or if it’s on the next line, like this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="cpp"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>x<span style="color: #000080;">==</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">//do stuff</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Just pick one and stick with it</strong>. Follow the <a title="C++ Coding Standards" href="http://www.possibility.com/Cpp/CppCodingStandard.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.possibility.com');" target="_blank">C++ coding standards</a> or follow the <a title="gnu coding standards" href="http://www.gnu.org/prep/standards/standards.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gnu.org');" target="_blank">gnu coding standards</a> or follow the<a title="JAVA coding standards" href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/java.sun.com');" target="_blank"> java coding standards</a> or make your own standards, it&#8217;s up to you, but chooses one and use it everywhere. It’s very annoying to see different kind of coding style in the same project, or worse, the same source file. Create a “Coding Standards.txt” and put it on the top directory of your source code so that all the coders can see that you follow, and expect them to follow, a coding guideline.</p>
<h3>2.    Indenting</h3>
<p>Indenting is one of the most important aspect of code readability. Indenting allows readers to have a general overview of the flow of the code. And it also provides a visible cue the code’s structure. For me personally, proper(and more importantly consistent) indenting is one of the biggest factor that contributes to code readability. The general rule is that all logic block should be indented, and any logic that branch from the same point should be indented at the same level.</p>
<h3>3.    Comments</h3>
<p>Many people argue that a lot of comments makes a code readable. But for me the comments should be used sparingly. A well written code should tell its readers what it is doing just by looking at it. Comments should be used however to indicate why a certain part of the code does what it does. For example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="cpp"><span style="color: #666666;">//example 1</span>
i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span>;<span style="color: #666666;">//initialize i</span>
<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>i<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span><span style="color: #666666;">//while i is less then 100</span>
	i<span style="color: #000040;">++</span>;<span style="color: #666666;">//increment i</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #666666;">//example 2</span>
<span style="color: #666666;">//this is part of out test suite to stress the CPU </span>
i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span>;
<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>i<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span><span style="color: #666666;">//an arbitaryly long number</span>
	i<span style="color: #000040;">++</span>;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>The first example while having more comments is pretty much useless since we already know it is initializing the variable and we already know that it is comparing against a million and we already know that is is incrementing the variable from the code. So the comments add nothing to the understanding of the code. We want to know why it is doing the loop. </p>
<p>The second example solves this by providing a <strong>reason</strong> for the code to be there and also provide <strong>useful information</strong> like why the number 1 million is chosen. If you see the code in a production environment then we KNOW that we can remove it because we know what it does. But if we see the first example we might be hesitant to remove it, why is the code here? Does the program require time to finish its task before running the next line and the previous developer never heard of sleep? What is the significant of the number 1 million. Is that the time to live for some unknown cache that we are waiting to expire?</p>
<p>Let the code tells most of the story and what the code can’t tell, you comment.</p>
<h3>4.    Variable names</h3>
<p>Following my stand that code should obvious and tell its readers what it is doing I believe in descriptive variable naming. I really don’t mind a long variable but <em>numberOfCommentsFromUsersThatAreRegistered</em> is really tiresome to type and read and more likely than not will cause horizontal scrolling on the part of the reader. The basic rule is to be as descriptive as possible but to drop grammatical articles from the variable name. So <em>numberOfCommentsFromUsersThatAreRegistered</em> would become something like <em>registeredUsersCommnetNum</em>. Short forms should be avoided unless it is a really common convention like the prefix <em>is</em> for any function that checks if something is a certain type/condition etc. or the <em>numOf</em> prefix. In strongly typed language like java or C it is common to prefix the name of the variable with the data type. For example <em>intCommentCount</em> is an integer and <em>strVehicleName</em> is a string and so on. Other stuff like underscore use and capitalization shouldn’t matter much but, as per item 1 in this list, pick a style and stick with it.</p>
<h3>5.    Minimize horizontal scrolling</h3>
<p>When writing code make some effort to minimize horizontal scrolling on your code. The typical screen size is 80 columns and you should try to make sure your code fits this. Horizontal scrolling make it harder to read because of the effort required to actually even see the code. On modern IDE the person reading the code would need to move the mouse to the bottom of the screen and click on the scrollbar. Which is bad enough but then if he needs to read something above or below the code he probably needs to scroll back to see it. On emacs it’s just plain annoying to scroll horizontally. I know there is word wrapping but that always make the code looks bad and ‘wrong’. Most codes can be broken into multiple lines or multiple instructions while keeping the same behaviour.</p>
<h3>6.    Follow the gnu convention of doing one thing and doing it right</h3>
<p>This apply to writing functions. I always cringe when I see a function called “process” or something like that. Never mind that is it is an ambiguous name to start with, it also implies that the function will do a lot things. For example it might filter the input, then validate it, then store it in the database. It would be much better to create one function to filter the data, another to validate it and another to store it into the database. It is easier to debug that way since we can isolate the processes in the function and also easier to extend because you can, for example, change how the program validate the data without messing with the database code. And more importantly and to the point of this article it is easier to read smaller chunks of code that you know is doing a single thing that to plow through a whole page of code that could be doing either of the three things mention.</p>
<h3>The End</h3>
<p>Now go write your code and make your fellow coders love you.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=K6mi8J"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=K6mi8J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=y1jbpj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=y1jbpj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/350130709" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/6-tips-to-make-your-fellow-coders-love-you/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2F6-tips-to-make-your-fellow-coders-love-you</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/6-tips-to-make-your-fellow-coders-love-you</feedburner:origLink></item>
		<item>
		<title>A shell script for creating a selfsigned cert.</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/345329445/a-shell-script-for-creating-a-selfsigned-cert</link>
		<comments>http://thetechmind.com/articles/a-shell-script-for-creating-a-selfsigned-cert#comments</comments>
		<pubDate>Fri, 25 Jul 2008 05:10:13 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[ca cert]]></category>

		<category><![CDATA[digital certificate]]></category>

		<category><![CDATA[selfsigned cert]]></category>

		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=107</guid>
		<description><![CDATA[Intro
A selfsigned cert is a digital certificate that is created by using a certification authority certificate that is issued by yourself. This is usefull for backend communications between servers that need the protection of a SSL tunnl but don&#8217;t need the &#8216;assurance&#8217; provided by a regonized and trusted third party certification authority (and the charges [...]]]></description>
			<content:encoded><![CDATA[<h3>Intro</h3>
<p>A selfsigned cert is a digital certificate that is created by using a certification authority certificate that is issued by yourself. This is usefull for backend communications between servers that need the protection of a SSL tunnl but don&#8217;t need the &#8216;assurance&#8217; provided by a regonized and trusted third party certification authority (and the charges that associated with obtaining one).</p>
<p>This is usefull in cases where communications between appserver and the data layer (typically RDMBS) needs to be protected with SSL. You just need to create a selfsigned cert and have your applications trust your own CA cert. You can then encrypt all your backened communications and only use certs obtained from trusted CA like, for example, Verisign where you want custumer confidence. And if your custom application need access to webservices you can make the application trust your own CA cert. There are many things other that you can do that doesn&#8217;t require a commercial SSL cert.</p>
<h3>Approach</h3>
<p>The people at <a title="Riseup Lab" href="http://riseuplabs.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/riseuplabs.org');" target="_blank">Riseup Lab</a> have already made <a title="Riseup Lab guide on Selfsigned cert" href="http://riseuplabs.org/grimoire/web-server/self-signed-certs/" onclick="javascript:pageTracker._trackPageview('/outbound/article/riseuplabs.org');" target="_blank">a great guide on selfsigned cert</a>. I have follow the steps that has been outlined there and created a shell script to create the selfsigned cert without going through the process of doing the work manually.</p>
<p>Basically, I take all the steps outline in the guide, put it in a shell script, do some externalizing on the parameter to make it a little configurable, and tested it abit. I use the term tested loosely here since all I did was try it in different directory and with some differences in the settings. It has some basic error checking but for the most part it&#8217;s not very robust and stills expects you to put in the correct stuff for it to work.</p>
<h3>Running it</h3>
<p style="text-align: center;"><a href="http://thetechmind.com/wp-content/uploads/2008/07/createselfsignedcert1.sh" >createSelfSignedCert.sh</a></p>
<p>Just download it above and run the supplied shell script and it will generate everything that you need to create the selfsigned cert. If for whatever reason you want to reset everything. Cleaning up the database of old certs and start fresh and create a new CA cert, just run the script with an extra &#8220;fromscratch&#8221; parameter, this will clean everything and start from scratch.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash">.<span style="color: #000000; font-weight: bold;">/</span>createSelfSignedCert.<span style="color: #c20cb9; font-weight: bold;">sh</span> fromscratch</pre></td></tr></table></div>

<h3>Your thoughts</h3>
<p>I would very much like to hear what you have to say about this script and how it can be improved. Please leave a comment if you happen to try it out.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=YQ0EVJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=YQ0EVJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=NXd2Gj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=NXd2Gj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/345329445" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/a-shell-script-for-creating-a-selfsigned-cert/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Fa-shell-script-for-creating-a-selfsigned-cert</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/a-shell-script-for-creating-a-selfsigned-cert</feedburner:origLink></item>
		<item>
		<title>Filter you output with HTML Purifier</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/341276667/filter-you-output-with-html-purifier</link>
		<comments>http://thetechmind.com/articles/filter-you-output-with-html-purifier#comments</comments>
		<pubDate>Mon, 21 Jul 2008 06:34:15 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[htmlpurifier]]></category>

		<category><![CDATA[input filtering]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[phpld]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=87</guid>
		<description><![CDATA[Now that you set up a rich text editor to you phpLD directory you would want to set up some filtering to prevent sites from doing nasty things like maybe insert a javascript in your site. Most phpld templates is already doing this. But they are using the smarty &#8216;escape&#8217; modifier which will escape ALL [...]]]></description>
			<content:encoded><![CDATA[<p>Now that you set up a rich text editor to you phpLD directory you would want to set up some filtering to prevent sites from doing nasty things like maybe insert a javascript in your site. Most phpld templates is already doing this. But they are using the smarty &#8216;escape&#8217; modifier which will escape ALL tags and leave you with something like this.</p>
<div id="attachment_89" class="wp-caption aligncenter" style="width: 503px"><img class="size-full wp-image-89" title="before html purifier" src="http://thetechmind.com/wp-content/uploads/2008/07/before.png" alt="Ugh.. We don't want this ugly html tags showing" width="493" height="166" /><p class="wp-caption-text">Ugh.. We don&#39;t want this ugly html tags showing</p></div>
<p>See the &lt;p&gt; tags? We don&#8217;t want that. We want to provide the submiters the ability to have some html formating power and yet we don&#8217;t want to allow them the use of fancy XSS or javascript on the site. Keeping with the opensource spirit we will go ahead and use another freely available component to filter our input. It is called <a title="HTML Purifier" href="http://htmlpurifier.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/htmlpurifier.org');" target="_blank">HTML Purifier</a>.</p>
<h3>Getting HTML Purifier</h3>
<p>Head on over to <a title="HTML Purifier download page" href="http://htmlpurifier.org/download.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/htmlpurifier.org');">HTML Purifier download page</a> and download it. There is a lite download that strips out all the extra documentation etc. from the package. That really is all that we need but the documentation does comes in handy sometimes. So I recommend the full package.</p>
<h3>Installing HTML Purifier</h3>
<p>We need to put the libraries somewhere and, like we did with the tinymce library in the previous article in the series, the lib directory in your phpLD installation is perfect for this. Just copy the whole library directory into the lib directory and rename it to something more descriptive, &#8216;htmlpurifier&#8217; will do.</p>
<div id="attachment_88" class="wp-caption aligncenter" style="width: 241px"><img class="size-full wp-image-88" title="library directory" src="http://thetechmind.com/wp-content/uploads/2008/07/libdir.png" alt="This is what your lib directory will look like" width="231" height="215" /><p class="wp-caption-text">This is what your lib directory will look like</p></div>
<h3>Configure</h3>
<p><b>[The few paragraphs below are just some of my thoughts about why I do things a certain way. They are kindda rant-ish. So you can just skip to the "Method 1: Handle it at code level" section if you want]</b></p>
<p>Ok now we need to configure it so that phpLD will know how to use it. There two way to go about this.</p>
<p>One is to do this during the process of getting the data from the database. Purify the data as we get the data then pass it to the template engine. This is usually the way I would prefer to do it. But the way phpld get links info is to give it to a variable straight from the resultset of a sql query. So there&#8217;s no way to intercept it, so we need to take the $links variable and travers through the resultset and filter it after it is assigned. Seems like a hack to me.</p>
<p>The other way to to send the data as is and let the template system handle the purifying. This involves writing a smarty plugin. Which is a better solution, in this case in my oppinion, but if you change theme then you have to remember to update the theme.</p>
<p>I&#8217;m leaning towards the first option really because I feel that this is a logic code rather than a UI code. And, following the MVC convention, should be handle by the code before handing it over to the template system. Either way, I&#8217;m really divided with this and I&#8217;ll just show you both ways(I&#8217;ll show the template method in the next article) and you can try out the ones that you thing fits your purpose.</p>
<h2>Method 1: Handle it at code level.</h2>
<h3>Include the libraries</h3>
<p>First you need to include the htmlpurifier include file in init.php. You need to add an extra include right after all the includes for the smarty and other libs includes.</p>
<div id="attachment_90" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-90" title="init.php" src="http://thetechmind.com/wp-content/uploads/2008/07/init.png" alt="You need to insert your include at the end of the other libs includes. Around line 52" width="500" height="188" /><p class="wp-caption-text">You need to insert your include at the end of the other libs includes. Around line 52</p></div>
<p>After line 52, add the following line</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>52
</pre></td><td class="code"><pre class="php"><span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'libs/htmlpurifier/HTMLPurifier.auto.php'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>Calling the purifier</h3>
<p>Now that the includes are done with. We need to go and call the purifier on out data. Go to index.php, near the bottom, right before we assign the variables to the template and call it.</p>
<div id="attachment_91" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-91" title="index.php" src="http://thetechmind.com/wp-content/uploads/2008/07/index.png" alt="Index.php.Just before assigning it to the template. Around line 178." width="500" height="240" /><p class="wp-caption-text">Index.php.Just before assigning it to the template. Around line 178.</p></div>
<p>Here we need to insert to following.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>180
181
182
183
184
185
186
</pre></td><td class="code"><pre class="php"><span style="color: #000033;">$purifier</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTMLPurifier<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$links</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$links</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$links</span> <span style="color: #b1b100;">as</span> <span style="color: #339933;">&amp;</span><span style="color: #000033;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000033;">$link</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;DESCRIPTION&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000033;">$purifier</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">purify</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$link</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;DESCRIPTION&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Disabling the smarty filtering</h3>
<p>One more thing that we need to do is to disable the filtering that is done by smarty. We need to go to link.tpl. And remove the escape modifier on the smarty variable {$link.DESCRIPTION}</p>
<div id="attachment_92" class="wp-caption aligncenter" style="width: 397px"><img class="size-full wp-image-92" title="link.tpl" src="http://thetechmind.com/wp-content/uploads/2008/07/link.png" alt="Remove the escape modifier on $link.DESCRIPTION. Around line 12." width="387" height="103" /><p class="wp-caption-text">Remove the escape modifier on $link.DESCRIPTION. Around line 11.</p></div>
<p>This is of course will be a little different depending on your template.But the important thing is that you remove the escape modifier from $link.DESCRIPTION.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
</pre></td><td class="code"><pre class="php"><span style="color: #009900;">&#123;</span><span style="color: #000033;">$link</span><span style="color: #339933;">.</span>DESCRIPTION<span style="color: #339933;">|</span>trim<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>And you&#8217;re done.</p>
<div id="attachment_98" class="wp-caption aligncenter" style="width: 372px"><img class="size-full wp-image-98" title="after the process" src="http://thetechmind.com/wp-content/uploads/2008/07/after.png" alt="Yay. Now we have bold text." width="362" height="103" /><p class="wp-caption-text">Yay. Now we have bold text.</p></div>
<h3>Other considerations.</h3>
<p>Remember that htmlpurifier is only PHP5 compatible. There is an old php4 version that you can use if you are still using php4. (You really should move to PHP5 :D).</p>
<p>You can also specify exactly which HTML tags that you want to allow and which ones you want to disable. But for me I think that the default that comes with htmlpurifier is good enough for me. You can consult the documentation on how to configure these.</p>
<p>The manual also have something to say about the loaders. If you you are using opcode cache like APC and the likes. The htmlpurifier autoload will have some problems with that and you need to spicify another include files that doesn&#8217;t use the autoload functionality. The manual also touches on performance issues. If you are concerned with that then you definitely should read the manual.</p>
<h3>Summary</h3>
<p>htmlpurifier is a good way to allow more flexibility to your submitters. There are many things that you do with it. For example letting premium listing have access to formatting that allow them to make their listing stand out more. It&#8217;s all up to you how you want to implement this.</p>
<div class="seriesmeta">This entry is part 2 of 3 in the series <a href="http://thetechmind.com/series/powered-by-phpld"  title="series-75">Powered by phpLD</a></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=im38uJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=im38uJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=NR2aNj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=NR2aNj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/341276667" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/filter-you-output-with-html-purifier/feed</wfw:commentRss>
	
		<series:name><![CDATA[Powered by phpLD]]></series:name>
	<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Ffilter-you-output-with-html-purifier</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/filter-you-output-with-html-purifier</feedburner:origLink></item>
		<item>
		<title>Rich text editor</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/341276668/rich-text-editor</link>
		<comments>http://thetechmind.com/articles/rich-text-editor#comments</comments>
		<pubDate>Mon, 21 Jul 2008 06:33:51 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[phpld]]></category>

		<category><![CDATA[rich text editor]]></category>

		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=55</guid>
		<description><![CDATA[After seeing countless phpld directory submission form. One thing strike me as strange. It&#8217;s that they still use your plain old text area as the input field for the site description. I&#8217;ve always thought that a rich text editor will be so much nicer. So long as you keep an eye on it and filter [...]]]></description>
			<content:encoded><![CDATA[<p>After seeing countless phpld directory submission form. One thing strike me as strange. It&#8217;s that they still use your plain old text area as the input field for the site description. I&#8217;ve always thought that a rich text editor will be so much nicer. So long as you keep an eye on it and filter out any harmful or otherwise unwanted tags, it will be a good addition to phpld.</p>
<p>Let&#8217;s get started then.</p>
<p>The 2 main rich text editor right now is TinyMCE and FCKEditor.Both are good but personally I prefer TinyMCE, so we&#8217;ll go with that. First download a copy of tinyMCE from <a title="tinyMCE download page" href="http://tinymce.moxiecode.com/download.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/tinymce.moxiecode.com');" target="_blank">tinyMCE download page</a>. The compressor php version is better because it is compressed so it downloads faster. But if you already have gz compression enabled on your website then it will cause problems and you need to use the plain vanilla version. The compressor php version is actually downloaded as an extra to tinyMCE, so if you want to use the compressed version you have to download both the normal version plus the compressor PHP version.</p>
<p>Now unzip the archive. The most logical location for the tinyMCE files are in the lib folder. So create a new tinyMCE folder and put everything in there. You directory should look more or less like this.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-56 aligncenter" title="folder" src="http://thetechmind.com/wp-content/uploads/2008/07/folder.png" alt="" width="500" height="244" /></p>
<p>tinyMCE is now ready to be used. So we need to add the includes to the .js files.</p>
<p>A good place to put the includes is right after all the other includes in the admin template. After line 31.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre>&lt;script src=&quot;files/admin.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;files/ie5.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;files/XulMenu.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;files/browser.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;files/tooltip.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;files/pop-list.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p><!--put tinymce include here--></p>
<p>I am using the compressor PHP version so this is my include:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php"><span style="color: #009900;">&#123;</span>literal<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;!--</span>tinymce<span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/libs/tinymce/tiny_mce_gzip.js&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>
tinyMCE_GZ<span style="color: #339933;">.</span>init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	plugins <span style="color: #339933;">:</span> <span style="color: #0000ff;">'style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,'</span><span style="color: #339933;">+</span>
        <span style="color: #0000ff;">'searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras'</span><span style="color: #339933;">,</span>
	themes <span style="color: #339933;">:</span> <span style="color: #0000ff;">'simple,advanced'</span><span style="color: #339933;">,</span>
	languages <span style="color: #339933;">:</span> <span style="color: #0000ff;">'en'</span><span style="color: #339933;">,</span>
	disk_cache <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
	debug <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">false</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// --&gt;&lt;/script&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>
tinyMCE<span style="color: #339933;">.</span>init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	theme <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;advanced&quot;</span><span style="color: #339933;">,</span>
	mode <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;textareas&quot;</span><span style="color: #339933;">,</span>
	plugins <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;contextmenu, searchreplace&quot;</span><span style="color: #339933;">,</span>
        theme_advanced_toolbar_location <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;top&quot;</span><span style="color: #339933;">,</span>
        convert_urls <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	theme_advanced_buttons3_add <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;search,replace&quot;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// --&gt;&lt;/script&gt;</span>
<span style="color: #009900;">&#123;</span><span style="color: #339933;">/</span>literal<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The first &lt;script&gt; tag is the gzip loader used to load the comppresed tinymce files. This is not needed if you are not using the compressed version of tinyMCE. The second &lt;script&gt; tag with the tinyMCE.init function is the important part. Here you can specify the options you want for your rich text editor.The option in it&#8217;s most basic form is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript">tinyMCE.<span style="color: #006600;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
mode <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;textareas&quot;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Which will give you the output like this:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-63 aligncenter" title="tinyMCE" src="http://thetechmind.com/wp-content/uploads/2008/07/tinymce_basic.png" alt="tinyMCE with basic controls" width="449" height="292" /></p>
<p>You could customize it some more according to the options at the <a title="tinyMCE Wiki" href="http://wiki.moxiecode.com/index.php/TinyMCE:Index" onclick="javascript:pageTracker._trackPageview('/outbound/article/wiki.moxiecode.com');" target="_blank">tinyMCE wiki</a>. For me I finally settled for the above options which gives me this out put</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-64 aligncenter" title="tinyMCE on xerie.net" src="http://thetechmind.com/wp-content/uploads/2008/07/xerie_tinymce.png" alt="tinyMCE on xerie.net" width="366" height="277" /></p>
<p>You could, if you want to, only enable the rich text editor on only some of the textareas that are identified by a certain id. But personally I think that the few textareas that phpld has (one on submit page, one on the admin approve page, and one on the add/edit category page) are the ones that needs the rich text editor.</p>
<p>You could also put the rich text editor on the submit page by adding the tinyMCE includes on the header.tpl file in the template folder. It will allow users to submit site descriptions with the rich text editor.  But I really would not do that untill we do some tags filtering on the output (which I will show how on the next article in the series) to prevent any abuse of the rich text editor.</p>
<div class="seriesmeta">This entry is part 1 of 3 in the series <a href="http://thetechmind.com/series/powered-by-phpld"  title="series-75">Powered by phpLD</a></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=KY7VGJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=KY7VGJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=Ap1SVj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=Ap1SVj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/341276668" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/rich-text-editor/feed</wfw:commentRss>
	
		<series:name><![CDATA[Powered by phpLD]]></series:name>
	<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Frich-text-editor</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/rich-text-editor</feedburner:origLink></item>
		<item>
		<title>Powered by phpLD</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/341271297/powered-by-phpld</link>
		<comments>http://thetechmind.com/articles/powered-by-phpld#comments</comments>
		<pubDate>Mon, 21 Jul 2008 06:32:15 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[phpld]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=54</guid>
		<description><![CDATA[Powered by phpLD is a series that I made to follow me as I poke under the hood of phpLD. I will share my experience as a first time directory owner for the directory site xerie.net and also my experience as I go poking into the source of phpld. I hope that the whole experice [...]]]></description>
			<content:encoded><![CDATA[<p>Powered by phpLD is a series that I made to follow me as I poke under the hood of phpLD. I will share my experience as a first time directory owner for the directory site <a title="Xerie.net directory" href="http://xerie.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/xerie.net');">xerie.net</a> and also my experience as I go poking into the source of phpld. I hope that the whole experice can be educational for me and also to whomever that reads this.</p>
<p>I&#8217;ve been wanting to get my hands on a toy project to play with when recently I&#8217;ve stumble upon phpLD. phpLD is a popular directory script. The version 2 of the product is the forgotten brother of the more advanced and paid version of phpld version 3. phpLD version 2 is still widely used by a lot of people. Mainly because it&#8217;s free and it works. It may not have all the nifty features and mods of the v3 line. But it is a solid directory software albeit a little barebone.</p>
<p>It is a good oppurtunity for my to sharpen my rusty coding skills with this project because it have a solid code base that I can use as a jump off point. so that I don&#8217;t need to spend a lot of time coding basic framework stuff. And secondly because there are a lot of ideas already implemented in phpLD3, if I ever ran out of idea on what to do with it I can easily look at a feature that is present in v3 but not implemented in v2 and try to do my own implementation of it. Finaly, because phpld2 is still widely used, any improvement (if I ever make any) will benefit a lot of people and give me a warm fuzzy feeling :D.</p>
<div class="seriesmeta">This entry is part 1 of 3 in the series <a href="http://thetechmind.com/series/powered-by-phpld"  title="series-75">Powered by phpLD</a></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=y8QQxJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=y8QQxJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=rsO9Fj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=rsO9Fj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/341271297" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/powered-by-phpld/feed</wfw:commentRss>
	
		<series:name><![CDATA[Powered by phpLD]]></series:name>
	<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Fpowered-by-phpld</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/powered-by-phpld</feedburner:origLink></item>
		<item>
		<title>Wordpress 2.6. An improvement all around.</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/337722597/wordpress-26-an-improvement-all-around</link>
		<comments>http://thetechmind.com/articles/wordpress-26-an-improvement-all-around#comments</comments>
		<pubDate>Thu, 17 Jul 2008 04:33:46 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[wordpress 2.6]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=78</guid>
		<description><![CDATA[Intro
For the past couple of days I &#8216;ve been breaking in the new wordpress 2.6. And all around I am impressed by the improvements of this version. But before I go to any details. The most obvious questions is of course &#8220;Should I upgrade?&#8221;. My answer to this is a big YES!. This main reason [...]]]></description>
			<content:encoded><![CDATA[<h3>Intro</h3>
<p>For the past couple of days I &#8216;ve been breaking in the new <a title="wordpress 2.6" href="http://wordpress.org/development/2008/07/wordpress-26-tyner/" onclick="javascript:pageTracker._trackPageview('/outbound/article/wordpress.org');" target="_blank">wordpress 2.6</a>. And all around I am impressed by the improvements of this version. But before I go to any details. The most obvious questions is of course &#8220;Should I upgrade?&#8221;. My answer to this is a big YES!. This main reason for this is:</p>
<ol>
<li>No compatibility issue
<ul>
<li>Unlike the 2.3 -&gt; 2.5 upgrade. This upgrade doesn&#8217;t change the theme and plugins architecture so you don&#8217;t have to worry about the plugins breaking or the theme breaking. If it worked in 2.5, it will work in 2.6.</li>
</ul>
</li>
<li>Security
<ul>
<li>Along with the many bug fixes, wordpress now also adds SSL security as a core functionality. You can now force SSL connection to yout wp-admin. This might not be much but it is a step in the right direction security wise.</li>
</ul>
</li>
</ol>
<p>Basicly it&#8217;s an improvement all around and you have no reason not to upgrade.</p>
<h3>Plugin Handling</h3>
<p>Plugin handling have received a big overhaul in terms of usability. You now can mass activate or deactivate plugins, a featured that have been requested many times. This is very helpful when upgrading or debugging when you need to deactivate a lot of pluggins at once. Considering that a typical site will have around 20 pluggins this is a really big time saver.</p>
<p>Another thing that I really like about the new pluggin page is the pluggins are grouped according to Active plugins, inactive plugins and recently active pluggins. This is really useful when you need to reactivate those pluggins that you deactivated earlier. Instead of digging through the long list of deactivated pluggins, you can just browse the recently active group and clearly see which of the plugins that has been deactivated recently. Furthermore shift click works as you would expect and select a range of check box saving you even more time instead of clicking on each checkbox.</p>
<div id="attachment_80" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-80" title="Wordpress recently active pluggin" src="http://thetechmind.com/wp-content/uploads/2008/07/recent-active.png" alt="Wordpress recently active pluggin" width="500" height="224" /><p class="wp-caption-text">Wordpress recently active pluggin</p></div>
<p>You could see a little similarity  between the functionality of the the new wordpress pluggins page with the <a title="PlugInstaller wordpress pluggin" href="http://henning.imaginemore.de/pluginstaller/" onclick="javascript:pageTracker._trackPageview('/outbound/article/henning.imaginemore.de');" target="_blank">PlugInstaller</a> pluggin. And you will see later that this is a somewhat recurring theme. The developer has taken a useful functionality that a plugin provides, improve it and integrate it into the core of the system.</p>
<h3>Post revision</h3>
<p>Owh&#8230; I just love this. Your post will now have revisions. And what&#8217;s more you can pick any to revision and put it side by side to get a diff between the two versions.</p>
<div id="attachment_82" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-82" title="Wordpress post revision" src="http://thetechmind.com/wp-content/uploads/2008/07/diff.png" alt="Wordpress post revision - showing a diff of 2 revision" width="500" height="164" /><p class="wp-caption-text">Wordpress post revision - showing a diff of 2 revision</p></div>
<p>Very handy. I personally write stuff in bits and chunks,  especially if I&#8217;m doing a how to. I&#8217;ll write down the major steps. And put in details and revise old sections as I go through the process of creating the how-to. Sometimes Stuff get lost because I deleted a section that I think I don&#8217;t need or something like that. But now with post revision it&#8217;s like you have a SVN for your post inside wordpress. Very cool.</p>
<h3>Improved media uploader</h3>
<p>I don&#8217;t use the media uploader much so I can&#8217;t say how improved it is now but one thing that I really love is the image caption functionality( as seen in this post). I used to use a <a href="http://www.channel-ai.com/blog/plugins/image-caption/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.channel-ai.com');" target="_blank">image caption pluggin</a> to do this. And I love it that they included it in wordpress.</p>
<h3>Press this</h3>
<p>This is another useful feature. You could drag a bookmarklet to your bookmark toolbar and drag anything onto it and wordpress will add that item to a &#8216;basket&#8217; so that you can insert it into your post. This works with anything from links to images and even youtube videos and flickr image. This is super useful while doing research for a post.</p>
<h3>Theme preview</h3>
<p>Now when you click on a theme in the design tab, wordpress will provide a theme preview ala wordpress.com theme preview. Wuuhooo&#8230;</p>
<div id="attachment_83" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-83" title="Theme Previwew" src="http://thetechmind.com/wp-content/uploads/2008/07/themepreciew.png" alt="Theme Preview" width="500" height="117" /><p class="wp-caption-text">Theme Preview</p></div>
<p>I absolutely love this. When I started to move from wordpress.com hosted blog to self hosted blogs I was surprise to find out that the theme preview I loved so much is not actually in wordpress. I search forever for plugins that can do this to no avail. Thanks wordpress team.</p>
<h3>Google gears</h3>
<p>With google gears what the wordpress team is storing all the images on your site and loading it straight from your harddrive stored cache. This makes surfing very fast especially in themes with lots of images. Google gears is very powerful  and it&#8217;ll be interesting to see what else they will do with google gears and wordpress.</p>
<h3>Summary</h3>
<p>No backwards compatibility issues with pluggins and themes. More security. More features. Really, just update already. Good job wordpress theme for this release.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=r8cnMJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=r8cnMJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=2HWehj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=2HWehj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/337722597" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/articles/wordpress-26-an-improvement-all-around/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Farticles%2Fwordpress-26-an-improvement-all-around</feedburner:awareness><feedburner:origLink>http://thetechmind.com/articles/wordpress-26-an-improvement-all-around</feedburner:origLink></item>
		<item>
		<title>2.6? This can’t be true?</title>
		<link>http://feeds.feedburner.com/~r/TheTechMind/~3/335832054/26-this-cant-be-true</link>
		<comments>http://thetechmind.com/news/26-this-cant-be-true#comments</comments>
		<pubDate>Tue, 15 Jul 2008 06:33:21 +0000</pubDate>
		<dc:creator>paan</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[word press]]></category>

		<category><![CDATA[wordpress 2.6]]></category>

		<guid isPermaLink="false">http://thetechmind.com/?p=74</guid>
		<description><![CDATA[What? They released? A whole month ahead of schedule?
If you haven&#8217;t heard wordpress 2.6 is released today. What a you waiting for? Go get them now.
]]></description>
			<content:encoded><![CDATA[<p>What? They released? A whole month ahead of schedule?</p>
<p>If you haven&#8217;t heard <a title="wordpress 2.6 is released today" href="http://wordpress.org/development/2008/07/wordpress-26-tyner/" onclick="javascript:pageTracker._trackPageview('/outbound/article/wordpress.org');">wordpress 2.6 is released today</a>. What a you waiting for? Go get them now.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/TheTechMind?a=oxCzQJ"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=oxCzQJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/TheTechMind?a=qN0nuj"><img src="http://feeds.feedburner.com/~f/TheTechMind?i=qN0nuj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TheTechMind/~4/335832054" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://thetechmind.com/news/26-this-cant-be-true/feed</wfw:commentRss>
		<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=TheTechMind&amp;itemurl=http%3A%2F%2Fthetechmind.com%2Fnews%2F26-this-cant-be-true</feedburner:awareness><feedburner:origLink>http://thetechmind.com/news/26-this-cant-be-true</feedburner:origLink></item>
	<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetFeedData?uri=TheTechMind</feedburner:awareness></channel>
</rss>
