<?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>bitblogr.com &#187; CSS</title>
	<atom:link href="http://www.bitblogr.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bitblogr.com</link>
	<description>design, tutorials, inspiration, creativity</description>
	<lastBuildDate>Sat, 05 Jun 2010 17:20:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>My twitter timeline</title>
		<link>http://www.bitblogr.com/tutorials/my-twitter-timeline/</link>
		<comments>http://www.bitblogr.com/tutorials/my-twitter-timeline/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 12:19:41 +0000</pubDate>
		<dc:creator>Opeyemi Obembe</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ngBot]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.bitblogr.com/?p=171</guid>
		<description><![CDATA[During the redesign of the ngBot blog, we figured it&#8217;d be nice dedicating a part of the sidebar to some of ngBot updates on twitter. This is a common trend with blogs and sure should be a piece of cake. Instead of re-inventing the wheel, I tried looking out for ready made scripts that perform [...]]]></description>
			<content:encoded><![CDATA[<div style="float:right;margin:0px 0px 0px 0px;"></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;margin-right:10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.bitblogr.com%2Ftutorials%2Fmy-twitter-timeline%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.bitblogr.com%2Ftutorials%2Fmy-twitter-timeline%2F&amp;source=bitblogr&amp;style=normal&amp;service_api=R_2574ec2cdf93a9dc24a80c02f8d96a25&amp;hashtags=CSS,Javascript,ngBot,Twitter" height="61" width="50" /><br />
			</a>
		</div>
<p>During the redesign of the <a href="http://blog.ngbot.com">ngBot blog</a>, we figured it&#8217;d be nice dedicating a part of the sidebar to some of ngBot updates on <a href="http://twitter.com/ngbot">twitter</a>. This is a common trend with blogs and sure should be a piece of cake.</p>
<p>Instead of re-inventing the wheel, I tried looking out for ready made scripts that perform similar functions – that is; pull out a user&#8217;s updates on twitter and integrate it in the blog.</p>
<p><span id="more-171"></span></p>
<p>I sure came across a couple like <a href="http://crunchbang.org/archives/2008/02/20/twitterzoid-php-script/">Twitterzoid</a> and <a href="http://twitterjs.googlecode.com">Twitter js</a>. But very much like me, I wasn&#8217;t contented with them as most of them were too complicating. Or maybe just the normal me &#8211; always wanting to try out things my own way. And so, I decided to write my own script.</p>
<p>Attached is what I came up with in less than a hundred lines of code. Called “<em>mytimeline.php” (</em><a href="http://www.bitblogr.com/freebies/mytimeline.phps" target="_blank">Download this file [3.20kb]</a> ), the script simply pulls a user&#8217;s latest updates (up to 20) from twitter. Below is a simple usage example as used on the <a href="http://blog.ngbot.com" target="_blank">ngBot blog</a>;</p>
<pre>&lt;strong&gt;Twitter stream (&lt;a href="<a href="http://twitter.com/ngbot&quot;&gt;@ngbot&lt;/a&gt;)&lt;/strong&gt;">http://twitter.com/ngbot"&gt;@ngbot&lt;/a&gt;)&lt;/strong&gt;

</a>&lt;ul class="sidecat"&gt;
    &lt;?php
    // The class accepts the username and number of wanted updates (up to 20)
    $timeline = new myTimeline('ngbot', 3);
    foreach($timeline-&gt;get() as $v)
    {
        list($tweet, $date, $link) = $v;
        ?&gt;
        &lt;li&gt;
           &lt;p&gt;&lt;?= $tweet; ?&gt; &lt;span class="fade"&gt;&amp;mdash; &lt;a href="&lt;?= $link; ?&gt;"&gt;&lt;?= $date; ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/li&gt;         &lt;?php
    }
    ?&gt;
    &lt;li class="last"&gt;
        &lt;p&gt;&lt;a href="<a href="http://twitter.com/ngbot&quot;">http://twitter.com/ngbot"</a>&gt;More on Twitter &amp;rarr;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;</pre>
<h2>Final words:</h2>
<p>Feel free to download, tweak and play around with it in whatever way you want. And don&#8217;t forget to hit me up in case you have any difficulties.</p>
<p>By the way, you may want to cache updates so that the script doesn&#8217;t connect to twitter on every visit to your site. Here is how we do it, using PEAR&#8217;s cache lite:</p>
<pre>&lt;?php
  // Pretend there are updates from twitter
$updates = true;
$cache = new Cache_Lite_Output(array(
    'cacheDir' =&gt; 'path/to/cache/directory/',
    'lifeTime' =&gt; 3600 * 3 // Cache for 3 hours
));

if(!($cache-&gt;start('tweets'))):
    // No update yet.
    $updates = false;
    $timeline = new myTimeline('ngbot', 3);
    foreach($timeline-&gt;get() as $v)
    {
        $updates = true;
        list($tweet, $date, $link) = $v;
        ?&gt;
        &lt;li&gt;
            &lt;p&gt;&lt;?= $tweet; ?&gt; &lt;span class="fade"&gt;&amp;mdash; &lt;a href="&lt;?= $link; ?&gt;"&gt;&lt;?= $date; ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/li&gt;
        &lt;?php
    }
$cache-&gt;end();
endif;
// If no updates from twitter, dont cache
if(!$updates)    $cache-&gt;remove('tweets');
?&gt;</pre>
<h2>File(s) used in this article:</h2>
<p><a href="http://www.bitblogr.com/freebies/mytimeline.phps" target="_blank">mytimeline.php</a> (size: 3.20kb)</p>
<h2>Update</h2>
<blockquote><p>The script has been pushed to Google Code here: <a href="http://mytimeline.googlecode.com">http://mytimeline.googlecode.com</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.bitblogr.com/tutorials/my-twitter-timeline/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Preventing forms from bots &#8211; the blank method</title>
		<link>http://www.bitblogr.com/how-to/preventing-forms-from-bots-the-blank-method/</link>
		<comments>http://www.bitblogr.com/how-to/preventing-forms-from-bots-the-blank-method/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 01:19:18 +0000</pubDate>
		<dc:creator>Opeyemi Obembe</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.bitblogr.com/?p=164</guid>
		<description><![CDATA[One of the challenges web designers and developers face is preventing forms from automated programs that disguise as humans and fill forms (call them bots). And needless to say, this bots can really be a nuisance &#8211; posting bad content, stealing data and doing all kind of weird stuffs. And so there was Captcha &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div style="float:right;margin:0px 0px 0px 0px;"></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;margin-right:10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.bitblogr.com%2Fhow-to%2Fpreventing-forms-from-bots-the-blank-method%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.bitblogr.com%2Fhow-to%2Fpreventing-forms-from-bots-the-blank-method%2F&amp;source=bitblogr&amp;style=normal&amp;service_api=R_2574ec2cdf93a9dc24a80c02f8d96a25&amp;hashtags=bot,captcha,CSS,development,php" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the challenges web designers and developers face is preventing forms from automated programs that disguise as humans and fill forms (call them <strong>bots</strong>). And needless to say, this bots can really be a nuisance &#8211; posting bad content, stealing data and doing all kind of weird stuffs. And so there was <a href="http://en.wikipedia.org/wiki/Captcha&quot;Captcha"></a><a href="http://en.wikipedia.org/wiki/Captcha" target="_blank">Captcha</a> &#8211; a test to verify human response and prevent such bots.</p>
<p><span id="more-164"></span><br />
But then, personally I don&#8217;t like Captchas. Ok, I love <a href="http://recaptcha.net" target="_blank">reCaptcha</a>, but just as an idea for <a href="http://recaptcha.net/learnmore.html" target="_blank">digitalizing books</a>; nothing more. Since I&#8217;m not a big fan then, I figured someone somewhere may as well not be, so I decide to go the way of a different technique for validating my forms. I call it the <em>blank method</em>. (No, that&#8217;s not an &#8216;official&#8217; name :P)</p>
<p>To start with, the technique is not my idea. Actually, an attribution to the owner should come somewhere here but I just can&#8217;t remember where I came across it as its really been long. That said, also note that the technique is not 100% fool proof. While it may save your form from bots, it won&#8217;t save you from real human spammers that are around to purposely junk up your site and be a nuisance.</p>
<p>So what is it all about? The technique is based on the fact that bots can&#8217;t see. A text input field is created somewhere in the form and labelled “Don’t fill” or “Leave Blank” or anything to tell the user to leave the input box empty. The human user filling the form will do just this  i.e.  ignore the field but a <strong>bot</strong> will fill in something there. During validation, the field can then be checked for content. If there exist a content for it, it sure is a bot (or probably a stubborn human).</p>
<p>Here is an overview of what it looks like:</p>
<h2>[The html code]</h2>
<pre>&lt;form method="post" action="submitpage.php"&gt;
    &lt;label&gt;Name&lt;/label&gt; &lt;input type="text" name="name" /&gt;    
    &lt;label&gt;Email&lt;/label&gt; &lt;input type="text" name="email" /&gt;
    &lt;label&gt;Leave Blank&lt;/label&gt; &lt;input type="text" name="foo" /&gt;
    &lt;input type="submit" name="submit" value="Submit" /&gt;
&lt;/form&gt;</pre>
<h2></h2>
<h2>[The server-side validation (I use PHP)]</h2>
<pre>&lt;?php
$foo = trim($_POST['foo']);
if(empty($foo))
{
  //ok, didnt fill anything in the field
  //most def a human
}
else
{
  //filled in something
  //bot! Kick out!
}
?&gt;</pre>
<p><img class="size-full wp-image-162 alignnone" title="unstyled.gif" src="http://www.bitblogr.com/wp-content/uploads/2009/12/unstyled.gif" alt="unstyled.gif" width="263" height="163" /></p>
<h2>And that&#8217;s all.</h2>
<p>Let&#8217;s tweak things a little bit to make the form more beautiful. But not just only beautiful. What about we hide the &#8216;Leave Blank&#8217; field with CSS so that normally users wont even see or notice it (and consequently won&#8217;t fill it)? Bots on the other hand will still &#8216;see&#8217; it and fill it.</p>
<h2>[The CSS]</h2>
<pre>/*resets*/
.nodisplay {
    display:none
} 

/*form*/
form label {
    float:left;
    text-align:right;
    padding-right:10px;
    width:100px
}

form input.txt {
    width:150px;
    padding:3px;
    border:1px solid #ACA899
}

form input.txt:hover, form input.txt:focus {
    border:1px solid #102336;
}</pre>
<h2>[The new html]</h2>
<pre>&lt;form method="post" action="submitpage.php"&gt;
    &lt;p&gt;&lt;label&gt;Name&lt;/label&gt; &lt;input type="text" name="name" class="txt" /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;label&gt;Email&lt;/label&gt; &lt;input type="text" name="email" class="txt" /&gt;&lt;/p&gt;
    &lt;p class="nodisplay"&gt;&lt;label&gt;Leave Blank&lt;/label&gt; &lt;input type="text" name="foo" /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;label&gt;&amp;nbsp;&lt;/label&gt;&lt;input type="submit" name="submit" value="Submit" /&gt;&lt;/p&gt;
&lt;/form&gt;</pre>
<p><img class="alignnone size-full wp-image-163" title="styled.gif" src="http://www.bitblogr.com/wp-content/uploads/2009/12/styled.gif" alt="styled.gif" width="245" height="124" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitblogr.com/how-to/preventing-forms-from-bots-the-blank-method/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS: When property/value order matters</title>
		<link>http://www.bitblogr.com/how-to/css-when-propertyvalue-order-matters/</link>
		<comments>http://www.bitblogr.com/how-to/css-when-propertyvalue-order-matters/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 18:08:57 +0000</pubDate>
		<dc:creator>Opeyemi Obembe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://www.bitblogr.com/?p=67</guid>
		<description><![CDATA[Generally, the believe about CSS is that no matter what order your property or value declaration comes in a selector, it is the same. In other words, thus; *{ margin: 0; padding; 0; } is the same as *{ padding: 0; margin; 0; } But this is not always so. Let’s take a look at [...]]]></description>
			<content:encoded><![CDATA[<div style="float:right;margin:0px 0px 0px 0px;"></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;margin-right:10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.bitblogr.com%2Fhow-to%2Fcss-when-propertyvalue-order-matters%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.bitblogr.com%2Fhow-to%2Fcss-when-propertyvalue-order-matters%2F&amp;source=bitblogr&amp;style=normal&amp;service_api=R_2574ec2cdf93a9dc24a80c02f8d96a25&amp;hashtags=CSS" height="61" width="50" /><br />
			</a>
		</div>
<p>Generally, the believe about CSS is that no matter what order your property or value declaration comes in a selector, it is the same.</p>
<p>In other words, thus;</p>
<pre>*{
margin: 0;

padding; 0;
}<span id="more-67"></span></pre>
<p>is the same as</p>
<pre>*{
padding: 0;

margin; 0;
}</pre>
<p>But this is not always so.</p>
<p><strong>Let’s take a look at borders;</strong></p>
<p>The declarations for borders looks something like this;</p>
<pre>.bordered{
  border: 1px solid #000;
  }</pre>
<p>If you are however interested in just the top and bottom border, you may want to go this way;</p>
<pre>.bordered{
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  }</pre>
<p>There is however a short-cut to that. A better way to go should be;</p>
<pre>.bordered{
  border: solid #000;
  border-width: 1px 0;

/* the 1px is for top &amp; bottom, while 0 is for left &amp; right  */
  }</pre>
<p>And that is where the order (which of ‘border’ &amp; ‘border-width’ comes first) matters. If the ordering is reversed (as shown below), it won’t work as expected.</p>
<pre>.bordered{
  border-width: 1px 0;

border: solid #000;

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bitblogr.com/how-to/css-when-propertyvalue-order-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
