<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>programming &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/programming/</link>
	<description>Feed of posts on WordPress.com tagged "programming"</description>
	<pubDate>Fri, 16 May 2008 03:13:54 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Tips bikin Random Images di halaman web....]]></title>
<link>http://tekkomerz.wordpress.com/?p=75</link>
<pubDate>Fri, 16 May 2008 02:28:54 +0000</pubDate>
<dc:creator>ipa8</dc:creator>
<guid>http://tekkomerz.wordpress.com/?p=75</guid>
<description><![CDATA[Sip..kali ni ane mau bagi2 tips cara bikin Random Images di web site, jadi setiap di refresh gambarn]]></description>
<content:encoded><![CDATA[<p>Sip..kali ni ane mau bagi2 tips cara bikin Random Images di web site, jadi setiap di refresh gambarnya berubah...<br />
Ada 2 cara, pertama pake bahasa PHP n pake java script.. Untuk yang ni ane kasih tips pake java scipt, kalo php ane dah  nyoba tapi belum berhasil jadi gak dikasih dulu...heheheh</p>
<p>ok...siapin dulu gambar nya, terserah mau berapa aja</p>
<p>1. ubah nama gambarnya berurutan.. misal:</p>
<ul>
<li>img1</li>
<li>img2</li>
<li>img3</li>
<li>dst</li>
</ul>
<p>2. trus ketik javascript dibawah ini n posisikan dalam tag&#60;head&#62;&#60;/head&#62; :</p>
<p>&#60;script&#62;<br />
NumberOfImagesToRotate = 6;</p>
<p>&#60;!--Angka 6 itu sesuai dengan jumlah gambar yang ada--&#62;</p>
<p>FirstPart = '&#60;img src="images/img';<br />
LastPart = '.jpg" width="540" height="150" border="2" style="border-color:#0033FF; "&#62;';</p>
<p>function printImage() {<br />
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);<br />
document.write(FirstPart + r + LastPart);<br />
}<br />
&#60;/script&#62;</p>
<p>3. trus panggil fungsi printImage() di dalam &#60;body&#62;&#60;/body&#62;..misal :</p>
<p>&#60;body&#62;<br />
&#60;script type="text/javascript" language="JavaScript" &#62;<br />
printImage();<br />
&#60;/script&#62;<br />
&#60;/body&#62;</p>
<p>4. trus jalankan halaman di browser kesayangan ente...</p>
<p>Met coba,,,kalo bingung tanya aja ke ane...OK<br />
moga bermanfaat...!!!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Membuat Tampilan XP pada Visual Basic TANPA OCX]]></title>
<link>http://poenyardhi.wordpress.com/?p=37</link>
<pubDate>Fri, 16 May 2008 01:02:43 +0000</pubDate>
<dc:creator>mzardhi</dc:creator>
<guid>http://poenyardhi.wordpress.com/?p=37</guid>
<description><![CDATA[halo semua,
ini aku mau berbagi nich, selain actskin.ocx ada juga lho yang bisa membuat tampilan pro]]></description>
<content:encoded><![CDATA[<p>halo semua,</p>
<p>ini aku mau berbagi nich, selain actskin.ocx ada juga lho yang bisa membuat tampilan program Qta jadi tampilan XP. Sebelumnya program kamu EXE. nah setelah itu kamu kamu tulis script dibawah ini "<strong>Pake Notepad</strong>" kemudian kamu simpan filenya dengan nama <strong>nama project kamu.EXE.MANIFEST</strong> ex: "<strong>project1.exe.manifest</strong>" kalo sudah maka saat kamu coba nampilkan program kamu . semua tampilan yang semula default VB maka akan berubah jadi XP.</p>
<p>&#60;?xml version="1.0" encoding="UTF-8" standalone="yes"?&#62;<br />
&#60;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&#62;<br />
&#60;assemblyIdentity<br />
version="1.0.0.0"<br />
processorArchitecture="X86"<br />
name="eindraz.Kontraktor.Main"<br />
type="win32"<br />
/&#62;<br />
&#60;description&#62;Contractor Application&#60;/description&#62;<br />
&#60;dependency&#62;<br />
&#60;dependentAssembly&#62;<br />
&#60;assemblyIdentity<br />
type="win32"<br />
name="Microsoft.Windows.Common-Controls"<br />
version="6.0.0.0"<br />
processorArchitecture="X86"<br />
publicKeyToken="6595b64144ccf1df"<br />
language="*"<br />
/&#62;<br />
&#60;/dependentAssembly&#62;<br />
&#60;/dependency&#62;<br />
&#60;/assembly&#62;</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Learning Interesting Things Pt III: ASP.Net Ajax]]></title>
<link>http://olivertower.wordpress.com/?p=30</link>
<pubDate>Fri, 16 May 2008 00:52:45 +0000</pubDate>
<dc:creator>charlieoliver</dc:creator>
<guid>http://olivertower.wordpress.com/?p=30</guid>
<description><![CDATA[I&#8217;ve been learning a ton about ASP.Net and its newest version 3.5 which contains some extremel]]></description>
<content:encoded><![CDATA[<p>I've been learning a ton about ASP.Net and its newest version 3.5 which contains some extremely handy feautures including some seriously awesome Ajax integration.  Needless to say my head has been stuck in <a href="http://msdn.microsoft.com/en-us/asp.net/aa940748.aspx">tutorials</a>, <a href="http://www.asp.net/AJAX/">videos</a> and <a href="http://http://www.asp.net/AJAX/documentation/">example</a> code for the past week.  Briefly I'm going to run down some of the features that I have found of particular interest.</p>
<p>I'm really glad that Microsoft has jumped on board with this and has put all the chips in so to speak.  With built in functionality for Ajax applications it makes ASP.Net a real contender in the space.  And with the <a href="http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=11121">Ajax control toolkit</a> being a community project it makes it a real viable option to take and use Microsoft technology even for those that see Microsoft as the closed source behemoth it still partially is, albeit slowly lumbering in the general direction of community openness.  Now on to the features.</p>
<ul>
<li>Code Behind for js files (I saw this in 2.0, but haven't seen it in 3.5... sure its still there just need to relocate it... All in all a really neat feature and something that a C# dev can understand)</li>
<li><a href="http://www.asp.net/learn/3.5-extensions-videos/">Extenders</a> for ASP.Net controls (This is so very very cool and something that makes it really powerful)</li>
<li>Update Panels (allowing you to drop in what you need to ajaxify it, and you know everything it should affect)</li>
<li>JavaScript IntelliSense (Not fantastic but definitely invaluable)</li>
</ul>
<p>So, what else is there?  Leave a comment telling me what I should be looking at and where.  Or, if you have an interesting thing for me to learn about send an e-mail my way: charlie.oliver {at} gmail {dot} com.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[How to Find Shell (System) Folders in Win32 from C/C++]]></title>
<link>http://justcheckingonall.wordpress.com/?p=169</link>
<pubDate>Fri, 16 May 2008 00:52:26 +0000</pubDate>
<dc:creator>JustChecking</dc:creator>
<guid>http://justcheckingonall.wordpress.com/?p=169</guid>
<description><![CDATA[It&#8217;s possible to refer to e.g. My Documents folder on your own computer by the path you know, ]]></description>
<content:encoded><![CDATA[<p>It's possible to refer to e.g. <em>My Documents</em> folder on your own computer by the path you know, and it'll work. But if you want to distribute your program among users, you cannot expect the fixed path to work. E.g. Windows allow you to save user's profile folders anywhere on the disk you want; it's not a rule that all are saved under <em>Documents and Settings</em>; e.g. mine are saved under folder called <em>Profiles</em>, since I wanted to preserve the original <em>Documents and Settings</em> from my previous Windows installation. Also, Windows need not to be installed under <em>C:\Windows</em>; mine are under <em>C:\Windows.1</em>.</p>
<p>But, there is a (quite) simple way to find all the necessary system folders in Windows. All you have to do is be a bit careful.</p>
<p><!--more--></p>
<p>There is a registry key <tt>HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ Shell Folders</tt>. This key contains several values that indicate where various special folders are kept on the user's hard drive.</p>
<p><strong>But!</strong> When the operating system is first installed, it <strong>does not add these values to this registry key</strong>. These values are added when any application calls the <tt>SHGetSpecialFolderLocation()</tt> function for the very first time. Also, this function uses this registry value in an algorithm to determine the user's personal directory, and this algorithm is likely to change in future versions of Windows. Because of this, <strong>you should never access this registry key directly</strong>.</p>
<p>The Win32 <strong>shlobj.h</strong> header file prototypes the <tt>SHGetSpecialFolderLocation()</tt> function and defines some symbols for use with this function. The function prototype is shown here, and the symbols can be found in the Win32 SDK documentation.</p>
<pre>HRESULT SHGetSpecialFolderLocation(HWND hwndOwner, int nFolder, LPITEMIDLIST* ppidl);</pre>
<p>The shell and its functions all work with item IDs, lists of item IDs, and pointers to lists of item IDs. When you call <tt>SHGetSpecialFolderLocation()</tt>, you pass a special folder symbol in the <tt>nFolder</tt> parameter. E.g. to get the user's personal directory, pass <tt>CLSID_PERSONAL</tt> for this parameter. The function then allocates a block of memory that contains a contiguous list of item IDs. Each item ID is a binary representation of an item in the shell's namespace. The root of the shell's namespace is the <em>Desktop</em>, and a list of item IDs is the binary representation of an item's location in the namespace starting from the <em>Desktop</em>. <tt>SHGetSpecialFolderLocation()</tt>'s last parameter, <tt>ppidl</tt>, is a pointer to an <tt>LPITEMIDLIST</tt> variable that you must allocate (you just allocate <em>the pointer</em>, not any additional memory). This pointer's value is set to point to the block of memory allocated for the special folder's item ID list just before the <tt>SHGetSpecialFolderLocation()</tt> function returns.</p>
<p>Then, you must convert an item ID list to a fully qualified path name that the file system understands. Calling <tt>SHGetPathFromIDList()</tt> does the trick:</p>
<pre>BOOL SHGetPathFromIDList(LPCITEMIDLIST pidl, LPSTR pszPath);</pre>
<p>The <tt>pidl</tt> parameter is a pointer to an ID list (returned from <tt>SHGetSpecialFolderLocation()</tt>), and the <tt>pszPath</tt> parameter identifies a character buffer that gets the folder's path name. The path's buffer must be at least <tt>_MAX_PATH</tt> characters long.</p>
<p>The last step, which is easy to forget, is to <em>free the item ID list</em>. The <tt>SHGetSpecialFolderLocation()</tt> function allocates memory for the item ID list by using the calling process's task allocator. <strong>You are responsible for freeing this memory</strong> by using the task's allocator. You get the task's allocator by calling <tt>SHGetMalloc()</tt>:</p>
<pre>HRESULT SHGetMalloc(LPMALLOC * ppMalloc);</pre>
<p>This function returns a pointer to an <tt>IMalloc</tt> interface that you can use to free the item ID list. Following code demonstrates all the steps necessary to get the full path of a special folder:</p>
<pre>// Allocate a pointer to an Item ID list
LPITEMIDLIST pidl;

// Get a pointer to an item ID list that represents the path of a special folder
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &#38;pidl);

// Convert the item ID list's binary representation into a file system path
char szPath[_MAX_PATH];
BOOL f = SHGetPathFromIDList(pidl, szPath);

// Allocate a pointer to an IMalloc interface
LPMALLOC pMalloc;

// Get the address of our task allocator's IMalloc interface
hr = SHGetMalloc(&#38;pMalloc);

// Free the item ID list allocated by SHGetSpecialFolderLocation
pMalloc-&#62;Free(pidl);

// Free our task allocator
pMalloc-&#62;Release();

// Work with the special folder's path (contained in szPath)...</pre>
<p>And that's it! Good luck!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Request For Comment: NomNom]]></title>
<link>http://karpology.wordpress.com/?p=53</link>
<pubDate>Fri, 16 May 2008 00:19:44 +0000</pubDate>
<dc:creator>Brent</dc:creator>
<guid>http://karpology.wordpress.com/?p=53</guid>
<description><![CDATA[using System;
namespace Silly
{
/// &lt;summary&gt;
/// Wrapper to facilitate the nom-nom-nom anti-p]]></description>
<content:encoded><![CDATA[<p>using System;</p>
<p>namespace Silly<br />
{<br />
/// &#60;summary&#62;<br />
/// Wrapper to facilitate the nom-nom-nom anti-pattern<br />
/// &#60;/summary&#62;<br />
/// &#60;typeparam name="T"&#62;&#60;/typeparam&#62;<br />
public static class NomNom&#60;T&#62;<br />
{<br />
public static void Nom&#60;WTF&#62;(Func&#60;WTF&#62; action)<br />
{<br />
try { action(); }<br />
catch { } // this is the om nom nom nom pattern<br />
}</p>
<p>public static void Nom&#60;WTF&#62;(Action&#60;WTF&#62; action, WTF input)<br />
{<br />
try { action(input); }<br />
catch { }<br />
}<br />
}<br />
}</p>
<p>private static void TestSilly()<br />
{<br />
NomNom&#60;int&#62;.Nom&#60;int&#62;(OMGBOOMZ(), -1);<br />
}</p>
<p>private static Action&#60;int&#62; OMGBOOMZ()<br />
{<br />
return x =&#62; { --x; List&#60;int&#62; xx = new List&#60;int&#62;(); xx[x]++; };<br />
}</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Shut Up About Your Language]]></title>
<link>http://irrefutablelogic.wordpress.com/?p=7</link>
<pubDate>Fri, 16 May 2008 00:17:22 +0000</pubDate>
<dc:creator>Rob Signorelli</dc:creator>
<guid>http://irrefutablelogic.wordpress.com/?p=7</guid>
<description><![CDATA[Lurking the posts of various tech and programming related sites it&#8217;s impossible to find one de]]></description>
<content:encoded><![CDATA[<p>Lurking the posts of various tech and programming related sites it's impossible to find one devoid of a never-ending series of bickering about why programming language X is so much better than programming language Y:</p>
<ul>
<li>[Rabblerouser 1]: Ruby's got awesome collection support and RAILS!!!!! OMGF!!!! If you don't learn it, you're just going to get left behind and I'm going to get your car, your job AND your woman (I always wanted a woman)...</li>
<li>[Rabblerouser 2]: Python has elegant first class functions and continuations. So I can write programs that you could only dream about in other languages. If you're not using the lambda calculus you're not really programming.</li>
<li>[Rabblerouser 3]: Who needs those? C++ has pointers so you can represent anything you want. You've got full control of memory! Besides, Rabblerouser 2, nobody cares that you wrote an Python interpreter in Python.</li>
<li>[Rabblerouser 4]: Java is (was) simple and has great library support. Oh by the way there's more Java code on earth than any other language, so suck it everyone!</li>
<li>... this never ends...</li>
</ul>
<p>It's exhausting. And more importantly, it's fucking pointless. People spend so much effort developing new languages which are 98% clones of languages that have existed for years. Imperative and functional styles have been around forever. List support has been around forever. You're reinventing the wheel with a different syntax and pretending like you've contributed something new to the world.</p>
<p>I'm all for things that make your programming life easier, but in all of this arguing seems to avoid one very core concept: <strong>no language will not turn a bad programmer into a good programmer</strong>. If you were a shitty C++ programmer, you're going to be a shitty Java programmer and probably an even worse Python programmer. But people seem to think that they're going to revolutionize the world with a new language and all of a sudden you will finally be able to create great software!</p>
<p>That's not how it works. That's not how it's ever worked. That's not how it's going to work. If you can't use your brain to remove those O(n^2) loops from your code to solve a problem that is not NP-Hard, it doesn't matter that you could probably do it in a few less lines in Ruby than in Java. Your software still sucks and you're still an awful programmer.</p>
<p>I remember reading this seemingly throw-away line in a paper Djykstra wrote, but this never-ending argument makes it ring as true as ever. To paraphrase he basically said that programmers don't like to write programs. They like to write things to help you write programs more easily. That's exactly what the language argument embodies. The more time you waste on reinventing yourself with a new language, the less time you actually spend writing software... which... at the end of the day is why you became a programmer right? Those programmers that can't write software probably stayed in academia to teach and try to publish papers. I kid, I kid (but seriously...)</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Belajar Dengan Mendengarkan]]></title>
<link>http://triaslama.wordpress.com/?p=165</link>
<pubDate>Fri, 16 May 2008 00:11:37 +0000</pubDate>
<dc:creator>triaslama</dc:creator>
<guid>http://triaslama.wordpress.com/?p=165</guid>
<description><![CDATA[Postingan ini saya tulis setelah saya secara tidak sengaja mengikuti MSDN Day. Kenapa tidak sengaja?]]></description>
<content:encoded><![CDATA[<p>Postingan ini saya tulis setelah saya secara tidak sengaja mengikuti MSDN Day. Kenapa tidak sengaja? Ya karena saya sebenarnya tidak pernah merencanakan untuk ikut dan malahan tidak tahu kalau pada tanggal 15 Mei kemaren ada acara itu.</p>
<p>Hal ini bermula dari saran salah satu teman, Anthony, supaya saya kirim e-mail ke Pak Risman Adnan salah satu lead developer Microsoft Indonesia. Intinya kami meminta waktu untuk membicarakan beberapa masalah teknis yang kami hadapi dan kemungkinan - kemungkinan solusi yang mungkin bisa dipakai. Email pun dikirim dan ini cuplikan jawabannya "Tri, kebetulan besok ada acara MSDN Day, silahkan datang untuk diskusi sebelum sesi saya dimulai".</p>
<p>Sempat juga terlintas dalam hatiku "Kalau besok ada acara itu apa kami sempat untuk diskusi ya?" Tapi ya sudahlah coba saja dulu. Siapa tahu banyak hal yang bisa dipelajari lagi pula sedang ada migrasi server sehingga development harus dihentikan dulu, maka kami memang bisa datang. </p>
<p>Entah karena saya lagi <em>mood</em>, atau karena acaranya lumayan menarik, atau karena pesertanya yang tidak terlalu banyak sehingga saya merasa nyaman, atau karena sebab yang lain, ternyata sampai dengan break makan siang lumayan banyak hal menarik yang berhasil masuk ke kepalaku :)<br />
Misalnya, aku ini termasuk sangat awam mengenai <a href="http://framework.zend.com/" target="_blank">Zend Framework</a>, karena salah satu materinya tentang itu dan ada orang dari Zend yang datang memberikan presentasi akhirnya sekilas aku mendapat gambaran lebih mendalam tentang Zend Framework.</p>
<p><!--more--><br />
Kembali ke diskusi yang kami rencanakan tadi, akhirnya yang kukhawatirkan memang terjadi, sulit untuk mencari waktu luang untuk berdiskusi dengan leluasa pada event seperti ini. Tapi akhirnya waktu itu datang juga saat makan siang temanku langsung "mencegat" pak Risman dan mulai bertanya, setelah selesai makan dan sholat akupun ikut nimbrung juga. Setelah menanyakan ini itu akhirnya kamipun diminta untuk meng-copy contoh source code yang mungkin bisa berguna. Nah, pada saat meng-copy itu mataku melihat dua folder yang dari namanya isinya tentang <a href="http://en.wikipedia.org/wiki/Silverlight" target="_blank">Silverlight</a>, ukuran file-nya beberapa <em>gigabytes</em>. Tanpa basa - basi langsung saja ku-<em>copy</em> dua folder tentang Silverlight (karena kebetulan aku juga tertarik untuk mencoba - coba Silverlight), setelah selesai baru aku bilang kira - kira "Pak saya <em>copy</em> materi - materi tentang Silverlight juga ya" dan untunglah jawabannya "Oh iya, boleh" (Padahal kalau tidak bolehpun udah terlanjur ku-<em>copy</em> juga ya :D )</p>
<p>Akhirnya acara berlanjut dan memang benar! Terkadang mendengarkan dari orang yang ahli bisa merupakan suatu cara cepat untuk mempelajari sesuatu! Mulai dari Zend Framework, <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" target="_blank">CGI</a>, <a href="http://en.wikipedia.org/wiki/ISAPI" target="_blank">ISAPI</a>, <a href="http://www.fastcgi.com/" target="_blank">FastCGI</a>, sampai arsitektur <a href="http://en.wikipedia.org/wiki/Web_Server" target="_blank">Web Server</a>. Akupun kepikiran "Kalau aku belajar sendiri dengan baca buku sepertinya butuh waktu yang lebih lama". Waktu di Jogja pernah juga aku beberapa kali ikut acara serupa cuma kali ini aku punya kesempatan bertemu dan berdiskusi lumayan lama dengan seorang lead developer Microsoft Indonesia dan juga dengan salah seorang tokoh, developer dan pecinta Open Source. </p>
<p>Jadi ini saja, ingin mempelajari sesuatu secara lebih cepat? Coba deh cara ini: belajarlah, dengarkan, dan bertanyalah kepada ahlinya!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Use a Web-based terminal for remote administration tasks]]></title>
<link>http://phpimpact.wordpress.com/?p=179</link>
<pubDate>Thu, 15 May 2008 23:26:52 +0000</pubDate>
<dc:creator>phpimpact</dc:creator>
<guid>http://phpimpact.wordpress.com/?p=179</guid>
<description><![CDATA[Ajaxterm offers a simple solution to those who want to run a terminal over the Web for performing re]]></description>
<content:encoded><![CDATA[<p><a href="http://antony.lesuisse.org/qweb/trac/wiki/AjaxTerm" target="_blank">Ajaxterm</a> offers a simple solution to those who want to run a terminal over the Web for performing remote administration tasks. <strong>Vincent Danen</strong> tells you <a href="http://articles.techrepublic.com.com/5100-10878_11-6168000.html" target="_blank">how to get it and configure it</a> for Apache.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Extract and compare database schemas]]></title>
<link>http://phpimpact.wordpress.com/?p=178</link>
<pubDate>Thu, 15 May 2008 21:47:52 +0000</pubDate>
<dc:creator>phpimpact</dc:creator>
<guid>http://phpimpact.wordpress.com/?p=178</guid>
<description><![CDATA[Making changes to the database structure is one of the most tedious and routine operations a develop]]></description>
<content:encoded><![CDATA[<p>Making changes to the database structure is one of the most tedious and routine operations a developer of corporate applications faces to. The necessity of frequent updates considerably delays implementation of the project.</p>
<p>eZ Components offers a new solution of this problem: <a href="http://ezcomponents.org/docs/tutorials/DatabaseSchema" target="_blank">DatabaseSchema</a>. First of all, DatabaseSchema it's not an application, it's a PHP component. It provides a unified data structure to describe relational databases. DatabaseSchema can read and write the structure from and to several databases (such as MySQL, SQLite and Oracle) and also read and write in two web language files (XML and PHP).</p>
<p>The main intention of the component is to extract an already existing schema from a database, and compare it with either a predefined schema to check for any changes. Although the component does allow you to create the schema manually through the API, it is often easier to create the schema yourself in a database, and then extract the data from it.</p>
<p><a href="http://ezcomponents.org/docs/tutorials/DatabaseSchema" target="_blank">DatabaseSchema Introduction<br />
</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[I'll be getting my Thursdays from a banana]]></title>
<link>http://dumbledad.wordpress.com/2008/05/15/ill-be-getting-my-thursdays-from-a-banana/</link>
<pubDate>Thu, 15 May 2008 21:07:23 +0000</pubDate>
<dc:creator>dumbledad</dc:creator>
<guid>http://dumbledad.wordpress.com/2008/05/15/ill-be-getting-my-thursdays-from-a-banana/</guid>
<description><![CDATA[
 &#8220;Camel&#8221; by bgiguere2
Like many programmers I have a long list of programming languages]]></description>
<content:encoded><![CDATA[</p>
<p><a href="http://www.flickr.com/photos/15753191@N06/2215392738/"><img src="http://farm3.static.flickr.com/2269/2215392738_fa5696c867_m.jpg"></a> <br>"<a href="http://www.flickr.com/photos/15753191@N06/2215392738/">Camel</a>" by <a href="http://www.flickr.com/photos/15753191@N06/">bgiguere2</a></p>
<p>Like many programmers I have a long list of programming languages that I've been meaning to try, meaning to master, or just meaning to dust off and revisit. For example my boss wants me to check out <a href="http://research.microsoft.com/fsharp/">F#</a>. In fact lots of the people at work are using F# on an increasing variety of projects. For some folk this is clearly a great idea. Take <a href="http://research.microsoft.com/~rherb/">Ralf</a> for example. Ralf's work often relies on applying clever Bayesian models to new problem domains. When Ralf codes the mathematical model and something doesn't work he needs to deduce whether it's something with the model or something in its translation into code that went wrong. So a language like F# that moves the implementation close to the maths without sacrificing the ability to call rich libraries is perfect for Ralf. But most of my code is user interface or (or data handling at present) so I doubt I'd see the same advantage. Still, F# is high up on my 'to try' list.</p>
<p>Another entry is <a href="http://processing.org/">Processing</a>. I'm increasingly doing lots of data visualization work and some of the most beautiful interactive visualizations I encounter on the web are written in Processing. But I am a tad confused (not least by if it is called Processing or Proce55ing). As I understand it Processing is a cut down Java that lets designers approach programming in a sketchbook style. But I can code full Java so why would I do that? Wouldn't it be like putting stabilisers or training wheels on my racing bike? Possibly not; it looks like the iterative nature of the Processing environment is its power. So that's on my list too.</p>
<p>But the catalyst for this post is <a href="http://en.wikipedia.org/wiki/Perl">Perl</a>. I did go through a brief Perl phase back in the late nineties, but I never got beyond the struggling phase. I remember once working for several hours on a VRML file manipulation script in Perl before I finally got so stuck that I didn't mind revealing my lack of knowledge and asking for help. At the time we had John Dent (aka <a href="http://www.qqdd.eu/">Denty</a>) interning in my group so I popped my head up over the divide between our desks and explained what I was trying to do. Denty started typing at the command prompt, and one line of Perl later he hit return. The computer thought for a few seconds and out popped the answer I needed. One line of Perl may give the impression it was a brief script, but IIRC it was a few hundred characters long. Wow. So Perl has been on my 'to try and master' list for a decade now.</p>
<p>So what bumped it up? I've just finished <a href="http://www.shirky.com/">Clay Shirky</a>'s book "<a href="http://www.herecomeseverybody.org/">Here Comes Everybody</a>". There's lots to say about this excellent book, so I'll weave it into more posts. Today it had me laughing on the train - and it is rare that a work book has you laugh out loud in public. It was the bit where Clay is recalling his days as a Perl programmer. Here are the two passages that had me LOLing.</p>
<p>&#62;&#62;&#62; Where, [the AT&#38;T engineers] asked, did we get our commercial support for Perl? We told them we didn't have any, which brought on yet more shocked reactions: We didn't have any support? "We didn't say that," we replied. "We just don't have any <em>commercial</em> support. We get out support from the Perl community."</p>
<p>It was as if we'd told them, "We get our Thursdays from a banana" &#60;&#60;&#60; (p. 256)</p>
<p>&#62;&#62;&#62; Perl is a viable programming language today because millions of people woke up today loving Perl and, more important, loving one another in the context of Perl. &#60;&#60;&#60; (pp. 257-258 )</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Why Can't Java Do That?]]></title>
<link>http://whatimean.wordpress.com/?p=40</link>
<pubDate>Thu, 15 May 2008 20:56:35 +0000</pubDate>
<dc:creator>Tom</dc:creator>
<guid>http://whatimean.wordpress.com/?p=40</guid>
<description><![CDATA[So this year I&#8217;m trying to make in-roads in learning some new languages, in particular Ruby an]]></description>
<content:encoded><![CDATA[<p>So this year I'm trying to make in-roads in learning some new languages, in particular Ruby and Haskell.  My problem is now that since I pay my bills by writing Java code every day I'm left thinking "That's one line in Ruby" or "Why can't Java do this like Haskell?"</p>
<p>Without these changes I will spend each day being a little bit more gumpy than is necessary.  This is bad because I vocalise my grumpiness.  (I like to think of it as contributing to the team.)  So if I'm grumpy, I'll make those around me grumpy.  And in turn, they'll make the ones around them grumpy.  So without these changes and with a few more hops like that <a href="http://en.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon">Kevin Bacon</a> will be grumpy.*  So I think that it's safe to say that even Kevin Bacon want's these changes.  Sun is actually making Keving Bacon grumpy.  And that's not fair.</p>
<p>So here's a very quick, off-the-top-of-my-head, list of things that I'd like to see in Java.  I don't care if they're adopted as fundamental language changes or whether they're just syntactic sugar that the compiler removes and replaces.  As long as the changes are made, I'll be a happy bunny.</p>
<h2>Validate Method Parameters</h2>
<p>Like a good boy I always check my method parameters before I can use them.  Most of my checks are boring and repetative, they clutter up my super-important-and-complicated business method.  Why can't they be moved out to annotations?</p>
<h3>Code Like This...</h3>
<p><code><b>public String complexMethod(Object someObj, String someStr, int number) {<br />
&#160;&#160;if(null == someObj) {<br />
&#160;&#160;&#160;&#160;throw new IllegalArgumentException("someObj cannot be null");<br />
&#160;&#160;}<br><br />
&#160;&#160;if(null == someStr &#124;&#124; 0 == someStr.trim().length()) {<br />
&#160;&#160;&#160;&#160;throw new IllegalArgumentException("someStr cannot be null or empty");<br />
&#160;&#160;}<br><br />
&#160;&#160;if(MIN &#62; number &#124;&#124; MAX &#60; number) {<br />
&#160;&#160;&#160;&#160;throw new IllegalArgumentException("number out of range");<br />
&#160;&#160;}<br><br><br />
&#160;&#160;// Complex code goes here<br />
}</b></code></p>
<h3>Is Replaced With...</h3>
<p><code><b>@Check(NOT_NULL, IllegalArgumentException, someObj, "someObj cannot be null")<br />
@Check(NOT_EMPTY, IllegalArgumentException, someStr, "someStr cannot be null or whitespace only")<br />
@Check(IN_RANGE, com.mycompany.BadNumberRangeException, number, MIN, MAX)<br><br />
public String complexMethod(Object someObj, String someStr, int number) {<br><br />
&#160;&#160;// Complex code goes here<br />
}</b></code></p>
<h2>Wrap Methods in Try-Catch</h2>
<p>Many times a day I see code where the entire method is wrapped in a try-catch statement.  Often times the stuff in the catch statement is repeated though the class (or classes).  Another annotation could remove this noise and make the business code look much more plain.</p>
<h3>Code Like This...</h3>
<p><code><b>public void doDatabaseThing() throws SQLException {<br />
&#160;&#160;try {<br />
&#160;&#160;&#160;&#160;// some database thing<br />
&#160;&#160;} catch (SQLException sqle) {<br />
&#160;&#160;&#160;&#160;methodToRun();<br />
&#160;&#160;}<br />
}</b></code></p>
<h3>Is Replaced With...</h3>
<p><code><b>@IfThrown(java.sql.SQLException, methodToRun)<br />
public void doDatabaseThing() throws SQLException {<br />
&#160;&#160;// some database thing<br />
}</b></code></p>
<p>Maybe a better approach is to abolish all checked exceptions, but that's another post.</p>
<h2>What was the index, please?</h2>
<p>Java's for-each loop is just syntactic sugar for a normal for loop, complete with counter.  Why couldn't they introduce a Perl-esque special variable that had the current iterations index in it?  For example;
<p>
<code><b>for(String name : names) {<br />
&#160;&#160;System.out.println(name + " is at index " + $_);<br />
}</b></code></p>
<h2>Controvertial: Easily implement the <a href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a></h2>
<p>Sometimes you need to wrap objects in other objects.  Fine.  Sometimes you can't use a simple "extends" and just override the methods you're interested.  Annoying.  But what happens when the object you want to wrap has an enormous public interface?  You can argue that this is implying you have a bad object model, and I probably won't disagree, but sometimes you just have to play the cards dealt you and that means wrapping something with a big public interface.</p>
<h3>Code Like This...</h3>
<p><code><b>public class Wrapper {<br />
&#160;&#160;private Wrapped wrapped = new Wrapped();<br><br />
&#160;&#160;public void method1() {<br />
&#160;&#160;&#160;&#160;wrapped.method1();<br />
&#160;&#160;}<br><br />
&#160;&#160;public void method2() {<br />
&#160;&#160;&#160;&#160;wrapped.method2();<br />
&#160;&#160;}<br><br />
&#160;&#160;public void method3() {<br />
&#160;&#160;&#160;&#160;//do something different first...<br />
&#160;&#160;&#160;&#160;wrapped.method3();<br />
&#160;&#160;}<br />
}</b></code></p>
<h3>Is Replaced With...</h3>
<p><code><b>@Decorates(wrapped)<br />
public class WrapperClass {<br />
&#160;&#160;private Wrapped wrapped = new Wrapped();<br />
&#160;&#160;public void method3() {<br />
&#160;&#160;&#160;&#160;//do something different first...<br />
&#160;&#160;&#160;&#160;wrapped.method3();<br />
&#160;&#160;}<br />
}</b></code></p>
<p>...and have the compiler fill in all the boring pass-through methods for me.</p>
<h2>Pattern Matching</h2>
<p>I really like the pattern matching of methods you get in Haskell and I'm left wondering if Java might benefit from them to.</p>
<h3>Code Like This...</h3>
<p><code><b>public void doSomething(boolean flag, Object otherArg) {<br />
&#160;&#160;if (flag) {<br />
&#160;&#160;&#160;&#160;// some code here<br />
&#160;&#160;} else {<br />
&#160;&#160;&#160;&#160;// other code here<br />
&#160;&#160;}<br />
}</b></code></p>
<h3>Is Replaced With...</h3>
<p><code><b>public void doSomething(Boolean.TRUE, Object otherArg) {<br />
&#160;&#160;&#160;&#160;// some code here<br />
}<br><br />
public void doSomething(Boolean.FALSE, Object otherArg) {<br />
&#160;&#160;&#160;&#160;// other code here<br />
}</b></code></p>
<p>But I really don't know if this makes things more simple.</p>
<h3>In Closing...</h3>
<p>I haven't actually done much (read: any) research into how to write my own annotations in Java.  I <em>really</em> don't know how to write an annotation that will make the compiler behave differently and inject code into the source.  I'd be interested to hear if anyone knows where I can do some reading on this.</p>
<p><br></p>
<p>* Okay, so it's not a perfect application of 6-degrees, so what?</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[UTSM Dev Series: BungeeConnect Demo]]></title>
<link>http://olivertower.wordpress.com/?p=29</link>
<pubDate>Thu, 15 May 2008 20:42:16 +0000</pubDate>
<dc:creator>charlieoliver</dc:creator>
<guid>http://olivertower.wordpress.com/?p=29</guid>
<description><![CDATA[I&#8217;ve been attending activities in the social media scene here in Utah ever since the first Soc]]></description>
<content:encoded><![CDATA[<p>I've been attending activities in the social media scene here in Utah ever since the first Social Media Dev Garage held at Twelve Horses that hosted Jeff Barr who discussed Amazon Web Services,  and I've been hooked ever since.  From what I have seen of the technology community here in Utah not many are doing the sort of fresh and innovative work that <a href="http://www.bungeelabs.com/">Bungee Labs</a> are doing down in Orem, Utah.  The tool that they are working on is an endeavor that could shake up the developer community in a big way.  That tool is called <a href="http://www.bungeeconnect.com/">Bungee Connect</a>.</p>
<p>First off they are hosting the IDE on their servers which allows you to work from any machine without having to install thousands of dollars worth of software.  Secondly, they are providing the hosting for your application, which can be a pretty worrisome thing for a developer to have another company host their application without them being able to access the files themselves.  Fortunately they mentioned that later on down the road they will be providing you with a bevy of hosting options so I don't think this fear will be well founded for at least very much longer.  But I think the real trick with Bungee's software is going to be the amount of ajax that is going on in the background that you really don't have to worry about, and Bungee's flatened MVC architecture that abstracts things out so each section can communicate quickly and effectively.  I don't have much in the way of media to show you from them but they were exceptional hosts who took the time to sit with us and walk us through setting up our own application that was able to take advantage of some of the shared code base that one of them had been working on (Brad Hintze took and wrapped the Twitter API into an importable class allowing us to call the API without having to mess with the XML return)  But in the way of media I highy recommend <a href="http://http://staynalive.com">Jesse Stay</a>'s <a href="http://staynalive.com/articles/2008/05/13/utah-startup-series-bungee-labs/">video</a> on Bungee Connect.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Ghosts of Math Classes Past]]></title>
<link>http://ywanne.wordpress.com/?p=32</link>
<pubDate>Thu, 15 May 2008 20:09:36 +0000</pubDate>
<dc:creator>Ywanne</dc:creator>
<guid>http://ywanne.wordpress.com/?p=32</guid>
<description><![CDATA[All right, I guess I have to admit that modulus (the remainder thing, not the absolute value), which]]></description>
<content:encoded><![CDATA[<p>All right, I guess I have to admit that modulus (the remainder thing, not the absolute value), which was annoying when I had to come up with proofs about it six months ago, is useful to me after all.</p>
<p>I've been asked to make a little links database, and I figured it's time for me to learn PHP instead of spending my work hours hooking together assorted free scripts procured through Google. I've been determined to get tables with alternating colors in the rows (everyone's saying "zebra tables") and there's all these adventures in JavaScript you can have. But then I looked at a list of basic PHP operators and, lo and behold, one of them is the modulus thing, and that's what I used to make zebra tables.</p>
<p>I think that's a widely known method, and probably five-sixths of the other physics majors would pretend they didn't know me if they heard that I just now found out about it, but I'm happy anyways.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Fatal error: Call to a member function on a non-object in...]]></title>
<link>http://mdea.wordpress.com/?p=9</link>
<pubDate>Thu, 15 May 2008 18:32:08 +0000</pubDate>
<dc:creator>mmelvin</dc:creator>
<guid>http://mdea.wordpress.com/?p=9</guid>
<description><![CDATA[You need to either pass the $db object into your function or declare the db object as global:
Exampl]]></description>
<content:encoded><![CDATA[<p>You need to either pass the $db object into your function or declare the db object as global:</p>
<p>Example 1<br />
function getProps( $db ) {<br />
}</p>
<p>Example 2<br />
function getProps() {<br />
global $db;</p>
<p>$res = $db-&#62;query(...<br />
}</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Introduction]]></title>
<link>http://virtuallyinprofit.wordpress.com/?p=4</link>
<pubDate>Thu, 15 May 2008 17:48:32 +0000</pubDate>
<dc:creator>excaliburresearch</dc:creator>
<guid>http://virtuallyinprofit.wordpress.com/?p=4</guid>
<description><![CDATA[So, what is this all about and why did I write it ? Well, basically I think too much (at least that]]></description>
<content:encoded><![CDATA[<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">So, what is this all about and why did I write it ? Well, basically I think too much (at least that's what I've been told), I also have the memory of a  goldfish so tend to then forget what I thought of until it's too late to do anything about it. Four in the morning ? No problem, remembering when I actually need it ? Not gonna happen.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">What this started off as was a series of notes to try and sort things out in my own head so I had a better chance of remembering what I needed to and explaining my point to whoever I needed. Like I said I think too much and having started a few notes I ended up with a book. Ok so maybe I can get a bit carried away too.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">I do firmly believe in the power of learning from your mistakes and whenever possible, learning from someone else's mistakes. There are very few problems that haven't already been encountered and solved by someone else. Looking at what they  faced and how they handled it can act as both a warning of issues you haven't found yet and ready made solutions to the issues you already know about.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">Most software books assume you're working on shrinkwrapped products as part of a large team in a huge, multi departmental company. For a lot of us though, that's not the case.<br />
If like me, you usually find yourself in small IT departments where the projects are a mixture of low volume company products and bespoke applications then you're pretty much on your own. The tools and methodologies available to larger groups either don't make sense with just one or two developers and those that do are still out of reach as you'd never get the budget approval to buy it anyway.<br />
It's not that smaller departments are less interested in quality and collaboration, it's just seen as being too expensive per developer to implement.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">For a team of 30 developers, spending $1000  is $33 per person and easy to justify but cut that to a smaller team of 5 and it turns into $200 each instead. Add that to the fact that everyone in the smaller team may be working on separate projects so the group collaboration in the software have less value and it starts becoming difficult to justify the first of several updates.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">What follows in these chapters is a breakdown of the various ways I've come across to get around the problems a small team (often just me) tends to get.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">Cost is always a big issue so I've concentrated on free and open source software, coupled with tools and ideas that can be developed in house thereby keeping whoever signs the cheques happy. In many cases, the smaller size is an advantage as the more expensive commercial tools include features that a small team doesn't really need allowing the same  result to be achieved with simpler tools.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">I would like to point out that this is definitely “Do as I say” not “Do as I do”. I may have come across enough problems to have fairly strong ideas about how I could have avoided them but I'm human, not perfect and don't always follow my own advice. Figuring out who I'd like to be and where I'd like to work is a lot easier that actually doing it. If I'd known when I started the things I know now then my life would have been a lot easier. Hopefully I can simplify yours a bit too.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">So if you work in a small company, a small team, can't get approval for changes that would make your life easier or just want another way of looking at things then please read on.</span></span></p>
<p><span style="font-family:Times New Roman,serif;"><span style="font-size:small;">If there's anything you think is confusing, badly described, could be done better or is just plain wrong then please let me know.</span></span></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Beginner's Guide to DarkBASIC Game Programming]]></title>
<link>http://ebookscollections.wordpress.com/?p=74</link>
<pubDate>Thu, 15 May 2008 16:49:05 +0000</pubDate>
<dc:creator>OWNER</dc:creator>
<guid>http://ebookscollections.wordpress.com/?p=74</guid>
<description><![CDATA[
Beginner&#8217;s Guide to DarkBASIC Game Programming (Game Development)
Course Technology PTR; firs]]></description>
<content:encoded><![CDATA[<p style="text-align:center;"><strong><img style="vertical-align:middle;" src="http://pixhost.eu/avaxhome/avaxhome/2008-01-04/1592000096.jpg" alt="" width="240" height="240" /></strong></p>
<p style="text-align:center;"><strong>Beginner's Guide to DarkBASIC Game Programming (Game Development)<br />
Course Technology PTR; first edition &#124; ISBN: 1592000096 &#124; 752 pages &#124; January 22, 2003 &#124; CHM &#124; 22 Mb</strong></p>
<p style="text-align:center;">
<strong>Design and play your own games without worrying about the technical details of programming DirectX. DarkBasic handles the entire game engine for you! By the end of the book, you will have written complete 2D and 3D games.<br />
</strong></p>
<p style="text-align:center;"><strong><!--more-->DOWNLOAD NOW:</strong></p>
<p style="text-align:center;">
<a href="http://www.paid4share.com/file/2134/1592000096-rar.html"><strong>http://www.paid4share.com/file/2134/1592000096-rar.html</strong></a></p>
<p style="text-align:center;"><strong>CHM VERSION:<br />
</strong><a href="http://rapidshare.com/files/81229968/1592000096.chm" target="_blank"><strong>http://rapidshare.com/files/81229968/1592000096.chm</strong></a><strong><br />
</strong><a href="http://www.filefactory.com/file/9e59a7/" target="_blank"><strong>http://www.filefactory.com/file/9e59a7/</strong></a><strong></p>
<p>PDF VERSION:<br />
</strong><a href="http://rapidshare.com/files/81232852/Beginners.Guide.to.Darkbasic.Game.Programming.PDF.1592000096.rar" target="_blank"><strong>http://rapidshare.com/files/81232852/Beginners.Guide.to.Darkbasic.Game.Programming.PDF.1592000096.rar</strong></a><br />
<a href="http://www.filefactory.com/file/1b4048/" target="_blank"><strong>http://www.filefactory.com/file/1b4048/</strong></a><strong><br />
</strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Importing library(.jar) into local maven repository]]></title>
<link>http://maxi326.wordpress.com/?p=63</link>
<pubDate>Thu, 15 May 2008 16:24:04 +0000</pubDate>
<dc:creator>maxi326</dc:creator>
<guid>http://maxi326.wordpress.com/?p=63</guid>
<description><![CDATA[in command line:
mvn install:install-file -DgroupId=be.mygroup -DartifactId=library -Dpackaging=jar ]]></description>
<content:encoded><![CDATA[<p>in command line:<br />
<code>mvn install:install-file -DgroupId=be.mygroup -DartifactId=library -Dpackaging=jar -Dversion=1.2.2 -Dfile=library.jar<br />
</code><br />
You have to install the jar files in your local:</p>
<p>for example:<br />
<code>mvn install:install-file -DgroupId=icefaces -DartifactId=icefaces -Dversion=1.7 -Dpackaging=jar -Dfile=c:\icefaces.jar<br />
</code><br />
Then write this in your pom.xml</p>
<pre>  &#60;dependencies&#62;
    &#60;dependency&#62;
      &#60;groupId&#62;icefaces&#60;/groupId&#62;
      &#60;artifactId&#62;icefaces&#60;/artifactId&#62;
      &#60;version&#62;1.7&#60;/version&#62;
      &#60;type&#62;jar&#60;/type&#62;
      &#60;scope&#62;provided&#60;/scope&#62;
    &#60;/dependency&#62;
    ...
  &#60;/dependencies&#62;</pre>
<p>For the detail of pom.xml, please refer to maven document.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Pythonic Matlab]]></title>
<link>http://ealdent.wordpress.com/?p=614</link>
<pubDate>Thu, 15 May 2008 15:49:26 +0000</pubDate>
<dc:creator>Jason Adams</dc:creator>
<guid>http://ealdent.wordpress.com/?p=614</guid>
<description><![CDATA[I attended a Matlab training seminar yesterday with the dual topics of &#8220;Advanced Matlab Progra]]></description>
<content:encoded><![CDATA[<p style="text-align:justify;">I attended a Matlab training seminar yesterday with the dual topics of "Advanced Matlab Programming" and "Distributed and Parallel Computing."  Of the two, the Advanced section was more interesting, though my original motivation for going was the parallel computing part.  In the morning, I felt like it was going to be a waste because my Matlab programming skills are weak, and if my advisor had not strongly suggested I attend, I might've skipped it.  I'm glad he did, because it was surprisingly enjoyable and I felt like it was right on my level.  This might be because programming in Matlab isn't especially hard or different from other programming languages and I know enough to get by already.  Or it might be because Matlab is becoming a little more like Python.<!--more--></p>
<p style="text-align:justify;">First let me clarify by saying that I'm not suggesting Matlab is copying Python (though they may be) or that Python has the market cornered on the similarities I'm about to talk about (it doesn't).  Also, I have no idea when this stuff was introduced to Matlab, so it might have all been there for years.</p>
<p style="text-align:justify;">The first thing of interest to me was the discussion about memory management in Matlab.  Suppose you create a matrix and store it in the variable X.  Next, you assign X to Y:  <code>Y = X</code>.  Here, Y acts as a pointer to the data pointed to by X.  If you clear X, Y still points to the data, so it continues to reside in memory until Y has been cleared also.  Now if you modify Y, perhaps like so:  <code>Y(1,1) = 2</code>, my thought was that both X and Y would be affected and the memory used would stay the same.  However, that is not the case, thanks to the <a href="http://en.wikipedia.org/wiki/Blas" target="_blank">BLAS</a> and <a href="http://en.wikipedia.org/wiki/LAPACK" target="_blank">LAPACK</a> libraries that require matrices to be contiguous in memory.  So when you modify Y as above, it creates a modified copy in memory that Y now points to, while X remains pointing to the same, unmodified data.  This is decidedly not Pythonic, since in Python that modification would have updated both X and Y, and they still would be pointing to the same thing in memory.</p>
<p style="text-align:justify;">The next set of interesting things were functions.  Here is where things struck me as Pythonic.   You can declare a simple function in an m-file like so:</p>
<p><code>function Y = square(x)<br />
Y = x.^2<br />
end</code></p>
<p style="text-align:justify;">Here the <code>end</code> is optional.  Like in Python, you can use function handles.  This lets you do cool things like decide on the fly which operation you can apply to a matrix without having to worry about record-keeping and if checks (I'm not going into this any further).  To demonstrate the function handle, here is one possibility:</p>
<p><code>fh = @sin<br />
fh(pi)<br />
fh = @cos<br />
fh(pi)</code></p>
<p style="text-align:justify;">We call the function handle fh on the same input, but get two different results:  0 and -1.  Matlab also lets you create factory functions like in Python:</p>
<p><code> function Y = makeF(a,b)<br />
Y = @makeFHelper;<br />
function Z = makeFHelper(x)<br />
Z = a * sin(x) + b;<br />
end<br />
end<br />
</code></p>
<p style="text-align:justify;">This returns a function handle to the subfunction makeFHelper with the parameters you passed hard-coded in the function produced.  So you could create two different functions:</p>
<p><code>Y1 = makeF(2,3)<br />
Y2 = makeF(3,-1)</code></p>
<p>and when you execute them:</p>
<p><code>Y1(pi/3)<br />
Y2(pi/3)</code></p>
<p style="text-align:justify;">you get two different results: 4.7321 and 1.5981.  If I had known about this before, I might've put more effort into learning Matlab programming, since it would have come in handy for a couple assignments this semester.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Adobe Flash Player 10 Beta, things move fast these days.]]></title>
<link>http://grfxguru.wordpress.com/2008/05/15/adobe-flash-player-10-beta-things-move-fast-these-days/</link>
<pubDate>Thu, 15 May 2008 15:23:27 +0000</pubDate>
<dc:creator>Peter Witham</dc:creator>
<guid>http://grfxguru.wordpress.com/2008/05/15/adobe-flash-player-10-beta-things-move-fast-these-days/</guid>
<description><![CDATA[Read about it here at the Adobe labs, all the usual Flash goodness with 3D Effects and plenty of new]]></description>
<content:encoded><![CDATA[<p><a href="http://labs.adobe.com/technologies/flashplayer10/">Read about it here</a> at the Adobe labs, all the usual Flash goodness with 3D Effects and plenty of new fun times. Not much else to say at this time :)</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Jumbled Words game in Python]]></title>
<link>http://anuragbhandari.wordpress.com/?p=26</link>
<pubDate>Thu, 15 May 2008 15:20:00 +0000</pubDate>
<dc:creator>Anurag</dc:creator>
<guid>http://anuragbhandari.wordpress.com/?p=26</guid>
<description><![CDATA[I talked about a jumbled words, GUI-based, game in my last post. I made that game just for fun. It w]]></description>
<content:encoded><![CDATA[<p>I talked about a jumbled words, GUI-based, game in my last post. I made that game just for fun. It was not at all hard to make when you are using a <strong>write-less-do-more-language</strong>, like Python.</p>
<p>I would like to share the code of that program with you and give a short tutorial on how to create your own Jumbled Words game. The tutorial is platform-independent. So, no matter if you are using Windows or Linux or Mac, the tut will work out in all the cases.</p>
<p>Here's a screenshot of the Jumbled Words game running in Linux.</p>
<p><a href="http://anuragbhandari.wordpress.com/files/2008/05/snapshot3.png"><img class="alignnone size-full wp-image-27" src="http://anuragbhandari.wordpress.com/files/2008/05/snapshot3.png" alt="" width="470" height="377" /></a></p>
<p><!--more--></p>
<ul>
<li> First of all, you will need the <strong>Python</strong> programming language installed on your system. Get it from here: <a href="http://python.org/download/" target="_blank">http://python.org/download/</a>.</li>
<li>Next, you'll need a GUI-tool kit for Python which would actually allow you create GUI based applications. I used the <strong>wxPython</strong> tool kit. Get it from here: <a href="http://wxpython.org/download.php#binaries" target="_blank">http://wxpython.org/download.php#binaries</a>.</li>
<li>After installing Python and wxPython on your system, you'll be ready to start writing the code now.</li>
<li>Create a new file, copy-paste the following contents in it, and save it by the name <strong>JumbledGUI.py</strong>.<br />
<span style="color:#ff6600;">import wx</p>
<p># First, we define a dictionary of jumbled words<br />
dict = {"special":"licapes", "guava":"augav", "begin":"ngibe",<br />
"compression":"serniospmoc", "praying":"igyaprn", "linux":"uilxn",<br />
"opposite":"seopopit", "depricated": "cpdirdaete",<br />
"leonardo da vinci":"o draconian devil", "the mona lisa":"oh lame saint",<br />
"dreaming":"earimngd", "tormented":"nemortted", "flabbergasted": "tasedbgaberlaf",<br />
"meticuluos":"ecusoulmit", "rectify":"fitecry", "mobile":"ibelmo",<br />
"computer":"mertopcu", "granular":"lrgaruna", "metro":"torem",<br />
"outrageous":"gretsouauo", "nothing":"hotning", "appreciable":"celbepiapra", "vandalism":"misdanlav", "tropical":"ptorlica"}</p>
<p>def func():<br />
'This is the core function of the program'<br />
# The result of popitem() method is a tuple<br />
# The following is an example of "sequence unpacking"<br />
word, jumbled = dict.popitem()<br />
return word, jumbled</p>
<p>def guess(event):<br />
ans = input_word.GetValue()<br />
if(ans == query[0]):<br />
result.SetLabel(label="Congrats! You got it right.")<br />
else:<br />
result.SetLabel(label="Sorry, wrong answer. Better luck next time!")</p>
<p>def next(event):<br />
# After a person clicks the Start button for the first time, this will happen<br />
nextButton.SetLabel("Next")<br />
guessButton.Enable()<br />
hintButton.Enable()<br />
input_word.SetValue("")<br />
# Unless we define the variable "query" as global, the function "guess" won't be able to access it<br />
global query<br />
query = func()<br />
if(dict!={}):<br />
question.SetLabel(label="The jumbled word is: "+query[1])<br />
result.SetLabel(label="Waiting for your input...")<br />
else:<br />
question.SetLabel(label="Game Over!")<br />
result.SetLabel(label="Yup, the game is finally over!")<br />
guessButton.Disable()<br />
nextButton.Disable()<br />
hintButton.Disable()</p>
<p>def hint(event):<br />
input_word.SetValue(query[0])</p>
<p>app = wx.App()<br />
win = wx.Frame(None, title="Jumbled Words Game", size=(460, 345))<br />
win.CenterOnScreen()<br />
bkg = wx.Panel(win)<br />
guessButton = wx.Button(bkg, label='Guess')<br />
guessButton.Bind(wx.EVT_BUTTON, guess)<br />
guessButton.SetDefault()<br />
# Unless the player has pressed the Start button, the Guess button will be disabled<br />
guessButton.Disable()<br />
nextButton = wx.Button(bkg, label='Start')<br />
nextButton.Bind(wx.EVT_BUTTON, next)<br />
hintButton = wx.Button(bkg, label='Hint')<br />
hintButton.Bind(wx.EVT_BUTTON, hint)<br />
hintButton.Disable()<br />
input_word = wx.TextCtrl(bkg)<br />
question = wx.StaticText(bkg, label="Welcome to jumbled words game\nTotal words: 24", style=wx.ALIGN_CENTER)<br />
# We define some stylish fonts for the welcome message / game questions<br />
font = wx.Font(pointSize=18, family=wx.DECORATIVE, style=wx.NORMAL, weight=wx.NORMAL)<br />
question.SetFont(font)<br />
result = wx.StaticText(bkg, label="Waiting for the initial result...", style=wx.ALIGN_CENTER)<br />
hbox = wx.BoxSizer()<br />
hbox.Add(input_word, proportion=1, flag=wx.EXPAND)<br />
hbox.Add(guessButton, proportion=0, flag=wx.LEFT, border=5)<br />
hbox.Add(nextButton, proportion=0, flag=wx.LEFT, border=5)<br />
hbox.Add(hintButton, proportion=0, flag=wx.LEFT, border=5)<br />
vbox = wx.BoxSizer(wx.VERTICAL)<br />
vbox.Add(question, proportion=1, flag=wx.EXPAND &#124; wx.ALL, border=5)<br />
vbox.Add(hbox, proportion=0, flag=wx.EXPAND &#124; wx.LEFT &#124; wx.BOTTOM &#124; wx.RIGHT, border=5)<br />
vbox.Add(result, proportion=0, flag=wx.EXPAND &#124; wx.LEFT &#124; wx.BOTTOM &#124; wx.RIGHT, border=5)<br />
bkg.SetSizer(vbox)<br />
win.Show()<br />
app.MainLoop()</span></li>
<li>To run it, open the command-line. In Windows, go to <strong>Start</strong> &#62; <strong>Run</strong>. Type <strong>cmd</strong>. In Linux, open <strong>Terminal</strong> is GNOME or <strong>Konsole</strong> in KDE. Then <strong>cd</strong> (move) to the location of the folder containing the file JumbledGUI.py. After that, type <strong>python JumbledGUI.py </strong>and enjoy playing with the just created application.</li>
<li>Now that you just ran it, what if you wanted to show it to your friend? Would it look good if he had to issue the command in the command-line just for running it? No? You are right. Now is the time to publish it!</li>
<li>You'll publish it by making an executable out of it (that .exe file which runs on double-clicking). With this step, I am going specific for just the Windows users. I'll come to the Linux method of creating an executable some time later. To make an executable from your Python file, download and install <strong>py2exe</strong> from here: <a href="http://sourceforge.net/project/showfiles.php?group_id=15583" target="_blank">http://sourceforge.net/project/showfiles.php?group_id=15583</a>.</li>
<li>Create a new file in the same folder as JumbledGUI.py, copy-paste the following content, and save it with the name <strong>setup.py</strong>.<br />
<span style="color:#ff6600;"># Requires wxPython.  This sample demonstrates:<br />
#<br />
# - single file exe using wxPython as GUI.</span><span style="color:#ff6600;">from distutils.core import setup<br />
import py2exe<br />
import sys</span></p>
<p><span style="color:#ff6600;"># If run without args, build executables, in quiet mode.<br />
if len(sys.argv) == 1:<br />
sys.argv.append("py2exe")<br />
sys.argv.append("-q")</span></p>
<p><span style="color:#ff6600;">class Target:<br />
def __init__(self, **kw):<br />
self.__dict__.update(kw)<br />
# for the versioninfo resources<br />
self.version = "1.1"<br />
self.company_name = "Anurag Bhandari"<br />
self.copyright = "GPL v2"<br />
self.name = "Jumbled Words Game"</span></p>
<p><span style="color:#ff6600;">################################################################<br />
# A program using wxPython</span></p>
<p><span style="color:#ff6600;"># The manifest will be inserted as resource into JumbledGUI.exe.  This<br />
# gives the controls the Windows XP appearance (if run on XP ;-)<br />
#<br />
# Another option would be to store it in a file named<br />
# JumbledGUI.exe.manifest, and copy it with the data_files option into<br />
# the dist-dir.<br />
#<br />
manifest_template = '''</span></p>
<p><span style="color:#ff6600;">%(prog)s Program</span></p>
<p><span style="color:#ff6600;">'''</span></p>
<p><span style="color:#ff6600;">RT_MANIFEST = 24</span></p>
<p><span style="color:#ff6600;">JumbledGUI = Target(<br />
# used for the versioninfo resource<br />
description = "A cute jumbled words game",</span></p>
<p><span style="color:#ff6600;"># what to build<br />
script = "JumbledGUI.py",<br />
other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="JumbledGUI"))],<br />
# icon_resources = [(1, "icon.ico")],<br />
dest_base = "JumbledGUI")</span></p>
<p><span style="color:#ff6600;">################################################################</span></p>
<p><span style="color:#ff6600;">setup(<br />
options = {"py2exe": {"compressed": 1,<br />
"optimize": 2,<br />
"ascii": 1,<br />
"bundle_files": 1}},<br />
zipfile = None,<br />
windows = [JumbledGUI],<br />
)</span></li>
<li>It's time to modify the publishing information of the to-be-created exe. Open setup.py and look for the code: Replace the <strong>self.version</strong>, <strong>self.company_name</strong>, <strong>self.copyright</strong> and <strong>self.name</strong> values with your desired values.</li>
<li>Now you are ready to "build" the exe. For that, open command prompt, cd to the folder where the setup.py file is placed (the same location as JumbledGUI.py) and issue the command: <strong>python setup.py py2exe</strong>.</li>
<li>This will create two folders where your two Python files are placed. One is the dist folder and the other is the build folder. Our folder of interest is the dist folder.</li>
<li>Open the dist folder and look for the just created exe file. Double click it and viola! It works!</li>
<li>To give your application a more professional touch, you may opt to created a setup of your program so that the end users are able to install it the way they install other softwares (the Next, Next, Next way...). For that, download the Inno Setup software from: <a href="http://www.jrsoftware.org/isinfo.php" target="_blank">http://www.jrsoftware.org/isinfo.php</a>.</li>
</ul>
<p>It was fun, wasn't it?</p>
<p>I've provided comments in the code at all possible places so you don't find it difficult to know what has been done there. I admit not using much efficient code, like making use of classes than just pure functions, but I'll try to modify the code and rewrite it with classes as soon as I get some time for it.</p>
<p>I'll post my own created setup for this app soon. :)</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Бесконечные последовательности в C#]]></title>
<link>http://bitsofmind.wordpress.com/?p=19</link>
<pubDate>Thu, 15 May 2008 14:57:04 +0000</pubDate>
<dc:creator>Yaroslav Pogrebnyak</dc:creator>
<guid>http://bitsofmind.wordpress.com/?p=19</guid>
<description><![CDATA[Компьютеры – в общей массе своей, штуки дискретные. По]]></description>
<content:encoded><![CDATA[<p>Компьютеры – в общей массе своей, штуки дискретные. Поэтому мы не можем сказать – дайте мне последовательность чисел Фибоначчи, и работать с ней, не указав необходимую её длину. Ну, на самом деле мы можем вычислять эту последовательность динамически, при каждой потребности в следующем элементе (пока у нас хватает памяти), создавая иллюзию бесконечности. В языках программирования такие вещи наиболее элегантно проделываются с помощью ленивых вычислений. Ленивые вычисления означают такие вычисления, которые производятся только тогда, когда в них действительно возникает необходимость, а до этого времени они откладываются, как могут.</p>
<p><!--more--></p>
<p>На самом деле возможность определять такие ленивые последовательности появилась ещё в С# 2.0 при помощи ключевого слова yield. Мы определяем метод, возвращающий IEnumerable или IEnumerator, а внутри него при необходимости генерации нового элемента этой последовательности вызываем yield return.</p>
<p>Например:</p>
<pre>Public static IEnumerable&#60;decimal&#62; Fibonacci
{
    get
    {
            decimal pred = 1;
            decimal curr = 1;

            yield return pred;
            yield return curr;

            while (true)
            {
                var next = pred + curr;
                yield return next;
                pred = curr;
                curr = next;
            }
    }
}
</pre>
<p>В этом примере каждый новый элемент генерируется при каждом обращении к методу MoveNext() IEnumerator-а данной последовательности. Плюс ко всему, я сделал Fibonacci свойством для красоты.  Теперь мы можем сделать следующее:</p>
<pre>foreach(var v in Fibonacci)
        Console.WriteLine (v);
</pre>
<p>На экран будет выводиться последовательность факториалов так долго, пока у вас хватит на это памяти, или не произойдёт переполнение decimal. Однако часто нам не нужны все значения бесконечной последовательности, а только первые несколько. Поэтому полезно будет определить следующий метод расширения, уже с использованием фишек C# 3.0. Конечно, данный метод должен содержаться в каком-то статическом классе.</p>
<pre>public static IEnumerable&#60;T&#62; Take&#60;T&#62;(this
            IEnumerable&#60;T&#62; e, int n)
{
    var r = e.GetEnumerator();
    for (int i = 0; i &#60; n; i++)
    {
        r.MoveNext();
        yield return r.Current;
    }
}
</pre>
<p>И теперь мы можем работать так:</p>
<pre>foreach(var k in Fibonacci.Take(10))
     Console.WriteLine(k);
</pre>
<p>А применяя расширяющие методы из System.Linq.Enumerable, мы можем применять к нашей бесконечной последовательности различные трансформации и ограничения, перед её использованием, например, для вывода только чётных элементов последовательности Фибоначчи можно проделать следующее:</p>
<pre>var fib = Fibonacci.Where(x =&#62; x % 2 == 0); // бесконечная из чётных чисел Фибоначчи
foreach(var k in fib.Take(10))
    Console.WriteLine(k);
</pre>
<p>Конечно, всё вышеперечисленное можно было реализовать и по-другому, но в контексте нововведений C# 3.0 конкретно данная реализация может показаться более естественной.</p>
<p>Исходный текст примера (с добавленной последовательностью факториалов) можно загрузить <a href="http://y.ne.truisty.org/files/InfiniteExamples.cs" target="_blank">отсюда</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Success Begins - One Step at a Time]]></title>
<link>http://thesingleparent.wordpress.com/?p=142</link>
<pubDate>Thu, 15 May 2008 14:53:09 +0000</pubDate>
<dc:creator>gem</dc:creator>
<guid>http://thesingleparent.wordpress.com/?p=142</guid>
<description><![CDATA[Today I made another personal success: getting recognized in my freelancing community through my blo]]></description>
<content:encoded><![CDATA[<p><img class="size-full wp-image-143 alignleft" style="float:left;" src="http://thesingleparent.wordpress.com/files/2008/05/jumping-man.jpg" alt="" width="133" height="200" />Today I made another <strong>personal success</strong>: getting recognized in my freelancing community through my blog.</p>
<p>I got into a <strong>guest posting on another blog</strong> because he liked my personal views on my blog. He happened to be the man behind that freelance site and I really appreciate the attention that I got from him. I was able to compose that blog - it was a long one - then submitted it to him for review. I was happy I was able to read it the next day.</p>
<p>I guess this is a new personal success for me.  I hope there will be others. I have to sustain my work in order to reach my goal - a <strong>successful freelancer</strong> who never runs out of projects to do.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Flash 10 Beta is Available]]></title>
<link>http://drawk.wordpress.com/?p=204</link>
<pubDate>Thu, 15 May 2008 13:12:28 +0000</pubDate>
<dc:creator>drawk</dc:creator>
<guid>http://drawk.wordpress.com/?p=204</guid>
<description><![CDATA[I would say more but it is time to play&#8230;
]]></description>
<content:encoded><![CDATA[<p>I would say more but it is <a href="http://labs.adobe.com/technologies/flashplayer10/demos/" target="_blank">time to play</a>...</p>
]]></content:encoded>
</item>

</channel>
</rss>
