<?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>Things n&#039; Stuff Programming</title>
	<atom:link href="http://geek.co.il/wp/category/software/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://geek.co.il/wp</link>
	<description>Thoughts about the universe in general</description>
	<lastBuildDate>Thu, 09 Sep 2010 01:45:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Kohana 3 RHEL/CentOS RPMs</title>
		<link>http://geek.co.il/wp/2010/05/28/kohana-3-rhelcentos-rpms</link>
		<comments>http://geek.co.il/wp/2010/05/28/kohana-3-rhelcentos-rpms#comments</comments>
		<pubDate>Fri, 28 May 2010 14:56:10 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Red Hat Enterprise Linux]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2010/05/28/kohana-3-rhelcentos-rpms</guid>
		<description><![CDATA[As I have not found any available, here is my build for Kohana &#8211; the PHP development framework &#8211; for RHEL 5 based operating systems. You can find Kohana RPM for the current stable release 3.0.5 here, and the source RPM is available here in case you want to rebuild it yourself (and you might, [...]]]></description>
			<content:encoded><![CDATA[<p>As I have not found any available, here is my build for <a class="zem_slink freebase/guid/9202a8c04000641f800000000a9ff71c" title="Kohana (web framework)" rel="homepage" href="http://kohanaphp.com">Kohana</a> &#8211; the <a class="zem_slink freebase/en/php" title="PHP" rel="homepage" href="http://www.php.net/">PHP</a> development framework &#8211; for <a class="zem_slink freebase/en/red_hat_enterprise_linux" title="Red Hat Enterprise Linux" rel="homepage" href="http://www.redhat.com/rhel/">RHEL</a> 5 based operating systems.</p>
<p>You can find <a href="http://rpms.geek.co.il/centos5/x86_64/">Kohana RPM for the current stable release 3.0.5 here</a>, and <a href="http://rpms.geek.co.il/centos5/SRPMS/">the source RPM is available here</a> in case you want to rebuild it yourself (and you might, details follow). New releases to correspond with new releases from Kohana will be updated there as needed.</p>
<p>This package is built on a <a class="zem_slink freebase/en/centos" title="CentOS" rel="homepage" href="http://www.centos.org/">CentOS</a> 5.4 machine, with pretty much default settings.</p>
<p><span id="more-1537"></span></p>
<p>Please note that Kohana is not tested with the PHP version 5.1.6 which is what RHEL/CentOS 5 uses by default, so there could be some problems with using it on such a default installation of the operating system. There was one place where Kohana uses a function in a way that is not supported on PHP 5.1.6, and I had to <a class="zem_slink freebase/en/patch" title="Patch (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Patch_%28computing%29">patch</a> that with a workaround.</p>
<p>This package includes additional patches that I felt where necessary, some to work around Kohana issues and some to add functionality that I felt is missing or or lacking. If there is interest I can expand on the work there. I do intend to submit all patches upstream, of course &#8211; once I&#8217;m more familiar with the community process of Kohana.</p>
<p>In the mean time, you can try it out and let me know if it works for you or not.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://blog.taragana.com/index.php/archive/top-5-free-linux-distributions-for-servers-in-2010/">Top 5 Free Linux Distributions for Servers in 2010</a> (taragana.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/248c6a04-81fb-44ee-b14a-ff6be15d39e1/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=248c6a04-81fb-44ee-b14a-ff6be15d39e1" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-info"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2010/05/28/kohana-3-rhelcentos-rpms/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet another programing language</title>
		<link>http://geek.co.il/wp/2009/11/11/yet-another-programing-language</link>
		<comments>http://geek.co.il/wp/2009/11/11/yet-another-programing-language#comments</comments>
		<pubDate>Wed, 11 Nov 2009 12:20:36 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Evangelism]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2009/11/11/yet-another-programing-language</guid>
		<description><![CDATA[Google have declared a new programming language &#8211; Go. Contrary to how the title might read, this post is not a tirade about the abundance of programming language &#8211; I just like this sort of expressions (and Google could have easily named Go as YAPL instead ). On the contrary &#8211; I&#8217;m all for a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://google-opensource.blogspot.com/2009/11/hey-ho-lets-go.html">Google have declared a new programming language &#8211; Go</a>. Contrary to how the title might read, this post is not a tirade about the abundance of programming language &#8211; I just like this sort of expressions (and Google could have easily named Go as YAPL instead <img src='http://geek.co.il/wp/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). On the contrary &#8211; I&#8217;m all for a large selection of good programming language to choose from, and a programming language coming from there, like any other Google product released, definitely warrants a more serious test then what I can offer in this rather quick post.</p>
<p>But I actually found out about Go from a friend that asked about it, didn&#8217;t mention Google, and gave me a link to the home page at <a href="http://golang.org">GoLang.org</a> where Google is not mentioned. So my review below was not influenced by any Google hype, and on the face of it, after reading through about half of the tutorial and a couple of other documents, I don&#8217;t like it.</p>
<p><span id="more-1221"></span></p>
<p>It is basically a C variant with garbage collection, some support for objects, a different type system (possibly better, definitely simpler then C++&#8217;s)  and internal support for threading and asynchronous IPC. I don&#8217;t like the fact that it has &#8220;native types&#8221; and &#8220;reference types&#8221; but requires the developer to know the difference and care about it (use new() vs. make(), Slices vs. Arrays, etc.) unlike Java which has similar issues but cares much less. Go is obviously built to compile fast and run fast with minimal considerations for coherent programming, and also to play into a few select people limited sense of &#8220;easy to program&#8221; &#8211; and the contrived syntax does not help.</p>
<p>Go also tries to adopt some useful features that were introduced in dynamic languages such as <a href="http://golang.org/doc/go_spec.html#Assignments">tuples</a>, <a href="http://golang.org/doc/go_spec.html#Function_literals">functions as 1st class values and closures</a> but in this C variant this only makes the syntax more contrived and less understandable, possibly due to the designer&#8217;s aversion from using parenthesis to group stuff.</p>
<p>I can see how it could be used to write small services instead of writing them in C or C++, and the benefits of that, but I would be very careful writing large software projects in this language, or small system administration tools.</p>
<p>The problems Go presents for large software development are in code reuse: lacking any sort of inheritance (not even Ruby-style mixins, though those would be obvious here) providing multiple implementations of an interface is going to be a pain. It looks like they prefer to implement polymorphism using services (as APIs or communication protocols) that reduce code duplication by importing functionality from packages &#8211; hardly what I&#8217;d consider sane for a large software project. Using flat packages (a-la C) for managing code is doable but allows developers to easily make a lot of mess and if I was designing a programming language with support for better code management I would have done it differently.</p>
<p>The problems Go presents for small system administration tools is that its overhead &#8211; while slightly lower then C or C++ &#8211; is still much higher then Perl and other dynamic languages (Ruby, Javascript, python) and possibly even higher then Java.</p>
<p>Its only benefits I see of Go are built-in multi-processing semantics with asynchronous communications, and possibly the small footprint which I guess would only interest people that have limits on the hardware they can deploy (small embedded systems, mobile devices, etc.). If you are planning to need these things, then by all means &#8211; go ahead and learn it, otherwise I suggest putting time into a more mature language with better semantics &#8211; like Ruby. It may be slower performing but it will allow you to deploy software faster and maintain it better.</p>
<p>After I&#8217;ve seen the Google blog post, I&#8217;d also like to comment that this new programming language came from several rather well known people:</p>
<ul>
<li>Rob Pike is one of the fathers of UNIX, author of programming books and well known hater of object oriented design.</li>
<li>Ken Thompson is also one of the fathers of UNIX and responsible to a large degree for C (and many of its horrors).</li>
<li>Russ Cox is like the previous two one of the people responsible for Plan 9, the failed UNIX sequel from Bell Labs.</li>
<li>And a few other folks who with a quick Googling I did not find any interesting information about them other then the fact that they work for Google <img src='http://geek.co.il/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</li>
</ul>
<p>All in all, a respected group that I feel will allow the Go programming language develop into a mature programming language on its own. But at the moment, I suggest staying away from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2009/11/11/yet-another-programing-language/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How many lines should a function have?</title>
		<link>http://geek.co.il/wp/2009/09/17/how-many-lines-should-a-function-have</link>
		<comments>http://geek.co.il/wp/2009/09/17/how-many-lines-should-a-function-have#comments</comments>
		<pubDate>Wed, 16 Sep 2009 23:51:29 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2009/09/17/how-many-lines-should-a-function-have</guid>
		<description><![CDATA[This question is probably one of the most debatable in programming, ever, and I wasn&#8217;t much surprised to find it also on Stack Overflow. Actually, I wasn&#8217;t surprised to find about a dozen different questions in the same gist, but here is the one that I really liked, especially some of the more interesting answers: [...]]]></description>
			<content:encoded><![CDATA[<p>This question is probably one of the most debatable in programming, ever, and I wasn&#8217;t much surprised to find it also on <a href="http://stackoverflow.com">Stack Overflow</a>. </p>
<p>Actually, I wasn&#8217;t surprised to find about a dozen different questions in the same gist, but here is the one that I really liked, especially some of the more interesting answers: <a href="http://stackoverflow.com/questions/1293548/how-many-lines-should-a-method-typically-have">How many lines should a method typically have?</a>.</p>
<p><span id="more-1177"></span></p>
<p>And to quote one of the answers that I really liked:</p>
<blockquote><p>
It should fit in my head.</p>
<p>That is to say, if I put my head against the monitor, the method should not be seen as extending past the boundaries of my head.
</p></blockquote>
<p>So what do you think should a method&#8217;s size be?</p>
<p>The way I see it &#8211; in the simplest terms &#8211; a function or method should be only as long to do one logical operation and no more. That being said, if your one logical operation is to large to fit on the screen, then something is very wrong with your logic <img src='http://geek.co.il/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2009/09/17/how-many-lines-should-a-function-have/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Script day: grep in jar (or zip) files</title>
		<link>http://geek.co.il/wp/2009/09/14/script-day-grep-in-jar-or-zip-files</link>
		<comments>http://geek.co.il/wp/2009/09/14/script-day-grep-in-jar-or-zip-files#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:07:32 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2009/09/14/script-day-grep-in-jar-or-zip-files</guid>
		<description><![CDATA[Here is another script I wrote for work and I thought it will be interesting enough to share: Say you want to check which JAR files (or ZIP files for that matter, as Java ARchive files are just ZIP files with a different extension) contain files that contain some text. grep is the obvious answer, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is another script I wrote for work and I thought it will be interesting enough to share: </p>
<p>Say you want to check which JAR files (or ZIP files for that matter, as Java ARchive files are just ZIP files with a different extension) contain files that contain some text. <code>grep</code> is the obvious answer, but how to grep files in JARs?</p>
<p><span id="more-1175"></span></p>
<p>A simple loop can go over the archives you are interested in, then <code>unzip -c</code> can extract the content of files to the standard output so that <code>grep</code> can be used on them:</p>
<p><code>
<pre>
pattern="smtp"
for jar in /usr/share/java/*.jar; do
    for file in $(unzip -l $jar | perl -nle 'split /\s+/ and print $_[-1];'); do
        unzip -c $jar $file | grep -qi "$pattern" &#038;&#038; (
            rpm -qf $jar 2>&#038;1 >/dev/null &#038;&#038; \
                rpm -qf $jar || \
                echo "orphan jar: $jar"
        );
    done
done | sort -u
</pre>
<p></code></p>
<p>This could also be written as single line in the terminal, obviously.</p>
<p>My version of the loop&#8217;s internal code looks at matching files and prints out the RPM they belong to or proclaim them to be orphaned files.</p>
<p>An alternative loop code might simply print the matching output and the file that contained it, a-la <code>grep -H</code>:</p>
<p><code>
<pre>
output="$(unzip -c $jar $file | grep -i "$pattern")"
[ -n "$output" ] &#038;&#038; echo "$jar, $file: $output"
</pre>
<p></code></p>
<p>Although there is an obvious bug in that last code example &#8211; see if you can figure it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2009/09/14/script-day-grep-in-jar-or-zip-files/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Insanity of Upstream</title>
		<link>http://geek.co.il/wp/2009/09/06/the-insanity-of-upstream</link>
		<comments>http://geek.co.il/wp/2009/09/06/the-insanity-of-upstream#comments</comments>
		<pubDate>Sun, 06 Sep 2009 17:32:04 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2009/09/06/the-insanity-of-upstream</guid>
		<description><![CDATA[Sometimes the Java community, or more specifically the people that write Java open source software, drive me nuts! For the past couple of week I&#8217;ve been trying to build a new version for the Jetty package based on the current Jetty6 package from JPackage, and in the process combating its hellish dependency tree and the [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the Java community, or more specifically the people that write Java open source software, drive me <em><strong>nuts</strong></em>!</p>
<p>For the past couple of week I&#8217;ve been trying to build a new version for the Jetty package based on the current Jetty6 package from JPackage, and in the process combating its hellish dependency tree and the way open source Java projects build opon each other in a complicated, confusing and often circular manner.</p>
<p><span id="more-1168"></span></p>
<p>Examples for circular dependencies are varied and not that interesting &#8211; In order to build Jetty you need some third party libraries, which in order to build them you need a provider of Servlet API 2.4, of which there are several candidates including the current version of Jetty (you need to build Jetty6 in order to be able to build Jetty6), the previous version of Jetty (you need to build Jetty5 in order to build Jetty6 &#8211; a bit less silly but still silly) or Tomcat (you need to build the competitor to Jetty in order to build Jetty &#8211; quite silly even if its open source we are talking about). </p>
<p>This is not the worst circular dependency &#8211; they were others far worst last time I tackled something like this (a couple of years back), like you need to have Jakarta&#8217;s commons-httpclient installed in order to be able to build Jakarta&#8217;s commons-httpclient. Luckily it appears they got that fixed.</p>
<h4>Update:</h4>
<p> Continuing to work on this, here is another problem I encountered: In order to build Jetty 6 you need wadi 2, which in order to build you need Maven 2 and specifically the Mojo Maven 2 plugin for javacc, which in order to build you need Xfire, which in order to build you need Jetty 6. Lather, Rinse, Repeat.</p>
<p>But what prompted this rant was another very common problem with Java open source project &#8211; feature creep in the worst kind of way: I&#8217;m trying to build the JAXB package, which is a simple interface to parse and build XML. It depends on args4j which is described as &#8220;a <em>small</em> Java class library that makes it easy to parse command line arguments&#8221;. First I&#8217;ve heard of it but oh well, lets try to build it. Well, apparently in order to build it it <strong>requires</strong> Saxon which is an XSLT processor. <em><strong>why ?!?</strong></em></p>
<p>Noticed the &#8220;small&#8221; part that I highlighted earlier? In my dictionary &#8220;small&#8221; includes many properties, one of which is <em>&#8220;Does not have large or complex external dependencies&#8221;</em>.</p>
<p>And you get this all the time when trying to build Java libraries and applications &#8211; up until now I had to install 2 versions of groovy, 2 versions of saxon, 3 versions of the Java development kit itself and I had to build and install Xalan twice (once for bootstrapping and a second time to actually get the xsltc processer I needed). </p>
<p>A few years back I ranted about this in an email to JPackage maintainer Ralph Apel at which point he replied that this is the best they can do to fight the insanity in the upstream.</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2009/09/06/the-insanity-of-upstream/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Script day &#8211; Shutting down multiple servers at once</title>
		<link>http://geek.co.il/wp/2009/07/20/script-day-shutting-down-multiple-servers-at-once</link>
		<comments>http://geek.co.il/wp/2009/07/20/script-day-shutting-down-multiple-servers-at-once#comments</comments>
		<pubDate>Mon, 20 Jul 2009 20:15:01 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Evangelism]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2009/07/20/script-day-shutting-down-multiple-servers-at-once</guid>
		<description><![CDATA[A system administrator in my company recently approached me with a problem &#8211; how to shutdown multiple Linux servers at the same time from a central location. Apparently this is something that people in the MS-Windows world use all kinds of applications, like the Remote Shutdown Tool from Microsoft (though I don&#8217;t understand how they [...]]]></description>
			<content:encoded><![CDATA[<p>A system administrator in my company recently approached me with a problem &#8211; how to shutdown multiple Linux servers at the same time from a central location. Apparently this is something that people in the MS-Windows world use all kinds of applications, like the <a href="http://support.microsoft.com/kb/317371">Remote Shutdown Tool</a> from Microsoft (though I don&#8217;t understand how they handle the authentication &#8211; this tools doesn&#8217;t seem to require any authentication so it appears that any person with network access can shutdown any computer).</p>
<p>Anyway, apparently searching the web for &#8220;Linux remote shutdown&#8221; yields no useful results (or so I&#8217;ve been told), but frankly &#8211; when you have standard UN*X tools at your fingertips, a remote shutdown tool is simply typing <code>ssh root@server shutdown -r now</code> at your local console. But still, for people who want a &#8220;tool&#8221; &#8211; read on.</p>
<p><span id="more-1135"></span></p>
<p>If you want to control multiple servers, it does gets a bit more tricky &#8211; you don&#8217;t really want to start sshing to server1, start the shutdown, ssh to server2, start the shutdown, lather, rinse, repeat.</p>
<p>So lets suppose you have a file with a list of all your servers. I&#8217;m assuming its a text file that looks something like this:<br />
<code>
<pre>
server1    1.2.3.4
server2    1.2.3.5
</pre>
<p></code></p>
<p>So here is a little something that scans such a list, calls each server to shut it down and waits 30 seconds for the server shutdown to complete. The assumption here is that you have exchange keys with each server so you can login as root to each server without the need to type in a password. If this is not the case, this script will attempt to publish your DSA key to the remote server so it will work better next time <img src='http://geek.co.il/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>Here is the script, with some inline documentation. Just copy and past it into a text file and make it executable. The server file is expected to be in a file named lan-servers.txt but its easy to change this.</p>
<p><code><br />
#!/bin/bash<br />
</code><code><br />
# where the server list sits<br />
LAN_LIST="$HOME/lan-servers.txt"<br />
</code><code>
<pre>
# Function to check if the server responds to ping
function testServer() {
    if ping -c1 $ip>/dev/null 2>&#038;1; then
	return 0
    else
	return 1
    fi
}
</pre>
<p></code><code>
<pre>
# get a list of IPs for the servers
function getServers() {
    cat $LAN_LIST  | egrep -v '^(#|\s*$)'  | perl -ple 's/\s+/ /g;' | cut -d' ' -f 2
}
</pre>
<p></code><code>
<pre>
# go over all servers
for ip in $(getServers); do
    # check if the server is alive
    if ! testServer $ip; then # if its not then its already down
	echo "Shutting down $ip: already down"
	continue; # to next server
    fi
</pre>
<p></code><code>
<pre>
    # check if I can log in to the server with no password
    if ! ssh -o "NumberOfPasswordPrompts 0" root@$ip '/bin/true' >/dev/null 2>&#038;1; then
	# if I can't, try to do a key exchange (this will require an interactive password prompt)
	cat $HOME/.ssh/id_dsa.pub | ssh root@$ip 'mkdir -p .ssh; cat >> .ssh/authorized_keys'
	# check if I can now log in to the server with no password
	if ! ssh -o "NumberOfPasswordPrompts 0" root@$ip '/bin/true' >/dev/null 2>&#038;1; then
	    # if I still can't then something is broken
	    echo "Failed to complete key exchange with $ip - skipping this server"
	    continue;
	fi
    fi
</pre>
<p></code><code>
<pre>
    # start to shutdown the server
    echo -n "Shutting down $(ssh root@$ip hostname)"
</pre>
<p></code><code>
<pre>
    # halt the remote server
    ssh root@$ip halt
    count=0
    # wait until its down or 30 seconds have passed
    while testServer $ip; do
        sleep 1; echo -n "."
        count=$(( $count + 1 )) # count up to 30
        if [ "$count" -gt 30 ]; then # if the server did not shutdown in 30 seconds, something is broken
    	    echo -n "Server did not shutdown properly!"
	    break;
	fi
    done
    echo ""
done
</pre>
<p></code></p>
<p>And thats it. Of course if you really want an application we can complicate it a lot more if we want &#8211; add a GUI, some command line switches, a web interface &#8211; what not. But the basic functionality is something that a sysadmin should be able to hack in a few minutes.</p>
<p>This story highlights one issue I have with MS-Windows: you need special apps to handle all kinds of simple administration tasks &#8211; for example my Brother uses a special program for batch renaming of files. This functionality is completely unneeded on Linux because your simple shell is so much more powerful and an advanced user can write much more complex renaming commands then what a GUI can offer, using simple bash commands.</p>
<p>The point is that some computer administration tasks are simple enough that you don&#8217;t need special tools &#8211; but what is considered &#8220;simple&#8221; is subjective also depending on your OS of choice. With MS-Windows simple stops at about the process of moving an entire directory tree. With Linux simple can be much <em>much</em> more interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2009/07/20/script-day-shutting-down-multiple-servers-at-once/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>פניני קוד</title>
		<link>http://geek.co.il/wp/2008/08/01/%d7%a4%d7%a0%d7%99%d7%a0%d7%99-%d7%a7%d7%95%d7%93</link>
		<comments>http://geek.co.il/wp/2008/08/01/%d7%a4%d7%a0%d7%99%d7%a0%d7%99-%d7%a7%d7%95%d7%93#comments</comments>
		<pubDate>Fri, 01 Aug 2008 11:37:02 +0000</pubDate>
		<dc:creator>Oded</dc:creator>
				<category><![CDATA[Evangelism]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="true">http://geek.co.il/wp/2008/08/01/%d7%a4%d7%a0%d7%99%d7%a0%d7%99-%d7%a7%d7%95%d7%93</guid>
		<description><![CDATA[מדי פעם יוצא לי לתחזק התקנת PHP Nuke ממש ישנה, ואני כל פעם מופתע מחדש מה&#8221;איכות&#8221; של הקוד: PHP Nuke הוא הדוגמה לכל מה שגרוע ב-PHP &#8211; זו טכנולוגיה לא רעה שהביאה את תכנות ה-Web להמוני אנשים שלא היתה להם דרך אחרת להתחיל, אבל זה גם הצד הרע שלה &#8211; PHP הביאה את התכנות להמוני [...]]]></description>
			<content:encoded><![CDATA[<p>מדי פעם יוצא לי לתחזק התקנת PHP Nuke ממש ישנה, ואני כל פעם מופתע מחדש מה&#8221;איכות&#8221; של הקוד: PHP Nuke הוא הדוגמה לכל מה שגרוע ב-PHP &#8211; זו טכנולוגיה לא רעה שהביאה את תכנות ה-Web להמוני אנשים שלא היתה להם דרך אחרת להתחיל, אבל זה גם הצד הרע שלה &#8211; PHP הביאה את התכנות להמוני אנשים שאין להם מושג בתכנות ואז אתה מקבל דברים כמו קוד שמביא פריטים מעץ הירארכי בעזרת הפונקציות GetKids ו-GetBabies (שקוראות אחת לשניה בלולאה), או את הקוד המבריק הזה:<br />
<span id="more-662"></span></p>
<p dir="ltr">
<code><br />
if ( (isset($tid)) &#038;&#038; (!isset($pid))) {<br />
  // do something<br />
} elseif ( ($mainfile) xor ( ($pid==0) AND (!isset($pid)))) {<br />
  // do something else<br />
} else {<br />
  if(!isset($pid)) $pid=0;<br />
  // do a third thing<br />
}<br />
</code>
</p>
<p>כל הקוד הזה מטופש, אבל הכי משך את עיני החלק האחרון של ה-<code>if</code> השני: &#8220;אם pid שווה לאפס וגם אינו מוגדר&#8221; .</p>
<p>אני רואה את ה-Script Kiddie שכותב את הקוד הזה &#8211; מוסיף תנאי ועוד אחד, וזה עדיין לא עובד כמו שצריך, אז נוסיף עוד תנאי פה ועוד תנאי כאן ואולי קצת סוגריים, עד שזה יעבוד.</p>
<p>זה לא שחסרה למרבית מתכנתי ה-PHP השכלה בסיסית במדעי המחשב &#8211; חסרה להם יכולת בסיסית לקרוא מדריכים, להבין אותם ולהסיק מסקנות, או חמור מזה &#8211; יכולת להסתכל על קוד ולהגיד &#8220;איכס! אפשר לכתוב את זה יותר טוב&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://geek.co.il/wp/2008/08/01/%d7%a4%d7%a0%d7%99%d7%a0%d7%99-%d7%a7%d7%95%d7%93/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
