<?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>GuShH&#039;s Development Blog</title>
	<atom:link href="http://gushh.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about game and software development.</description>
	<lastBuildDate>Sat, 20 Feb 2010 20:45:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RAC Is really getting on my nerves.</title>
		<link>http://gushh.net/blog/2010/02/20/rac-is-really-getting-on-my-nerves/</link>
		<comments>http://gushh.net/blog/2010/02/20/rac-is-really-getting-on-my-nerves/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 20:45:49 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Bullshit]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[outbid]]></category>
		<category><![CDATA[RAC]]></category>
		<category><![CDATA[Rent A Coder]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/2010/02/20/rac-is-really-getting-on-my-nerves/</guid>
		<description><![CDATA[




While the concept is sound, the actual implementation is lacking many of the important aspects a service of this caliber requires.
For instance buyer/seller filtering, there is no filtering whatsoever; a 5 year old kid can and will outbid you. It doesn&#8217;t matter how illegal that is, they can still register and post bids, possibly wasting [...]]]></description>
			<content:encoded><![CDATA[<!-- AdSense Now! V1.83 -->
<!-- Post[count: 3] -->
<div class="adsense adsense-leadin" style="float:right;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "pub-2462949361920197";
/* 120x240, created 2/20/10 */
google_ad_slot = "1644272555";
google_ad_width = 120;
google_ad_height = 240;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>While the concept is sound, the actual implementation is lacking many of the important aspects a service of this caliber requires.</p>
<p>For instance buyer/seller filtering, there is no filtering whatsoever; a 5 year old kid can and will outbid you. It doesn&#8217;t matter how illegal that is, they can still register and post bids, possibly wasting everyone&#8217;s time in the process.</p>
<p>There doesn&#8217;t seem to be any way of tracking bids either, you get outbidded and there are no emails sent, the only email sent is the &#8220;try again next time buddy!&#8221;&#8211; once said under-aged kiddo lands the job!</p>
<p>&#8221; Notify me if I lose a bid request (that I&#8217;ve bid on) &#8221; &#8212; Is broken, I never received one email, the only ones I receive are when the buyer accepted a lower bid and someone else landed the job.</p>
<p>To give you a real example: A guy from Serbia with 0 completed jobs (therefore no rating/ranking whatsoever) outbids you (and you never get notified of this) therefore the buyer accepts his bid and the guy lands the job. It doesn&#8217;t matter that you&#8217;ve got 10+ years of experience in the field, and a 10 solid rating.</p>
<p>For all you know that guy showed him a bunch of renders he found on Google Images and gave him a holy speech about how big his hangers are.</p>
<p>That&#8217;s a total and complete pile of bullshit in my eyes. I cannot begin to comprehend how this is even possible to begin with.</p>
<p>It used to be a trustworthy place, but now buyers have to repost their bid requests after wasting a week or two with someone who had no experience whatsoever in the job and didn&#8217;t even care to begin with!</p>
<p>Either that or they end up with what I call &#8220;code from the past&#8221;, ie. unusable code/graphics. Thus wasting time and money.</p>
<p>Now, it&#8217;s also the buyer&#8217;s fault; They became cheapskates. Most of the time they don&#8217;t know what they want and they drive you around town like you&#8217;re some sort of puppet.</p>
<p>Or they do know what they want; because they stole every single one of your ideas and they gave them to the 5 year old kid, who obviously steals a template / design and copy&#038;pastes everything together to call it a day.</p>
<p>It&#8217;s a shame.</p>
<p>If only I had the capital, I&#8217;d be running against RAC. I don&#8217;t have the stone face the actual creator of RAC does, but I do have the passion, drive and knowhow to do things right.</p>
<p>That&#8217;s just how I see it, but I&#8217;m certain I&#8217;m not the only one with this point of view. Let&#8217;s just hope Karma is real.</p>
]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2010/02/20/rac-is-really-getting-on-my-nerves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Away from the IDEs.</title>
		<link>http://gushh.net/blog/2009/09/12/away-from-the-ides/</link>
		<comments>http://gushh.net/blog/2009/09/12/away-from-the-ides/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 08:43:05 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[busy]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[studying]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=253</guid>
		<description><![CDATA[I had in mind to share a bunch of my libraries throughout the course of this week, however real life kicked-in and prevented me from doing any of it. In a few days I will hopefully start posting the promised code. Keep in mind though, I&#8217;ve been studying electronics lately (I find it fascinating) so any [...]]]></description>
			<content:encoded><![CDATA[<p>I had in mind to share a bunch of my libraries throughout the course of this week, however real life kicked-in and prevented me from doing any of it. In a few days I will hopefully start posting the promised code. Keep in mind though, I&#8217;ve been studying electronics lately (I find it fascinating) so any spare time is likely to be spent on that as well.</p>
<p>Let&#8217;s see if I can get some well deserved rest now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2009/09/12/away-from-the-ides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Declar&#8217;em! &#8211; Automatic declaration of procedures.</title>
		<link>http://gushh.net/blog/2009/09/05/automatic-declare-tool/</link>
		<comments>http://gushh.net/blog/2009/09/05/automatic-declare-tool/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 20:32:44 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[automatic procedure declaration]]></category>
		<category><![CDATA[declare]]></category>
		<category><![CDATA[declarem]]></category>
		<category><![CDATA[GuShH]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[procedures]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=240</guid>
		<description><![CDATA[This is a tool that I&#8217;ve been using for quite a long while, just recently I fixed a small bug in the regexp and I thought it was time to share it.
For those of you using the official IDE, there&#8217;s no real solution to this &#8220;problem&#8221;. When you&#8217;re working on something small, it&#8217;s not a [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tool that I&#8217;ve been using for quite a long while, just recently I fixed a small bug in the regexp and I thought it was time to share it.</p>
<p>For those of you using the official IDE, there&#8217;s no real solution to this &#8220;problem&#8221;. When you&#8217;re working on something small, it&#8217;s not a big deal to define a couple of declares here and there&#8230; However, on bigger code this becomes a real issue!. So why waste the time switching between IDEs or doing it by hand?&#8230;</p>
<p style="text-align: left;"><a title="Declar'em!" href="http://gushh.net/dls/declarem.zip" target="_blank">Grab it</a> and let me know how it runs! (<span style="text-decoration: line-through;">nasty</span> <em>ugly </em>source included).</p>
<p style="text-align: center;">The tool is very simple to install, I recommend you unzip directly into your PB directory and configure it as follows:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-243" title="Declarem_installation" src="http://gushh.net/blog/wp-content/uploads/2009/09/Declarem_installation.PNG" alt="Declarem_installation" width="485" height="296" /></p>
<p style="text-align: center;">That&#8217;s it. You&#8217;re ready to declar&#8217;em!.</p>
<p style="text-align: left; ">Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2009/09/05/automatic-declare-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Structuring libraries, basic design tips.</title>
		<link>http://gushh.net/blog/2009/08/28/structuring-libraries-basic-design-tips/</link>
		<comments>http://gushh.net/blog/2009/08/28/structuring-libraries-basic-design-tips/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 23:20:56 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[instancing]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[prng]]></category>
		<category><![CDATA[programming tutorial]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=227</guid>
		<description><![CDATA[One of the most important things a programmer has to know and learn is proper code design, structuring of the code, etc. This may not be imperative for you if you&#8217;re just starting out, but sooner or later you&#8217;ll be able to spot the patterns and realize that your current way of doing things is [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most important things a programmer has to know and learn is proper code design, structuring of the code, etc. This may not be imperative for you if you&#8217;re just starting out, but sooner or later you&#8217;ll be able to spot the patterns and realize that your current way of doing things is not optimal but rather cumbersome. This is when you start to separate things into modules and you begin to design your code with more meaning and purpose.</p>
<p>By breaking your code into modules or &#8220;classes&#8221; you can have a finer granularity of the code itself, you can encapsulate the base code and work on top of it, you can also reuse the code in other projects if you have a good design. An example would be a log library (for logging useful debugging information onto text files) with proper design and care you&#8217;ll be able to use the same library in almost all of your projects with little to no modification at all.<br />
<span id="more-227"></span><br />
The main points you should never forget about are:</p>
<ul>
<li>Instancing
<ul>
<li>This is when you create an &#8220;object&#8221; &#8211; And as you create it, you should also be able to destroy it. (Constructors / Destructors in OOP). An object factory may be implemented (this would be another class) to handle the instances. <em>In CPP you may use smart pointers, but we&#8217;re talking about PB in this case.</em></li>
</ul>
</li>
<li>Members
<ul>
<li>In our case a main structure is used as the &#8220;members&#8221; (Again, in reference to OOP) &#8211; This structure is instantiated by the constructor or &#8220;create&#8221; function. Don&#8217;t forget that anything you allocate you should also be able to deallocate. It doesn&#8217;t matter if the language or OS handles it underneath; it&#8217;s bad coding practice to avoid such trivial &#8211; but important &#8211; code.</li>
</ul>
</li>
<li>Methods
<ul>
<li>They give you functionality, in PB there are no methods but a similar concept applies: you have functions or routines that you create specifically for the library itself. Some may be of the Get / Set type (which either get or set a variable) Or other methods such as converters, helpers, accesibility calls, etc.</li>
</ul>
</li>
</ul>
<p>All together they make a class; in our case a library.</p>
<p>Let&#8217;s write one and follow by example!</p>
<p>Imagine you needed to encapsulate the random functions to provide extra functionality, then all you need to do is first define a structure (if you&#8217;re going to have members; for instance do you want the library to &#8220;remember&#8221; the previous and current numbers?, if so you would need a structure!)</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Library Structure</span>
<span style="color: #000066; font-weight: bold;">Structure</span> <span style="color: #0000ff;">RANDOM</span>
	LastNumber.i
	PreviousNumber.i
	Seed.i
<span style="color: #000066; font-weight: bold;">EndStructure</span></pre></div></div>

<p>Alright, now we need to write our constructor and destructor functions! This will create and destroy the instances.</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Library Instancing</span>
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomCreate<span style="color: #000066;">&#40;</span> Seed.i <span style="color: #000066;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Define</span>.<span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">*</span>this <span style="color: #000066;">=</span> <span style="color: #0000ff;">AllocateMemory</span><span style="color: #000066;">&#40;</span> <span style="color: #0000ff;">SizeOf</span><span style="color: #000066;">&#40;</span> <span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066; font-weight: bold;">Not</span> Seed
			Seed <span style="color: #000066;">=</span> <span style="color: #0000ff;">ElapsedMilliseconds</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">With</span> <span style="color: #000066;">*</span>this
			 <span style="color: #000066;">\</span>LastNumber 		<span style="color: #000066;">=</span> <span style="color: #CC0000;">0</span>
			 <span style="color: #000066;">\</span>PreviousNumber 	<span style="color: #000066;">=</span> <span style="color: #CC0000;">0</span>
			 <span style="color: #000066;">\</span>Seed 			<span style="color: #000066;">=</span> Seed
		<span style="color: #000066; font-weight: bold;">EndWith</span>
&nbsp;
		<span style="color: #0000ff;">RandomSeed</span><span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>Seed <span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this
&nbsp;
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomDestroy<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
&nbsp;
		<span style="color: #0000ff;">FreeMemory</span><span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this <span style="color: #000066;">&#41;</span>
		<span style="color: #000066;">*</span>this <span style="color: #000066;">=</span> #Null
		<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this
&nbsp;
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>That&#8217;s not too bad, first we allocate an instance and then we populate the member variables just to return the pointer of our new &#8220;object&#8221;. The destructor simply frees any allocated memory and clears out the pointer itself.</p>
<p>Now we need to define our library functions, in this case we only need one so we may generate a random number and keep track of the previous and current numbers.</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Library functions</span>
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomGetInteger<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span>, min.i, max.i <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
&nbsp;
		<span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>PreviousNumber 	<span style="color: #000066;">=</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>LastNumber
		<span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>LastNumber 	<span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span> min <span style="color: #000066;">+</span> <span style="color: #0000ff;">Random</span><span style="color: #000066;">&#40;</span> max<span style="color: #000066;">-</span>min <span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>LastNumber
&nbsp;
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>That&#8217;s ok, but we can still add functionality. For instance, we need a way to access the structure fields (or &#8220;members&#8221;) without having to cast pointers, etc. We can do this by implementing a few Get/Set routines. In this case we only need to get the previous and current numbers, so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Helper functions</span>
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomGetLast<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
		<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>LastNumber
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomGetPrevious<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
		<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>PreviousNumber
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>But wait, we can still add functionality! such as utility functions, in this case we would like to fill a given array with random numbers, so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Utility functions</span>
<span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomFillArray<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span>, min.i, max.i, Array DestArray.i<span style="color: #000066;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
&nbsp;
		<span style="color: #000066; font-weight: bold;">Define</span>.i Size, i
		Size <span style="color: #000066;">=</span> ArraySize<span style="color: #000066;">&#40;</span> DestArray<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, <span style="color: #CC0000;">1</span> <span style="color: #000066;">&#41;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> Size
			<span style="color: #000066; font-weight: bold;">For</span> i<span style="color: #000066;">=</span><span style="color: #CC0000;">0</span> <span style="color: #000066; font-weight: bold;">To</span> Size
				DestArray<span style="color: #000066;">&#40;</span>i<span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> RandomGetInteger<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this, min, max <span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">Next</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>And while we&#8217;re at it, let&#8217;s fill lists as well!</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Procedure</span>.i RandomFillList<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.<span style="color: #0000ff;">RANDOM</span>, min.i, max.i, elements.i, List DestList.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, Clear.i<span style="color: #000066;">=</span>#False <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> Clear
			<span style="color: #0000ff;">ClearList</span><span style="color: #000066;">&#40;</span>DestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">Define</span>.i i
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> elements
			<span style="color: #000066; font-weight: bold;">For</span> i<span style="color: #000066;">=</span><span style="color: #CC0000;">1</span> <span style="color: #000066; font-weight: bold;">To</span> elements
				<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #0000ff;">AddElement</span><span style="color: #000066;">&#40;</span> DestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
					DestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> RandomGetInteger<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this, min, max <span style="color: #000066;">&#41;</span>
				<span style="color: #000066; font-weight: bold;">EndIf</span>
			<span style="color: #000066; font-weight: bold;">Next</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>If you don&#8217;t need to keep track of the current and previous numbers, you can just opt out the instancing system and modify the utility calls to work in an &#8220;instance-less&#8221; mode, however that&#8217;s up to you.</p>
<p>But, let&#8217;s take it for a ride first!</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">;- Example</span>
<span style="color: #000066; font-weight: bold;">Define</span>.<span style="color: #0000ff;">RANDOM</span> <span style="color: #000066;">*</span>rnd <span style="color: #000066;">=</span> RandomCreate<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">Define</span>.i i
&nbsp;
<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>rnd
&nbsp;
	<span style="color: #000066; font-weight: bold;">For</span> i<span style="color: #000066;">=</span><span style="color: #CC0000;">0</span> <span style="color: #000066; font-weight: bold;">To</span> <span style="color: #CC0000;">99</span>
		<span style="color: #000066; font-weight: bold;">Debug</span> RandomGetInteger<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>rnd, <span style="color: #CC0000;">5</span>, <span style="color: #CC0000;">10</span> <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Next</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Debug</span> <span style="color: #009900;">&quot;--&quot;</span>
	<span style="color: #000066; font-weight: bold;">Debug</span> RandomGetLast<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>rnd <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Debug</span> RandomGetPrevious<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>rnd <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Debug</span> <span style="color: #009900;">&quot;--&quot;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Dim</span> TestArray.i<span style="color: #000066;">&#40;</span><span style="color: #CC0000;">9</span><span style="color: #000066;">&#41;</span>
	RandomFillArray<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>rnd, <span style="color: #CC0000;">100</span>, <span style="color: #CC0000;">200</span>, TestArray<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">For</span> i<span style="color: #000066;">=</span><span style="color: #CC0000;">0</span> <span style="color: #000066; font-weight: bold;">To</span> <span style="color: #CC0000;">9</span>
		<span style="color: #000066; font-weight: bold;">Debug</span> TestArray<span style="color: #000066;">&#40;</span>i<span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Next</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Debug</span> <span style="color: #009900;">&quot;--&quot;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">NewList</span> TestList.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
	RandomFillList<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>rnd, <span style="color: #CC0000;">10</span>, <span style="color: #CC0000;">20</span>, <span style="color: #CC0000;">5</span>, TestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">ForEach</span> TestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">Debug</span> TestList<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Next</span>
&nbsp;
	RandomDestroy<span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>rnd<span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">EndIf</span></pre></div></div>

<p>Ok, so we tested the instancing and most if not all of the &#8220;methods&#8221; we just created. By now you should realize how useful such systems can be if you happen to design them correctly.</p>
<p>This particular lib could be extended to support averaging of the numbers, median / mean, etc. You could even implement a custom PRNG and give the option to choose between yours and the built-in one!.</p>
<p>You may download the entire source from <a href="http://gushh.net/dev/?file=pb/random.pb">here</a>. As an exercise you could implement the Get/Set methods for the Seed.</p>
<p>Cheers!</p>
<p>PS: Someone remind me to update the language file for GeShi and to fix the font <img src='http://gushh.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (The indentation is all wrong!)</p>
]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2009/08/28/structuring-libraries-basic-design-tips/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>About the negative comments&#8230;</title>
		<link>http://gushh.net/blog/2009/08/28/about-the-negative-comments/</link>
		<comments>http://gushh.net/blog/2009/08/28/about-the-negative-comments/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 22:38:16 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=229</guid>
		<description><![CDATA[I&#8217;ve been receiving quite a few negative comments lately, I don&#8217;t know why exactly but most of them are plain insults in broken English (and no, they are not spam). Someone either has way too much time on their hands or they got it all wrong!
I will not approve such behavior. I&#8217;m merely sharing some [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been receiving quite a few negative comments lately, I don&#8217;t know why exactly but most of them are plain insults in broken English (and no, they are not spam). Someone either has way too much time on their hands or they got it all wrong!</p>
<p>I will not approve such behavior. I&#8217;m merely sharing some points of view and bits of code, there is no reason for flame wars. If you&#8217;re a fanboy and I happened to hurt your feelings then I&#8217;m sorry but you didn&#8217;t get it right. I&#8217;m entitled to my own opinions, and so are you! But you can&#8217;t insult me over this, in fact you can&#8217;t insult me over anything at all. I didn&#8217;t disrespect you and I don&#8217;t know you, but one thing I do know: you must stop this nonsense.<br />
<span id="more-229"></span><br />
Most of the comments are leaned towards the concept that I don&#8217;t support PureBasic&#8230; Well, this isn&#8217;t entirely true. I helped as much as I could, I also got help when I was starting out and I appreciate that. I don&#8217;t care for recognition but I actually translated the IDE to Spanish, I made the 3D icon the IDE uses and I keep on posting bits of code every now and then in here, proving that I do support the language; which doesn&#8217;t mean that I love it or I wouldn&#8217;t change a thing of it, in fact you can read what I think about the IDE and other aspects of the language in this very same blog.</p>
<p>However, I pay my domain and my hosting: I get to say whatever I want and you get to choose whether you like it or not, because I&#8217;m forcing no one here. As with anything else in this world; if you&#8217;re vegan go ahead, eat salad. But don&#8217;t enforce it on me! &#8212; I&#8217;ll have a burger full of bacon, thank you.</p>
<p><em>Takes a break</em></p>
<p>Well, on that note I hope that whoever you are you happen to understand this, if you can&#8217;t then please don&#8217;t come back. Because I made myself quite clear already.</p>
<p>As I said, I won&#8217;t approve such foul language. You can have your rant, but be educated. I would really enjoy a dose of constructive criticism for instance. And if you can do better, then by all means do share with the rest of the world!. But rest assured; with insults you won&#8217;t go far. So you better start spending your time on something useful for a change. You could accomplish a lot if you just refer to others with a little bit of respect, whether they deserve it or not.</p>
<p>Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2009/08/28/about-the-negative-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.830 seconds -->
