Canol Gökel's bloghttp://smalltalk.gnu.org/blog/zuluuuuuu
enSimple XML Creatorhttp://smalltalk.gnu.org/blog/zuluuuuuu/simple-xml-creator
<p>Hello,</p>
<p>This is an extremely simple XML creator to create simple XML files quickly. The usage is like this:</p>
<p><pre>html := XMLNode new: 'html'.
body := html add: (XMLNode new: 'body').
body at: 'bgcolor' put: '#ff0000'.
h1 := body add: (XMLNode new: 'h1').
h1 value: 'My Heading'.
p := body add: (XMLNode new: 'p').
p value: 'My paragraph'.
html fileOut: '/home/myhome/sample.xml'.</pre></p>
<p>Which creates an XML file with the following content:</p>
<p><pre>&lt;html&gt;
&lt;body bgcolor=&quot;#ff0000&quot;&gt;
&lt;h1&gt;My Heading&lt;/h1&gt;
&lt;p&gt;My paragraph&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></p>
<p>You can download the package via:</p>
<p><pre>gst-package --download SimpleXMLCreator -t ~/.st</pre></p>
<p>or from:</p>
<p><a href="http://www.canol.info/smalltalk/packages/SimpleXMLCreator.star" title="http://www.canol.info/smalltalk/packages/SimpleXMLCreator.star" rel="nofollow">http://www.canol.info/smalltalk/packages/SimpleXMLCreator.star</a> (Non-GNU Smalltalkers can open the star package with their archive manager to look at the code, it is just a zip file)</p>http://smalltalk.gnu.org/blog/zuluuuuuu/simple-xml-creator#commentssimple xml ccreatorxmlWed, 31 Aug 2011 12:53:23 -0700Canol Gökel607 at http://smalltalk.gnu.orgCreating custom stock items in GTK+http://smalltalk.gnu.org/blog/zuluuuuuu/creating-custom-stock-items-gtk
<p>Let's say you want to put a tool button with a custom image, which is not among the stock items, to the toolbar of your GTK+ application. Here is the code for creating additional stock items from custom images:</p>
<p><pre>&quot;Variously sized versions of an image is held inside an icon set and icon sets are held inside icon factories. You may put one size of an image inside an icon set and GTK+ will scale it appropriately for your usage.&quot;
&quot;First create an icon factory.&quot;
myIconFactory := GtkIconFactory new.
&quot;Add that factory as a default icon factory so that the icons inside it can be found by the application.&quot;
myIconFactory addDefault.
&quot;The image we want to create the icon from.&quot;
myImage := GtkImage newFromFile: 'Path/To/My/Image.png'.
&quot;Create an icon set with our image inside. Here we use the convenience method #newFromPixbuf to create an icon set with one image inside.&quot;
myIconSet := GtkIconSet newFromPixbuf: myImage getPixbuf.
&quot;Finally, add our icon set to the icon factory and specify a stock item name for it. It is a convention to add a prefix for your application's custom stock item names.&quot;
myIconFactory add: 'myprefix-my-icon' iconSet: myIconSet.</pre></p>
<p>Now you can use your new stock item like this:</p>
<p><pre>GtkToolButton newFromStock: 'myprefix-my-icon'.</pre></p>http://smalltalk.gnu.org/blog/zuluuuuuu/creating-custom-stock-items-gtk#commentscreategtknewstock itemTue, 30 Aug 2011 16:23:47 -0700Canol Gökel606 at http://smalltalk.gnu.orgGNU Smalltalk Monthly Digest (April 2011)http://smalltalk.gnu.org/blog/zuluuuuuu/gnu-smalltalk-monthly-digest-april-2011
<p>Welcome to GNU Smalltalk (GST) monthly digest, a place to find a summary of happenings from the world of GST. If you don't know what GST is, you can look at [1] to learn more about this beautiful programming language.</p>
<p>Here are some of the news happened last month:</p>
<ul>
<li> Nicolas Petton announced Jtalk. Jtalk is an implementation of the Smalltalk language that runs on top of the JavaScript runtime:</li>
</ul>
<p><a href="http://forum.world.st/Jtalk-a-Smalltalk-for-web-developers-td3354669.html" title="http://forum.world.st/Jtalk-a-Smalltalk-for-web-developers-td3354669.html" rel="nofollow">http://forum.world.st/Jtalk-a-Smalltalk-for-web-developers-td3354669.htm...</a></p>
<ul>
<li> Gwenael Casaccio is now a part of Planet GNOME:</li>
</ul>
<p><a href="http://smalltalk.gnu.org/blog/mrgwen/hello-planet-gnome" title="http://smalltalk.gnu.org/blog/mrgwen/hello-planet-gnome" rel="nofollow">http://smalltalk.gnu.org/blog/mrgwen/hello-planet-gnome</a></p>
<ul>
<li> GNU Smalltalk 3.2.4 released:</li>
</ul>
<p><a href="http://smalltalk.gnu.org/blog/mrgwen/gnu-smalltalk-3-2-4" title="http://smalltalk.gnu.org/blog/mrgwen/gnu-smalltalk-3-2-4" rel="nofollow">http://smalltalk.gnu.org/blog/mrgwen/gnu-smalltalk-3-2-4</a></p>
<ul>
<li> GNU Smalltalk 4.1 is also released:</li>
</ul>
<p><a href="http://forum.world.st/GNU-Smalltalk-4-1-released-td3419830.html" title="http://forum.world.st/GNU-Smalltalk-4-1-released-td3419830.html" rel="nofollow">http://forum.world.st/GNU-Smalltalk-4-1-released-td3419830.html</a></p>
<ul>
<li> Mathieu Suen explains how to use MiniDebugger, a command line debugger for GST:</li>
</ul>
<p><a href="http://smalltalk.gnu.org/blog/mathk/how-use-minideubgger" title="http://smalltalk.gnu.org/blog/mathk/how-use-minideubgger" rel="nofollow">http://smalltalk.gnu.org/blog/mathk/how-use-minideubgger</a></p>
<ul>
<li> The WebQA did an interview with Nicolas Petton:</li>
</ul>
<p><a href="http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-javascript-runtime/" title="http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-javascript-runtime/" rel="nofollow">http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-ja...</a></p>
<ul>
<li> Chasing memory leaks:</li>
</ul>
<p><a href="http://forum.world.st/Strategy-to-finding-memleaks-td3438067.html" title="http://forum.world.st/Strategy-to-finding-memleaks-td3438067.html" rel="nofollow">http://forum.world.st/Strategy-to-finding-memleaks-td3438067.html</a></p>
<p>[1] GNU Smalltalk is a free implementation of the Smalltalk-80 programming language. It runs on most POSIX compatible operating systems (including GNU/Linux, of course), as well as under Windows. Smalltalk is a dynamic, purely object-oriented programming language, also well-versed in scripting tasks. You can get more information from:</p>
<p><a href="http://smalltalk.gnu.org/" title="http://smalltalk.gnu.org/" rel="nofollow">http://smalltalk.gnu.org/</a></p>
<p>Mailing list:</p>
<p><a href="http://smalltalk.gnu.org/community/ml" title="http://smalltalk.gnu.org/community/ml" rel="nofollow">http://smalltalk.gnu.org/community/ml</a><br />
<a href="http://forum.world.st/Gnu-f1290346.html" title="http://forum.world.st/Gnu-f1290346.html" rel="nofollow">http://forum.world.st/Gnu-f1290346.html</a></p>
<p>Blogs:</p>
<p><a href="http://smalltalk.gnu.org/blog" title="http://smalltalk.gnu.org/blog" rel="nofollow">http://smalltalk.gnu.org/blog</a></p>
<p>Wiki:</p>
<p><a href="http://smalltalk.gnu.org/wiki" title="http://smalltalk.gnu.org/wiki" rel="nofollow">http://smalltalk.gnu.org/wiki</a></p>http://smalltalk.gnu.org/blog/zuluuuuuu/gnu-smalltalk-monthly-digest-april-2011#comments2011aprilgnu smalltalkmonthly digestSat, 09 Apr 2011 08:55:04 -0700Canol Gökel582 at http://smalltalk.gnu.orgNicolas Petton Interviewhttp://smalltalk.gnu.org/blog/zuluuuuuu/nicolas-petton-interview
<p><a href="http://www.thewebqa.com/" rel="nofollow">The WebQA</a> did an interview with Nicolas Petton, co-author/author of Iliad Web Framework and Jtalk. You can find the interview here:</p>
<p><a href="http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-javascript-runtime/" title="http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-javascript-runtime/" rel="nofollow">http://www.thewebqa.com/javascript/nicolas-petton-on-smalltalk-on-the-ja...</a></p>http://smalltalk.gnu.org/blog/zuluuuuuu/nicolas-petton-interview#commentsMon, 04 Apr 2011 09:14:18 -0700Canol Gökel580 at http://smalltalk.gnu.orgInstalling GNU Smalltalk on Ubuntu 10.10http://smalltalk.gnu.org/blog/zuluuuuuu/installing-gnu-smalltalk-ubuntu-10-10
<p>Ubuntu usually comes with an older version of GNU Smalltalk. To install a healthy GNU Smalltalk development environment which includes an IDE as well, here are the steps:</p>
<ol>
<li> Download the latest stable version (currently 3.2.4) using FTP:<p><a href="ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-3.2.4.tar.gz" title="ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-3.2.4.tar.gz" rel="nofollow">ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-3.2.4.tar.gz</a></p></li>
<li> Install the following dependencies using Synaptic Package Manager:<ul>
<li> build-essential (the base compiler system)</li>
<li> texinfo</li>
<li> gawk</li>
<li> libreadline (for convenience when using commandline (recommended))</li>
<li> libreadline-dev (for convenience when using commandline (recommended))</li>
<li> git (for using gst-package --download (recommended))</li>
<li> libgnutls (for using gst-package --download (recommended))</li>
<li> libgnutls-dev (for using gst-package --download (recommended))</li>
<li> libgtk2.0 (for gst-browser IDE (recommended))</li>
<li> libgtk2.0-dev (for gst-browser IDE (recommended))</li>
<li> libcairo2 (for gst-browser IDE (recommended))</li>
<li> libcairo2-dev (for gst-browser IDE (recommended))</li>
<li> tcl (for gst-blox IDE (optional))</li>
<li> tcl-dev (for gst-blox IDE (optional))</li>
<li> tk (for gst-blox IDE (optional))</li>
<li> tk-dev (for gst-blox IDE (optional))</li>
</ul></li>
<li> Extract the tarball you've downloaded to a folder, open a terminal and type:</li>
</ol>
<p><pre>cd /the-folder-path-you-have-extracted
./configure
make
sudo make install</pre></p>
<p>respectively. Then you will be able to use the GNU Smalltalk IDE (which is called VisualGST) by entering the command below to your terminal:</p>
<p><pre>gst-browser</pre></p>
<p>or if you want to use the old IDE:</p>
<p><pre>gst-blox</pre></p>
<p>or if you want to use command line (without any IDE):</p>
<p><pre>gst</pre></p>http://smalltalk.gnu.org/blog/zuluuuuuu/installing-gnu-smalltalk-ubuntu-10-10#commentsFri, 04 Mar 2011 08:40:02 -0700Canol Gökel560 at http://smalltalk.gnu.orgGNU Smalltalk 3.2 is availablehttp://smalltalk.gnu.org/blog/zuluuuuuu/gnu-smalltalk-3-2-available
<p>I'm writing here so that it appears on the planet. GNU Smalltalk 3.2 is now available. It has lots of new features like:</p>
<ul>
<li> gst-browser (or VisualGST), a brand new browser written using GTK+ which replaces the old gst-blox which was written using Tk. It looks beautiful and already has lots of features.</li>
</ul>
<ul>
<li> gst-package which allows you to download packages via internet. You can grab Iliad Web Framework in just a few seconds and you are ready to go!</li>
</ul>
<p>More detailed list of the new features and bug fixes are at: <a href="http://smalltalk.gnu.org/news/gnu-smalltalk-3-2" title="http://smalltalk.gnu.org/news/gnu-smalltalk-3-2" rel="nofollow">http://smalltalk.gnu.org/news/gnu-smalltalk-3-2</a></p>http://smalltalk.gnu.org/blog/zuluuuuuu/gnu-smalltalk-3-2-available#comments3.2gnu smalltalknew releaseSun, 02 May 2010 13:37:11 -0700Canol Gökel490 at http://smalltalk.gnu.org"Computer Programming using GNU Smalltalk" is available on Lulu.comhttp://smalltalk.gnu.org/blog/zuluuuuuu/computer-programming-using-gnu-smalltalk-available-lulu-com
<p>After the release of my small book, quite a few people asked if there is an edition to buy on Lulu.com. So here it is, I hope you’ll enjoy reading it :)</p>
<p><a href="http://www.lulu.com/content/paperback-book/computer-programming-using-gnu-smalltalk/7746227" title="http://www.lulu.com/content/paperback-book/computer-programming-using-gnu-smalltalk/7746227" rel="nofollow">http://www.lulu.com/content/paperback-book/computer-programming-using-gn...</a></p>
<p>You can still get the e-book version as free:</p>
<p><a href="http://www.canol.info/books/computer_programming_using_gnu_smalltalk" title="http://www.canol.info/books/computer_programming_using_gnu_smalltalk" rel="nofollow">http://www.canol.info/books/computer_programming_using_gnu_smalltalk</a></p>http://smalltalk.gnu.org/blog/zuluuuuuu/computer-programming-using-gnu-smalltalk-available-lulu-com#commentsTue, 20 Oct 2009 15:52:00 -0700Canol Gökel419 at http://smalltalk.gnu.orgXML: <!-- Weirdly --> Extensible Markup Languagehttp://smalltalk.gnu.org/blog/zuluuuuuu/xml-weirdly-extensible-markup-language
<p>I was looking at XML these days. It is really interesting language. It is very useful and I like it a lot and I used it in some of my projects to save data but as I learn how I can extend it or use the not well known features, it confuses me.</p>
<p>For example, you can create <em>entities</em>, which are like <em>variables</em> in other languages. You can define/declare entities like this:</p>
<p><code>&lt;!ENTITY client &quot;Canol&quot;&gt;</code></p>
<p>Here, we created an entity named <em>client</em> and which has a value of <em>Canol</em>. The thing I cannot understand is that why we use such a not understandable syntax. It is against to the intention of XML, which is being readable. Why can't we just use an XML like syntax for this, like:</p>
<p><code>&lt;entity name=&quot;client&quot;&gt;Canol&lt;/entity&gt;</code></p>
<p>Ok, the user should be able to define his/her own element named <em>entity</em>, so let's write it like this:</p>
<p><code>&lt;!entity name=&quot;client&quot;&gt;Canol&lt;/!entity&gt;</code></p>
<p>So, a predefined element (like <em>keywords</em> in other languages) are beginning with exclamation mark.</p>
<p>You can also use entities which are not to be replaced by XML processor and then it looks even uglier, like:</p>
<p><code>&lt;!ENTITY mypicture SYSTEM &quot;canol.gif&quot; NDATA GIF&gt;</code></p>
<p>You cannot even guess why we wrote Assembly like words <em>SYSTEM</em>, <em>NDATA</em> and <em>GIF</em>. You should learn this weird rules of XML. It is like learning what the parts before and after semi-colons do in <em>for</em> loops in languages like C:</p>
<p><code>for (part 1; part 2; part 3)</code></p>
<p>You cannot guess them, you should read the rules for writing for loops from somewhere. But, for example, in Python:</p>
<p><code>for i in range(1, 5)</code></p>
<p>You can most probably guess what <em>i</em> does here, right? And the above example could be:</p>
<p><code>&lt;!entity name=&quot;mypicture&quot; type=&quot;ndata/gif&quot;&gt;canol.gif&lt;/!entity&gt;</code></p>
<p>XML is full of such interesting things, even &lt;!&#45;&#45; and &#45;&#45;&gt; look ugly to me. Was there really no other way, that they have to come up with these things? Then why are they allowing us to define the xml version like this:</p>
<p><code>&lt;?xml version=&quot;1.0&quot;?&gt;</code></p>
<p>And not like this:</p>
<p><code>&lt;!&#91;&#91;?&#45;&#45;XML version SYSTEM COMPUTER &quot;1.0&quot; MEMORY CDATA REFRIGERATOR&#45;&#45;?&#93;&#93;!&gt;</code></p>http://smalltalk.gnu.org/blog/zuluuuuuu/xml-weirdly-extensible-markup-language#commentssyntaxxmlTue, 29 Jul 2008 12:17:24 -0700Canol Gökel238 at http://smalltalk.gnu.orgBroken a Recordhttp://smalltalk.gnu.org/blog/zuluuuuuu/broken-record
<p>Today, I've just broken my old record of writing an errorless program at the first try with 29 lines of code which includes creating classes, subclasses, methods, comments and doing some test :) Hooray Smalltalk! What is your record and in what language? Leave a comment :)</p>http://smalltalk.gnu.org/blog/zuluuuuuu/broken-record#commentsrecordThu, 24 Jul 2008 08:59:09 -0700Canol Gökel237 at http://smalltalk.gnu.orgSmalltalk and Turkishhttp://smalltalk.gnu.org/blog/zuluuuuuu/smalltalk-and-turkish
<p>I realized one important thing which pulls me towards Smalltalk, subconsciously. Smalltalk's syntax resembles Turkish in some ways. I will try to show it via examples.</p>
<p>The first thing which seperates Turkish from other English like languages is that verbs are put at the end of sentences, not after the subject. In English, the order of sentence components is:</p>
<p><pre>Subject verb object.</pre></p>
<p>In Turkish:</p>
<p><pre>Subject object verb.</pre></p>
<p>In Turkish, you can join subject and verb into 1 word. In that case it is like:</p>
<p><pre>Object verb.</pre></p>
<p>The key thing here is that objects are &quot;before&quot; the verbs in English and &quot;after&quot; the verbs in Turkish. Let's take some examples:</p>
<p><pre>1 to: 3 do: [something].</pre></p>
<p>In English like languages you normally tell such a pattern as:</p>
<p><pre>Do something from 1 to 3.</pre></p>
<p>In Turkish:</p>
<p><pre>1'den 3'e kadar birşey yap.</pre></p>
<p>&quot;1'den 3'e kadar&quot; means &quot;1 to 3&quot;. &quot;birşey yap&quot; means &quot;do something&quot;. In Turkish &quot;what to do&quot; is said after specifying other details. But in English you first say what to do and then specify the details.</p>
<p>Take an example for splitting a string. A message might be formed like this:</p>
<p><pre>'A string to be splitted' split.</pre></p>
<p>In english you would say:</p>
<p><pre>Split the sentence &quot;A string to be splitted&quot;.</pre></p>
<p>In Turkish:</p>
<p><pre>&quot;Bölünecek cümle&quot; cümlesini böl.</pre></p>
<p>&quot;cümlesini&quot; means &quot;sentence&quot; and &quot;böl&quot; means &quot;split&quot;. In programming we don't need to specify that it is a sentence because it is understood from single quotes. So let's form English and Turkish sentences without &quot;the sentence&quot; and &quot;cümlesini&quot;:</p>
<p>In English:</p>
<p><pre>Split &quot;A string to be splitted&quot;.</pre></p>
<p>In Turkish:</p>
<p><pre>&quot;Bölünecek cümle&quot; böl.</pre></p>
<p>Can you see the closeness of Smalltalk expression and Turkish sentence?</p>
<p><pre>'A string to be splitted' split.
&quot;A string to be splitted&quot; böl.</pre></p>
<p>Maybe a C++ or Tcl like syntax is more close to English in this one:</p>
<p><pre>split(&quot;this sentence&quot;);
split &quot;this sentence&quot;
Split &quot;A string to be splitted&quot;.</pre></p>
<p>This is because in Turkish, you first tell the object and then what to do with it, in contrast to English inwhich you first tell what to do and then the object in concern.</p>
<p>Now take the ifTrue: controlling message:</p>
<p><pre>[something] ifTrue: [do another thing].</pre></p>
<p>In English you would say:</p>
<p><pre>if something is true do another thing.</pre></p>
<p>It is close but not as close as Turkish because you give the &quot;controlling meaning&quot; before the condition via &quot;if&quot;. In Turkish you give the condition first and then give the controlling meaning:</p>
<p><pre>Birşey doğruysa başka birşey yap.</pre></p>
<p>&quot;Birşey&quot; means &quot;something&quot;, &quot;doğruysa&quot; means &quot;if true&quot; and &quot;başka birşey yap&quot; means &quot;do another thing&quot;.</p>
<p><pre>Birşey =&gt; [something]
doğruysa =&gt; ifTrue:
başka birşey yap =&gt; [do another thing]</pre></p>
<p>The classic C style is more close to English:</p>
<p><pre>if (something is true) do another thing;</pre></p>
<p>We can tell the same thing with whileTrue: message.</p>
<p>In conclusion: Although in some situations C style syntax is more close to English; in general, Smalltalk is more close to both English and Turkish compared to C style syntax. But it is even more close to a Turkish language user. There are &quot;suffixes&quot; in Turkish which causes some serious differences between Turkish and English/Smalltalk but the main order of sentence components causes it to feel native to Turkish people. I read somewhere about Turkish being an ideal computer language syntax but didn't see an example until Smalltalk. But I think the suffix system of Turkish language would make a computer language design unnecessarily complex, like the article system of German language (der die das) would, too.</p>
<p>Maybe the thing I mentioned above is one of the reasons why I fall in love with Smalltalk syntax.</p>http://smalltalk.gnu.org/blog/zuluuuuuu/smalltalk-and-turkish#commentssmalltalkturkishThu, 17 Jul 2008 14:34:32 -0700Canol Gökel235 at http://smalltalk.gnu.org