<?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>ITPindia &#187; PHP</title>
	<atom:link href="http://itp.nyu.edu/~ia303/thunk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://itp.nyu.edu/~ia303/thunk</link>
	<description>India’s ITP blog</description>
	<lastBuildDate>Fri, 10 Apr 2009 06:20:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP 101</title>
		<link>http://itp.nyu.edu/~ia303/thunk/2009/01/27/php-101/</link>
		<comments>http://itp.nyu.edu/~ia303/thunk/2009/01/27/php-101/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 08:41:43 +0000</pubDate>
		<dc:creator>India</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[DWD]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[homework]]></category>

		<guid isPermaLink="false">http://itp.nyu.edu/~ia303/thunk/?p=415</guid>
		<description><![CDATA[
My homework for the first week of Dynamic Web Development is over here: Hello, World. I reused the CSS from CommLab week 1 and made absolutely no modifications to the &#8220;hello, world&#8221; PHP from the instructions. So, sue me. I think the point was to make sure we all know how to upload files and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/emerym42/2614607486/"><img src="http://itp.nyu.edu/~ia303/thunk/wp-content/uploads/hello_world.jpg" alt="Hello World" title="Hello World" width="450" height="340" class="alignnone size-full wp-image-416" /></a></p>
<p>My homework for the first week of Dynamic Web Development is over here: <a href="http://itp.nyu.edu/~ia303/DWD/helloworld.php">Hello, World</a>. I reused the <acronym title="cascading style sheets">CSS</acronym> from <a href="http://itp.nyu.edu/~ia303/thunk/2008/09/15/commlab-homework-week-1/">CommLab week 1</a> and made absolutely no modifications to the &#8220;hello, world&#8221; <acronym title="hypertext preprocessor">PHP</acronym> from the instructions. So, sue me. <span id="more-415"></span>I think the point was to make sure we all know how to upload files and have got our permissions set up correctly.</p>
<p>One thing I did not copy from the instructions we got in class was the fucked-up sample <acronym title="hypertext markup language">HTML</acronym>, which was something like this:</p>
<blockquote><p><code>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;?=$pageTitle?&gt;&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;b&gt;One paragraph&lt;/b&gt;<br />
&lt;p&gt;<br />
Another paragraph<br />
&lt;p&gt;<br />
Third paragraph<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p></blockquote>
<p>What is with <acronym title="Interactive Telecommunications Program">ITP</acronym> teachers and lazy-ass <acronym title="hypertext markup language">HTML</acronym>? Spencer did the same thing, using &lt;p&gt; tags to &#8220;put a little space between&#8221; stuff. Guys. Guys. <em>Guys.</em> Ever heard the term <i>well-formed</i>? Ever heard the term <i>semantic</i>? <acronym title="hypertext markup language">HTML</acronym> is so fucking <em>not difficult</em>; why not just do it correctly instead of teaching a roomful of people shitty habits?</p>
<p><span style="font-size:smaller;color:#666;">Photo: <a href="http://www.flickr.com/photos/emerym42/2614607486/">&#8220;Hello World&#8221;</a> by Mark Emery Photography; <a href="http://creativecommons.org/licenses/by-nc/2.0/deed.en">some rights reserved</a>.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://itp.nyu.edu/~ia303/thunk/2009/01/27/php-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPhun</title>
		<link>http://itp.nyu.edu/~ia303/thunk/2008/11/10/phphun/</link>
		<comments>http://itp.nyu.edu/~ia303/thunk/2008/11/10/phphun/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 08:13:27 +0000</pubDate>
		<dc:creator>India</dc:creator>
				<category><![CDATA[ICM]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[homework]]></category>

		<guid isPermaLink="false">http://itp.nyu.edu/~ia303/thunk/?p=233</guid>
		<description><![CDATA[
I completely spaced the ICM homework last week, which is sad, because it involved a language I actually have some experience with: PHP. I know just enough about it to fiddle with WordPress templates&#8212;and once, in 2002 or so, I spent a few days trying to rebuild the ColdFusion-backed poets.org in PHP, just for kicks.
Yeah, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/ooocha/2844442207/"><img src="http://itp.nyu.edu/~ia303/thunk/wp-content/uploads/auto-setter.jpg" alt="" title="Auto Setter" width="450" height="134" class="alignnone size-full wp-image-234" /></a></p>
<p>I completely spaced the ICM homework last week, which is sad, because it involved a language I actually have some experience with: PHP. I know just enough about it to fiddle with WordPress templates&mdash;and once, in 2002 or so, I spent a few days trying to rebuild the ColdFusion-backed poets.org in PHP, just for kicks.</p>
<p>Yeah, I didn&#x0092;t get very far with that, <span id="more-233"></span>but it&#x0092;s the thought that counts.</p>
<p>Last week&#x0092;s assignment was to </p>
<blockquote><p>Using HTML and PHP, create a page which contains a form for some kind of (census, survey?) data collection and a second page which tallies up and displays the results (perhaps use Processing for visualizing the results</p></blockquote>
<p>Easy peasy. I mean, not that this is stuff I can do off the top of my head&mdash;HTML forms are one of the many things I rarely have occasion to create from scratch, so I&#x0092;ve never gotten enough practice at it to not have to look up the syntax for every single type of control&mdash;but it&#x0092;s certainly stuff I&#x0092;ve done dozens of times. So on Friday, while I was waiting for it to be time to go to a party, I started putting together a little cast-off calculator.</p>
<p><i>Casting off</i>, for those who do not work in publishing, is the process of figuring out how long a typeset book will be, based on its typed or word-processed manuscript. It can be surprisingly accurate, when one has reliable character-per-pica (CPP) charts with which to estimate the volume of the typeset page. This problem is, of course, that there are a zillion factors that can affect the CPP. Which font are you using&mdash;that is, which typeface, and in which size? You have to be very specific about this. Just saying &#8220;Garamond 9&#8243; won&#x0092;t do; you need to know <em>which</em> Garamond&mdash;Adobe? Postscript or OpenType (or metal, or photoset)? The old Adobe Garamond, or the new Adobe Garamond Premier Pro? What typesetting program are you using&mdash;InDesign CS3, Quark XPress 4.11, PageMaker 6 Win, Pages? LaTeX? What <acronym title="hyphenation and justification settings">H&#038;J</acronym>s are you using? Does the text use a lot of italics? Blah, blah, blah.</p>
<p>So, this calculator is actually pretty useless, because the CPP figures for my various font options are pulled from a couple of sources, none of them good. Somewhere I have a real list of CPPs from Westchester, a major U.S. typesetter, which I know are reliable . . . for the conditions under which Westchester was setting books for me at the time: Quark XPress 4 or 5, PostScript fonts, fixed H&#038;Js, etc. Somewhere I also have a more detailed, and therefore accurate, cast-off formula that takes into account the number of chapters and parts a book has, and how much front or back matter there is. Maybe later I&#x0092;ll update this code to reflect those real-life samples. For now, though, it gives you the basic gist: you plug in some numbers, you get some numbers back.</p>
<p>The input form&mdash;adapted from an example in the <cite><a href="http://www.chicagomanualofstyle.org/">Chicago Manual of Style</a></cite> (Fig. A.4)&mdash;is okay, but the output page is quite nasty so far. Not sure what&#x0092;s the best way to present all that information, so for now I&#x0092;ve just left it where the PHP flang it.</p>
<p>Try it out: <a href=" http://itp.nyu.edu/~ia303/ICM/week9/castoff.html">Cast-off Calculator</a></p>
<p>The PHP portion is as follows:</p>
<p><code>&lt;?php<br />
			$chars_per_line = $_GET['chars_per_line'];<br />
 			$lines_per_page = $_GET['lines_per_page'];<br />
			$ms_page_count = $_GET['ms_page_count'];<br />
            $total_ms_chars = $chars_per_line * $lines_per_page * $ms_page_count;</p>
<p>			list($font, $cpp) = split(";", $_GET['typeface'], 2);<br />
			$measure = $_GET['measure'];<br />
			$depth = $_GET['depth'];<br />
            $total_page_chars = $cpp * $measure * $depth;<br />
            $chars_tight = round($total_page_chars * .9);<br />
            $chars_loose = round($total_page_chars * 1.10);</p>
<p>            $castoff = round($total_ms_chars / $total_page_chars);<br />
            $pages_tight = round($castoff * .9);<br />
            $pages_loose = round($castoff * 1.10);</p>
<p>			echo "&lt;p>&lt;b>Characters per line:&lt;/b> " . $chars_per_line . "&lt;br /><br />
			&amp;times;&lt;br /><br />
			&lt;b>Lines per page:&lt;/b> " . $lines_per_page . "&lt;br /><br />
			&amp;times;&lt;br /><br />
			&lt;b>Number of manuscript pages:&lt;/b> " . $ms_page_count . "&lt;br /><br />
			=&lt;br /><br />
			" . number_format($total_ms_chars) . " total characters in manuscript&lt;/p><br />
			&lt;p>&lt;b>Font:&lt;/b> " . $font . "&lt;br /><br />
			&lt;b>Characters per pica:&lt;/b> " . $cpp . "&lt;br /><br />
			&amp;times;&lt;br />&lt;b>Picas per line:&lt;/b> " . $measure . "&lt;br /><br />
			&amp;times;&lt;br /><br />
			&lt;b>Lines per typeset page:&lt;/b> " . $depth . "&lt;br /><br />
			=&lt;br /><br />
			" . number_format($total_page_chars) . " total characters per typeset page&lt;br /><br />
			&lt;b>Tight:&lt;/b> " . number_format($chars_tight) . "&lt;br /><br />
			&lt;b>Loose:&lt;/b> " . number_format($chars_loose) . "&lt;/p><br />
			&lt;p>Characters in manuscript &divide; characters per typeset page =&lt;br /><br />
			&lt;b>Normal:&lt;/b> " .  number_format($castoff) . " pages &amp;#8594; " . floor($castoff / 8) . " &amp;times; 8 + " . bcmod($castoff, '8') . " pages&lt;br /><br />
			&lt;b>Tight:&lt;/b> " . number_format($pages_tight) . " pages &amp;#8594; " . floor($pages_tight / 8) . " &amp;times; 8 + " . bcmod($pages_tight, '8') . " pages&lt;br /><br />
			&lt;b>Loose:&lt;/b> " . number_format($pages_loose) . " pages &amp;#8594; " . floor($pages_loose / 8) . " &amp;times; 8 + " . bcmod($pages_loose, '8') . " pages&lt;/p>";</p>
<p>?></code><br />
<span style="font-size:smaller;color:#666;">Photo: <a href="http://www.flickr.com/photos/ooocha/2844442207/">Auto Setter</a> by Marion Doss; <a href="http://creativecommons.org/licenses/by-sa/2.0/deed.en">some rights reserved</a>.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://itp.nyu.edu/~ia303/thunk/2008/11/10/phphun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
