<?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>Hacking at 0300 &#187; Web Design</title>
	<atom:link href="http://bililite.nfshost.com/blog/category/web-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://bililite.nfshost.com/blog</link>
	<description>Thoughts on web design and programming from a very occasional volunteer webmaster</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:05:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Nearly Free Speech</title>
		<link>http://bililite.nfshost.com/blog/2012/02/03/nearly-free-speech/</link>
		<comments>http://bililite.nfshost.com/blog/2012/02/03/nearly-free-speech/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 10:05:17 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=2228</guid>
		<description><![CDATA[I've used 1&#038;1 since I started mucking about on the web; they had a cheap plan for $3/month with one domain name and a simple LAMP stack. But the price has been going up (now $5/month; still comparatively cheap!), and I'm starting to chafe at the limitations (no SSH shell access, proprietary 404 pages, no [...]]]></description>
			<content:encoded><![CDATA[<p>I've used <a href="http://1and1.com">1&#038;1</a> since I started mucking about on the web; they had a cheap plan for $3/month with one domain name and a simple <a href="http://en.wikipedia.org/wiki/LAMP_(software_bundle)">LAMP stack</a>. But the price has been going up (now $5/month; still comparatively cheap!), and I'm starting to chafe at the limitations (no SSH shell access, proprietary 404 pages, no languages beside PHP) and I didn't want to shell out for my own virtual server (<a href="http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/">Rackspace</a> goes as low as $11/month but I'm really cheap). So I was overjoyed when I found <a href="http://nearlyfreespeech.net">Nearly Free Speech</a>.<p>
<span id="more-2228"></span>
<p>It has several advantages:</p>
<ol>
<li>SSH into a real Linux shell. It's been a while since I used Unix, but the old habits come back fast and I like having all those tools available.</li>
<li><a href="http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SFTP</a> support. More secure and faster (at least it seems that way) than FTP, especially with <a href="http://notepad-plus-plus.org/">Notepad++</a>.</li>
<li>It sure seems cheap (only $0.01/day for the site, $0.02/day for as many mySQL databases as you want).</li>
<li><a href="http://example72.nfshost.com/versions.php">Lots of languages</a> besides PHP. Maybe I will learn <a href="http://xkcd.com/353/">Python</a> someday.</li>
<li>Up-to-date versions of the tools, like PHP 5.3 (<a href="http://us.php.net/manual/en/functions.anonymous.php">anonymous functions</a>!) and Apache 2.2 (<a href="http://httpd.apache.org/docs/2.3/mod/mod_dir.html#fallbackresource">FallbackResource</a>!). 1and1 was still stuck on the old versions.</li>
<li>They enable <a href="http://us.php.net/manual/en/features.remote-files.php">file URL wrappers</a>, so I can use get_file_contents('http://example.com') and the like, rather than cURL.</li>
<li>A general feel that these guys are <a href="http://faq.nearlyfreespeech.net/full/easy#easy">more hacker-oriented rather than simple, one-click-install-package oriented</a>.</li>
</ol>
<p>But there are disadvantages as well.</p>
<ol>
<li>It's not nearly as cheap as it seems. A simple site as above is $0.03/day = $10.95/year, but it's all pay for what you use. They charge for server usage based on storage, $0.01 per megabyte-month, so my 100 megabytes of fonts and images is another $12/year. Domain name registration is $9.49/year, plus $0.41/year for DNS. Bandwidth is $0.20 to $1.00/gigabyte, depending on usage. For my relatively popular blog (about 300-600 visits/day) I'm sending about 100 MB/day or $0.07/day or $25.55/year. That adds up to $58.40/year, basically the same price as 1and1. And I feel like I have to watch every byte stored or transferred. I know it's not really much money, but it's an avocation rather than a vocation so I need to justify the cost to myself. The bandwidth I'm going to have to explore to find out what's going on and possibly stop hotlinking and the like. The storage costs I can hack around by putting the big stuff on <a href="http://aws.amazon.com/s3/pricing/">Amazon S3</a> at only $0.14/gigabyte.</li>
<li>They don't automatically take the money from a credit card. You have to deposit funds in your account, and if it runs dry, the site goes down. They'll send out low-balance warnings but I'd like an automated method. Alos, every payment comes with a $1.00 deposit fee, so making monthly payments is another $12/year.</li>
<li>PHP runs in <a href="http://us.php.net/manual/en/features.safe-mode.php">safe mode</a>, so a lot of file and system functions are disabled. This is deprecated in the latest PHP, so I don't know what NearlyFreeSpeech will do, but right now it makes life much more difficult. There are workarounds, notably using <a href="/blog/2012/01/12/writing-cgi-scripts/" title="Writing CGI scripts">CGI scripts</a> rather than straight PHP, but this is the biggest downside.</li>
<li><a href="https://www.nearlyfreespeech.net/about/faq?&#038;keywords=cron&#038;form=1#WontGo">No cron jobs</a>. You can't run any processes on their servers besides the webserver, mySQL and whatever you're doing when SSH'ing in. <a href="http://faq.nearlyfreespeech.net/section/programming/cron#cron">They promise they're working on a solution</a>, but no update since 2008. You can use hacks like <a href="http://codex.wordpress.org/Category:WP-Cron_Functions">WP-cron</a> but that is exactly that, a hack.</li>
</ol>
<p>But overall, it looks like a good thing and I'm looking forward to (slowly, as I have the time) moving all of bililite.com over to the new host (then transferring the domain when I'm sure it works).</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2012/02/03/nearly-free-speech/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Amazon Advertising API</title>
		<link>http://bililite.nfshost.com/blog/2012/02/01/newamzonapi/</link>
		<comments>http://bililite.nfshost.com/blog/2012/02/01/newamzonapi/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 14:48:06 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=2225</guid>
		<description><![CDATA[Just got an email from Amazon reminding me that "As part of our continued effort to ensure that the Product Advertising API is an efficient and effective advertising tool, we’ve identified opportunities to streamline the API", which is their way of saying that the API exists to make them money. Anything that doesn't serve that [...]]]></description>
			<content:encoded><![CDATA[<p>Just got an email from Amazon reminding me that "As part of our continued effort to ensure that the Product Advertising API is an efficient and effective advertising tool, we’ve identified opportunities to streamline the API", which is their way of saying that the API exists to make <em>them</em> money. Anything that doesn't serve that purpose is eliminated, however nice it might be for me. Their right, even if they're <em>not</em> right. I've already taken into account <a href="/blog/2011/11/01/the-new-amazon-advertising-api/" title="The New Amazon Advertising API">the major changes</a>. The only thing is to change the API version to the most recent; in the <a href="http://mierendo.com/software/aws_signed_query/">aws_signed_request</a> routine, change the <code class="language-html">$params["Version"]</code> line to read <code class="language-html">$params["Version"] = "2011-08-01";</code> and that should be it.</p> ]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2012/02/01/newamzonapi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing CGI scripts</title>
		<link>http://bililite.nfshost.com/blog/2012/01/12/writing-cgi-scripts/</link>
		<comments>http://bililite.nfshost.com/blog/2012/01/12/writing-cgi-scripts/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 18:28:41 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=2206</guid>
		<description><![CDATA[nearlyfreespeech runs with safe mode and safe_mode_gid on, so you can't run shell scripts or other cool things. Usually that's not an issue, but if you do, they let you run CGI scripts, in any of a number of languages. You just have to treat it as a shell script, with a shebang notation of [...]]]></description>
			<content:encoded><![CDATA[<p>nearlyfreespeech runs with <a href="http://www.php.net/manual/en/features.safe-mode.php">safe mode</a> and <a href="http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-gid">safe_mode_gid</a> on, so you can't run shell scripts or other cool things. Usually that's not an issue, but if you do, they let you run <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a> scripts, in any of a <a href="http://example72.nfshost.com/versions.php">number of languages</a>. You just have to treat it as a shell script, with a <a href="http://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> notation of the proper language. There are a few caveats that took me a day to find out:</p>
<ol><li>The correct program is <code>/usr/local/bin/php-cgi</code> (or whereever your server puts PHP), not <code>/usr/local/bin/php</code>. That is the command-line interpreter, which does not output the headers. You can manually do <code class="language-php">echo "Content-type: text/html\n"</code> etc., followed by a blank line, but who wants to try to debug that?</li>
<li>The script has to be executable. You get a 500 Server Error otherwise. Do a <code>chmod +x scriptname.cgi</code>.</li>
<li>Scripts need the appropriate file and directory permissions to write to the server.  Changing the permissions of the server directory is probably too insecure (though for safe mode it's the only way); it's better to set-uid the script, but then keep it under wraps. </li>
</ol>
<p>So a sample CGI script would be:</p>
<pre><code class="language-html">#!/usr/local/bin/php-cgi
&lt;?php echo "Hello, world"; ?&gt;</code></pre>
<p>in an executable file with a <code>.cgi</code> extension.</p>
<p>Note that FTP and SFTP can't set the setuid bit, so that if you upload the file (or edit it with an FTP-aware editor like <a href="http://notepad-plus-plus.org/">Notepad++</a>), you need to <code>chmod 477 scriptname.cgi</code> again.]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2012/01/12/writing-cgi-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things I Learned About .htaccess, part 2</title>
		<link>http://bililite.nfshost.com/blog/2012/01/12/things-i-learned-about-htaccess-part-2/</link>
		<comments>http://bililite.nfshost.com/blog/2012/01/12/things-i-learned-about-htaccess-part-2/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 16:29:48 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=2200</guid>
		<description><![CDATA[I've learned some things about .htaccess, but mostly I've learned that programming it is deep black magic. The most important thing is "Don't use mod-rewrite unless you absolutely need to". All the fancy stuff is better off done by the PHP (or whatever language you're using) code. Don't do: RewriteEngine On RewriteBase / RewriteRule ^([^/\.]+)/$ [...]]]></description>
			<content:encoded><![CDATA[<p>I've <a href="/blog/2009/07/27/things-i-learned-about-htaccess/">learned some things about .htaccess</a>, but mostly I've learned that programming it is deep black magic. The most important thing is "Don't use mod-rewrite unless you absolutely need to". All the fancy stuff is better off done by the PHP (or whatever language you're using) code.</p>
<p>Don't do:</p>
<pre><code>RewriteEngine On
RewriteBase /
RewriteRule ^([^/\.]+)/$ /index.php?main=$1&#038;part=$1 [QSA,L]
RewriteRule ^([^/\.]+)/([^/\.]+)$ /index.php?main=$1&#038;part=$2 [QSA,L]</code></pre>
<p>to map your site to your index page; do:</p>
<pre><code><a href="https://httpd.apache.org/docs/2.3/mod/mod_dir.html#fallbackresource">FallbackResource</a> /index.php</code></pre>
<p>And in <code>index.php</code> parse the <code class="language-php">$_SERVER['REQUEST_URI']</code> to get your page/subpage arguments. Much easier to debug!</p>
<p>And to use <code>FallbackResource</code> you need to be running Apache 2.2, so get a good web host.</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2012/01/12/things-i-learned-about-htaccess-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A New Twist in Comment Spam</title>
		<link>http://bililite.nfshost.com/blog/2011/07/08/a-new-twist-in-comment-spam/</link>
		<comments>http://bililite.nfshost.com/blog/2011/07/08/a-new-twist-in-comment-spam/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 19:46:25 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1829</guid>
		<description><![CDATA[I get lots of comment spam, either obvious ads for dubious products or boilerplate praise in almost understandable Engfish ("This is the most coherent soliloquy on this germane topic in the recent memory") with links to the ads. But I'd never seen comment spam that went out of its way to insult me: The subsequent [...]]]></description>
			<content:encoded><![CDATA[<p>I get lots of comment spam, either obvious ads for dubious products or boilerplate praise in almost understandable <a href="http://www.kristisiegel.com/CXC/engfish2.htm">Engfish</a> ("This is the most coherent soliloquy on this germane topic in the recent memory") with links to the ads. But I'd never seen comment spam that went out of its way to insult me:</p>
<blockquote>The subsequent time I learn a blog, I hope that it doesnt disappoint me as much as this one. I imply, I know it was my choice to read, however I truly thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about one thing that you would repair in the event you werent too busy searching for attention.<em>[links to some construction contractor removed]</em></blockquote>
<p>I guess they know how humble I am and that I'd take criticism more seriously than praise.</p>
<p>But it's still painful to read something negative and have to take the time to parse it and realize it doesn't say anything at all, so I hope it doesn't become a trend. Thank goodness for Akismet!</p>
]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/07/08/a-new-twist-in-comment-spam/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Trying to Search with Bing and Failing</title>
		<link>http://bililite.nfshost.com/blog/2011/02/24/trying-to-search-with-bing-and-failing/</link>
		<comments>http://bililite.nfshost.com/blog/2011/02/24/trying-to-search-with-bing-and-failing/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 18:21:04 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1614</guid>
		<description><![CDATA[I'm not a fan of having to create a Google Custom Search Engine to limit searches to one site with an HTML form (which seems to be necessary for mobile sites), so let's play with Bing: &#60;form method="get" action="http://www.bing.com/search" &#62; &#60;input name="q" type="text"/&#62; &#60;input type="submit" value="Search with Bing"/&#62; &#60;input name="q1" value="site:http://bililite.nfshost.com/blog" type="hidden"/&#62; &#60;/form&#62; And it [...]]]></description>
			<content:encoded><![CDATA[<p>I'm not a fan of having to create a Google Custom Search Engine to limit searches to one site with an HTML form (which seems to <a href="/blog/2011/02/23/back-to-a-simple-google-search-form/">be necessary for mobile sites</a>), so let's play with Bing:</p>
<pre><code class="language-html demo">
&lt;form method="get" action="http://www.bing.com/search" &gt;
	&lt;input name="q" type="text"/&gt;
	&lt;input type="submit" value="Search with Bing"/&gt;
	&lt;input name="q1" value="site:http://bililite.nfshost.com/blog" type="hidden"/&gt;
&lt;/form&gt;</code></pre>
<p>And it works, but fails again on the mobile site, just like Google. This may get better as the search engines figure it out, but I'm going to have to write my own search engine portal. What a pain.</p>
<p>Actually, not such a pain. Something like:</p>
<pre><code class="language-php">header('Location: http://www.bing.com/search?q='.urlencode($_GET['q']).'+'.urlencode($_GET['q1']))</code></pre>
<p>for Bing and</p>
<pre><code class="language-php">header('Location: http://www.google.com/search?q='.urlencode($_GET['q']).'+site:'.urlencode($_GET['sitesearch']))</code></pre>
<p>for Google. And that's what I did for the <a href="http://youngisrael-stl.org">Young Israel site</a></p>


]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/02/24/trying-to-search-with-bing-and-failing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to a Simple Google Search Form</title>
		<link>http://bililite.nfshost.com/blog/2011/02/23/back-to-a-simple-google-search-form/</link>
		<comments>http://bililite.nfshost.com/blog/2011/02/23/back-to-a-simple-google-search-form/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 23:20:41 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1607</guid>
		<description><![CDATA[Earlier, I noted that the old, simple Google search: &#60;form method="get" action="http://www.google.com/search" &#62; &#60;input name="q" type="text"/&#62; &#60;input type="submit" value="Search with Google"/&#62; &#60;input name="sitesearch" value="http://bililite.nfshost.com/blog" type="hidden"/&#62; &#60;/form&#62; is deprecated and doesn't work from Google's mobile site. Google does have an API for custom searches that has all sorts of fancy parameters to manipulate, but it requires [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/blog/2011/02/23/a-google-bug/">Earlier</a>, I noted that the old, simple Google search:</p>
<pre><code class="language-html demo">
&lt;form method="get" action="http://www.google.com/search" &gt;
	&lt;input name="q" type="text"/&gt;
	&lt;input type="submit" value="Search with Google"/&gt;
	&lt;input name="sitesearch" value="http://bililite.nfshost.com/blog" type="hidden"/&gt;
&lt;/form&gt;</code></pre>
<p>is deprecated and doesn't work from Google's mobile site. Google does have an API for custom searches that has all sorts of fancy parameters to manipulate, but it requires signing up for a key and constructing the search ahead of time. However, some experimentation shows that <em>not</em> including a key brings back the old, simple search query (with a new URL and <a href="http://www.google.com/cse/docs/resultsxml.html">some new parameters</a>), so we're back in business:</p>
<pre><code class="language-html demo">
&lt;form method="get" action="http://www.google.com/cse" &gt;
	&lt;input name="q" type="text"/&gt;
	&lt;input type="submit" value="Search with Google"/&gt;
	&lt;input name="as_sitesearch" value="http://bililite.nfshost.com/blog" type="hidden"/&gt;
&lt;/form&gt;</code></pre>
<p>And there's all sorts of interesting things hidden in there, like sorting by date (Google tries to <a href="https://code.google.com/apis/customsearch/docs/structured_data.html#page_dates">guess that, but doesn't do so well</a>):</p>
<pre><code class="language-html demo">
&lt;form method="get" action="http://www.google.com/cse" &gt;
	&lt;input name="q" type="text"/&gt;
	&lt;input type="submit" value="Search with Google"/&gt;
	&lt;input name="as_sitesearch" value="http://bililite.nfshost.com/blog" type="hidden"/&gt;
	&lt;input name="sort" value="date:d" type="hidden"/&gt;
&lt;/form&gt;</code></pre>
<p>And the entire Web Search API is <a href="http://code.google.com/apis/websearch/docs/">deprecated</a>, so I'll have to change the googleSearch widget to use the <a href="https://code.google.com/apis/customsearch/v1/overview.html">JSON Custom Search API</a> eventually.</p>
<p>Overall, sweet. At least until Google changes things again.</p>
<p>Addendum: it looks as though the mobile site <em>does</em> require the <code>cx</code> parameter to limit the search to a specific site. Oh, well. It's not that hard to create a custom search.</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/02/23/back-to-a-simple-google-search-form/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Google Bug (no, not really)</title>
		<link>http://bililite.nfshost.com/blog/2011/02/23/a-google-bug/</link>
		<comments>http://bililite.nfshost.com/blog/2011/02/23/a-google-bug/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 19:11:10 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1591</guid>
		<description><![CDATA[For the search on the Young Israel site, I use Google with a form that creates links like http://www.google.com/search?q=foo&#038;sitesearch=http://youngisrael-stl.org to limit the search to the one site. It works fine in normal browsers, but on my iPhone it detects the browser and changes it to a mobile-optimized site that ignores the sitesearch=http://youngisrael-stl.org and returns results [...]]]></description>
			<content:encoded><![CDATA[<p>For the search on the <a href="http://youngisrael-stl.org">Young Israel</a> site, I use Google with a form that creates links like <code>http://www.google.com/search?q=foo&#038;sitesearch=http://youngisrael-stl.org</code> to limit the search to the one site. It works fine in normal browsers, but on my iPhone it detects the browser and changes it to a mobile-optimized site that ignores the <code>sitesearch=http://youngisrael-stl.org</code> and returns results for the whole web. <code>http://www.google.com/search?q=foo+site:youngisrael-stl.org</code> works fine, but I can't make an HTML form add the <code>site:</code> term automatically. A workaround would be to make my own page on the server that mangles the query string and changes <code>Location</code>, but I'm not sure it's worth the effort. I'll see how many complaints I get.</p>
<p><strong>Addendum, later the same day</strong>: It looks as though Google isn't supporting the <code>sitesearch</code> query at all; it was <a href="http://googlecode.blogspot.com/2010/11/introducing-google-apis-console-and-our.html">deprecated</a> a few months ago. The fact that it still sometimes works is just a lucky coincidence. They use "<a href="http://www.google.com/cse/manage/create">Custom Searches</a>" now, and <a href="http://www.darrenhoyt.com/2007/09/15/build-a-simpler-google-search-form/#comment-1197">this wise person</a> figured out how to use it with forms rather than javascript. So that's what I'm using now. It serves ads at the top of the page, but I'm too cheap to pay for the <a href="http://www.google.com/sitesearch/">ad-free version</a>.</p>
<p>The <a href="http://www.google.com/cse/docs/resultsxml.html">documentation for the query parameters</a> is pretty complete, and it looks as though you could create a "generic" all-web custom search then use the parameters to limit it programmatically. Unfortunately, it looks as though the XML/JSON data is only available to paying customers.</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/02/23/a-google-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom CSS for iPhone</title>
		<link>http://bililite.nfshost.com/blog/2011/02/23/custom-css-for-iphone/</link>
		<comments>http://bililite.nfshost.com/blog/2011/02/23/custom-css-for-iphone/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 19:00:20 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1587</guid>
		<description><![CDATA[I decided to make the Young Israel site iPhone-friendly, and there are lots of good sites for tips on creating custom CSS for the small screen. The best I found was on CSS wizardry. It doesn't focus on the how so much (using media queries or checking the User-Agent string (evil!)) as the what&#8212;making sure [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to make the <a href="http://youngisrael-stl.org">Young Israel</a> site iPhone-friendly, and there are lots of good sites for tips on creating custom CSS for the small screen. The best I found was on <a href="http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites">CSS wizardry</a>. It doesn't focus on the <em>how</em> so much (using media queries or checking the User-Agent string (evil!)) as the <em>what</em>&mdash;making sure the elements are linear vertically, not using floats, shortening headers, etc. The major problem is that his <a href="http://csswizardry.com/wp-content/themes/default/style.css">CSS sample</a> has the "wrong" syntax for the media query, so it won't work.</p>
<p>The big gotcha from the <a href="http://www.w3.org/TR/css3-mediaqueries/#syntax">official CSS3 documentation</a>: <code class="language-css">@media (max-device-width: 480px)</code> <em>doesn't work</em> (in either Safari or Firefox), even though the documentation says it's legal. You have to have a media type in there: <code class="language-css">@media screen and (max-device-width: 480px)</code>. Took me forever to find that bug.</p>
<p>I would also use <code>max-device-width</code> rather than <code>max-width</code>; the user on a big screen may shrink the window and it would be confusing for the layout of the site to suddenly change. I would also not use the <code>only screen</code> hack that Apple suggests; there doesn't seem to be any reason to use CSS hacks (shades of the 1990's!) to target only iPhones.</p>
<p>The other gotcha is with my <a href="/blog/2009/01/16/jquery-css-parser/">CSS parser</a>: the javascript is run in the order that it is seen, so if you want to remove a widget for the small screen you have to explicitly destroy it:</p>
<pre><code>#q {
  -jquery-googleSearch: /* default */;
}
@media screen and (max-device-width: 480px){
  #q {
    -jquery-googleSearch: destroy;
  }
}</code></pre>
<p>Hope this helps somebody avoid a miserable morning.</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/02/23/custom-css-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing with Syntax Highlighters</title>
		<link>http://bililite.nfshost.com/blog/2011/01/28/playing-with-syntax-highlighters/</link>
		<comments>http://bililite.nfshost.com/blog/2011/01/28/playing-with-syntax-highlighters/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 06:09:49 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://bililite.nfshost.com/blog/?p=1558</guid>
		<description><![CDATA[I wanted to try different syntax highlighters so I wrote a little WordPress plugin that let me switch between different highlighters (email me if you would like that code). I wanted syntax highlighters that were javascript-based (ruling out GeSHi), and that allowed me to highlight inline code elements as well as code elements within block-level [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to try <a href="/blog/2011/01/13/fixins-for-chili/">different syntax highlighters</a> so I wrote a little WordPress plugin that let me switch between different highlighters (<a href="mailto:d.wachss@prodigy.net">email me</a> if you would like that code). I wanted syntax highlighters that were javascript-based (ruling out <a href="http://qbnz.com/highlighter/">GeSHi</a>), and that allowed me to highlight inline <code>code</code> elements as well as <code>code</code> elements within block-level <code>pre</code> elements, using the <a href="http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element">HTML5 <code>&lt;code class="language-whatever"&gt;</code> notation</a> for determining language. I also wanted something that didn't do any fancy javascript or Flash for selection and copying, and either supported Lisp and Basic or was easy enough to extend.</p>
<p>Everyone seems to use <a href="http://code.google.com/p/syntaxhighlighter/">Alex Gorbatchev's syntaxhighlighter</a> but it uses nonstandard name attributes and only works on <code>pre</code> and <code>textarea</code> elements, so I haven't tried that. I tried <a href="http://balupton.com/projects/jquery-syntaxhighlighter">Benjamin Lupton's jQuery syntaxhighlighter</a> based on <a href="http://code.google.com/p/google-code-prettify/">Google's prettify</a>. It insisted on making all elements <code class="language-css">display: block</code> but a little CSS manipulation fixed that.</p> <p>Then I tried <a href="http://www.steamdev.com/snippet/">snippet</a>, which only works on <code>pre</code> elements but was easily modifiable to get around that, then also needed some stylesheet changes to keep the results from being <code class="language-css">display: block</code>. Adding new languages however looks far too complicated; it uses <a href="http://shjs.sourceforge.net/">shjs</a> which uses language definitions from <a href="http://www.gnu.org/software/src-highlite/">GNU Source-highlight</a>, which is a whole different language.</p>
<p><a href="http://jush.sourceforge.net/">jush</a> does things right (working on <code>code</code> elements and not forcing them to be block) but it's hardwired for a limited number of languages and the CSS is pretty ugly. That could be fixed, though, and it does a cool trick of turning keywords into links to the documentation. Too limited a language selection, though, but it would be a nice base for working on.</p>
<p>In the end, I'm going to stick with <a href="http://noteslog.com/chili/">chili</a>. It's simple enough for me to modify to suit my needs, it's easy to add new languages and it works. Creating new "themes" is impossible; the styles are hard-coded into the javascript files, but I can live with that. I may sometime write my own highlighter, but for now, I'll stick with what works.</p>]]></content:encoded>
			<wfw:commentRss>http://bililite.nfshost.com/blog/2011/01/28/playing-with-syntax-highlighters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

